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
F102590622: D29937.diff
Thu, Nov 14, 12:10 PM
Unknown Object (File)
Sat, Nov 2, 9:35 PM
Unknown Object (File)
Sep 29 2024, 12:27 PM
Unknown Object (File)
Sep 28 2024, 1:38 AM
Unknown Object (File)
Sep 27 2024, 7:45 PM
Unknown Object (File)
Sep 26 2024, 11:09 PM
Unknown Object (File)
Sep 25 2024, 10:08 AM
Unknown Object (File)
Sep 25 2024, 4:32 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