Page MenuHomeFreeBSD

newbus: Create a preferred list of drivers
Needs ReviewPublic

Authored by imp on Feb 23 2022, 11:01 PM.

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 OK
Unit
No Unit 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
263

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, ",");
2165

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
2165

sure.