Page MenuHomeFreeBSD

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

Authored by imp on Nov 29 2022, 9:16 PM.
Tags
None
Referenced Files
F102738575: D37553.diff
Sat, Nov 16, 1:38 PM
Unknown Object (File)
Sep 28 2024, 6:58 PM
Unknown Object (File)
Sep 28 2024, 6:58 PM
Unknown Object (File)
Sep 28 2024, 6:58 PM
Unknown Object (File)
Sep 28 2024, 6:42 PM
Unknown Object (File)
Sep 25 2024, 7:39 PM
Unknown Object (File)
Sep 22 2024, 5:20 PM
Unknown Object (File)
Sep 22 2024, 3:26 PM
Subscribers

Details

Summary

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

Repository
rG FreeBSD src repository
Lint
Lint Not Applicable
Unit
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