Author: imp
Date: Mon Mar 12 21:39:49 2018
New Revision: 330809
URL: https://svnweb.freebsd.org/changeset/base/330809

Log:
  Use the actual struct devdesc at the start of all *_devdesc structs
  
  The current system is fragile and requires very careful layout of all
  *_devdesc structures. It also makes it hard to change the base
  devdesc. Take a page from CAM and put the 'header' in all the derived
  classes and adjust the code to match.
  
  For OFW, move the iHandle h_handle out of a slot conflicting with
  d_opendata. Due to quirks in the alignment rules, this worked.
  However changing the code to use d_opendata storage now that it's a
  pointer is hard, so just have a separate field for it.
  
  All other cleanups were to make the *_devdesc structures match where
  they'd taken some liberties that were none-the-less compatible enough
  to work.

Modified:
  head/stand/common/disk.c
  head/stand/common/disk.h
  head/stand/efi/libefi/efipart.c
  head/stand/efi/libefi/efizfs.c
  head/stand/efi/loader/main.c
  head/stand/i386/libi386/bioscd.c
  head/stand/i386/libi386/biosdisk.c
  head/stand/i386/libi386/bootinfo32.c
  head/stand/i386/libi386/devicename.c
  head/stand/i386/libi386/libi386.h
  head/stand/i386/loader/chain.c
  head/stand/i386/loader/main.c
  head/stand/mips/beri/loader/beri_disk_cfi.c
  head/stand/mips/beri/loader/beri_disk_sdcard.c
  head/stand/mips/beri/loader/devicename.c
  head/stand/ofw/libofw/devicename.c
  head/stand/ofw/libofw/libofw.h
  head/stand/sparc64/loader/main.c
  head/stand/uboot/common/main.c
  head/stand/uboot/lib/devicename.c
  head/stand/uboot/lib/disk.c
  head/stand/uboot/lib/libuboot.h
  head/stand/userboot/userboot/devicename.c
  head/stand/userboot/userboot/main.c
  head/stand/userboot/userboot/userboot_disk.c
  head/stand/zfs/libzfs.h
  head/stand/zfs/zfs.c

Modified: head/stand/common/disk.c
==============================================================================
--- head/stand/common/disk.c    Mon Mar 12 21:39:42 2018        (r330808)
+++ head/stand/common/disk.c    Mon Mar 12 21:39:49 2018        (r330809)
@@ -86,7 +86,7 @@ ptblread(void *d, void *buf, size_t blocks, uint64_t o
        struct open_disk *od;
 
        dev = (struct disk_devdesc *)d;
-       od = (struct open_disk *)dev->d_opendata;
+       od = (struct open_disk *)dev->dd.d_opendata;
 
        /*
         * The strategy function assumes the offset is in units of 512 byte
@@ -98,7 +98,7 @@ ptblread(void *d, void *buf, size_t blocks, uint64_t o
         * As the GPT backup partition is located at the end of the disk,
         * to avoid reading past disk end, flag bcache not to use RA.
         */
-       return (dev->d_dev->dv_strategy(dev, F_READ | F_NORA, offset,
+       return (dev->dd.d_dev->dv_strategy(dev, F_READ | F_NORA, offset,
            blocks * od->sectorsize, (char *)buf, NULL));
 }
 
@@ -114,7 +114,7 @@ ptable_print(void *arg, const char *pname, const struc
        int res;
 
        pa = (struct print_args *)arg;
-       od = (struct open_disk *)pa->dev->d_opendata;
+       od = (struct open_disk *)pa->dev->dd.d_opendata;
        sprintf(line, "  %s%s: %s", pa->prefix, pname,
            parttype2str(part->type));
        if (pa->verbose)
@@ -127,8 +127,8 @@ ptable_print(void *arg, const char *pname, const struc
        res = 0;
        if (part->type == PART_FREEBSD) {
                /* Open slice with BSD label */
-               dev.d_dev = pa->dev->d_dev;
-               dev.d_unit = pa->dev->d_unit;
+               dev.dd.d_dev = pa->dev->dd.d_dev;
+               dev.dd.d_unit = pa->dev->dd.d_unit;
                dev.d_slice = part->index;
                dev.d_partition = -1;
                if (disk_open(&dev, part->end - part->start + 1,
@@ -158,7 +158,7 @@ disk_print(struct disk_devdesc *dev, char *prefix, int
        struct print_args pa;
 
        /* Disk should be opened */
-       od = (struct open_disk *)dev->d_opendata;
+       od = (struct open_disk *)dev->dd.d_opendata;
        pa.dev = dev;
        pa.prefix = prefix;
        pa.verbose = verbose;
@@ -171,8 +171,8 @@ disk_read(struct disk_devdesc *dev, void *buf, uint64_
        struct open_disk *od;
        int ret;
 
-       od = (struct open_disk *)dev->d_opendata;
-       ret = dev->d_dev->dv_strategy(dev, F_READ, dev->d_offset + offset,
+       od = (struct open_disk *)dev->dd.d_opendata;
+       ret = dev->dd.d_dev->dv_strategy(dev, F_READ, dev->d_offset + offset,
            blocks * od->sectorsize, buf, NULL);
 
        return (ret);
@@ -184,8 +184,8 @@ disk_write(struct disk_devdesc *dev, void *buf, uint64
        struct open_disk *od;
        int ret;
 
-       od = (struct open_disk *)dev->d_opendata;
-       ret = dev->d_dev->dv_strategy(dev, F_WRITE, dev->d_offset + offset,
+       od = (struct open_disk *)dev->dd.d_opendata;
+       ret = dev->dd.d_dev->dv_strategy(dev, F_WRITE, dev->d_offset + offset,
            blocks * od->sectorsize, buf, NULL);
 
        return (ret);
@@ -194,7 +194,7 @@ disk_write(struct disk_devdesc *dev, void *buf, uint64
 int
 disk_ioctl(struct disk_devdesc *dev, u_long cmd, void *data)
 {
-       struct open_disk *od = dev->d_opendata;
+       struct open_disk *od = dev->dd.d_opendata;
 
        if (od == NULL)
                return (ENOTTY);
@@ -238,7 +238,7 @@ disk_open(struct disk_devdesc *dev, uint64_t mediasize
                DEBUG("no memory");
                return (ENOMEM);
        }
-       dev->d_opendata = od;
+       dev->dd.d_opendata = od;
        od->entrysize = 0;
        od->mediasize = mediasize;
        od->sectorsize = sectorsize;
@@ -348,7 +348,7 @@ disk_close(struct disk_devdesc *dev)
 {
        struct open_disk *od;
 
-       od = (struct open_disk *)dev->d_opendata;
+       od = (struct open_disk *)dev->dd.d_opendata;
        DEBUG("%s closed => %p", disk_fmtdev(dev), od);
        ptable_close(od->table);
        free(od);
@@ -361,7 +361,7 @@ disk_fmtdev(struct disk_devdesc *dev)
        static char buf[128];
        char *cp;
 
-       cp = buf + sprintf(buf, "%s%d", dev->d_dev->dv_name, dev->d_unit);
+       cp = buf + sprintf(buf, "%s%d", dev->dd.d_dev->dv_name, dev->dd.d_unit);
        if (dev->d_slice >= 0) {
 #ifdef LOADER_GPT_SUPPORT
                if (dev->d_partition == 255) {
@@ -423,7 +423,7 @@ disk_parsedev(struct disk_devdesc *dev, const char *de
 
        if (*cp != '\0' && *cp != ':')
                return (EINVAL);
-       dev->d_unit = unit;
+       dev->dd.d_unit = unit;
        dev->d_slice = slice;
        dev->d_partition = partition;
        if (path != NULL)

Modified: head/stand/common/disk.h
==============================================================================
--- head/stand/common/disk.h    Mon Mar 12 21:39:42 2018        (r330808)
+++ head/stand/common/disk.h    Mon Mar 12 21:39:49 2018        (r330809)
@@ -83,10 +83,7 @@
 
 /* Note: Must match the 'struct devdesc' in stand.h */
 struct disk_devdesc {
-       struct devsw    *d_dev;
-       int             d_type;
-       int             d_unit;
-       void            *d_opendata;
+       struct devdesc  dd;
        int             d_slice;
        int             d_partition;
        uint64_t        d_offset;

Modified: head/stand/efi/libefi/efipart.c
==============================================================================
--- head/stand/efi/libefi/efipart.c     Mon Mar 12 21:39:42 2018        
(r330808)
+++ head/stand/efi/libefi/efipart.c     Mon Mar 12 21:39:49 2018        
(r330809)
@@ -744,8 +744,8 @@ efipart_print_common(struct devsw *dev, pdinfo_list_t 
                                continue;
 
                        pd->pd_blkio = blkio;
-                       pd_dev.d_dev = dev;
-                       pd_dev.d_unit = pd->pd_unit;
+                       pd_dev.dd.d_dev = dev;
+                       pd_dev.dd.d_unit = pd->pd_unit;
                        pd_dev.d_slice = -1;
                        pd_dev.d_partition = -1;
                        ret = disk_open(&pd_dev, blkio->Media->BlockSize *
@@ -820,7 +820,7 @@ efipart_open(struct open_file *f, ...)
        if (pd->pd_bcache == NULL)
                pd->pd_bcache = bcache_allocate();
 
-       if (dev->d_dev->dv_type == DEVT_DISK) {
+       if (dev->dd.d_dev->dv_type == DEVT_DISK) {
                int rc;
 
                rc = disk_open(dev,
@@ -859,7 +859,7 @@ efipart_close(struct open_file *f)
                bcache_free(pd->pd_bcache);
                pd->pd_bcache = NULL;
        }
-       if (dev->d_dev->dv_type == DEVT_DISK)
+       if (dev->dd.d_dev->dv_type == DEVT_DISK)
                return (disk_close(dev));
        return (0);
 }
@@ -879,7 +879,7 @@ efipart_ioctl(struct open_file *f, u_long cmd, void *d
        if (pd == NULL)
                return (EINVAL);
 
-       if (dev->d_dev->dv_type == DEVT_DISK) {
+       if (dev->dd.d_dev->dv_type == DEVT_DISK) {
                rc = disk_ioctl(dev, cmd, data);
                if (rc != ENOTTY)
                        return (rc);
@@ -966,7 +966,7 @@ efipart_strategy(void *devdata, int rw, daddr_t blk, s
        bcd.dv_devdata = devdata;
        bcd.dv_cache = pd->pd_bcache;
 
-       if (dev->d_dev->dv_type == DEVT_DISK) {
+       if (dev->dd.d_dev->dv_type == DEVT_DISK) {
                daddr_t offset;
 
                offset = dev->d_offset * pd->pd_blkio->Media->BlockSize;
@@ -1010,7 +1010,7 @@ efipart_realstrategy(void *devdata, int rw, daddr_t bl
         * partition.
         */
        disk_blocks = 0;
-       if (dev->d_dev->dv_type == DEVT_DISK) {
+       if (dev->dd.d_dev->dv_type == DEVT_DISK) {
                if (disk_ioctl(dev, DIOCGMEDIASIZE, &disk_blocks) == 0) {
                        /* DIOCGMEDIASIZE does return bytes. */
                        disk_blocks /= blkio->Media->BlockSize;

Modified: head/stand/efi/libefi/efizfs.c
==============================================================================
--- head/stand/efi/libefi/efizfs.c      Mon Mar 12 21:39:42 2018        
(r330808)
+++ head/stand/efi/libefi/efizfs.c      Mon Mar 12 21:39:49 2018        
(r330809)
@@ -29,8 +29,7 @@
 __FBSDID("$FreeBSD$");
 
 #include <sys/param.h>
-#include <sys/disk.h>
-#include <stdint.h>
+#include <stand.h>
 
 #ifdef EFI_ZFS_BOOT
 #include <libzfs.h>

Modified: head/stand/efi/loader/main.c
==============================================================================
--- head/stand/efi/loader/main.c        Mon Mar 12 21:39:42 2018        
(r330808)
+++ head/stand/efi/loader/main.c        Mon Mar 12 21:39:49 2018        
(r330809)
@@ -201,9 +201,9 @@ find_currdev(EFI_LOADED_IMAGE *img)
        if (pool_guid != 0) {
                struct zfs_devdesc currdev;
 
-               currdev.d_dev = &zfs_dev;
-               currdev.d_unit = 0;
-               currdev.d_type = currdev.d_dev->dv_type;
+               currdev.dd.d_dev = &zfs_dev;
+               currdev.dd.d_unit = 0;
+               currdev.dd.d_type = currdev.dd.d_dev->dv_type;
                currdev.pool_guid = pool_guid;
                currdev.root_guid = 0;
                devname = efi_fmtdev(&currdev);
@@ -222,9 +222,9 @@ find_currdev(EFI_LOADED_IMAGE *img)
        STAILQ_FOREACH(dp, pdi_list, pd_link) {
                struct disk_devdesc currdev;
 
-               currdev.d_dev = &efipart_hddev;
-               currdev.d_type = currdev.d_dev->dv_type;
-               currdev.d_unit = dp->pd_unit;
+               currdev.dd.d_dev = &efipart_hddev;
+               currdev.dd.d_type = currdev.dd.d_dev->dv_type;
+               currdev.dd.d_unit = dp->pd_unit;
                currdev.d_slice = -1;
                currdev.d_partition = -1;
 

Modified: head/stand/i386/libi386/bioscd.c
==============================================================================
--- head/stand/i386/libi386/bioscd.c    Mon Mar 12 21:39:42 2018        
(r330808)
+++ head/stand/i386/libi386/bioscd.c    Mon Mar 12 21:39:49 2018        
(r330809)
@@ -90,7 +90,7 @@ static struct bcinfo {
 } bcinfo [MAXBCDEV];
 static int nbcinfo = 0;
 
-#define        BC(dev) (bcinfo[(dev)->d_unit])
+#define        BC(dev) (bcinfo[(dev)->dd.d_unit])
 
 static int     bc_read(int unit, daddr_t dblk, int blks, caddr_t dest);
 static int     bc_init(void);
@@ -211,7 +211,7 @@ bc_open(struct open_file *f, ...)
        va_start(ap, f);
        dev = va_arg(ap, struct i386_devdesc *);
        va_end(ap);
-       if (dev->d_unit >= nbcinfo) {
+       if (dev->dd.d_unit >= nbcinfo) {
                DEBUG("attempt to open nonexistent disk");
                return(ENXIO);
        }
@@ -271,7 +271,7 @@ bc_realstrategy(void *devdata, int rw, daddr_t dblk, s
        if ((rw & F_MASK) != F_READ)
                return(EROFS);
        dev = (struct i386_devdesc *)devdata;
-       unit = dev->d_unit;
+       unit = dev->dd.d_unit;
        blks = size / BIOSCD_SECSIZE;
        if (dblk % (BIOSCD_SECSIZE / DEV_BSIZE) != 0)
                return (EINVAL);
@@ -427,7 +427,7 @@ bc_getdev(struct i386_devdesc *dev)
     int major;
     int rootdev;
 
-    unit = dev->d_unit;
+    unit = dev->dd.d_unit;
     biosdev = bc_unit2bios(unit);
     DEBUG("unit %d BIOS device %d", unit, biosdev);
     if (biosdev == -1)                         /* not a BIOS device */

Modified: head/stand/i386/libi386/biosdisk.c
==============================================================================
--- head/stand/i386/libi386/biosdisk.c  Mon Mar 12 21:39:42 2018        
(r330808)
+++ head/stand/i386/libi386/biosdisk.c  Mon Mar 12 21:39:49 2018        
(r330809)
@@ -120,7 +120,7 @@ static struct bdinfo
 } bdinfo [MAXBDDEV];
 static int nbdinfo = 0;
 
-#define        BD(dev)         (bdinfo[(dev)->d_unit])
+#define        BD(dev)         (bdinfo[(dev)->dd.d_unit])
 
 static int bd_read(struct disk_devdesc *dev, daddr_t dblk, int blks,
     caddr_t dest);
@@ -349,8 +349,8 @@ bd_print(int verbose)
                    bdinfo[i].bd_sectorsize);
                if ((ret = pager_output(line)) != 0)
                        break;
-               dev.d_dev = &biosdisk;
-               dev.d_unit = i;
+               dev.dd.d_dev = &biosdisk;
+               dev.dd.d_unit = i;
                dev.d_slice = -1;
                dev.d_partition = -1;
                if (disk_open(&dev,
@@ -389,7 +389,7 @@ bd_open(struct open_file *f, ...)
        dev = va_arg(ap, struct disk_devdesc *);
        va_end(ap);
 
-       if (dev->d_unit < 0 || dev->d_unit >= nbdinfo)
+       if (dev->dd.d_unit < 0 || dev->dd.d_unit >= nbdinfo)
                return (EIO);
        BD(dev).bd_open++;
        if (BD(dev).bd_bcache == NULL)
@@ -402,10 +402,10 @@ bd_open(struct open_file *f, ...)
         * During bd_probe() we tested if the mulitplication of bd_sectors
         * would overflow so it should be safe to perform here.
         */
-       disk.d_dev = dev->d_dev;
-       disk.d_type = dev->d_type;
-       disk.d_unit = dev->d_unit;
-       disk.d_opendata = NULL;
+       disk.dd.d_dev = dev->dd.d_dev;
+       disk.dd.d_type = dev->dd.d_type;
+       disk.dd.d_unit = dev->dd.d_unit;
+       disk.dd.d_opendata = NULL;
        disk.d_slice = -1;
        disk.d_partition = -1;
        disk.d_offset = 0;
@@ -431,7 +431,7 @@ bd_open(struct open_file *f, ...)
                return (err);
 
        /* if we already know there is no GELI, skip the rest */
-       if (geli_status[dev->d_unit][dev->d_slice] != ISGELI_UNKNOWN)
+       if (geli_status[dev->dd.d_unit][dev->d_slice] != ISGELI_UNKNOWN)
                return (err);
 
        struct dsk dskp;
@@ -440,9 +440,9 @@ bd_open(struct open_file *f, ...)
        struct pentry *entry;
        int geli_part = 0;
 
-       dskp.drive = bd_unit2bios(dev->d_unit);
-       dskp.type = dev->d_type;
-       dskp.unit = dev->d_unit;
+       dskp.drive = bd_unit2bios(dev->dd.d_unit);
+       dskp.type = dev->dd.d_type;
+       dskp.unit = dev->dd.d_unit;
        dskp.slice = dev->d_slice;
        dskp.part = dev->d_partition;
        dskp.start = dev->d_offset;
@@ -466,13 +466,13 @@ bd_open(struct open_file *f, ...)
                dskp.slice = entry->part.index;
                dskp.start = entry->part.start;
                if (is_geli(&dskp) == 0) {
-                       geli_status[dev->d_unit][dskp.slice] = ISGELI_YES;
+                       geli_status[dev->dd.d_unit][dskp.slice] = ISGELI_YES;
                        return (0);
                }
                if (geli_taste(bios_read, &dskp,
                    entry->part.end - entry->part.start) == 0) {
                        if (geli_havekey(&dskp) == 0) {
-                               geli_status[dev->d_unit][dskp.slice] = 
ISGELI_YES;
+                               geli_status[dev->dd.d_unit][dskp.slice] = 
ISGELI_YES;
                                geli_part++;
                                continue;
                        }
@@ -486,18 +486,18 @@ bd_open(struct open_file *f, ...)
                                    &dskp) == 0) {
                                setenv("kern.geom.eli.passphrase", gelipw, 1);
                                bzero(gelipw, sizeof(gelipw));
-                               geli_status[dev->d_unit][dskp.slice] = 
ISGELI_YES;
+                               geli_status[dev->dd.d_unit][dskp.slice] = 
ISGELI_YES;
                                geli_part++;
                                continue;
                        }
                } else
-                       geli_status[dev->d_unit][dskp.slice] = ISGELI_NO;
+                       geli_status[dev->dd.d_unit][dskp.slice] = ISGELI_NO;
        }
 
        /* none of the partitions on this disk have GELI */
        if (geli_part == 0) {
                /* found no GELI */
-               geli_status[dev->d_unit][dev->d_slice] = ISGELI_NO;
+               geli_status[dev->dd.d_unit][dev->d_slice] = ISGELI_NO;
        }
 #endif /* LOADER_GELI_SUPPORT */
 
@@ -834,10 +834,10 @@ bd_read(struct disk_devdesc *dev, daddr_t dblk, int bl
        char *tmpbuf;
 
        /* if we already know there is no GELI, skip the rest */
-       if (geli_status[dev->d_unit][dev->d_slice] != ISGELI_YES)
+       if (geli_status[dev->dd.d_unit][dev->d_slice] != ISGELI_YES)
                return (bd_io(dev, dblk, blks, dest, 0));
 
-       if (geli_status[dev->d_unit][dev->d_slice] == ISGELI_YES) {
+       if (geli_status[dev->dd.d_unit][dev->d_slice] == ISGELI_YES) {
                /*
                 * Align reads to DEV_GELIBOOT_BSIZE bytes because partial
                 * sectors cannot be decrypted. Round the requested LBA down to
@@ -871,9 +871,9 @@ bd_read(struct disk_devdesc *dev, daddr_t dblk, int bl
                if (err)
                        return (err);
 
-               dskp.drive = bd_unit2bios(dev->d_unit);
-               dskp.type = dev->d_type;
-               dskp.unit = dev->d_unit;
+               dskp.drive = bd_unit2bios(dev->dd.d_unit);
+               dskp.type = dev->dd.d_type;
+               dskp.unit = dev->dd.d_unit;
                dskp.slice = dev->d_slice;
                dskp.part = dev->d_partition;
                dskp.start = dev->d_offset;
@@ -950,8 +950,8 @@ bd_getdev(struct i386_devdesc *d)
     int                                i, unit;
 
     dev = (struct disk_devdesc *)d;
-    biosdev = bd_unit2bios(dev->d_unit);
-    DEBUG("unit %d BIOS device %d", dev->d_unit, biosdev);
+    biosdev = bd_unit2bios(dev->dd.d_unit);
+    DEBUG("unit %d BIOS device %d", dev->dd.d_unit, biosdev);
     if (biosdev == -1)                         /* not a BIOS device */
        return(-1);
     if (disk_open(dev, BD(dev).bd_sectors * BD(dev).bd_sectorsize,
@@ -962,7 +962,7 @@ bd_getdev(struct i386_devdesc *d)
 
     if (biosdev < 0x80) {
        /* floppy (or emulated floppy) or ATAPI device */
-       if (bdinfo[dev->d_unit].bd_type == DT_ATAPI) {
+       if (bdinfo[dev->dd.d_unit].bd_type == DT_ATAPI) {
            /* is an ATAPI disk */
            major = WFDMAJOR;
        } else {
@@ -996,9 +996,9 @@ bios_read(void *vdev __unused, void *xpriv, off_t off,
        struct disk_devdesc dev;
        struct dsk *priv = xpriv;
 
-       dev.d_dev = &biosdisk;
-       dev.d_type = priv->type;
-       dev.d_unit = priv->unit;
+       dev.dd.d_dev = &biosdisk;
+       dev.dd.d_type = priv->type;
+       dev.dd.d_unit = priv->unit;
        dev.d_slice = priv->slice;
        dev.d_partition = priv->part;
        dev.d_offset = priv->start;

Modified: head/stand/i386/libi386/bootinfo32.c
==============================================================================
--- head/stand/i386/libi386/bootinfo32.c        Mon Mar 12 21:39:42 2018        
(r330808)
+++ head/stand/i386/libi386/bootinfo32.c        Mon Mar 12 21:39:49 2018        
(r330809)
@@ -181,16 +181,16 @@ bi_load32(char *args, int *howtop, int *bootdevp, vm_o
     /* XXX - use a default bootdev of 0.  Is this ok??? */
     bootdevnr = 0;
 
-    switch(rootdev->d_type) {
+    switch(rootdev->dd.d_type) {
     case DEVT_CD:
            /* Pass in BIOS device number. */
-           bi.bi_bios_dev = bc_unit2bios(rootdev->d_unit);
+           bi.bi_bios_dev = bc_unit2bios(rootdev->dd.d_unit);
            bootdevnr = bc_getdev(rootdev);
            break;
 
     case DEVT_DISK:
        /* pass in the BIOS device number of the current disk */
-       bi.bi_bios_dev = bd_unit2bios(rootdev->d_unit);
+       bi.bi_bios_dev = bd_unit2bios(rootdev->dd.d_unit);
        bootdevnr = bd_getdev(rootdev);
        break;
 
@@ -199,7 +199,7 @@ bi_load32(char *args, int *howtop, int *bootdevp, vm_o
            break;
 
     default:
-       printf("WARNING - don't know how to boot from device type %d\n", 
rootdev->d_type);
+       printf("WARNING - don't know how to boot from device type %d\n", 
rootdev->dd.d_type);
     }
     if (bootdevnr == -1) {
        printf("root device %s invalid\n", i386_fmtdev(rootdev));

Modified: head/stand/i386/libi386/devicename.c
==============================================================================
--- head/stand/i386/libi386/devicename.c        Mon Mar 12 21:39:42 2018        
(r330808)
+++ head/stand/i386/libi386/devicename.c        Mon Mar 12 21:39:49 2018        
(r330809)
@@ -135,7 +135,7 @@ i386_parsedev(struct i386_devdesc **dev, const char *d
            goto fail;
        }
 
-       idev->d_unit = unit;
+       idev->dd.d_unit = unit;
        if (path != NULL)
            *path = (*cp == 0) ? cp : cp + 1;
        break;
@@ -148,8 +148,8 @@ i386_parsedev(struct i386_devdesc **dev, const char *d
        err = EINVAL;
        goto fail;
     }
-    idev->d_dev = dv;
-    idev->d_type = dv->dv_type;
+    idev->dd.d_dev = dv;
+    idev->dd.d_type = dv->dv_type;
     if (dev == NULL) {
        free(idev);
     } else {
@@ -169,14 +169,14 @@ i386_fmtdev(void *vdev)
     struct i386_devdesc        *dev = (struct i386_devdesc *)vdev;
     static char                buf[128];       /* XXX device length constant? 
*/
 
-    switch(dev->d_type) {
+    switch(dev->dd.d_type) {
     case DEVT_NONE:
        strcpy(buf, "(no device)");
        break;
 
     case DEVT_CD:
     case DEVT_NET:
-       sprintf(buf, "%s%d:", dev->d_dev->dv_name, dev->d_unit);
+       sprintf(buf, "%s%d:", dev->dd.d_dev->dv_name, dev->dd.d_unit);
        break;
 
     case DEVT_DISK:

Modified: head/stand/i386/libi386/libi386.h
==============================================================================
--- head/stand/i386/libi386/libi386.h   Mon Mar 12 21:39:42 2018        
(r330808)
+++ head/stand/i386/libi386/libi386.h   Mon Mar 12 21:39:49 2018        
(r330809)
@@ -33,10 +33,7 @@
  */
 /* Note: Must match the 'struct devdesc' in stand.h */
 struct i386_devdesc {
-    struct devsw       *d_dev;
-    int                        d_type;
-    int                        d_unit;
-    void               *d_opendata;
+    struct devdesc     dd;
     union 
     {
        struct 

Modified: head/stand/i386/loader/chain.c
==============================================================================
--- head/stand/i386/loader/chain.c      Mon Mar 12 21:39:42 2018        
(r330808)
+++ head/stand/i386/loader/chain.c      Mon Mar 12 21:39:49 2018        
(r330809)
@@ -111,7 +111,7 @@ command_chain(int argc, char *argv[])
        relocater_data[0].dest = 0x7C00;
        relocater_data[0].size = SECTOR_SIZE;
 
-       relocator_edx = bd_unit2bios(rootdev->d_unit);
+       relocator_edx = bd_unit2bios(rootdev->dd.d_unit);
        relocator_esi = relocater_size;
        relocator_ds = 0;
        relocator_es = 0;

Modified: head/stand/i386/loader/main.c
==============================================================================
--- head/stand/i386/loader/main.c       Mon Mar 12 21:39:42 2018        
(r330808)
+++ head/stand/i386/loader/main.c       Mon Mar 12 21:39:49 2018        
(r330809)
@@ -254,18 +254,18 @@ extract_currdev(void)
     int                                biosdev = -1;
 
     /* Assume we are booting from a BIOS disk by default */
-    new_currdev.d_dev = &biosdisk;
+    new_currdev.dd.d_dev = &biosdisk;
 
     /* new-style boot loaders such as pxeldr and cdldr */
     if (kargs->bootinfo == 0) {
         if ((kargs->bootflags & KARGS_FLAGS_CD) != 0) {
            /* we are booting from a CD with cdboot */
-           new_currdev.d_dev = &bioscd;
-           new_currdev.d_unit = bc_bios2unit(initial_bootdev);
+           new_currdev.dd.d_dev = &bioscd;
+           new_currdev.dd.d_unit = bc_bios2unit(initial_bootdev);
        } else if ((kargs->bootflags & KARGS_FLAGS_PXE) != 0) {
            /* we are booting from pxeldr */
-           new_currdev.d_dev = &pxedisk;
-           new_currdev.d_unit = 0;
+           new_currdev.dd.d_dev = &pxedisk;
+           new_currdev.dd.d_unit = 0;
        } else {
            /* we don't know what our boot device is */
            new_currdev.d_kind.biosdisk.slice = -1;
@@ -295,7 +295,7 @@ extract_currdev(void)
            new_currdev.d_kind.zfs.pool_guid = kargs->zfspool;
            new_currdev.d_kind.zfs.root_guid = 0;
        }
-       new_currdev.d_dev = &zfs_dev;
+       new_currdev.dd.d_dev = &zfs_dev;
 #endif
     } else if ((initial_bootdev & B_MAGICMASK) != B_DEVMAGIC) {
        /* The passed-in boot device is bad */
@@ -316,21 +316,21 @@ extract_currdev(void)
        if ((biosdev == 0) && (B_TYPE(initial_bootdev) != 2))   /* biosdev 
doesn't match major */
            biosdev = 0x80 + B_UNIT(initial_bootdev);           /* assume 
harddisk */
     }
-    new_currdev.d_type = new_currdev.d_dev->dv_type;
+    new_currdev.dd.d_type = new_currdev.dd.d_dev->dv_type;
 
     /*
      * If we are booting off of a BIOS disk and we didn't succeed in 
determining
      * which one we booted off of, just use disk0: as a reasonable default.
      */
-    if ((new_currdev.d_type == biosdisk.dv_type) &&
-       ((new_currdev.d_unit = bd_bios2unit(biosdev)) == -1)) {
+    if ((new_currdev.dd.d_type == biosdisk.dv_type) &&
+       ((new_currdev.dd.d_unit = bd_bios2unit(biosdev)) == -1)) {
        printf("Can't work out which disk we are booting from.\n"
               "Guessed BIOS device 0x%x not found by probes, defaulting to 
disk0:\n", biosdev);
-       new_currdev.d_unit = 0;
+       new_currdev.dd.d_unit = 0;
     }
 
 #ifdef LOADER_ZFS_SUPPORT
-    if (new_currdev.d_type == DEVT_ZFS)
+    if (new_currdev.dd.d_type == DEVT_ZFS)
        init_zfs_bootenv(zfs_fmtdev(&new_currdev));
 #endif
 

Modified: head/stand/mips/beri/loader/beri_disk_cfi.c
==============================================================================
--- head/stand/mips/beri/loader/beri_disk_cfi.c Mon Mar 12 21:39:42 2018        
(r330808)
+++ head/stand/mips/beri/loader/beri_disk_cfi.c Mon Mar 12 21:39:49 2018        
(r330809)
@@ -98,7 +98,7 @@ beri_cfi_disk_open(struct open_file *f, ...)
        dev = va_arg(ap, struct disk_devdesc *);
        va_end(ap);
 
-       if (dev->d_unit != 0)
+       if (dev->dd.d_unit != 0)
                return (EIO);
        return (disk_open(dev, cfi_get_mediasize(), cfi_get_sectorsize()));
 }
@@ -127,8 +127,8 @@ beri_cfi_disk_print(int verbose)
        ret = pager_output(line);
        if (ret != 0)
                return (ret);
-       dev.d_dev = &beri_cfi_disk;
-       dev.d_unit = 0;
+       dev.dd.d_dev = &beri_cfi_disk;
+       dev.dd.d_unit = 0;
        dev.d_slice = -1;
        dev.d_partition = -1;
        if (disk_open(&dev, cfi_get_mediasize(), cfi_get_sectorsize()) == 0) {

Modified: head/stand/mips/beri/loader/beri_disk_sdcard.c
==============================================================================
--- head/stand/mips/beri/loader/beri_disk_sdcard.c      Mon Mar 12 21:39:42 
2018        (r330808)
+++ head/stand/mips/beri/loader/beri_disk_sdcard.c      Mon Mar 12 21:39:49 
2018        (r330809)
@@ -103,7 +103,7 @@ beri_sdcard_disk_open(struct open_file *f, ...)
                return (ENXIO);
        }
 
-       if (dev->d_unit != 0)
+       if (dev->dd.d_unit != 0)
                return (EIO);
        return (disk_open(dev, altera_sdcard_get_mediasize(),
            altera_sdcard_get_sectorsize()));
@@ -133,8 +133,8 @@ beri_sdcard_disk_print(int verbose)
        ret = pager_output(line);
        if (ret != 0)
            return (ret);
-       dev.d_dev = &beri_sdcard_disk;
-       dev.d_unit = 0;
+       dev.dd.d_dev = &beri_sdcard_disk;
+       dev.dd.d_unit = 0;
        dev.d_slice = -1;
        dev.d_partition = -1;
        if (disk_open(&dev, altera_sdcard_get_mediasize(),

Modified: head/stand/mips/beri/loader/devicename.c
==============================================================================
--- head/stand/mips/beri/loader/devicename.c    Mon Mar 12 21:39:42 2018        
(r330808)
+++ head/stand/mips/beri/loader/devicename.c    Mon Mar 12 21:39:49 2018        
(r330809)
@@ -139,7 +139,7 @@ beri_arch_parsedev(struct disk_devdesc **dev, const ch
            goto fail;
        }
 
-       idev->d_unit = unit;
+       idev->dd.d_unit = unit;
        if (path != NULL)
            *path = (*cp == 0) ? cp : cp + 1;
        break;
@@ -148,8 +148,8 @@ beri_arch_parsedev(struct disk_devdesc **dev, const ch
        err = EINVAL;
        goto fail;
     }
-    idev->d_dev = dv;
-    idev->d_type = dv->dv_type;
+    idev->dd.d_dev = dv;
+    idev->dd.d_type = dv->dv_type;
     if (dev == NULL) {
        free(idev);
     } else {
@@ -175,7 +175,7 @@ beri_arch_fmtdev(void *vdev)
        break;
 
     case DEVT_CD:
-       sprintf(buf, "%s%d:", dev->d_dev->dv_name, dev->d_unit);
+       sprintf(buf, "%s%d:", dev->dd.d_dev->dv_name, dev->dd.d_unit);
        break;
 
     case DEVT_DISK:
@@ -183,7 +183,7 @@ beri_arch_fmtdev(void *vdev)
 
     case DEVT_NET:
     case DEVT_ZFS:
-       sprintf(buf, "%s%d:", dev->d_dev->dv_name, dev->d_unit);
+       sprintf(buf, "%s%d:", dev->dd.d_dev->dv_name, dev->dd.d_unit);
        break;
     }
     return(buf);

Modified: head/stand/ofw/libofw/devicename.c
==============================================================================
--- head/stand/ofw/libofw/devicename.c  Mon Mar 12 21:39:42 2018        
(r330808)
+++ head/stand/ofw/libofw/devicename.c  Mon Mar 12 21:39:49 2018        
(r330809)
@@ -113,9 +113,9 @@ found:
        return ENOMEM;
     }
     strcpy(idev->d_path, name);
-    idev->d_dev = dv;
-    idev->d_type = dv->dv_type;
-    if (idev->d_type == DEVT_ZFS) {
+    idev->dd.d_dev = dv;
+    idev->dd.d_type = dv->dv_type;
+    if (idev->dd.d_type == DEVT_ZFS) {
        p = devspec + strlen(dv->dv_name);
        err = zfs_parsedev((struct zfs_devdesc *)idev, p, path);
        if (err != 0) {

Modified: head/stand/ofw/libofw/libofw.h
==============================================================================
--- head/stand/ofw/libofw/libofw.h      Mon Mar 12 21:39:42 2018        
(r330808)
+++ head/stand/ofw/libofw/libofw.h      Mon Mar 12 21:39:49 2018        
(r330809)
@@ -27,14 +27,13 @@
 
 #include "openfirm.h"
 
-/* Note: Must match the 'struct devdesc' in stand.h */
 struct ofw_devdesc {
-       struct devsw    *d_dev;
-       int             d_type;
-       int             d_unit;
-       ihandle_t       d_handle;
+       struct devdesc                  dd;
        union {
-               char                    d_path[256];
+               struct {
+                       ihandle_t       d_handle;       
+                       char            d_path[256];
+               };
                struct {
                        uint64_t        pool_guid;
                        uint64_t        root_guid;

Modified: head/stand/sparc64/loader/main.c
==============================================================================
--- head/stand/sparc64/loader/main.c    Mon Mar 12 21:39:42 2018        
(r330808)
+++ head/stand/sparc64/loader/main.c    Mon Mar 12 21:39:49 2018        
(r330809)
@@ -806,8 +806,8 @@ sparc64_zfs_probe(void)
        if (guid != 0) {
                zfs_currdev.pool_guid = guid;
                zfs_currdev.root_guid = 0;
-               zfs_currdev.d_dev = &zfs_dev;
-               zfs_currdev.d_type = zfs_currdev.d_dev->dv_type;
+               zfs_currdev.dd.d_dev = &zfs_dev;
+               zfs_currdev.dd.d_type = zfs_currdev.dd.d_dev->dv_type;
        }
 }
 #endif /* LOADER_ZFS_SUPPORT */

Modified: head/stand/uboot/common/main.c
==============================================================================
--- head/stand/uboot/common/main.c      Mon Mar 12 21:39:42 2018        
(r330808)
+++ head/stand/uboot/common/main.c      Mon Mar 12 21:39:49 2018        
(r330809)
@@ -318,7 +318,7 @@ print_disk_probe_info()
                strcpy(partition, "<auto>");
 
        printf("  Checking unit=%d slice=%s partition=%s...",
-           currdev.d_unit, slice, partition);
+           currdev.dd.d_unit, slice, partition);
 
 }
 
@@ -338,8 +338,8 @@ probe_disks(int devidx, int load_type, int load_unit, 
        if (load_type == -1) {
                printf("  Probing all disk devices...\n");
                /* Try each disk in succession until one works.  */
-               for (currdev.d_unit = 0; currdev.d_unit < UB_MAX_DEV;
-                    currdev.d_unit++) {
+               for (currdev.dd.d_unit = 0; currdev.dd.d_unit < UB_MAX_DEV;
+                    currdev.dd.d_unit++) {
                        print_disk_probe_info();
                        open_result = devsw[devidx]->dv_open(&f, &currdev);
                        if (open_result == 0) {
@@ -355,8 +355,8 @@ probe_disks(int devidx, int load_type, int load_unit, 
                printf("  Probing all %s devices...\n", 
device_typename(load_type));
                /* Try each disk of given type in succession until one works. */
                for (unit = 0; unit < UB_MAX_DEV; unit++) {
-                       currdev.d_unit = uboot_diskgetunit(load_type, unit);
-                       if (currdev.d_unit == -1)
+                       currdev.dd.d_unit = uboot_diskgetunit(load_type, unit);
+                       if (currdev.dd.d_unit == -1)
                                break;
                        print_disk_probe_info();
                        open_result = devsw[devidx]->dv_open(&f, &currdev);
@@ -369,7 +369,7 @@ probe_disks(int devidx, int load_type, int load_unit, 
                return (-1);
        }
 
-       if ((currdev.d_unit = uboot_diskgetunit(load_type, load_unit)) != -1) {
+       if ((currdev.dd.d_unit = uboot_diskgetunit(load_type, load_unit)) != 
-1) {
                print_disk_probe_info();
                open_result = devsw[devidx]->dv_open(&f,&currdev);
                if (open_result == 0) {
@@ -459,9 +459,9 @@ main(int argc, char **argv)
 
                printf("Found U-Boot device: %s\n", devsw[i]->dv_name);
 
-               currdev.d_dev = devsw[i];
-               currdev.d_type = currdev.d_dev->dv_type;
-               currdev.d_unit = 0;
+               currdev.dd.d_dev = devsw[i];
+               currdev.dd.d_type = currdev.dd.d_dev->dv_type;
+               currdev.dd.d_unit = 0;
 
                if ((load_type == -1 || (load_type & DEV_TYP_STOR)) &&
                    strcmp(devsw[i]->dv_name, "disk") == 0) {

Modified: head/stand/uboot/lib/devicename.c
==============================================================================
--- head/stand/uboot/lib/devicename.c   Mon Mar 12 21:39:42 2018        
(r330808)
+++ head/stand/uboot/lib/devicename.c   Mon Mar 12 21:39:49 2018        
(r330809)
@@ -136,7 +136,7 @@ uboot_parsedev(struct uboot_devdesc **dev, const char 
                        err = EINVAL;
                        goto fail;
                }
-               idev->d_unit = unit;
+               idev->dd.d_unit = unit;
 
                if (path != NULL)
                        *path = (*cp == 0) ? cp : cp + 1;
@@ -146,8 +146,8 @@ uboot_parsedev(struct uboot_devdesc **dev, const char 
                err = EINVAL;
                goto fail;
        }
-       idev->d_dev = dv;
-       idev->d_type = dv->dv_type;
+       idev->dd.d_dev = dv;
+       idev->dd.d_type = dv->dv_type;
        if (dev == NULL) {
                free(idev);
        } else {
@@ -167,7 +167,7 @@ uboot_fmtdev(void *vdev)
        struct uboot_devdesc *dev = (struct uboot_devdesc *)vdev;
        static char buf[128];
 
-       switch(dev->d_type) {
+       switch(dev->dd.d_type) {
        case DEVT_NONE:
                strcpy(buf, "(no device)");
                break;
@@ -178,7 +178,7 @@ uboot_fmtdev(void *vdev)
 #endif
 
        case DEVT_NET:
-               sprintf(buf, "%s%d:", dev->d_dev->dv_name, dev->d_unit);
+               sprintf(buf, "%s%d:", dev->dd.d_dev->dv_name, dev->dd.d_unit);
                break;
        }
        return(buf);

Modified: head/stand/uboot/lib/disk.c
==============================================================================
--- head/stand/uboot/lib/disk.c Mon Mar 12 21:39:42 2018        (r330808)
+++ head/stand/uboot/lib/disk.c Mon Mar 12 21:39:49 2018        (r330809)
@@ -46,7 +46,7 @@ __FBSDID("$FreeBSD$");
 #include "libuboot.h"
 
 #define stor_printf(fmt, args...) do {                 \
-    printf("%s%d: ", dev->d_dev->dv_name, dev->d_unit);        \
+    printf("%s%d: ", dev->dd.d_dev->dv_name, dev->dd.d_unit);  \
     printf(fmt, ##args);                               \
 } while (0)
 
@@ -65,7 +65,7 @@ static struct {
        u_int           bsize;  /* block size */
 } stor_info[UB_MAX_DEV];
 
-#define        SI(dev)         (stor_info[(dev)->d_unit])
+#define        SI(dev)         (stor_info[(dev)->dd.d_unit])
 
 static int stor_info_no = 0;
 static int stor_opendev(struct disk_devdesc *);
@@ -190,7 +190,7 @@ stor_opendev(struct disk_devdesc *dev)
 {
        int err;
 
-       if (dev->d_unit < 0 || dev->d_unit >= stor_info_no)
+       if (dev->dd.d_unit < 0 || dev->dd.d_unit >= stor_info_no)
                return (EIO);
 
        if (SI(dev).opened == 0) {
@@ -252,8 +252,8 @@ stor_print(int verbose)
                return (ret);
 
        for (i = 0; i < stor_info_no; i++) {
-               dev.d_dev = &uboot_storage;
-               dev.d_unit = i;
+               dev.dd.d_dev = &uboot_storage;
+               dev.dd.d_unit = i;
                dev.d_slice = -1;
                dev.d_partition = -1;
                snprintf(line, sizeof(line), "\tdisk%d (%s)\n", i,

Modified: head/stand/uboot/lib/libuboot.h
==============================================================================
--- head/stand/uboot/lib/libuboot.h     Mon Mar 12 21:39:42 2018        
(r330808)
+++ head/stand/uboot/lib/libuboot.h     Mon Mar 12 21:39:49 2018        
(r330809)
@@ -29,10 +29,7 @@
 
 /* Note: Must match the 'struct devdesc' in stand.h */
 struct uboot_devdesc {
-       struct devsw    *d_dev;
-       int             d_type;
-       int             d_unit;
-       void            *d_opendata;
+       struct devdesc          dd;
        union {
                struct {
                        int     slice;

Modified: head/stand/userboot/userboot/devicename.c
==============================================================================
--- head/stand/userboot/userboot/devicename.c   Mon Mar 12 21:39:42 2018        
(r330808)
+++ head/stand/userboot/userboot/devicename.c   Mon Mar 12 21:39:49 2018        
(r330809)
@@ -139,7 +139,7 @@ userboot_parsedev(struct disk_devdesc **dev, const cha
            goto fail;
        }
 
-       idev->d_unit = unit;
+       idev->dd.d_unit = unit;
        if (path != NULL)
            *path = (*cp == 0) ? cp : cp + 1;
        break;
@@ -158,8 +158,8 @@ userboot_parsedev(struct disk_devdesc **dev, const cha
        err = EINVAL;
        goto fail;
     }
-    idev->d_dev = dv;
-    idev->d_type = dv->dv_type;
+    idev->dd.d_dev = dv;
+    idev->dd.d_type = dv->dv_type;
     if (dev == NULL) {
        free(idev);
     } else {
@@ -179,27 +179,27 @@ userboot_fmtdev(void *vdev)
     struct disk_devdesc        *dev = (struct disk_devdesc *)vdev;
     static char                buf[128];       /* XXX device length constant? 
*/
 
-    switch(dev->d_type) {
+    switch(dev->dd.d_type) {
     case DEVT_NONE:
        strcpy(buf, "(no device)");
        break;
 
     case DEVT_CD:
-       sprintf(buf, "%s%d:", dev->d_dev->dv_name, dev->d_unit);
+       sprintf(buf, "%s%d:", dev->dd.d_dev->dv_name, dev->dd.d_unit);
        break;
 
     case DEVT_DISK:
        return (disk_fmtdev(vdev));
 
     case DEVT_NET:
-       sprintf(buf, "%s%d:", dev->d_dev->dv_name, dev->d_unit);
+       sprintf(buf, "%s%d:", dev->dd.d_dev->dv_name, dev->dd.d_unit);
        break;
 
     case DEVT_ZFS:
 #if defined(USERBOOT_ZFS_SUPPORT)
        return (zfs_fmtdev(vdev));
 #else
-       sprintf(buf, "%s%d:", dev->d_dev->dv_name, dev->d_unit);
+       sprintf(buf, "%s%d:", dev->dd.d_dev->dv_name, dev->dd.d_unit);
 #endif
        break;
     }

Modified: head/stand/userboot/userboot/main.c
==============================================================================
--- head/stand/userboot/userboot/main.c Mon Mar 12 21:39:42 2018        
(r330808)
+++ head/stand/userboot/userboot/main.c Mon Mar 12 21:39:49 2018        
(r330809)
@@ -159,13 +159,14 @@ extract_currdev(void)
        //bzero(&dev, sizeof(dev));
 
 #if defined(USERBOOT_ZFS_SUPPORT)
+       CT_ASSERT(sizeof(struct disk_devdesc) >= sizeof(struct zfs_devdesc));
        if (userboot_zfs_found) {
                struct zfs_devdesc zdev;
        
                /* Leave the pool/root guid's unassigned */
                bzero(&zdev, sizeof(zdev));
-               zdev.d_dev = &zfs_dev;
-               zdev.d_type = zdev.d_dev->dv_type;
+               zdev.dd.d_dev = &zfs_dev;
+               zdev.dd.d_type = zdev.dd.d_dev->dv_type;
                
                dev = *(struct disk_devdesc *)&zdev;
                init_zfs_bootenv(zfs_fmtdev(&dev));
@@ -173,23 +174,23 @@ extract_currdev(void)
 #endif
 
        if (userboot_disk_maxunit > 0) {
-               dev.d_dev = &userboot_disk;
-               dev.d_type = dev.d_dev->dv_type;
-               dev.d_unit = 0;
+               dev.dd.d_dev = &userboot_disk;
+               dev.dd.d_type = dev.dd.d_dev->dv_type;
+               dev.dd.d_unit = 0;
                dev.d_slice = 0;
                dev.d_partition = 0;
                /*
                 * If we cannot auto-detect the partition type then
                 * access the disk as a raw device.
                 */
-               if (dev.d_dev->dv_open(NULL, &dev)) {
+               if (dev.dd.d_dev->dv_open(NULL, &dev)) {
                        dev.d_slice = -1;
                        dev.d_partition = -1;
                }
        } else {
-               dev.d_dev = &host_dev;
-               dev.d_type = dev.d_dev->dv_type;
-               dev.d_unit = 0;
+               dev.dd.d_dev = &host_dev;
+               dev.dd.d_type = dev.dd.d_dev->dv_type;
+               dev.dd.d_unit = 0;
        }
 
        env_setenv("currdev", EV_VOLATILE, userboot_fmtdev(&dev),

Modified: head/stand/userboot/userboot/userboot_disk.c
==============================================================================
--- head/stand/userboot/userboot/userboot_disk.c        Mon Mar 12 21:39:42 
2018        (r330808)
+++ head/stand/userboot/userboot/userboot_disk.c        Mon Mar 12 21:39:49 
2018        (r330809)
@@ -135,8 +135,8 @@ userdisk_print(int verbose)
                ret = pager_output(line);
                if (ret != 0)
                        break;
-               dev.d_dev = &userboot_disk;
-               dev.d_unit = i;
+               dev.dd.d_dev = &userboot_disk;
+               dev.dd.d_unit = i;
                dev.d_slice = -1;
                dev.d_partition = -1;
                if (disk_open(&dev, ud_info[i].mediasize,
@@ -164,13 +164,13 @@ userdisk_open(struct open_file *f, ...)
        dev = va_arg(ap, struct disk_devdesc *);
        va_end(ap);
 
-       if (dev->d_unit < 0 || dev->d_unit >= userdisk_maxunit)
+       if (dev->dd.d_unit < 0 || dev->dd.d_unit >= userdisk_maxunit)
                return (EIO);
-       ud_info[dev->d_unit].ud_open++;
-       if (ud_info[dev->d_unit].ud_bcache == NULL)
-               ud_info[dev->d_unit].ud_bcache = bcache_allocate();
-       return (disk_open(dev, ud_info[dev->d_unit].mediasize,
-           ud_info[dev->d_unit].sectorsize));

*** DIFF OUTPUT TRUNCATED AT 1000 LINES ***
_______________________________________________
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"

Reply via email to