Page MenuHomeFreeBSD

newbus: Create a preferred list of drivers
AbandonedPublic

Authored by imp on Feb 23 2022, 11:01 PM.
Tags
None
Referenced Files
Unknown Object (File)
Mon, Oct 7, 10:31 AM
Unknown Object (File)
Mon, Oct 7, 10:31 AM
Unknown Object (File)
Mon, Oct 7, 10:31 AM
Unknown Object (File)
Mon, Oct 7, 9:57 AM
Unknown Object (File)
Oct 1 2024, 6:51 PM
Unknown Object (File)
Sep 27 2024, 8:39 AM
Unknown Object (File)
Sep 1 2024, 7:54 AM
Unknown Object (File)
Sep 1 2024, 5:06 AM
Subscribers

Details

Reviewers
jhb
Summary

When there is a tie for priority for a device, and the new driver is on
the preferred list, prefer it to the other driver. It's undefined what
happens if multiple drivers on the preferred list can claim a device.

Sponsored by: Netflix

Test Plan

Note: this needs a man page adjusted, but I'm at a loss for which one

Diff Detail

Repository
rS FreeBSD src repository - subversion
Lint
Lint Passed
Unit
No Test Coverage
Build Status
Buildable 44612
Build 41500: arc lint + arc unit

Event Timeline

imp requested review of this revision.Feb 23 2022, 11:01 PM
imp created this revision.
imp added a reviewer: jhb.
imp added inline comments.
sys/kern/subr_bus.c
380

I should likely not delete this line... I'll fix locally, but not update the review unless other changes are needed since it's so trivial.

I guess this is ok (my only worry is we have to do something else in the future and have to maintain backwards compat for this and the other). It needs to be documented in some foo(4) manpage though?

sys/kern/subr_bus.c
264

I feel like using strsep would be slightly shorter as it would do the null terminate for you? I think there's even an example in the strsep() manpage that is kind of like this, something like:

memcpy(walk2, buffer, len);
for (int i = 0; i < npref; i++)
     preferred_drivers[i] = strsep(&walk2, ",");
2166

s/device/driver/? ("nvme" is a driver name, "nvme0" is a device name)

In D34357#778242, @jhb wrote:

I guess this is ok (my only worry is we have to do something else in the future and have to maintain backwards compat for this and the other). It needs to be documented in some foo(4) manpage though?

which one though?

sys/kern/subr_bus.c
2166

sure.

There's problems with this approach, since it relies on ties.