Page MenuHomeFreeBSD

newbus: Move from bus_child_{pnpinfo,location}_src to bus_child_{pnpinfo,location} with sbuf
ClosedPublic

Authored by imp on Apr 22 2021, 8:50 PM.
Tags
None
Referenced Files
Unknown Object (File)
Sun, Apr 7, 4:52 AM
Unknown Object (File)
Sat, Mar 30, 4:39 PM
Unknown Object (File)
Mar 16 2024, 7:54 PM
Unknown Object (File)
Mar 1 2024, 4:11 PM
Unknown Object (File)
Feb 21 2024, 4:21 AM
Unknown Object (File)
Jan 16 2024, 3:14 AM
Unknown Object (File)
Jan 14 2024, 4:56 AM
Unknown Object (File)
Jan 11 2024, 4:50 AM

Details

Summary

Now that the uppoer layers all go through a layer to tie into these
information functions that translates an sbuf into char * and len. The
current interface suffers issues of what to do in cases of truncation,
etc. Instead, migrate all these functions to using struct sbuf and these
issues go away. The caller is also in charge of any memory allocation
and/or expansion that's needed during this process.

Create a bus_generic_child_{pnpinfo,location} and make it default. It
just returns success. This is for those busses that have no information
for these items. Migrate the now-empty routines to using this as
appropriate.

Document these new interfaces with man pages, and oversight from before.
Sponsored by: Netflix

Diff Detail

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

Event Timeline

imp requested review of this revision.Apr 22 2021, 8:50 PM
imp added reviewers: rpokala, jhb.
sys/dev/ahci/ahci.c
707

I rather hate that the return value from sbuf_printf() is being ignored, but the return value from snprintf() was _also_ being ignored, so... 😢

sys/dev/bhnd/bhnd.c
909

Since you're here: "Default implementation" is seems wrong; this is the bhnd(4)-specific implementation, right? The "Default implementation" would be the one in subr_bus.c, right?

sys/dev/ahci/ahci.c
707

At least with sbuf, you can get an error status from it. and once the buffer is full, there's no harm in calling sbuf functions again. The caller can still extract the errors and decide what to do, so the client functions needn't worry about it.

sys/dev/bhnd/bhnd.c
909

Well, it's no worse then before, but you're right that it reads weird.

bcr added a subscriber: bcr.

The manpages look good to me.

jhb added inline comments.
sys/dev/bhnd/bhnd.c
909

Maybe fix it to match what is done below for BUS_CHILD_DELETED() and use:

* Default bhnd(4) bus driver implementation of BUS_CHILD_PNPINFO().

But these comments actually add no useful value and I'd be happy to see them be axed instead.

This revision is now accepted and ready to land.May 11 2021, 9:08 PM