Page MenuHomeFreeBSD

sound: Sort channels by unit number as well
ClosedPublic

Authored by christos on Sep 5 2024, 8:00 PM.
Tags
None
Referenced Files
Unknown Object (File)
Sun, Dec 8, 12:54 AM
Unknown Object (File)
Sun, Dec 8, 12:54 AM
Unknown Object (File)
Sun, Dec 8, 12:53 AM
Unknown Object (File)
Sun, Dec 8, 12:53 AM
Unknown Object (File)
Fri, Dec 6, 4:54 AM
Unknown Object (File)
Wed, Dec 4, 11:29 PM
Unknown Object (File)
Nov 21 2024, 5:46 AM
Unknown Object (File)
Nov 18 2024, 9:33 PM
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 Not Applicable
Unit
Tests Not Applicable

Event Timeline

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

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

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.Sep 16 2024, 12:58 AM
This revision was automatically updated to reflect the committed changes.