Page MenuHomeFreeBSD

stand: parsedev API change: devspec now points to start of full device name

Authored by imp on Nov 29 2022, 9:16 PM.
Referenced Files
Unknown Object (File)
Wed, Mar 22, 6:42 PM
Unknown Object (File)
Tue, Mar 21, 3:04 AM
Unknown Object (File)
Mon, Mar 6, 3:35 AM
Unknown Object (File)
Sun, Mar 5, 1:26 AM
Unknown Object (File)
Mar 1 2023, 4:31 PM
Unknown Object (File)
Feb 10 2023, 6:40 PM
Unknown Object (File)
Dec 18 2022, 7:33 AM
Unknown Object (File)
Dec 4 2022, 6:16 AM



To support more flexible device matching, we now pass in the full
devspec to the parsedev routines. For everything execpt uboot, this is
just a drop in (since everything except uboot and openfirmware always
uses disk...: and/or zfs:, but openfirmware isn't really affected).

uboot we kludge around it by subtracting 4 from where the rest of the
device name starts. This is unforunate, and can compute the address one
before the string. But we never dereference that address. uboot needs
more work, and this is an acceptable UB until that other work happens.

OFW doesn't really use the parsedev routines these days (since none of
the supported device uses this... yet). It too needs more work, but it
needs device matching support first.

Sponsored by: Netflix

Diff Detail

rG FreeBSD src repository
Lint Not Applicable
Tests Not Applicable

Event Timeline

imp requested review of this revision.Nov 29 2022, 9:16 PM

I think the code is fine as-is.

<nitpick>Have you considered splitting disk_parsedev into two routines, like disk_parsedev (to be called by regular callers and with the 'disk' prefix) and disk_parsedev2 (which is called by callers including disk_parsedev who knows to skip the 'disk' prefix) to avoid the hack? As an added benefit the callee (also zfs_parsedev) could validate that caller is passing the proper prefix when boot code is built with diagnostics enabled.</nitpick>

This revision is now accepted and ready to land.Nov 30 2022, 6:30 AM