Commit Graph

9 Commits

Author SHA1 Message Date
Warner Losh
4883f347f6 stand: dev can't be NULL in default_prasedev
We pass in the address of a variable to store this value always in the
only place that calls this function, so there is no need to test for NULL.

Sponsored by:		Netflix
Notied by:		tsoome in D38041
2023-01-13 15:54:44 -07:00
Warner Losh
bf020787d5 stand: Move dev_cleanup into libsa
Since dev_cleanup() walks through all the devsw devices with dv_cleanup
rotuines, move it into libsa rather than having it in
'common'. Logically, it operates only on things that are in libsa, and
would never be different for different loaders: either people would call
it as is, or they'd do the loop themselves with 'special' things inline
between calls to cleanup (not that I think that will ever be needed
though).

Sponsored by:		Netflix
Reviewed by:		kevans
Differential Revision:	https://reviews.freebsd.org/D38004
2023-01-11 15:15:14 -07:00
Warner Losh
a07cef5a73 stand: Add dv_match
On OpenFirmware, and possibly kboot, we use full path names for the
objects that are the 'device'. kboot uses a hack of knowing that all
disk device nodes start with '/dev', but this generalizes it for
OpenFirmware where both 'block' and 'network' devices live in the same
namespace and one must ask the OF node its type to know if this device
type matches.

For drivers that don't specify, the current convention of using
strncmp() is retained. This is done only in devparse(), but everything
uses it directly (or will soon).

Sponsored by:		Netflix
Differential Revision:	https://reviews.freebsd.org/D37554
2022-11-30 15:30:33 -07:00
Warner Losh
33bbe5ddcb stand: parsedev API change: devspec now points to start of full device name
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
Reviewed by:		delphij
Differential Revision:	https://reviews.freebsd.org/D37553
2022-11-30 15:30:33 -07:00
Warner Losh
66012c8fc4 stand: create devinit
devinit() marches through all the devices, calling the inint routines if
any exist. Replace all the identical copies of this code.

Sponsored by:		Netflix
Differential Revision:	https://reviews.freebsd.org/D37349
2022-11-30 15:30:33 -07:00
Warner Losh
781ca0afcd stand: Introduce devparse to parse device / path strings
devparse is now the preferred interface to use to parse device
strings or device:/path strings. It parses the passed in string,
mallocs the device's particular devdesc string and returns the
'remainder' of the device:/path for further processing.

Sponsored by:		Netflix
Differential Revision:	https://reviews.freebsd.org/D37338
2022-11-30 15:30:31 -07:00
Warner Losh
dc472f6702 stand: Add devformat to return formatted string for a device
Use dv_fmtdev to return a formatted string for a device. If this is a
null pointer, return the device name and unit followed by a colon (eg
disk3:).

Sponsored by:		Netflix
Reviewed by:		tsoome (prior version)
Differential Revision:	https://reviews.freebsd.org/D35916
2022-08-11 10:27:16 -06:00
Alfonso
1f629966d6 ANSIify libsa functions
Convert libsa files to use ANSI function definitions.

Pull request: https://github.com/freebsd/freebsd-src/pull/508
[ cut and paste error corrected ]
2021-11-18 22:43:02 -07:00
Warner Losh
ca987d4641 Move sys/boot to stand. Fix all references to new location
Sponsored by:	Netflix
2017-11-14 23:02:19 +00:00