summaryrefslogtreecommitdiffstats
path: root/sys/boot
diff options
context:
space:
mode:
authormarcel <marcel@FreeBSD.org>2006-11-02 01:23:18 +0000
committermarcel <marcel@FreeBSD.org>2006-11-02 01:23:18 +0000
commitdc91b1990af7dcb6d36cfccc9756c830cf400108 (patch)
treef6d4e8e00f43cedf707309d12500b41a38fcaaf0 /sys/boot
parent19b599de4af959c5287bac69d61c3810ae390dfe (diff)
downloadFreeBSD-src-dc91b1990af7dcb6d36cfccc9756c830cf400108.zip
FreeBSD-src-dc91b1990af7dcb6d36cfccc9756c830cf400108.tar.gz
Extend struct devdesc with a unit field, called d_unit. Promote the
device (kind) specific unit field to the common field. This change allows a future version of libefi to work without requiring anything more than what is defined in struct devdesc and as such makes it possible to compile said version of libefi for different platforms without requiring that those platforms have identical derivatives of struct devdesc.
Diffstat (limited to 'sys/boot')
-rw-r--r--sys/boot/common/bootstrap.h1
-rw-r--r--sys/boot/efi/libefi/devicename.c8
-rw-r--r--sys/boot/efi/libefi/efiboot.h5
-rw-r--r--sys/boot/efi/libefi/efifs.c2
-rw-r--r--sys/boot/i386/libi386/bioscd.c6
-rw-r--r--sys/boot/i386/libi386/biosdisk.c14
-rw-r--r--sys/boot/i386/libi386/bootinfo32.c4
-rw-r--r--sys/boot/i386/libi386/devicename.c13
-rw-r--r--sys/boot/i386/libi386/libi386.h9
-rw-r--r--sys/boot/i386/loader/main.c8
-rw-r--r--sys/boot/ia64/common/devicename.c8
-rw-r--r--sys/boot/ia64/efi/main.c4
-rw-r--r--sys/boot/ia64/ski/devicename.c8
-rw-r--r--sys/boot/ia64/ski/libski.h5
-rw-r--r--sys/boot/ia64/ski/main.c2
-rw-r--r--sys/boot/ofw/libofw/libofw.h1
-rw-r--r--sys/boot/pc98/libpc98/bioscd.c6
-rw-r--r--sys/boot/pc98/libpc98/biosdisk.c16
-rw-r--r--sys/boot/pc98/loader/main.c8
19 files changed, 58 insertions, 70 deletions
diff --git a/sys/boot/common/bootstrap.h b/sys/boot/common/bootstrap.h
index d309c2b..862b06c 100644
--- a/sys/boot/common/bootstrap.h
+++ b/sys/boot/common/bootstrap.h
@@ -43,6 +43,7 @@ struct devdesc
#define DEVT_DISK 1
#define DEVT_NET 2
#define DEVT_CD 3
+ int d_unit;
};
/* Commands and return values; nonzero return sets command_errmsg != NULL */
diff --git a/sys/boot/efi/libefi/devicename.c b/sys/boot/efi/libefi/devicename.c
index d9f5275..62c943a 100644
--- a/sys/boot/efi/libefi/devicename.c
+++ b/sys/boot/efi/libefi/devicename.c
@@ -146,7 +146,7 @@ efi_parsedev(struct efi_devdesc **dev, const char *devspec, const char **path)
goto fail;
}
- idev->d_kind.efidisk.unit = unit;
+ idev->d_unit = unit;
idev->d_kind.efidisk.slice = slice;
idev->d_kind.efidisk.partition = partition;
@@ -169,7 +169,7 @@ efi_parsedev(struct efi_devdesc **dev, const char *devspec, const char **path)
goto fail;
}
- idev->d_kind.netif.unit = unit;
+ idev->d_unit = unit;
if (path != NULL)
*path = (*cp == 0) ? cp : cp + 1;
break;
@@ -207,7 +207,7 @@ efi_fmtdev(void *vdev)
case DEVT_DISK:
cp = buf;
- cp += sprintf(cp, "%s%d", dev->d_dev->dv_name, dev->d_kind.efidisk.unit);
+ cp += sprintf(cp, "%s%d", dev->d_dev->dv_name, dev->d_unit);
if (dev->d_kind.efidisk.slice > 0)
cp += sprintf(cp, "s%d", dev->d_kind.efidisk.slice);
if (dev->d_kind.efidisk.partition >= 0)
@@ -216,7 +216,7 @@ efi_fmtdev(void *vdev)
break;
case DEVT_NET:
- sprintf(buf, "%s%d:", dev->d_dev->dv_name, dev->d_kind.netif.unit);
+ sprintf(buf, "%s%d:", dev->d_dev->dv_name, dev->d_unit);
break;
}
return(buf);
diff --git a/sys/boot/efi/libefi/efiboot.h b/sys/boot/efi/libefi/efiboot.h
index d93213b..74e659a 100644
--- a/sys/boot/efi/libefi/efiboot.h
+++ b/sys/boot/efi/libefi/efiboot.h
@@ -40,16 +40,13 @@ struct efi_devdesc {
#define DEVT_NONE 0
#define DEVT_DISK 1
#define DEVT_NET 2
+ int d_unit;
EFI_HANDLE d_handle;
union {
struct {
- int unit;
int slice;
int partition;
} efidisk;
- struct {
- int unit; /* XXX net layer lives over these? */
- } netif;
} d_kind;
};
diff --git a/sys/boot/efi/libefi/efifs.c b/sys/boot/efi/libefi/efifs.c
index cf89a9d..ce20a6e 100644
--- a/sys/boot/efi/libefi/efifs.c
+++ b/sys/boot/efi/libefi/efifs.c
@@ -365,7 +365,7 @@ efifs_dev_open(struct open_file *f, ...)
dev = va_arg(args, struct efi_devdesc*);
va_end(args);
- unit = dev->d_kind.efidisk.unit;
+ unit = dev->d_unit;
if (unit < 0 || unit >= fs_handle_count) {
printf("attempt to open nonexistent EFI filesystem\n");
return(ENXIO);
diff --git a/sys/boot/i386/libi386/bioscd.c b/sys/boot/i386/libi386/bioscd.c
index 5ffcada..42dfbb3 100644
--- a/sys/boot/i386/libi386/bioscd.c
+++ b/sys/boot/i386/libi386/bioscd.c
@@ -195,7 +195,7 @@ bc_open(struct open_file *f, ...)
va_start(ap, f);
dev = va_arg(ap, struct i386_devdesc *);
va_end(ap);
- if (dev->d_kind.bioscd.unit >= nbcinfo) {
+ if (dev->d_unit >= nbcinfo) {
DEBUG("attempt to open nonexistent disk");
return(ENXIO);
}
@@ -230,7 +230,7 @@ bc_strategy(void *devdata, int rw, daddr_t dblk, size_t size, char *buf,
if (rw != F_READ)
return(EROFS);
dev = (struct i386_devdesc *)devdata;
- unit = dev->d_kind.bioscd.unit;
+ unit = dev->d_unit;
blks = size / BIOSCD_SECSIZE;
if (dblk % (BIOSCD_SECSIZE / DEV_BSIZE) != 0)
return (EINVAL);
@@ -331,7 +331,7 @@ bc_getdev(struct i386_devdesc *dev)
int major;
int rootdev;
- unit = dev->d_kind.bioscd.unit;
+ unit = dev->d_unit;
biosdev = bc_unit2bios(unit);
DEBUG("unit %d BIOS device %d", unit, biosdev);
if (biosdev == -1) /* not a BIOS device */
diff --git a/sys/boot/i386/libi386/biosdisk.c b/sys/boot/i386/libi386/biosdisk.c
index 8a1b402..b65ddd8 100644
--- a/sys/boot/i386/libi386/biosdisk.c
+++ b/sys/boot/i386/libi386/biosdisk.c
@@ -251,7 +251,7 @@ bd_print(int verbose)
pager_output(line);
/* try to open the whole disk */
- dev.d_kind.biosdisk.unit = i;
+ dev.d_unit = i;
dev.d_kind.biosdisk.slice = -1;
dev.d_kind.biosdisk.partition = -1;
@@ -454,7 +454,7 @@ bd_opendisk(struct open_disk **odp, struct i386_devdesc *dev)
int error;
char buf[BUFSIZE];
- if (dev->d_kind.biosdisk.unit >= nbdinfo) {
+ if (dev->d_unit >= nbdinfo) {
DEBUG("attempt to open nonexistent disk");
return(ENXIO);
}
@@ -466,14 +466,14 @@ bd_opendisk(struct open_disk **odp, struct i386_devdesc *dev)
}
/* Look up BIOS unit number, intialise open_disk structure */
- od->od_dkunit = dev->d_kind.biosdisk.unit;
+ od->od_dkunit = dev->d_unit;
od->od_unit = bdinfo[od->od_dkunit].bd_unit;
od->od_flags = bdinfo[od->od_dkunit].bd_flags;
od->od_boff = 0;
od->od_nslices = 0;
error = 0;
DEBUG("open '%s', unit 0x%x slice %d partition %c",
- i386_fmtdev(dev), dev->d_kind.biosdisk.unit,
+ i386_fmtdev(dev), dev->d_unit,
dev->d_kind.biosdisk.slice, dev->d_kind.biosdisk.partition + 'a');
/* Get geometry for this open (removable device may have changed) */
@@ -1177,8 +1177,8 @@ bd_getdev(struct i386_devdesc *dev)
char *nip, *cp;
int unitofs = 0, i, unit;
- biosdev = bd_unit2bios(dev->d_kind.biosdisk.unit);
- DEBUG("unit %d BIOS device %d", dev->d_kind.biosdisk.unit, biosdev);
+ biosdev = bd_unit2bios(dev->d_unit);
+ DEBUG("unit %d BIOS device %d", dev->d_unit, biosdev);
if (biosdev == -1) /* not a BIOS device */
return(-1);
if (bd_opendisk(&od, dev) != 0) /* oops, not a viable device */
@@ -1186,7 +1186,7 @@ bd_getdev(struct i386_devdesc *dev)
if (biosdev < 0x80) {
/* floppy (or emulated floppy) or ATAPI device */
- if (bdinfo[dev->d_kind.biosdisk.unit].bd_type == DT_ATAPI) {
+ if (bdinfo[dev->d_unit].bd_type == DT_ATAPI) {
/* is an ATAPI disk */
major = WFDMAJOR;
} else {
diff --git a/sys/boot/i386/libi386/bootinfo32.c b/sys/boot/i386/libi386/bootinfo32.c
index ceb254c..6b517c5 100644
--- a/sys/boot/i386/libi386/bootinfo32.c
+++ b/sys/boot/i386/libi386/bootinfo32.c
@@ -172,13 +172,13 @@ bi_load32(char *args, int *howtop, int *bootdevp, vm_offset_t *bip, vm_offset_t
switch(rootdev->d_type) {
case DEVT_CD:
/* Pass in BIOS device number. */
- bi.bi_bios_dev = bc_unit2bios(rootdev->d_kind.bioscd.unit);
+ bi.bi_bios_dev = bc_unit2bios(rootdev->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_kind.biosdisk.unit);
+ bi.bi_bios_dev = bd_unit2bios(rootdev->d_unit);
bootdevnr = bd_getdev(rootdev);
break;
diff --git a/sys/boot/i386/libi386/devicename.c b/sys/boot/i386/libi386/devicename.c
index fac0b83..c906a52 100644
--- a/sys/boot/i386/libi386/devicename.c
+++ b/sys/boot/i386/libi386/devicename.c
@@ -142,7 +142,7 @@ i386_parsedev(struct i386_devdesc **dev, const char *devspec, const char **path)
goto fail;
}
- idev->d_kind.biosdisk.unit = unit;
+ idev->d_unit = unit;
idev->d_kind.biosdisk.slice = slice;
idev->d_kind.biosdisk.partition = partition;
if (path != NULL)
@@ -165,10 +165,7 @@ i386_parsedev(struct i386_devdesc **dev, const char *devspec, const char **path)
goto fail;
}
- if (dv->dv_type == DEVT_NET)
- idev->d_kind.netif.unit = unit;
- else
- idev->d_kind.bioscd.unit = unit;
+ idev->d_unit = unit;
if (path != NULL)
*path = (*cp == 0) ? cp : cp + 1;
break;
@@ -205,12 +202,12 @@ i386_fmtdev(void *vdev)
break;
case DEVT_CD:
- sprintf(buf, "%s%d:", dev->d_dev->dv_name, dev->d_kind.bioscd.unit);
+ sprintf(buf, "%s%d:", dev->d_dev->dv_name, dev->d_unit);
break;
case DEVT_DISK:
cp = buf;
- cp += sprintf(cp, "%s%d", dev->d_dev->dv_name, dev->d_kind.biosdisk.unit);
+ cp += sprintf(cp, "%s%d", dev->d_dev->dv_name, dev->d_unit);
if (dev->d_kind.biosdisk.slice > 0)
cp += sprintf(cp, "s%d", dev->d_kind.biosdisk.slice);
if (dev->d_kind.biosdisk.partition >= 0)
@@ -219,7 +216,7 @@ i386_fmtdev(void *vdev)
break;
case DEVT_NET:
- sprintf(buf, "%s%d:", dev->d_dev->dv_name, dev->d_kind.netif.unit);
+ sprintf(buf, "%s%d:", dev->d_dev->dv_name, dev->d_unit);
break;
}
return(buf);
diff --git a/sys/boot/i386/libi386/libi386.h b/sys/boot/i386/libi386/libi386.h
index 412e1b6..ccae099 100644
--- a/sys/boot/i386/libi386/libi386.h
+++ b/sys/boot/i386/libi386/libi386.h
@@ -36,24 +36,19 @@ struct i386_devdesc
{
struct devsw *d_dev;
int d_type;
+ int d_unit;
union
{
struct
{
- int unit;
+ void *data;
int slice;
int partition;
- void *data;
} biosdisk;
struct
{
- int unit;
void *data;
} bioscd;
- struct
- {
- int unit; /* XXX net layer lives over these? */
- } netif;
} d_kind;
};
diff --git a/sys/boot/i386/loader/main.c b/sys/boot/i386/loader/main.c
index 9dd4a05..daac4d6 100644
--- a/sys/boot/i386/loader/main.c
+++ b/sys/boot/i386/loader/main.c
@@ -201,11 +201,11 @@ extract_currdev(void)
if ((kargs->bootflags & KARGS_FLAGS_CD) != 0) {
/* we are booting from a CD with cdboot */
new_currdev.d_dev = &bioscd;
- new_currdev.d_kind.bioscd.unit = bc_bios2unit(initial_bootdev);
+ new_currdev.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_kind.netif.unit = 0;
+ new_currdev.d_unit = 0;
} else {
/* we don't know what our boot device is */
new_currdev.d_kind.biosdisk.slice = -1;
@@ -240,10 +240,10 @@ extract_currdev(void)
* which one we booted off of, just use disk0: as a reasonable default.
*/
if ((new_currdev.d_type == biosdisk.dv_type) &&
- ((new_currdev.d_kind.biosdisk.unit = bd_bios2unit(biosdev)) == -1)) {
+ ((new_currdev.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_kind.biosdisk.unit = 0;
+ new_currdev.d_unit = 0;
}
env_setenv("currdev", EV_VOLATILE, i386_fmtdev(&new_currdev),
i386_setcurrdev, env_nounset);
diff --git a/sys/boot/ia64/common/devicename.c b/sys/boot/ia64/common/devicename.c
index d9f5275..62c943a 100644
--- a/sys/boot/ia64/common/devicename.c
+++ b/sys/boot/ia64/common/devicename.c
@@ -146,7 +146,7 @@ efi_parsedev(struct efi_devdesc **dev, const char *devspec, const char **path)
goto fail;
}
- idev->d_kind.efidisk.unit = unit;
+ idev->d_unit = unit;
idev->d_kind.efidisk.slice = slice;
idev->d_kind.efidisk.partition = partition;
@@ -169,7 +169,7 @@ efi_parsedev(struct efi_devdesc **dev, const char *devspec, const char **path)
goto fail;
}
- idev->d_kind.netif.unit = unit;
+ idev->d_unit = unit;
if (path != NULL)
*path = (*cp == 0) ? cp : cp + 1;
break;
@@ -207,7 +207,7 @@ efi_fmtdev(void *vdev)
case DEVT_DISK:
cp = buf;
- cp += sprintf(cp, "%s%d", dev->d_dev->dv_name, dev->d_kind.efidisk.unit);
+ cp += sprintf(cp, "%s%d", dev->d_dev->dv_name, dev->d_unit);
if (dev->d_kind.efidisk.slice > 0)
cp += sprintf(cp, "s%d", dev->d_kind.efidisk.slice);
if (dev->d_kind.efidisk.partition >= 0)
@@ -216,7 +216,7 @@ efi_fmtdev(void *vdev)
break;
case DEVT_NET:
- sprintf(buf, "%s%d:", dev->d_dev->dv_name, dev->d_kind.netif.unit);
+ sprintf(buf, "%s%d:", dev->d_dev->dv_name, dev->d_unit);
break;
}
return(buf);
diff --git a/sys/boot/ia64/efi/main.c b/sys/boot/ia64/efi/main.c
index 8cc0a04..2d11bed 100644
--- a/sys/boot/ia64/efi/main.c
+++ b/sys/boot/ia64/efi/main.c
@@ -135,13 +135,13 @@ main(int argc, CHAR16 *argv[])
i = efifs_get_unit(img->DeviceHandle);
if (i >= 0) {
currdev.d_dev = devsw[0]; /* XXX disk */
- currdev.d_kind.efidisk.unit = i;
+ currdev.d_unit = i;
/* XXX should be able to detect this, default to autoprobe */
currdev.d_kind.efidisk.slice = -1;
currdev.d_kind.efidisk.partition = 0;
} else {
currdev.d_dev = devsw[1]; /* XXX net */
- currdev.d_kind.netif.unit = 0; /* XXX */
+ currdev.d_unit = 0; /* XXX */
}
currdev.d_type = currdev.d_dev->dv_type;
diff --git a/sys/boot/ia64/ski/devicename.c b/sys/boot/ia64/ski/devicename.c
index b01bf18..1a3a75d 100644
--- a/sys/boot/ia64/ski/devicename.c
+++ b/sys/boot/ia64/ski/devicename.c
@@ -143,7 +143,7 @@ ski_parsedev(struct ski_devdesc **dev, const char *devspec, const char **path)
goto fail;
}
- idev->d_kind.skidisk.unit = unit;
+ idev->d_unit = unit;
idev->d_kind.skidisk.slice = slice;
idev->d_kind.skidisk.partition = partition;
@@ -166,7 +166,7 @@ ski_parsedev(struct ski_devdesc **dev, const char *devspec, const char **path)
goto fail;
}
- idev->d_kind.netif.unit = unit;
+ idev->d_unit = unit;
if (path != NULL)
*path = (*cp == 0) ? cp : cp + 1;
break;
@@ -204,7 +204,7 @@ ski_fmtdev(void *vdev)
case DEVT_DISK:
cp = buf;
- cp += sprintf(cp, "%s%d", dev->d_dev->dv_name, dev->d_kind.skidisk.unit);
+ cp += sprintf(cp, "%s%d", dev->d_dev->dv_name, dev->d_unit);
if (dev->d_kind.skidisk.slice > 0)
cp += sprintf(cp, "s%d", dev->d_kind.skidisk.slice);
if (dev->d_kind.skidisk.partition >= 0)
@@ -213,7 +213,7 @@ ski_fmtdev(void *vdev)
break;
case DEVT_NET:
- sprintf(buf, "%s%d:", dev->d_dev->dv_name, dev->d_kind.netif.unit);
+ sprintf(buf, "%s%d:", dev->d_dev->dv_name, dev->d_unit);
break;
}
return(buf);
diff --git a/sys/boot/ia64/ski/libski.h b/sys/boot/ia64/ski/libski.h
index 6fe8034..595e59a 100644
--- a/sys/boot/ia64/ski/libski.h
+++ b/sys/boot/ia64/ski/libski.h
@@ -35,15 +35,12 @@ struct ski_devdesc {
#define DEVT_NONE 0
#define DEVT_DISK 1
#define DEVT_NET 2
+ int d_unit;
union {
struct {
- int unit;
int slice;
int partition;
} skidisk;
- struct {
- int unit; /* XXX net layer lives over these? */
- } netif;
} d_kind;
};
diff --git a/sys/boot/ia64/ski/main.c b/sys/boot/ia64/ski/main.c
index f27d166..604553c 100644
--- a/sys/boot/ia64/ski/main.c
+++ b/sys/boot/ia64/ski/main.c
@@ -89,7 +89,7 @@ ski_main(void)
/* XXX presumes that biosdisk is first in devsw */
currdev.d_dev = devsw[0];
currdev.d_type = currdev.d_dev->dv_type;
- currdev.d_kind.skidisk.unit = 0;
+ currdev.d_unit = 0;
/* XXX should be able to detect this, default to autoprobe */
currdev.d_kind.skidisk.slice = -1;
/* default to 'a' */
diff --git a/sys/boot/ofw/libofw/libofw.h b/sys/boot/ofw/libofw/libofw.h
index 71a2462..748233e 100644
--- a/sys/boot/ofw/libofw/libofw.h
+++ b/sys/boot/ofw/libofw/libofw.h
@@ -31,6 +31,7 @@
struct ofw_devdesc {
struct devsw *d_dev;
int d_type;
+ int d_unit;
ihandle_t d_handle;
char d_path[256];
};
diff --git a/sys/boot/pc98/libpc98/bioscd.c b/sys/boot/pc98/libpc98/bioscd.c
index 1b8d432..03b38a3 100644
--- a/sys/boot/pc98/libpc98/bioscd.c
+++ b/sys/boot/pc98/libpc98/bioscd.c
@@ -192,7 +192,7 @@ bc_open(struct open_file *f, ...)
va_start(ap, f);
dev = va_arg(ap, struct i386_devdesc *);
va_end(ap);
- if (dev->d_kind.bioscd.unit >= nbcinfo) {
+ if (dev->d_unit >= nbcinfo) {
DEBUG("attempt to open nonexistent disk");
return(ENXIO);
}
@@ -227,7 +227,7 @@ bc_strategy(void *devdata, int rw, daddr_t dblk, size_t size, char *buf,
if (rw != F_READ)
return(EROFS);
dev = (struct i386_devdesc *)devdata;
- unit = dev->d_kind.bioscd.unit;
+ unit = dev->d_unit;
blks = size / BIOSCD_SECSIZE;
if (dblk % (BIOSCD_SECSIZE / DEV_BSIZE) != 0)
return (EINVAL);
@@ -321,7 +321,7 @@ bc_getdev(struct i386_devdesc *dev)
int major;
int rootdev;
- unit = dev->d_kind.bioscd.unit;
+ unit = dev->d_unit;
biosdev = bc_unit2bios(unit);
DEBUG("unit %d BIOS device %d", unit, biosdev);
if (biosdev == -1) /* not a BIOS device */
diff --git a/sys/boot/pc98/libpc98/biosdisk.c b/sys/boot/pc98/libpc98/biosdisk.c
index 23c9680..ef89e12 100644
--- a/sys/boot/pc98/libpc98/biosdisk.c
+++ b/sys/boot/pc98/libpc98/biosdisk.c
@@ -256,7 +256,7 @@ bd_print(int verbose)
pager_output(line);
/* try to open the whole disk */
- dev.d_kind.biosdisk.unit = i;
+ dev.d_unit = i;
dev.d_kind.biosdisk.slice = -1;
dev.d_kind.biosdisk.partition = -1;
@@ -385,7 +385,7 @@ bd_opendisk(struct open_disk **odp, struct i386_devdesc *dev)
int error;
char buf[BUFSIZE];
- if (dev->d_kind.biosdisk.unit >= nbdinfo) {
+ if (dev->d_unit >= nbdinfo) {
DEBUG("attempt to open nonexistent disk");
return(ENXIO);
}
@@ -397,14 +397,14 @@ bd_opendisk(struct open_disk **odp, struct i386_devdesc *dev)
}
/* Look up BIOS unit number, intialise open_disk structure */
- od->od_dkunit = dev->d_kind.biosdisk.unit;
+ od->od_dkunit = dev->d_unit;
od->od_unit = bdinfo[od->od_dkunit].bd_unit;
od->od_flags = bdinfo[od->od_dkunit].bd_flags;
od->od_boff = 0;
od->od_nslices = 0;
error = 0;
DEBUG("open '%s', unit 0x%x slice %d partition %c",
- i386_fmtdev(dev), dev->d_kind.biosdisk.unit,
+ i386_fmtdev(dev), dev->d_unit,
dev->d_kind.biosdisk.slice, dev->d_kind.biosdisk.partition + 'a');
/* Get geometry for this open (removable device may have changed) */
@@ -1058,8 +1058,8 @@ bd_getdev(struct i386_devdesc *dev)
char *nip, *cp;
int unitofs = 0, i, unit;
- biosdev = bd_unit2bios(dev->d_kind.biosdisk.unit);
- DEBUG("unit %d BIOS device %d", dev->d_kind.biosdisk.unit, biosdev);
+ biosdev = bd_unit2bios(dev->d_unit);
+ DEBUG("unit %d BIOS device %d", dev->d_unit, biosdev);
if (biosdev == -1) /* not a BIOS device */
return(-1);
if (bd_opendisk(&od, dev) != 0) /* oops, not a viable device */
@@ -1067,7 +1067,7 @@ bd_getdev(struct i386_devdesc *dev)
if ((biosdev & 0xf0) == 0x90 || (biosdev & 0xf0) == 0x30) {
/* floppy (or emulated floppy) or ATAPI device */
- if (bdinfo[dev->d_kind.biosdisk.unit].bd_type == DT_ATAPI) {
+ if (bdinfo[dev->d_unit].bd_type == DT_ATAPI) {
/* is an ATAPI disk */
major = WFDMAJOR;
} else {
@@ -1093,7 +1093,7 @@ bd_getdev(struct i386_devdesc *dev)
}
/* default root disk unit number */
if ((biosdev & 0xf0) == 0xa0)
- unit = bdinfo[dev->d_kind.biosdisk.unit].bd_da_unit;
+ unit = bdinfo[dev->d_unit].bd_da_unit;
else
unit = biosdev & 0xf;
diff --git a/sys/boot/pc98/loader/main.c b/sys/boot/pc98/loader/main.c
index 12fa7e7..d56e352 100644
--- a/sys/boot/pc98/loader/main.c
+++ b/sys/boot/pc98/loader/main.c
@@ -193,11 +193,11 @@ extract_currdev(void)
if ((kargs->bootflags & KARGS_FLAGS_CD) != 0) {
/* we are booting from a CD with cdboot */
new_currdev.d_dev = &bioscd;
- new_currdev.d_kind.bioscd.unit = bc_bios2unit(initial_bootdev);
+ new_currdev.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_kind.netif.unit = 0;
+ new_currdev.d_unit = 0;
} else {
/* we don't know what our boot device is */
new_currdev.d_kind.biosdisk.slice = -1;
@@ -236,10 +236,10 @@ extract_currdev(void)
* which one we booted off of, just use disk0: as a reasonable default.
*/
if ((new_currdev.d_type == biosdisk.dv_type) &&
- ((new_currdev.d_kind.biosdisk.unit = bd_bios2unit(biosdev)) == -1)) {
+ ((new_currdev.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_kind.biosdisk.unit = 0;
+ new_currdev.d_unit = 0;
}
env_setenv("currdev", EV_VOLATILE, i386_fmtdev(&new_currdev),
i386_setcurrdev, env_nounset);
OpenPOWER on IntegriCloud