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.
This commit is contained in:
parent
f264386b32
commit
de04d704a9
@ -86,7 +86,7 @@ ptblread(void *d, void *buf, size_t blocks, uint64_t offset)
|
|||||||
struct open_disk *od;
|
struct open_disk *od;
|
||||||
|
|
||||||
dev = (struct disk_devdesc *)d;
|
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
|
* 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 offset)
|
|||||||
* As the GPT backup partition is located at the end of the disk,
|
* 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.
|
* 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));
|
blocks * od->sectorsize, (char *)buf, NULL));
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -114,7 +114,7 @@ ptable_print(void *arg, const char *pname, const struct ptable_entry *part)
|
|||||||
int res;
|
int res;
|
||||||
|
|
||||||
pa = (struct print_args *)arg;
|
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,
|
sprintf(line, " %s%s: %s", pa->prefix, pname,
|
||||||
parttype2str(part->type));
|
parttype2str(part->type));
|
||||||
if (pa->verbose)
|
if (pa->verbose)
|
||||||
@ -127,8 +127,8 @@ ptable_print(void *arg, const char *pname, const struct ptable_entry *part)
|
|||||||
res = 0;
|
res = 0;
|
||||||
if (part->type == PART_FREEBSD) {
|
if (part->type == PART_FREEBSD) {
|
||||||
/* Open slice with BSD label */
|
/* Open slice with BSD label */
|
||||||
dev.d_dev = pa->dev->d_dev;
|
dev.dd.d_dev = pa->dev->dd.d_dev;
|
||||||
dev.d_unit = pa->dev->d_unit;
|
dev.dd.d_unit = pa->dev->dd.d_unit;
|
||||||
dev.d_slice = part->index;
|
dev.d_slice = part->index;
|
||||||
dev.d_partition = -1;
|
dev.d_partition = -1;
|
||||||
if (disk_open(&dev, part->end - part->start + 1,
|
if (disk_open(&dev, part->end - part->start + 1,
|
||||||
@ -158,7 +158,7 @@ disk_print(struct disk_devdesc *dev, char *prefix, int verbose)
|
|||||||
struct print_args pa;
|
struct print_args pa;
|
||||||
|
|
||||||
/* Disk should be opened */
|
/* Disk should be opened */
|
||||||
od = (struct open_disk *)dev->d_opendata;
|
od = (struct open_disk *)dev->dd.d_opendata;
|
||||||
pa.dev = dev;
|
pa.dev = dev;
|
||||||
pa.prefix = prefix;
|
pa.prefix = prefix;
|
||||||
pa.verbose = verbose;
|
pa.verbose = verbose;
|
||||||
@ -171,8 +171,8 @@ disk_read(struct disk_devdesc *dev, void *buf, uint64_t offset, u_int blocks)
|
|||||||
struct open_disk *od;
|
struct open_disk *od;
|
||||||
int ret;
|
int ret;
|
||||||
|
|
||||||
od = (struct open_disk *)dev->d_opendata;
|
od = (struct open_disk *)dev->dd.d_opendata;
|
||||||
ret = dev->d_dev->dv_strategy(dev, F_READ, dev->d_offset + offset,
|
ret = dev->dd.d_dev->dv_strategy(dev, F_READ, dev->d_offset + offset,
|
||||||
blocks * od->sectorsize, buf, NULL);
|
blocks * od->sectorsize, buf, NULL);
|
||||||
|
|
||||||
return (ret);
|
return (ret);
|
||||||
@ -184,8 +184,8 @@ disk_write(struct disk_devdesc *dev, void *buf, uint64_t offset, u_int blocks)
|
|||||||
struct open_disk *od;
|
struct open_disk *od;
|
||||||
int ret;
|
int ret;
|
||||||
|
|
||||||
od = (struct open_disk *)dev->d_opendata;
|
od = (struct open_disk *)dev->dd.d_opendata;
|
||||||
ret = dev->d_dev->dv_strategy(dev, F_WRITE, dev->d_offset + offset,
|
ret = dev->dd.d_dev->dv_strategy(dev, F_WRITE, dev->d_offset + offset,
|
||||||
blocks * od->sectorsize, buf, NULL);
|
blocks * od->sectorsize, buf, NULL);
|
||||||
|
|
||||||
return (ret);
|
return (ret);
|
||||||
@ -194,7 +194,7 @@ disk_write(struct disk_devdesc *dev, void *buf, uint64_t offset, u_int blocks)
|
|||||||
int
|
int
|
||||||
disk_ioctl(struct disk_devdesc *dev, u_long cmd, void *data)
|
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)
|
if (od == NULL)
|
||||||
return (ENOTTY);
|
return (ENOTTY);
|
||||||
@ -238,7 +238,7 @@ disk_open(struct disk_devdesc *dev, uint64_t mediasize, u_int sectorsize)
|
|||||||
DEBUG("no memory");
|
DEBUG("no memory");
|
||||||
return (ENOMEM);
|
return (ENOMEM);
|
||||||
}
|
}
|
||||||
dev->d_opendata = od;
|
dev->dd.d_opendata = od;
|
||||||
od->entrysize = 0;
|
od->entrysize = 0;
|
||||||
od->mediasize = mediasize;
|
od->mediasize = mediasize;
|
||||||
od->sectorsize = sectorsize;
|
od->sectorsize = sectorsize;
|
||||||
@ -348,7 +348,7 @@ disk_close(struct disk_devdesc *dev)
|
|||||||
{
|
{
|
||||||
struct open_disk *od;
|
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);
|
DEBUG("%s closed => %p", disk_fmtdev(dev), od);
|
||||||
ptable_close(od->table);
|
ptable_close(od->table);
|
||||||
free(od);
|
free(od);
|
||||||
@ -361,7 +361,7 @@ disk_fmtdev(struct disk_devdesc *dev)
|
|||||||
static char buf[128];
|
static char buf[128];
|
||||||
char *cp;
|
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) {
|
if (dev->d_slice >= 0) {
|
||||||
#ifdef LOADER_GPT_SUPPORT
|
#ifdef LOADER_GPT_SUPPORT
|
||||||
if (dev->d_partition == 255) {
|
if (dev->d_partition == 255) {
|
||||||
@ -423,7 +423,7 @@ disk_parsedev(struct disk_devdesc *dev, const char *devspec, const char **path)
|
|||||||
|
|
||||||
if (*cp != '\0' && *cp != ':')
|
if (*cp != '\0' && *cp != ':')
|
||||||
return (EINVAL);
|
return (EINVAL);
|
||||||
dev->d_unit = unit;
|
dev->dd.d_unit = unit;
|
||||||
dev->d_slice = slice;
|
dev->d_slice = slice;
|
||||||
dev->d_partition = partition;
|
dev->d_partition = partition;
|
||||||
if (path != NULL)
|
if (path != NULL)
|
||||||
|
@ -83,10 +83,7 @@
|
|||||||
|
|
||||||
/* Note: Must match the 'struct devdesc' in stand.h */
|
/* Note: Must match the 'struct devdesc' in stand.h */
|
||||||
struct disk_devdesc {
|
struct disk_devdesc {
|
||||||
struct devsw *d_dev;
|
struct devdesc dd;
|
||||||
int d_type;
|
|
||||||
int d_unit;
|
|
||||||
void *d_opendata;
|
|
||||||
int d_slice;
|
int d_slice;
|
||||||
int d_partition;
|
int d_partition;
|
||||||
uint64_t d_offset;
|
uint64_t d_offset;
|
||||||
|
@ -744,8 +744,8 @@ efipart_print_common(struct devsw *dev, pdinfo_list_t *pdlist, int verbose)
|
|||||||
continue;
|
continue;
|
||||||
|
|
||||||
pd->pd_blkio = blkio;
|
pd->pd_blkio = blkio;
|
||||||
pd_dev.d_dev = dev;
|
pd_dev.dd.d_dev = dev;
|
||||||
pd_dev.d_unit = pd->pd_unit;
|
pd_dev.dd.d_unit = pd->pd_unit;
|
||||||
pd_dev.d_slice = -1;
|
pd_dev.d_slice = -1;
|
||||||
pd_dev.d_partition = -1;
|
pd_dev.d_partition = -1;
|
||||||
ret = disk_open(&pd_dev, blkio->Media->BlockSize *
|
ret = disk_open(&pd_dev, blkio->Media->BlockSize *
|
||||||
@ -820,7 +820,7 @@ efipart_open(struct open_file *f, ...)
|
|||||||
if (pd->pd_bcache == NULL)
|
if (pd->pd_bcache == NULL)
|
||||||
pd->pd_bcache = bcache_allocate();
|
pd->pd_bcache = bcache_allocate();
|
||||||
|
|
||||||
if (dev->d_dev->dv_type == DEVT_DISK) {
|
if (dev->dd.d_dev->dv_type == DEVT_DISK) {
|
||||||
int rc;
|
int rc;
|
||||||
|
|
||||||
rc = disk_open(dev,
|
rc = disk_open(dev,
|
||||||
@ -859,7 +859,7 @@ efipart_close(struct open_file *f)
|
|||||||
bcache_free(pd->pd_bcache);
|
bcache_free(pd->pd_bcache);
|
||||||
pd->pd_bcache = NULL;
|
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 (disk_close(dev));
|
||||||
return (0);
|
return (0);
|
||||||
}
|
}
|
||||||
@ -879,7 +879,7 @@ efipart_ioctl(struct open_file *f, u_long cmd, void *data)
|
|||||||
if (pd == NULL)
|
if (pd == NULL)
|
||||||
return (EINVAL);
|
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);
|
rc = disk_ioctl(dev, cmd, data);
|
||||||
if (rc != ENOTTY)
|
if (rc != ENOTTY)
|
||||||
return (rc);
|
return (rc);
|
||||||
@ -966,7 +966,7 @@ efipart_strategy(void *devdata, int rw, daddr_t blk, size_t size,
|
|||||||
bcd.dv_devdata = devdata;
|
bcd.dv_devdata = devdata;
|
||||||
bcd.dv_cache = pd->pd_bcache;
|
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;
|
daddr_t offset;
|
||||||
|
|
||||||
offset = dev->d_offset * pd->pd_blkio->Media->BlockSize;
|
offset = dev->d_offset * pd->pd_blkio->Media->BlockSize;
|
||||||
@ -1010,7 +1010,7 @@ efipart_realstrategy(void *devdata, int rw, daddr_t blk, size_t size,
|
|||||||
* partition.
|
* partition.
|
||||||
*/
|
*/
|
||||||
disk_blocks = 0;
|
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) {
|
if (disk_ioctl(dev, DIOCGMEDIASIZE, &disk_blocks) == 0) {
|
||||||
/* DIOCGMEDIASIZE does return bytes. */
|
/* DIOCGMEDIASIZE does return bytes. */
|
||||||
disk_blocks /= blkio->Media->BlockSize;
|
disk_blocks /= blkio->Media->BlockSize;
|
||||||
|
@ -29,8 +29,7 @@
|
|||||||
__FBSDID("$FreeBSD$");
|
__FBSDID("$FreeBSD$");
|
||||||
|
|
||||||
#include <sys/param.h>
|
#include <sys/param.h>
|
||||||
#include <sys/disk.h>
|
#include <stand.h>
|
||||||
#include <stdint.h>
|
|
||||||
|
|
||||||
#ifdef EFI_ZFS_BOOT
|
#ifdef EFI_ZFS_BOOT
|
||||||
#include <libzfs.h>
|
#include <libzfs.h>
|
||||||
|
@ -201,9 +201,9 @@ find_currdev(EFI_LOADED_IMAGE *img)
|
|||||||
if (pool_guid != 0) {
|
if (pool_guid != 0) {
|
||||||
struct zfs_devdesc currdev;
|
struct zfs_devdesc currdev;
|
||||||
|
|
||||||
currdev.d_dev = &zfs_dev;
|
currdev.dd.d_dev = &zfs_dev;
|
||||||
currdev.d_unit = 0;
|
currdev.dd.d_unit = 0;
|
||||||
currdev.d_type = currdev.d_dev->dv_type;
|
currdev.dd.d_type = currdev.dd.d_dev->dv_type;
|
||||||
currdev.pool_guid = pool_guid;
|
currdev.pool_guid = pool_guid;
|
||||||
currdev.root_guid = 0;
|
currdev.root_guid = 0;
|
||||||
devname = efi_fmtdev(&currdev);
|
devname = efi_fmtdev(&currdev);
|
||||||
@ -222,9 +222,9 @@ find_currdev(EFI_LOADED_IMAGE *img)
|
|||||||
STAILQ_FOREACH(dp, pdi_list, pd_link) {
|
STAILQ_FOREACH(dp, pdi_list, pd_link) {
|
||||||
struct disk_devdesc currdev;
|
struct disk_devdesc currdev;
|
||||||
|
|
||||||
currdev.d_dev = &efipart_hddev;
|
currdev.dd.d_dev = &efipart_hddev;
|
||||||
currdev.d_type = currdev.d_dev->dv_type;
|
currdev.dd.d_type = currdev.dd.d_dev->dv_type;
|
||||||
currdev.d_unit = dp->pd_unit;
|
currdev.dd.d_unit = dp->pd_unit;
|
||||||
currdev.d_slice = -1;
|
currdev.d_slice = -1;
|
||||||
currdev.d_partition = -1;
|
currdev.d_partition = -1;
|
||||||
|
|
||||||
|
@ -90,7 +90,7 @@ static struct bcinfo {
|
|||||||
} bcinfo [MAXBCDEV];
|
} bcinfo [MAXBCDEV];
|
||||||
static int nbcinfo = 0;
|
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_read(int unit, daddr_t dblk, int blks, caddr_t dest);
|
||||||
static int bc_init(void);
|
static int bc_init(void);
|
||||||
@ -211,7 +211,7 @@ bc_open(struct open_file *f, ...)
|
|||||||
va_start(ap, f);
|
va_start(ap, f);
|
||||||
dev = va_arg(ap, struct i386_devdesc *);
|
dev = va_arg(ap, struct i386_devdesc *);
|
||||||
va_end(ap);
|
va_end(ap);
|
||||||
if (dev->d_unit >= nbcinfo) {
|
if (dev->dd.d_unit >= nbcinfo) {
|
||||||
DEBUG("attempt to open nonexistent disk");
|
DEBUG("attempt to open nonexistent disk");
|
||||||
return(ENXIO);
|
return(ENXIO);
|
||||||
}
|
}
|
||||||
@ -271,7 +271,7 @@ bc_realstrategy(void *devdata, int rw, daddr_t dblk, size_t size,
|
|||||||
if ((rw & F_MASK) != F_READ)
|
if ((rw & F_MASK) != F_READ)
|
||||||
return(EROFS);
|
return(EROFS);
|
||||||
dev = (struct i386_devdesc *)devdata;
|
dev = (struct i386_devdesc *)devdata;
|
||||||
unit = dev->d_unit;
|
unit = dev->dd.d_unit;
|
||||||
blks = size / BIOSCD_SECSIZE;
|
blks = size / BIOSCD_SECSIZE;
|
||||||
if (dblk % (BIOSCD_SECSIZE / DEV_BSIZE) != 0)
|
if (dblk % (BIOSCD_SECSIZE / DEV_BSIZE) != 0)
|
||||||
return (EINVAL);
|
return (EINVAL);
|
||||||
@ -427,7 +427,7 @@ bc_getdev(struct i386_devdesc *dev)
|
|||||||
int major;
|
int major;
|
||||||
int rootdev;
|
int rootdev;
|
||||||
|
|
||||||
unit = dev->d_unit;
|
unit = dev->dd.d_unit;
|
||||||
biosdev = bc_unit2bios(unit);
|
biosdev = bc_unit2bios(unit);
|
||||||
DEBUG("unit %d BIOS device %d", unit, biosdev);
|
DEBUG("unit %d BIOS device %d", unit, biosdev);
|
||||||
if (biosdev == -1) /* not a BIOS device */
|
if (biosdev == -1) /* not a BIOS device */
|
||||||
|
@ -120,7 +120,7 @@ static struct bdinfo
|
|||||||
} bdinfo [MAXBDDEV];
|
} bdinfo [MAXBDDEV];
|
||||||
static int nbdinfo = 0;
|
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,
|
static int bd_read(struct disk_devdesc *dev, daddr_t dblk, int blks,
|
||||||
caddr_t dest);
|
caddr_t dest);
|
||||||
@ -349,8 +349,8 @@ bd_print(int verbose)
|
|||||||
bdinfo[i].bd_sectorsize);
|
bdinfo[i].bd_sectorsize);
|
||||||
if ((ret = pager_output(line)) != 0)
|
if ((ret = pager_output(line)) != 0)
|
||||||
break;
|
break;
|
||||||
dev.d_dev = &biosdisk;
|
dev.dd.d_dev = &biosdisk;
|
||||||
dev.d_unit = i;
|
dev.dd.d_unit = i;
|
||||||
dev.d_slice = -1;
|
dev.d_slice = -1;
|
||||||
dev.d_partition = -1;
|
dev.d_partition = -1;
|
||||||
if (disk_open(&dev,
|
if (disk_open(&dev,
|
||||||
@ -389,7 +389,7 @@ bd_open(struct open_file *f, ...)
|
|||||||
dev = va_arg(ap, struct disk_devdesc *);
|
dev = va_arg(ap, struct disk_devdesc *);
|
||||||
va_end(ap);
|
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);
|
return (EIO);
|
||||||
BD(dev).bd_open++;
|
BD(dev).bd_open++;
|
||||||
if (BD(dev).bd_bcache == NULL)
|
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
|
* During bd_probe() we tested if the mulitplication of bd_sectors
|
||||||
* would overflow so it should be safe to perform here.
|
* would overflow so it should be safe to perform here.
|
||||||
*/
|
*/
|
||||||
disk.d_dev = dev->d_dev;
|
disk.dd.d_dev = dev->dd.d_dev;
|
||||||
disk.d_type = dev->d_type;
|
disk.dd.d_type = dev->dd.d_type;
|
||||||
disk.d_unit = dev->d_unit;
|
disk.dd.d_unit = dev->dd.d_unit;
|
||||||
disk.d_opendata = NULL;
|
disk.dd.d_opendata = NULL;
|
||||||
disk.d_slice = -1;
|
disk.d_slice = -1;
|
||||||
disk.d_partition = -1;
|
disk.d_partition = -1;
|
||||||
disk.d_offset = 0;
|
disk.d_offset = 0;
|
||||||
@ -431,7 +431,7 @@ bd_open(struct open_file *f, ...)
|
|||||||
return (err);
|
return (err);
|
||||||
|
|
||||||
/* if we already know there is no GELI, skip the rest */
|
/* 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);
|
return (err);
|
||||||
|
|
||||||
struct dsk dskp;
|
struct dsk dskp;
|
||||||
@ -440,9 +440,9 @@ bd_open(struct open_file *f, ...)
|
|||||||
struct pentry *entry;
|
struct pentry *entry;
|
||||||
int geli_part = 0;
|
int geli_part = 0;
|
||||||
|
|
||||||
dskp.drive = bd_unit2bios(dev->d_unit);
|
dskp.drive = bd_unit2bios(dev->dd.d_unit);
|
||||||
dskp.type = dev->d_type;
|
dskp.type = dev->dd.d_type;
|
||||||
dskp.unit = dev->d_unit;
|
dskp.unit = dev->dd.d_unit;
|
||||||
dskp.slice = dev->d_slice;
|
dskp.slice = dev->d_slice;
|
||||||
dskp.part = dev->d_partition;
|
dskp.part = dev->d_partition;
|
||||||
dskp.start = dev->d_offset;
|
dskp.start = dev->d_offset;
|
||||||
@ -466,13 +466,13 @@ bd_open(struct open_file *f, ...)
|
|||||||
dskp.slice = entry->part.index;
|
dskp.slice = entry->part.index;
|
||||||
dskp.start = entry->part.start;
|
dskp.start = entry->part.start;
|
||||||
if (is_geli(&dskp) == 0) {
|
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);
|
return (0);
|
||||||
}
|
}
|
||||||
if (geli_taste(bios_read, &dskp,
|
if (geli_taste(bios_read, &dskp,
|
||||||
entry->part.end - entry->part.start) == 0) {
|
entry->part.end - entry->part.start) == 0) {
|
||||||
if (geli_havekey(&dskp) == 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++;
|
geli_part++;
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
@ -486,18 +486,18 @@ bd_open(struct open_file *f, ...)
|
|||||||
&dskp) == 0) {
|
&dskp) == 0) {
|
||||||
setenv("kern.geom.eli.passphrase", gelipw, 1);
|
setenv("kern.geom.eli.passphrase", gelipw, 1);
|
||||||
bzero(gelipw, sizeof(gelipw));
|
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++;
|
geli_part++;
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
} else
|
} 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 */
|
/* none of the partitions on this disk have GELI */
|
||||||
if (geli_part == 0) {
|
if (geli_part == 0) {
|
||||||
/* found no GELI */
|
/* 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 */
|
#endif /* LOADER_GELI_SUPPORT */
|
||||||
|
|
||||||
@ -834,10 +834,10 @@ bd_read(struct disk_devdesc *dev, daddr_t dblk, int blks, caddr_t dest)
|
|||||||
char *tmpbuf;
|
char *tmpbuf;
|
||||||
|
|
||||||
/* if we already know there is no GELI, skip the rest */
|
/* 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));
|
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
|
* Align reads to DEV_GELIBOOT_BSIZE bytes because partial
|
||||||
* sectors cannot be decrypted. Round the requested LBA down to
|
* sectors cannot be decrypted. Round the requested LBA down to
|
||||||
@ -871,9 +871,9 @@ bd_read(struct disk_devdesc *dev, daddr_t dblk, int blks, caddr_t dest)
|
|||||||
if (err)
|
if (err)
|
||||||
return (err);
|
return (err);
|
||||||
|
|
||||||
dskp.drive = bd_unit2bios(dev->d_unit);
|
dskp.drive = bd_unit2bios(dev->dd.d_unit);
|
||||||
dskp.type = dev->d_type;
|
dskp.type = dev->dd.d_type;
|
||||||
dskp.unit = dev->d_unit;
|
dskp.unit = dev->dd.d_unit;
|
||||||
dskp.slice = dev->d_slice;
|
dskp.slice = dev->d_slice;
|
||||||
dskp.part = dev->d_partition;
|
dskp.part = dev->d_partition;
|
||||||
dskp.start = dev->d_offset;
|
dskp.start = dev->d_offset;
|
||||||
@ -950,8 +950,8 @@ bd_getdev(struct i386_devdesc *d)
|
|||||||
int i, unit;
|
int i, unit;
|
||||||
|
|
||||||
dev = (struct disk_devdesc *)d;
|
dev = (struct disk_devdesc *)d;
|
||||||
biosdev = bd_unit2bios(dev->d_unit);
|
biosdev = bd_unit2bios(dev->dd.d_unit);
|
||||||
DEBUG("unit %d BIOS device %d", dev->d_unit, biosdev);
|
DEBUG("unit %d BIOS device %d", dev->dd.d_unit, biosdev);
|
||||||
if (biosdev == -1) /* not a BIOS device */
|
if (biosdev == -1) /* not a BIOS device */
|
||||||
return(-1);
|
return(-1);
|
||||||
if (disk_open(dev, BD(dev).bd_sectors * BD(dev).bd_sectorsize,
|
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) {
|
if (biosdev < 0x80) {
|
||||||
/* floppy (or emulated floppy) or ATAPI device */
|
/* 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 */
|
/* is an ATAPI disk */
|
||||||
major = WFDMAJOR;
|
major = WFDMAJOR;
|
||||||
} else {
|
} else {
|
||||||
@ -996,9 +996,9 @@ bios_read(void *vdev __unused, void *xpriv, off_t off, void *buf, size_t bytes)
|
|||||||
struct disk_devdesc dev;
|
struct disk_devdesc dev;
|
||||||
struct dsk *priv = xpriv;
|
struct dsk *priv = xpriv;
|
||||||
|
|
||||||
dev.d_dev = &biosdisk;
|
dev.dd.d_dev = &biosdisk;
|
||||||
dev.d_type = priv->type;
|
dev.dd.d_type = priv->type;
|
||||||
dev.d_unit = priv->unit;
|
dev.dd.d_unit = priv->unit;
|
||||||
dev.d_slice = priv->slice;
|
dev.d_slice = priv->slice;
|
||||||
dev.d_partition = priv->part;
|
dev.d_partition = priv->part;
|
||||||
dev.d_offset = priv->start;
|
dev.d_offset = priv->start;
|
||||||
|
@ -181,16 +181,16 @@ bi_load32(char *args, int *howtop, int *bootdevp, vm_offset_t *bip, vm_offset_t
|
|||||||
/* XXX - use a default bootdev of 0. Is this ok??? */
|
/* XXX - use a default bootdev of 0. Is this ok??? */
|
||||||
bootdevnr = 0;
|
bootdevnr = 0;
|
||||||
|
|
||||||
switch(rootdev->d_type) {
|
switch(rootdev->dd.d_type) {
|
||||||
case DEVT_CD:
|
case DEVT_CD:
|
||||||
/* Pass in BIOS device number. */
|
/* 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);
|
bootdevnr = bc_getdev(rootdev);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case DEVT_DISK:
|
case DEVT_DISK:
|
||||||
/* pass in the BIOS device number of the current 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);
|
bootdevnr = bd_getdev(rootdev);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
@ -199,7 +199,7 @@ bi_load32(char *args, int *howtop, int *bootdevp, vm_offset_t *bip, vm_offset_t
|
|||||||
break;
|
break;
|
||||||
|
|
||||||
default:
|
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) {
|
if (bootdevnr == -1) {
|
||||||
printf("root device %s invalid\n", i386_fmtdev(rootdev));
|
printf("root device %s invalid\n", i386_fmtdev(rootdev));
|
||||||
|
@ -135,7 +135,7 @@ i386_parsedev(struct i386_devdesc **dev, const char *devspec, const char **path)
|
|||||||
goto fail;
|
goto fail;
|
||||||
}
|
}
|
||||||
|
|
||||||
idev->d_unit = unit;
|
idev->dd.d_unit = unit;
|
||||||
if (path != NULL)
|
if (path != NULL)
|
||||||
*path = (*cp == 0) ? cp : cp + 1;
|
*path = (*cp == 0) ? cp : cp + 1;
|
||||||
break;
|
break;
|
||||||
@ -148,8 +148,8 @@ i386_parsedev(struct i386_devdesc **dev, const char *devspec, const char **path)
|
|||||||
err = EINVAL;
|
err = EINVAL;
|
||||||
goto fail;
|
goto fail;
|
||||||
}
|
}
|
||||||
idev->d_dev = dv;
|
idev->dd.d_dev = dv;
|
||||||
idev->d_type = dv->dv_type;
|
idev->dd.d_type = dv->dv_type;
|
||||||
if (dev == NULL) {
|
if (dev == NULL) {
|
||||||
free(idev);
|
free(idev);
|
||||||
} else {
|
} else {
|
||||||
@ -169,14 +169,14 @@ i386_fmtdev(void *vdev)
|
|||||||
struct i386_devdesc *dev = (struct i386_devdesc *)vdev;
|
struct i386_devdesc *dev = (struct i386_devdesc *)vdev;
|
||||||
static char buf[128]; /* XXX device length constant? */
|
static char buf[128]; /* XXX device length constant? */
|
||||||
|
|
||||||
switch(dev->d_type) {
|
switch(dev->dd.d_type) {
|
||||||
case DEVT_NONE:
|
case DEVT_NONE:
|
||||||
strcpy(buf, "(no device)");
|
strcpy(buf, "(no device)");
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case DEVT_CD:
|
case DEVT_CD:
|
||||||
case DEVT_NET:
|
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;
|
break;
|
||||||
|
|
||||||
case DEVT_DISK:
|
case DEVT_DISK:
|
||||||
|
@ -33,10 +33,7 @@
|
|||||||
*/
|
*/
|
||||||
/* Note: Must match the 'struct devdesc' in stand.h */
|
/* Note: Must match the 'struct devdesc' in stand.h */
|
||||||
struct i386_devdesc {
|
struct i386_devdesc {
|
||||||
struct devsw *d_dev;
|
struct devdesc dd;
|
||||||
int d_type;
|
|
||||||
int d_unit;
|
|
||||||
void *d_opendata;
|
|
||||||
union
|
union
|
||||||
{
|
{
|
||||||
struct
|
struct
|
||||||
|
@ -111,7 +111,7 @@ command_chain(int argc, char *argv[])
|
|||||||
relocater_data[0].dest = 0x7C00;
|
relocater_data[0].dest = 0x7C00;
|
||||||
relocater_data[0].size = SECTOR_SIZE;
|
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_esi = relocater_size;
|
||||||
relocator_ds = 0;
|
relocator_ds = 0;
|
||||||
relocator_es = 0;
|
relocator_es = 0;
|
||||||
|
@ -254,18 +254,18 @@ extract_currdev(void)
|
|||||||
int biosdev = -1;
|
int biosdev = -1;
|
||||||
|
|
||||||
/* Assume we are booting from a BIOS disk by default */
|
/* 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 */
|
/* new-style boot loaders such as pxeldr and cdldr */
|
||||||
if (kargs->bootinfo == 0) {
|
if (kargs->bootinfo == 0) {
|
||||||
if ((kargs->bootflags & KARGS_FLAGS_CD) != 0) {
|
if ((kargs->bootflags & KARGS_FLAGS_CD) != 0) {
|
||||||
/* we are booting from a CD with cdboot */
|
/* we are booting from a CD with cdboot */
|
||||||
new_currdev.d_dev = &bioscd;
|
new_currdev.dd.d_dev = &bioscd;
|
||||||
new_currdev.d_unit = bc_bios2unit(initial_bootdev);
|
new_currdev.dd.d_unit = bc_bios2unit(initial_bootdev);
|
||||||
} else if ((kargs->bootflags & KARGS_FLAGS_PXE) != 0) {
|
} else if ((kargs->bootflags & KARGS_FLAGS_PXE) != 0) {
|
||||||
/* we are booting from pxeldr */
|
/* we are booting from pxeldr */
|
||||||
new_currdev.d_dev = &pxedisk;
|
new_currdev.dd.d_dev = &pxedisk;
|
||||||
new_currdev.d_unit = 0;
|
new_currdev.dd.d_unit = 0;
|
||||||
} else {
|
} else {
|
||||||
/* we don't know what our boot device is */
|
/* we don't know what our boot device is */
|
||||||
new_currdev.d_kind.biosdisk.slice = -1;
|
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.pool_guid = kargs->zfspool;
|
||||||
new_currdev.d_kind.zfs.root_guid = 0;
|
new_currdev.d_kind.zfs.root_guid = 0;
|
||||||
}
|
}
|
||||||
new_currdev.d_dev = &zfs_dev;
|
new_currdev.dd.d_dev = &zfs_dev;
|
||||||
#endif
|
#endif
|
||||||
} else if ((initial_bootdev & B_MAGICMASK) != B_DEVMAGIC) {
|
} else if ((initial_bootdev & B_MAGICMASK) != B_DEVMAGIC) {
|
||||||
/* The passed-in boot device is bad */
|
/* 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 */
|
if ((biosdev == 0) && (B_TYPE(initial_bootdev) != 2)) /* biosdev doesn't match major */
|
||||||
biosdev = 0x80 + B_UNIT(initial_bootdev); /* assume harddisk */
|
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
|
* 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.
|
* which one we booted off of, just use disk0: as a reasonable default.
|
||||||
*/
|
*/
|
||||||
if ((new_currdev.d_type == biosdisk.dv_type) &&
|
if ((new_currdev.dd.d_type == biosdisk.dv_type) &&
|
||||||
((new_currdev.d_unit = bd_bios2unit(biosdev)) == -1)) {
|
((new_currdev.dd.d_unit = bd_bios2unit(biosdev)) == -1)) {
|
||||||
printf("Can't work out which disk we are booting from.\n"
|
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);
|
"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
|
#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));
|
init_zfs_bootenv(zfs_fmtdev(&new_currdev));
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
@ -98,7 +98,7 @@ beri_cfi_disk_open(struct open_file *f, ...)
|
|||||||
dev = va_arg(ap, struct disk_devdesc *);
|
dev = va_arg(ap, struct disk_devdesc *);
|
||||||
va_end(ap);
|
va_end(ap);
|
||||||
|
|
||||||
if (dev->d_unit != 0)
|
if (dev->dd.d_unit != 0)
|
||||||
return (EIO);
|
return (EIO);
|
||||||
return (disk_open(dev, cfi_get_mediasize(), cfi_get_sectorsize()));
|
return (disk_open(dev, cfi_get_mediasize(), cfi_get_sectorsize()));
|
||||||
}
|
}
|
||||||
@ -127,8 +127,8 @@ beri_cfi_disk_print(int verbose)
|
|||||||
ret = pager_output(line);
|
ret = pager_output(line);
|
||||||
if (ret != 0)
|
if (ret != 0)
|
||||||
return (ret);
|
return (ret);
|
||||||
dev.d_dev = &beri_cfi_disk;
|
dev.dd.d_dev = &beri_cfi_disk;
|
||||||
dev.d_unit = 0;
|
dev.dd.d_unit = 0;
|
||||||
dev.d_slice = -1;
|
dev.d_slice = -1;
|
||||||
dev.d_partition = -1;
|
dev.d_partition = -1;
|
||||||
if (disk_open(&dev, cfi_get_mediasize(), cfi_get_sectorsize()) == 0) {
|
if (disk_open(&dev, cfi_get_mediasize(), cfi_get_sectorsize()) == 0) {
|
||||||
|
@ -103,7 +103,7 @@ beri_sdcard_disk_open(struct open_file *f, ...)
|
|||||||
return (ENXIO);
|
return (ENXIO);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (dev->d_unit != 0)
|
if (dev->dd.d_unit != 0)
|
||||||
return (EIO);
|
return (EIO);
|
||||||
return (disk_open(dev, altera_sdcard_get_mediasize(),
|
return (disk_open(dev, altera_sdcard_get_mediasize(),
|
||||||
altera_sdcard_get_sectorsize()));
|
altera_sdcard_get_sectorsize()));
|
||||||
@ -133,8 +133,8 @@ beri_sdcard_disk_print(int verbose)
|
|||||||
ret = pager_output(line);
|
ret = pager_output(line);
|
||||||
if (ret != 0)
|
if (ret != 0)
|
||||||
return (ret);
|
return (ret);
|
||||||
dev.d_dev = &beri_sdcard_disk;
|
dev.dd.d_dev = &beri_sdcard_disk;
|
||||||
dev.d_unit = 0;
|
dev.dd.d_unit = 0;
|
||||||
dev.d_slice = -1;
|
dev.d_slice = -1;
|
||||||
dev.d_partition = -1;
|
dev.d_partition = -1;
|
||||||
if (disk_open(&dev, altera_sdcard_get_mediasize(),
|
if (disk_open(&dev, altera_sdcard_get_mediasize(),
|
||||||
|
@ -139,7 +139,7 @@ beri_arch_parsedev(struct disk_devdesc **dev, const char *devspec,
|
|||||||
goto fail;
|
goto fail;
|
||||||
}
|
}
|
||||||
|
|
||||||
idev->d_unit = unit;
|
idev->dd.d_unit = unit;
|
||||||
if (path != NULL)
|
if (path != NULL)
|
||||||
*path = (*cp == 0) ? cp : cp + 1;
|
*path = (*cp == 0) ? cp : cp + 1;
|
||||||
break;
|
break;
|
||||||
@ -148,8 +148,8 @@ beri_arch_parsedev(struct disk_devdesc **dev, const char *devspec,
|
|||||||
err = EINVAL;
|
err = EINVAL;
|
||||||
goto fail;
|
goto fail;
|
||||||
}
|
}
|
||||||
idev->d_dev = dv;
|
idev->dd.d_dev = dv;
|
||||||
idev->d_type = dv->dv_type;
|
idev->dd.d_type = dv->dv_type;
|
||||||
if (dev == NULL) {
|
if (dev == NULL) {
|
||||||
free(idev);
|
free(idev);
|
||||||
} else {
|
} else {
|
||||||
@ -175,7 +175,7 @@ beri_arch_fmtdev(void *vdev)
|
|||||||
break;
|
break;
|
||||||
|
|
||||||
case DEVT_CD:
|
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;
|
break;
|
||||||
|
|
||||||
case DEVT_DISK:
|
case DEVT_DISK:
|
||||||
@ -183,7 +183,7 @@ beri_arch_fmtdev(void *vdev)
|
|||||||
|
|
||||||
case DEVT_NET:
|
case DEVT_NET:
|
||||||
case DEVT_ZFS:
|
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;
|
break;
|
||||||
}
|
}
|
||||||
return(buf);
|
return(buf);
|
||||||
|
@ -113,9 +113,9 @@ ofw_parsedev(struct ofw_devdesc **dev, const char *devspec, const char **path)
|
|||||||
return ENOMEM;
|
return ENOMEM;
|
||||||
}
|
}
|
||||||
strcpy(idev->d_path, name);
|
strcpy(idev->d_path, name);
|
||||||
idev->d_dev = dv;
|
idev->dd.d_dev = dv;
|
||||||
idev->d_type = dv->dv_type;
|
idev->dd.d_type = dv->dv_type;
|
||||||
if (idev->d_type == DEVT_ZFS) {
|
if (idev->dd.d_type == DEVT_ZFS) {
|
||||||
p = devspec + strlen(dv->dv_name);
|
p = devspec + strlen(dv->dv_name);
|
||||||
err = zfs_parsedev((struct zfs_devdesc *)idev, p, path);
|
err = zfs_parsedev((struct zfs_devdesc *)idev, p, path);
|
||||||
if (err != 0) {
|
if (err != 0) {
|
||||||
|
@ -27,14 +27,13 @@
|
|||||||
|
|
||||||
#include "openfirm.h"
|
#include "openfirm.h"
|
||||||
|
|
||||||
/* Note: Must match the 'struct devdesc' in stand.h */
|
|
||||||
struct ofw_devdesc {
|
struct ofw_devdesc {
|
||||||
struct devsw *d_dev;
|
struct devdesc dd;
|
||||||
int d_type;
|
|
||||||
int d_unit;
|
|
||||||
ihandle_t d_handle;
|
|
||||||
union {
|
union {
|
||||||
char d_path[256];
|
struct {
|
||||||
|
ihandle_t d_handle;
|
||||||
|
char d_path[256];
|
||||||
|
};
|
||||||
struct {
|
struct {
|
||||||
uint64_t pool_guid;
|
uint64_t pool_guid;
|
||||||
uint64_t root_guid;
|
uint64_t root_guid;
|
||||||
|
@ -806,8 +806,8 @@ sparc64_zfs_probe(void)
|
|||||||
if (guid != 0) {
|
if (guid != 0) {
|
||||||
zfs_currdev.pool_guid = guid;
|
zfs_currdev.pool_guid = guid;
|
||||||
zfs_currdev.root_guid = 0;
|
zfs_currdev.root_guid = 0;
|
||||||
zfs_currdev.d_dev = &zfs_dev;
|
zfs_currdev.dd.d_dev = &zfs_dev;
|
||||||
zfs_currdev.d_type = zfs_currdev.d_dev->dv_type;
|
zfs_currdev.dd.d_type = zfs_currdev.dd.d_dev->dv_type;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#endif /* LOADER_ZFS_SUPPORT */
|
#endif /* LOADER_ZFS_SUPPORT */
|
||||||
|
@ -318,7 +318,7 @@ print_disk_probe_info()
|
|||||||
strcpy(partition, "<auto>");
|
strcpy(partition, "<auto>");
|
||||||
|
|
||||||
printf(" Checking unit=%d slice=%s partition=%s...",
|
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, int load_slice,
|
|||||||
if (load_type == -1) {
|
if (load_type == -1) {
|
||||||
printf(" Probing all disk devices...\n");
|
printf(" Probing all disk devices...\n");
|
||||||
/* Try each disk in succession until one works. */
|
/* Try each disk in succession until one works. */
|
||||||
for (currdev.d_unit = 0; currdev.d_unit < UB_MAX_DEV;
|
for (currdev.dd.d_unit = 0; currdev.dd.d_unit < UB_MAX_DEV;
|
||||||
currdev.d_unit++) {
|
currdev.dd.d_unit++) {
|
||||||
print_disk_probe_info();
|
print_disk_probe_info();
|
||||||
open_result = devsw[devidx]->dv_open(&f, &currdev);
|
open_result = devsw[devidx]->dv_open(&f, &currdev);
|
||||||
if (open_result == 0) {
|
if (open_result == 0) {
|
||||||
@ -355,8 +355,8 @@ probe_disks(int devidx, int load_type, int load_unit, int load_slice,
|
|||||||
printf(" Probing all %s devices...\n", device_typename(load_type));
|
printf(" Probing all %s devices...\n", device_typename(load_type));
|
||||||
/* Try each disk of given type in succession until one works. */
|
/* Try each disk of given type in succession until one works. */
|
||||||
for (unit = 0; unit < UB_MAX_DEV; unit++) {
|
for (unit = 0; unit < UB_MAX_DEV; unit++) {
|
||||||
currdev.d_unit = uboot_diskgetunit(load_type, unit);
|
currdev.dd.d_unit = uboot_diskgetunit(load_type, unit);
|
||||||
if (currdev.d_unit == -1)
|
if (currdev.dd.d_unit == -1)
|
||||||
break;
|
break;
|
||||||
print_disk_probe_info();
|
print_disk_probe_info();
|
||||||
open_result = devsw[devidx]->dv_open(&f, &currdev);
|
open_result = devsw[devidx]->dv_open(&f, &currdev);
|
||||||
@ -369,7 +369,7 @@ probe_disks(int devidx, int load_type, int load_unit, int load_slice,
|
|||||||
return (-1);
|
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();
|
print_disk_probe_info();
|
||||||
open_result = devsw[devidx]->dv_open(&f,&currdev);
|
open_result = devsw[devidx]->dv_open(&f,&currdev);
|
||||||
if (open_result == 0) {
|
if (open_result == 0) {
|
||||||
@ -459,9 +459,9 @@ main(int argc, char **argv)
|
|||||||
|
|
||||||
printf("Found U-Boot device: %s\n", devsw[i]->dv_name);
|
printf("Found U-Boot device: %s\n", devsw[i]->dv_name);
|
||||||
|
|
||||||
currdev.d_dev = devsw[i];
|
currdev.dd.d_dev = devsw[i];
|
||||||
currdev.d_type = currdev.d_dev->dv_type;
|
currdev.dd.d_type = currdev.dd.d_dev->dv_type;
|
||||||
currdev.d_unit = 0;
|
currdev.dd.d_unit = 0;
|
||||||
|
|
||||||
if ((load_type == -1 || (load_type & DEV_TYP_STOR)) &&
|
if ((load_type == -1 || (load_type & DEV_TYP_STOR)) &&
|
||||||
strcmp(devsw[i]->dv_name, "disk") == 0) {
|
strcmp(devsw[i]->dv_name, "disk") == 0) {
|
||||||
|
@ -136,7 +136,7 @@ uboot_parsedev(struct uboot_devdesc **dev, const char *devspec,
|
|||||||
err = EINVAL;
|
err = EINVAL;
|
||||||
goto fail;
|
goto fail;
|
||||||
}
|
}
|
||||||
idev->d_unit = unit;
|
idev->dd.d_unit = unit;
|
||||||
|
|
||||||
if (path != NULL)
|
if (path != NULL)
|
||||||
*path = (*cp == 0) ? cp : cp + 1;
|
*path = (*cp == 0) ? cp : cp + 1;
|
||||||
@ -146,8 +146,8 @@ uboot_parsedev(struct uboot_devdesc **dev, const char *devspec,
|
|||||||
err = EINVAL;
|
err = EINVAL;
|
||||||
goto fail;
|
goto fail;
|
||||||
}
|
}
|
||||||
idev->d_dev = dv;
|
idev->dd.d_dev = dv;
|
||||||
idev->d_type = dv->dv_type;
|
idev->dd.d_type = dv->dv_type;
|
||||||
if (dev == NULL) {
|
if (dev == NULL) {
|
||||||
free(idev);
|
free(idev);
|
||||||
} else {
|
} else {
|
||||||
@ -167,7 +167,7 @@ uboot_fmtdev(void *vdev)
|
|||||||
struct uboot_devdesc *dev = (struct uboot_devdesc *)vdev;
|
struct uboot_devdesc *dev = (struct uboot_devdesc *)vdev;
|
||||||
static char buf[128];
|
static char buf[128];
|
||||||
|
|
||||||
switch(dev->d_type) {
|
switch(dev->dd.d_type) {
|
||||||
case DEVT_NONE:
|
case DEVT_NONE:
|
||||||
strcpy(buf, "(no device)");
|
strcpy(buf, "(no device)");
|
||||||
break;
|
break;
|
||||||
@ -178,7 +178,7 @@ uboot_fmtdev(void *vdev)
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
case DEVT_NET:
|
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;
|
break;
|
||||||
}
|
}
|
||||||
return(buf);
|
return(buf);
|
||||||
|
@ -46,7 +46,7 @@ __FBSDID("$FreeBSD$");
|
|||||||
#include "libuboot.h"
|
#include "libuboot.h"
|
||||||
|
|
||||||
#define stor_printf(fmt, args...) do { \
|
#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); \
|
printf(fmt, ##args); \
|
||||||
} while (0)
|
} while (0)
|
||||||
|
|
||||||
@ -65,7 +65,7 @@ static struct {
|
|||||||
u_int bsize; /* block size */
|
u_int bsize; /* block size */
|
||||||
} stor_info[UB_MAX_DEV];
|
} 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_info_no = 0;
|
||||||
static int stor_opendev(struct disk_devdesc *);
|
static int stor_opendev(struct disk_devdesc *);
|
||||||
@ -190,7 +190,7 @@ stor_opendev(struct disk_devdesc *dev)
|
|||||||
{
|
{
|
||||||
int err;
|
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);
|
return (EIO);
|
||||||
|
|
||||||
if (SI(dev).opened == 0) {
|
if (SI(dev).opened == 0) {
|
||||||
@ -252,8 +252,8 @@ stor_print(int verbose)
|
|||||||
return (ret);
|
return (ret);
|
||||||
|
|
||||||
for (i = 0; i < stor_info_no; i++) {
|
for (i = 0; i < stor_info_no; i++) {
|
||||||
dev.d_dev = &uboot_storage;
|
dev.dd.d_dev = &uboot_storage;
|
||||||
dev.d_unit = i;
|
dev.dd.d_unit = i;
|
||||||
dev.d_slice = -1;
|
dev.d_slice = -1;
|
||||||
dev.d_partition = -1;
|
dev.d_partition = -1;
|
||||||
snprintf(line, sizeof(line), "\tdisk%d (%s)\n", i,
|
snprintf(line, sizeof(line), "\tdisk%d (%s)\n", i,
|
||||||
|
@ -29,10 +29,7 @@
|
|||||||
|
|
||||||
/* Note: Must match the 'struct devdesc' in stand.h */
|
/* Note: Must match the 'struct devdesc' in stand.h */
|
||||||
struct uboot_devdesc {
|
struct uboot_devdesc {
|
||||||
struct devsw *d_dev;
|
struct devdesc dd;
|
||||||
int d_type;
|
|
||||||
int d_unit;
|
|
||||||
void *d_opendata;
|
|
||||||
union {
|
union {
|
||||||
struct {
|
struct {
|
||||||
int slice;
|
int slice;
|
||||||
|
@ -139,7 +139,7 @@ userboot_parsedev(struct disk_devdesc **dev, const char *devspec, const char **p
|
|||||||
goto fail;
|
goto fail;
|
||||||
}
|
}
|
||||||
|
|
||||||
idev->d_unit = unit;
|
idev->dd.d_unit = unit;
|
||||||
if (path != NULL)
|
if (path != NULL)
|
||||||
*path = (*cp == 0) ? cp : cp + 1;
|
*path = (*cp == 0) ? cp : cp + 1;
|
||||||
break;
|
break;
|
||||||
@ -158,8 +158,8 @@ userboot_parsedev(struct disk_devdesc **dev, const char *devspec, const char **p
|
|||||||
err = EINVAL;
|
err = EINVAL;
|
||||||
goto fail;
|
goto fail;
|
||||||
}
|
}
|
||||||
idev->d_dev = dv;
|
idev->dd.d_dev = dv;
|
||||||
idev->d_type = dv->dv_type;
|
idev->dd.d_type = dv->dv_type;
|
||||||
if (dev == NULL) {
|
if (dev == NULL) {
|
||||||
free(idev);
|
free(idev);
|
||||||
} else {
|
} else {
|
||||||
@ -179,27 +179,27 @@ userboot_fmtdev(void *vdev)
|
|||||||
struct disk_devdesc *dev = (struct disk_devdesc *)vdev;
|
struct disk_devdesc *dev = (struct disk_devdesc *)vdev;
|
||||||
static char buf[128]; /* XXX device length constant? */
|
static char buf[128]; /* XXX device length constant? */
|
||||||
|
|
||||||
switch(dev->d_type) {
|
switch(dev->dd.d_type) {
|
||||||
case DEVT_NONE:
|
case DEVT_NONE:
|
||||||
strcpy(buf, "(no device)");
|
strcpy(buf, "(no device)");
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case DEVT_CD:
|
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;
|
break;
|
||||||
|
|
||||||
case DEVT_DISK:
|
case DEVT_DISK:
|
||||||
return (disk_fmtdev(vdev));
|
return (disk_fmtdev(vdev));
|
||||||
|
|
||||||
case DEVT_NET:
|
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;
|
break;
|
||||||
|
|
||||||
case DEVT_ZFS:
|
case DEVT_ZFS:
|
||||||
#if defined(USERBOOT_ZFS_SUPPORT)
|
#if defined(USERBOOT_ZFS_SUPPORT)
|
||||||
return (zfs_fmtdev(vdev));
|
return (zfs_fmtdev(vdev));
|
||||||
#else
|
#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
|
#endif
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -159,13 +159,14 @@ extract_currdev(void)
|
|||||||
//bzero(&dev, sizeof(dev));
|
//bzero(&dev, sizeof(dev));
|
||||||
|
|
||||||
#if defined(USERBOOT_ZFS_SUPPORT)
|
#if defined(USERBOOT_ZFS_SUPPORT)
|
||||||
|
CT_ASSERT(sizeof(struct disk_devdesc) >= sizeof(struct zfs_devdesc));
|
||||||
if (userboot_zfs_found) {
|
if (userboot_zfs_found) {
|
||||||
struct zfs_devdesc zdev;
|
struct zfs_devdesc zdev;
|
||||||
|
|
||||||
/* Leave the pool/root guid's unassigned */
|
/* Leave the pool/root guid's unassigned */
|
||||||
bzero(&zdev, sizeof(zdev));
|
bzero(&zdev, sizeof(zdev));
|
||||||
zdev.d_dev = &zfs_dev;
|
zdev.dd.d_dev = &zfs_dev;
|
||||||
zdev.d_type = zdev.d_dev->dv_type;
|
zdev.dd.d_type = zdev.dd.d_dev->dv_type;
|
||||||
|
|
||||||
dev = *(struct disk_devdesc *)&zdev;
|
dev = *(struct disk_devdesc *)&zdev;
|
||||||
init_zfs_bootenv(zfs_fmtdev(&dev));
|
init_zfs_bootenv(zfs_fmtdev(&dev));
|
||||||
@ -173,23 +174,23 @@ extract_currdev(void)
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
if (userboot_disk_maxunit > 0) {
|
if (userboot_disk_maxunit > 0) {
|
||||||
dev.d_dev = &userboot_disk;
|
dev.dd.d_dev = &userboot_disk;
|
||||||
dev.d_type = dev.d_dev->dv_type;
|
dev.dd.d_type = dev.dd.d_dev->dv_type;
|
||||||
dev.d_unit = 0;
|
dev.dd.d_unit = 0;
|
||||||
dev.d_slice = 0;
|
dev.d_slice = 0;
|
||||||
dev.d_partition = 0;
|
dev.d_partition = 0;
|
||||||
/*
|
/*
|
||||||
* If we cannot auto-detect the partition type then
|
* If we cannot auto-detect the partition type then
|
||||||
* access the disk as a raw device.
|
* 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_slice = -1;
|
||||||
dev.d_partition = -1;
|
dev.d_partition = -1;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
dev.d_dev = &host_dev;
|
dev.dd.d_dev = &host_dev;
|
||||||
dev.d_type = dev.d_dev->dv_type;
|
dev.dd.d_type = dev.dd.d_dev->dv_type;
|
||||||
dev.d_unit = 0;
|
dev.dd.d_unit = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
env_setenv("currdev", EV_VOLATILE, userboot_fmtdev(&dev),
|
env_setenv("currdev", EV_VOLATILE, userboot_fmtdev(&dev),
|
||||||
|
@ -135,8 +135,8 @@ userdisk_print(int verbose)
|
|||||||
ret = pager_output(line);
|
ret = pager_output(line);
|
||||||
if (ret != 0)
|
if (ret != 0)
|
||||||
break;
|
break;
|
||||||
dev.d_dev = &userboot_disk;
|
dev.dd.d_dev = &userboot_disk;
|
||||||
dev.d_unit = i;
|
dev.dd.d_unit = i;
|
||||||
dev.d_slice = -1;
|
dev.d_slice = -1;
|
||||||
dev.d_partition = -1;
|
dev.d_partition = -1;
|
||||||
if (disk_open(&dev, ud_info[i].mediasize,
|
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 *);
|
dev = va_arg(ap, struct disk_devdesc *);
|
||||||
va_end(ap);
|
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);
|
return (EIO);
|
||||||
ud_info[dev->d_unit].ud_open++;
|
ud_info[dev->dd.d_unit].ud_open++;
|
||||||
if (ud_info[dev->d_unit].ud_bcache == NULL)
|
if (ud_info[dev->dd.d_unit].ud_bcache == NULL)
|
||||||
ud_info[dev->d_unit].ud_bcache = bcache_allocate();
|
ud_info[dev->dd.d_unit].ud_bcache = bcache_allocate();
|
||||||
return (disk_open(dev, ud_info[dev->d_unit].mediasize,
|
return (disk_open(dev, ud_info[dev->dd.d_unit].mediasize,
|
||||||
ud_info[dev->d_unit].sectorsize));
|
ud_info[dev->dd.d_unit].sectorsize));
|
||||||
}
|
}
|
||||||
|
|
||||||
static int
|
static int
|
||||||
@ -179,10 +179,10 @@ userdisk_close(struct open_file *f)
|
|||||||
struct disk_devdesc *dev;
|
struct disk_devdesc *dev;
|
||||||
|
|
||||||
dev = (struct disk_devdesc *)f->f_devdata;
|
dev = (struct disk_devdesc *)f->f_devdata;
|
||||||
ud_info[dev->d_unit].ud_open--;
|
ud_info[dev->dd.d_unit].ud_open--;
|
||||||
if (ud_info[dev->d_unit].ud_open == 0) {
|
if (ud_info[dev->dd.d_unit].ud_open == 0) {
|
||||||
bcache_free(ud_info[dev->d_unit].ud_bcache);
|
bcache_free(ud_info[dev->dd.d_unit].ud_bcache);
|
||||||
ud_info[dev->d_unit].ud_bcache = NULL;
|
ud_info[dev->dd.d_unit].ud_bcache = NULL;
|
||||||
}
|
}
|
||||||
return (disk_close(dev));
|
return (disk_close(dev));
|
||||||
}
|
}
|
||||||
@ -197,7 +197,7 @@ userdisk_strategy(void *devdata, int rw, daddr_t dblk, size_t size,
|
|||||||
dev = (struct disk_devdesc *)devdata;
|
dev = (struct disk_devdesc *)devdata;
|
||||||
bcd.dv_strategy = userdisk_realstrategy;
|
bcd.dv_strategy = userdisk_realstrategy;
|
||||||
bcd.dv_devdata = devdata;
|
bcd.dv_devdata = devdata;
|
||||||
bcd.dv_cache = ud_info[dev->d_unit].ud_bcache;
|
bcd.dv_cache = ud_info[dev->dd.d_unit].ud_bcache;
|
||||||
return (bcache_strategy(&bcd, rw, dblk + dev->d_offset,
|
return (bcache_strategy(&bcd, rw, dblk + dev->d_offset,
|
||||||
size, buf, rsize));
|
size, buf, rsize));
|
||||||
}
|
}
|
||||||
@ -218,8 +218,8 @@ userdisk_realstrategy(void *devdata, int rw, daddr_t dblk, size_t size,
|
|||||||
return (EINVAL);
|
return (EINVAL);
|
||||||
if (rsize)
|
if (rsize)
|
||||||
*rsize = 0;
|
*rsize = 0;
|
||||||
off = dblk * ud_info[dev->d_unit].sectorsize;
|
off = dblk * ud_info[dev->dd.d_unit].sectorsize;
|
||||||
rc = CALLBACK(diskread, dev->d_unit, off, buf, size, &resid);
|
rc = CALLBACK(diskread, dev->dd.d_unit, off, buf, size, &resid);
|
||||||
if (rc)
|
if (rc)
|
||||||
return (rc);
|
return (rc);
|
||||||
if (rsize)
|
if (rsize)
|
||||||
@ -238,5 +238,5 @@ userdisk_ioctl(struct open_file *f, u_long cmd, void *data)
|
|||||||
if (rc != ENOTTY)
|
if (rc != ENOTTY)
|
||||||
return (rc);
|
return (rc);
|
||||||
|
|
||||||
return (CALLBACK(diskioctl, dev->d_unit, cmd, data));
|
return (CALLBACK(diskioctl, dev->dd.d_unit, cmd, data));
|
||||||
}
|
}
|
||||||
|
@ -38,12 +38,9 @@
|
|||||||
*/
|
*/
|
||||||
/* Note: Must match the 'struct devdesc' in stand.h */
|
/* Note: Must match the 'struct devdesc' in stand.h */
|
||||||
struct zfs_devdesc {
|
struct zfs_devdesc {
|
||||||
struct devsw *d_dev;
|
struct devdesc dd;
|
||||||
int d_type;
|
uint64_t pool_guid;
|
||||||
int d_unit;
|
uint64_t root_guid;
|
||||||
void *d_opendata;
|
|
||||||
uint64_t pool_guid;
|
|
||||||
uint64_t root_guid;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
#ifdef LOADER_GELI_SUPPORT
|
#ifdef LOADER_GELI_SUPPORT
|
||||||
|
@ -687,8 +687,8 @@ zfs_parsedev(struct zfs_devdesc *dev, const char *devspec, const char **path)
|
|||||||
return (rv);
|
return (rv);
|
||||||
if (path != NULL)
|
if (path != NULL)
|
||||||
*path = (*end == '\0') ? end : end + 1;
|
*path = (*end == '\0') ? end : end + 1;
|
||||||
dev->d_dev = &zfs_dev;
|
dev->dd.d_dev = &zfs_dev;
|
||||||
dev->d_type = zfs_dev.dv_type;
|
dev->dd.d_type = zfs_dev.dv_type;
|
||||||
return (0);
|
return (0);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -701,7 +701,7 @@ zfs_fmtdev(void *vdev)
|
|||||||
spa_t *spa;
|
spa_t *spa;
|
||||||
|
|
||||||
buf[0] = '\0';
|
buf[0] = '\0';
|
||||||
if (dev->d_type != DEVT_ZFS)
|
if (dev->dd.d_type != DEVT_ZFS)
|
||||||
return (buf);
|
return (buf);
|
||||||
|
|
||||||
if (dev->pool_guid == 0) {
|
if (dev->pool_guid == 0) {
|
||||||
@ -723,9 +723,9 @@ zfs_fmtdev(void *vdev)
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (rootname[0] == '\0')
|
if (rootname[0] == '\0')
|
||||||
sprintf(buf, "%s:%s:", dev->d_dev->dv_name, spa->spa_name);
|
sprintf(buf, "%s:%s:", dev->dd.d_dev->dv_name, spa->spa_name);
|
||||||
else
|
else
|
||||||
sprintf(buf, "%s:%s/%s:", dev->d_dev->dv_name, spa->spa_name,
|
sprintf(buf, "%s:%s/%s:", dev->dd.d_dev->dv_name, spa->spa_name,
|
||||||
rootname);
|
rootname);
|
||||||
return (buf);
|
return (buf);
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user