Page MenuHomeFreeBSD

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

Authored by imp on Apr 22 2021, 8:50 PM.
Referenced Files
Unknown Object (File)
Sat, Jan 14, 8:03 PM
Unknown Object (File)
Dec 14 2022, 11:50 PM
Unknown Object (File)
Dec 13 2022, 2:34 PM
Unknown Object (File)
Nov 27 2022, 12:15 PM



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

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

Diff Detail

rS FreeBSD src repository - subversion
Lint Passed
No Test Coverage
Build Status
Buildable 38819
Build 35708: arc lint + arc unit

Event Timeline

imp requested review of this revision.Apr 22 2021, 8:50 PM
imp added reviewers: rpokala, jhb.

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


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?


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.


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.

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