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 and
also tidied up how devices can report that they can contain a virtual
storage device (eg, a RAID, LVM, ZFS, etc).

A summary of changes:

 - A new bdev/cdev device flag D_STORAGEPOOL, which indicates that the
   device can contain other storage device.
 - A new device_t flag DVF_NO_PARTITIONS, for storage devices which
   don't contain partititons (eg, wedges, flash).
 - New mountroot_rootspec 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, removes the
hard-coded list of device types used by RAIDframe autoconfiguration, and
will also be used for the upcoming boot-from-ZFS support.

This has been tested on amd64 with FFS and ZFS for a while, but hasn't
had any testing on any other architectures.

The diffstats output is below, and the diff is available at
http://www.NetBSD.org/~simonb/mountroot-20220812.diff

Any comments, questions, suggestions or abuse before I commit this?

Cheers,
Simon.


 arch/hp300/dev/rd.c            |    4 +-
 arch/sun3/dev/xd.c             |    4 +-
 arch/sun3/dev/xy.c             |    4 +-
 arch/vax/mba/hp.c              |    4 +-
 arch/vax/vsa/hdc9224.c         |    4 +-
 arch/xen/xen/xbd_xenbus.c      |    4 +-
 dev/ata/wd.c                   |    4 +-
 dev/ccd.c                      |    4 +-
 dev/cgd.c                      |    4 +-
 dev/dkwedge/dk.c               |   29 ++++++++++++--
 dev/dm/device-mapper.c         |    4 +-
 dev/flash/flash.c              |    3 +
 dev/gpib/rd.c                  |    4 +-
 dev/ld.c                       |    4 +-
 dev/mca/ed_mca.c               |    4 +-
 dev/mscp/mscp_disk.c           |    4 +-
 dev/ofw/ofdisk.c               |    4 +-
 dev/qbus/rl.c                  |    4 +-
 dev/raidframe/rf_netbsdkintf.c |   38 ++-----------------
 dev/scsipi/sd.c                |    4 +-
 dev/vme/xd.c                   |    4 +-
 dev/vme/xy.c                   |    4 +-
 dev/vnd.c                      |    4 +-
 kern/kern_hook.c               |   80 +++++++++++++++++++++++++++++++++++++++++
 kern/kern_subr.c               |   59 +++++++-----------------------
 kern/subr_device.c             |   22 +++++++++++
 kern/subr_devsw.c              |   13 ++++++
 rump/librump/rumpvfs/rumpblk.c |    6 +--
 sys/conf.h                     |    2 +
 sys/device.h                   |    3 +
 sys/dkio.h                     |    2 +
 sys/systm.h                    |    8 ++++
 32 files changed, 219 insertions(+), 126 deletions(-)


Home | Main Index | Thread Index | Old Index