Remove d_type from devdesc. It's not needed as we can fetch it from
d_dev->dv_type when we need it.
This commit is contained in:
parent
de04d704a9
commit
ad00892f4c
@ -161,7 +161,6 @@ efi_parsedev(struct devdesc **dev, const char *devspec, const char **path)
|
||||
}
|
||||
|
||||
idev->d_dev = dv;
|
||||
idev->d_type = dv->dv_type;
|
||||
|
||||
if (dev != NULL)
|
||||
*dev = idev;
|
||||
@ -180,7 +179,7 @@ efi_fmtdev(void *vdev)
|
||||
struct devdesc *dev = (struct devdesc *)vdev;
|
||||
static char buf[SPECNAMELEN + 1];
|
||||
|
||||
switch(dev->d_type) {
|
||||
switch(dev->d_dev->dv_type) {
|
||||
case DEVT_NONE:
|
||||
strcpy(buf, "(no device)");
|
||||
break;
|
||||
|
@ -175,7 +175,6 @@ set_devdesc_currdev(struct devsw *dev, int unit)
|
||||
char *devname;
|
||||
|
||||
currdev.d_dev = dev;
|
||||
currdev.d_type = currdev.d_dev->dv_type;
|
||||
currdev.d_unit = unit;
|
||||
devname = efi_fmtdev(&currdev);
|
||||
|
||||
@ -203,7 +202,6 @@ find_currdev(EFI_LOADED_IMAGE *img)
|
||||
|
||||
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);
|
||||
@ -223,7 +221,6 @@ find_currdev(EFI_LOADED_IMAGE *img)
|
||||
struct disk_devdesc currdev;
|
||||
|
||||
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;
|
||||
@ -845,7 +842,7 @@ command_chain(int argc, char *argv[])
|
||||
struct disk_devdesc *d_dev;
|
||||
pdinfo_t *hd, *pd;
|
||||
|
||||
switch (dev->d_type) {
|
||||
switch (dev->d_dev->dv_type) {
|
||||
#ifdef EFI_ZFS_BOOT
|
||||
case DEVT_ZFS:
|
||||
z_dev = (struct zfs_devdesc *)dev;
|
||||
|
@ -403,7 +403,6 @@ bd_open(struct open_file *f, ...)
|
||||
* would overflow so it should be safe to perform here.
|
||||
*/
|
||||
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;
|
||||
@ -441,7 +440,7 @@ bd_open(struct open_file *f, ...)
|
||||
int geli_part = 0;
|
||||
|
||||
dskp.drive = bd_unit2bios(dev->dd.d_unit);
|
||||
dskp.type = dev->dd.d_type;
|
||||
dskp.type = dev->dd.d_dev->dv_type;
|
||||
dskp.unit = dev->dd.d_unit;
|
||||
dskp.slice = dev->d_slice;
|
||||
dskp.part = dev->d_partition;
|
||||
@ -872,7 +871,7 @@ bd_read(struct disk_devdesc *dev, daddr_t dblk, int blks, caddr_t dest)
|
||||
return (err);
|
||||
|
||||
dskp.drive = bd_unit2bios(dev->dd.d_unit);
|
||||
dskp.type = dev->dd.d_type;
|
||||
dskp.type = dev->dd.d_dev->dv_type;
|
||||
dskp.unit = dev->dd.d_unit;
|
||||
dskp.slice = dev->d_slice;
|
||||
dskp.part = dev->d_partition;
|
||||
@ -997,7 +996,6 @@ bios_read(void *vdev __unused, void *xpriv, off_t off, void *buf, size_t bytes)
|
||||
struct dsk *priv = xpriv;
|
||||
|
||||
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;
|
||||
|
@ -181,7 +181,7 @@ 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??? */
|
||||
bootdevnr = 0;
|
||||
|
||||
switch(rootdev->dd.d_type) {
|
||||
switch(rootdev->dd.d_dev->dv_type) {
|
||||
case DEVT_CD:
|
||||
/* Pass in BIOS device number. */
|
||||
bi.bi_bios_dev = bc_unit2bios(rootdev->dd.d_unit);
|
||||
@ -199,7 +199,8 @@ bi_load32(char *args, int *howtop, int *bootdevp, vm_offset_t *bip, vm_offset_t
|
||||
break;
|
||||
|
||||
default:
|
||||
printf("WARNING - don't know how to boot from device type %d\n", rootdev->dd.d_type);
|
||||
printf("WARNING - don't know how to boot from device type %d\n",
|
||||
rootdev->dd.d_dev->dv_type);
|
||||
}
|
||||
if (bootdevnr == -1) {
|
||||
printf("root device %s invalid\n", i386_fmtdev(rootdev));
|
||||
|
@ -149,7 +149,6 @@ i386_parsedev(struct i386_devdesc **dev, const char *devspec, const char **path)
|
||||
goto fail;
|
||||
}
|
||||
idev->dd.d_dev = dv;
|
||||
idev->dd.d_type = dv->dv_type;
|
||||
if (dev == NULL) {
|
||||
free(idev);
|
||||
} else {
|
||||
@ -169,7 +168,7 @@ i386_fmtdev(void *vdev)
|
||||
struct i386_devdesc *dev = (struct i386_devdesc *)vdev;
|
||||
static char buf[128]; /* XXX device length constant? */
|
||||
|
||||
switch(dev->dd.d_type) {
|
||||
switch(dev->dd.d_dev->dv_type) {
|
||||
case DEVT_NONE:
|
||||
strcpy(buf, "(no device)");
|
||||
break;
|
||||
|
@ -316,13 +316,12 @@ 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.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.dd.d_type == biosdisk.dv_type) &&
|
||||
if ((new_currdev.dd.d_dev->dv_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);
|
||||
@ -330,7 +329,7 @@ extract_currdev(void)
|
||||
}
|
||||
|
||||
#ifdef LOADER_ZFS_SUPPORT
|
||||
if (new_currdev.dd.d_type == DEVT_ZFS)
|
||||
if (new_currdev.dd.d_dev->dv_type == DEVT_ZFS)
|
||||
init_zfs_bootenv(zfs_fmtdev(&new_currdev));
|
||||
#endif
|
||||
|
||||
|
@ -168,7 +168,6 @@ extern int errno;
|
||||
*/
|
||||
struct devdesc {
|
||||
struct devsw *d_dev;
|
||||
int d_type;
|
||||
int d_unit;
|
||||
void *d_opendata;
|
||||
};
|
||||
|
@ -149,7 +149,6 @@ beri_arch_parsedev(struct disk_devdesc **dev, const char *devspec,
|
||||
goto fail;
|
||||
}
|
||||
idev->dd.d_dev = dv;
|
||||
idev->dd.d_type = dv->dv_type;
|
||||
if (dev == NULL) {
|
||||
free(idev);
|
||||
} else {
|
||||
@ -169,7 +168,7 @@ beri_arch_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_dev->dv_type) {
|
||||
case DEVT_NONE:
|
||||
strcpy(buf, "(no device)");
|
||||
break;
|
||||
|
@ -114,8 +114,7 @@ found:
|
||||
}
|
||||
strcpy(idev->d_path, name);
|
||||
idev->dd.d_dev = dv;
|
||||
idev->dd.d_type = dv->dv_type;
|
||||
if (idev->dd.d_type == DEVT_ZFS) {
|
||||
if (dv->dv_type == DEVT_ZFS) {
|
||||
p = devspec + strlen(dv->dv_name);
|
||||
err = zfs_parsedev((struct zfs_devdesc *)idev, p, path);
|
||||
if (err != 0) {
|
||||
|
@ -807,7 +807,6 @@ sparc64_zfs_probe(void)
|
||||
zfs_currdev.pool_guid = guid;
|
||||
zfs_currdev.root_guid = 0;
|
||||
zfs_currdev.dd.d_dev = &zfs_dev;
|
||||
zfs_currdev.dd.d_type = zfs_currdev.dd.d_dev->dv_type;
|
||||
}
|
||||
}
|
||||
#endif /* LOADER_ZFS_SUPPORT */
|
||||
|
@ -460,7 +460,6 @@ main(int argc, char **argv)
|
||||
printf("Found U-Boot device: %s\n", devsw[i]->dv_name);
|
||||
|
||||
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)) &&
|
||||
|
@ -147,7 +147,6 @@ uboot_parsedev(struct uboot_devdesc **dev, const char *devspec,
|
||||
goto fail;
|
||||
}
|
||||
idev->dd.d_dev = dv;
|
||||
idev->dd.d_type = dv->dv_type;
|
||||
if (dev == NULL) {
|
||||
free(idev);
|
||||
} else {
|
||||
@ -167,7 +166,7 @@ uboot_fmtdev(void *vdev)
|
||||
struct uboot_devdesc *dev = (struct uboot_devdesc *)vdev;
|
||||
static char buf[128];
|
||||
|
||||
switch(dev->dd.d_type) {
|
||||
switch(dev->dd.d_dev->dv_type) {
|
||||
case DEVT_NONE:
|
||||
strcpy(buf, "(no device)");
|
||||
break;
|
||||
|
@ -159,7 +159,6 @@ userboot_parsedev(struct disk_devdesc **dev, const char *devspec, const char **p
|
||||
goto fail;
|
||||
}
|
||||
idev->dd.d_dev = dv;
|
||||
idev->dd.d_type = dv->dv_type;
|
||||
if (dev == NULL) {
|
||||
free(idev);
|
||||
} else {
|
||||
@ -179,7 +178,7 @@ userboot_fmtdev(void *vdev)
|
||||
struct disk_devdesc *dev = (struct disk_devdesc *)vdev;
|
||||
static char buf[128]; /* XXX device length constant? */
|
||||
|
||||
switch(dev->dd.d_type) {
|
||||
switch(dev->dd.d_dev->dv_type) {
|
||||
case DEVT_NONE:
|
||||
strcpy(buf, "(no device)");
|
||||
break;
|
||||
|
@ -166,7 +166,6 @@ extract_currdev(void)
|
||||
/* Leave the pool/root guid's unassigned */
|
||||
bzero(&zdev, sizeof(zdev));
|
||||
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));
|
||||
@ -175,7 +174,6 @@ extract_currdev(void)
|
||||
|
||||
if (userboot_disk_maxunit > 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;
|
||||
@ -189,7 +187,6 @@ extract_currdev(void)
|
||||
}
|
||||
} else {
|
||||
dev.dd.d_dev = &host_dev;
|
||||
dev.dd.d_type = dev.dd.d_dev->dv_type;
|
||||
dev.dd.d_unit = 0;
|
||||
}
|
||||
|
||||
|
@ -688,7 +688,6 @@ zfs_parsedev(struct zfs_devdesc *dev, const char *devspec, const char **path)
|
||||
if (path != NULL)
|
||||
*path = (*end == '\0') ? end : end + 1;
|
||||
dev->dd.d_dev = &zfs_dev;
|
||||
dev->dd.d_type = zfs_dev.dv_type;
|
||||
return (0);
|
||||
}
|
||||
|
||||
@ -701,7 +700,7 @@ zfs_fmtdev(void *vdev)
|
||||
spa_t *spa;
|
||||
|
||||
buf[0] = '\0';
|
||||
if (dev->dd.d_type != DEVT_ZFS)
|
||||
if (dev->dd.d_dev->dv_type != DEVT_ZFS)
|
||||
return (buf);
|
||||
|
||||
if (dev->pool_guid == 0) {
|
||||
|
Loading…
x
Reference in New Issue
Block a user