tech-kern archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
mount root hooks for non-disk-device devices
Hi folks,
As part of my boot-from-ZFS work, I've generalised how "non-disk"
disk-type storage devices interface with the mountroot mechanism.
This change adds "mount root hooks", which allows a device driver
to advertise that it can contain a virtual storage device. The new
interface is:
mountroot_rootspec_hook_establish()
Called by a driver to register a callback to check if the passed
boot device string is matched by a driver and a callback to
print a list of any boot devices provided by the driver.
The match function also passes a string prefix (eg "wedge") to
register the hook.
mountroot_rootspec_hook_disestablish()
Remove callbacks previously registered.
domountroot_rootspec_hooks()
Called during the mount root process. This checks if registered
prefixes match any listed hooks and calls them. The prefix is
can be separated from the boot specifier with either a ":" or an
"="; for example "wedge:foo", "NAME=bar".
domountroot_rootspec_print()
Called when the boot device prompt lists the available boot
devices.
These changes remove most wedge-specific code from sys/kern. One change
in behaviour is that both ":" and "=" can be used to separate a prefix
from the target. For example "NAME=foo" and "NAME:foo" will both work.
This has been tested on amd64 with FFS and ZFS for a while, but has only
had limited testing on other architectures.
The diffstats output is below, and the diff is available at
https://www.netbsd.org/~simonb/mountroot-hooks-20240501.diff
sys/dev/dkwedge/dk.c | 34 ++++++++++++++++++-
sys/kern/kern_hook.c | 87 ++++++++++++++++++++++++++++++++++++++++++++++++++
sys/kern/kern_subr.c | 31 ++---------------
sys/sys/systm.h | 12 ++++++
4 files changed, 135 insertions(+), 29 deletions(-)
Home |
Main Index |
Thread Index |
Old Index