Page MenuHomeFreeBSD

sound: Sort channels by unit number as well
AcceptedPublic

Authored by christos on Thu, Sep 5, 8:00 PM.
Tags
None
Referenced Files
F97703056: D46549.id142989.diff
Mon, Sep 30, 8:49 PM
Unknown Object (File)
Sat, Sep 28, 4:23 PM
Unknown Object (File)
Sat, Sep 28, 2:09 PM
Unknown Object (File)
Sat, Sep 28, 9:34 AM
Unknown Object (File)
Tue, Sep 24, 3:20 PM
Unknown Object (File)
Sun, Sep 22, 4:37 PM
Unknown Object (File)
Thu, Sep 19, 11:32 AM
Unknown Object (File)
Wed, Sep 18, 7:20 AM
Subscribers

Details

Summary

This makes the channel list easier to parse, as the channels are also
sorted by unit number.

Sponsored by: The FreeBSD Foundation
MFC after: 2 days

Diff Detail

Repository
rG FreeBSD src repository
Lint
Lint Skipped
Unit
Tests Skipped
Build Status
Buildable 59497
Build 56384: arc lint + arc unit

Event Timeline

What happens when (y)->type == t->type

sys/dev/sound/pcm/channel.h
227–237

This does not sort correctly. It can prematurely break out of the loop as soon as (y)->unit w t->unit isn't satisfied, thus inserting the channel among the wrong channel type. You probably want to prioritize one partial order (type) over the other (unit).

christos marked an inline comment as done.

Fix.

I think this is correct, but overly complicated. The classic sorting comparison would be:

if (((y)->type w t->type) || 
    (((y)->type == t->type) && ((y)->unit w t->unit)))
        a = t;
else
        break;
This revision is now accepted and ready to land.Mon, Sep 16, 12:58 AM