summaryrefslogtreecommitdiff
path: root/sys/dev/vnd.c
diff options
context:
space:
mode:
authorKenneth R Westerback <krw@cvs.openbsd.org>2023-05-14 18:34:03 +0000
committerKenneth R Westerback <krw@cvs.openbsd.org>2023-05-14 18:34:03 +0000
commit4055cbd4f777a9dbe36e438c8c6fdaf232299600 (patch)
tree7031e7a8605916e97f7fccc0d5a5e87948a54a68 /sys/dev/vnd.c
parent7ed75e1709657a44b25e0a2a1c978153e0f6b357 (diff)
Improve emulation of a disktab entry (-t) by using the type
specified in the disktab entry (:dt:) when setting the default disklabel's d_type. This will enable installboot(8) to know the vnd device should be treated as a floppy disk. Feedback & improved field packing from millert@
Diffstat (limited to 'sys/dev/vnd.c')
-rw-r--r--sys/dev/vnd.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/sys/dev/vnd.c b/sys/dev/vnd.c
index 947561ee622..591d6fa67f3 100644
--- a/sys/dev/vnd.c
+++ b/sys/dev/vnd.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: vnd.c,v 1.180 2023/03/08 04:43:08 guenther Exp $ */
+/* $OpenBSD: vnd.c,v 1.181 2023/05/14 18:34:02 krw Exp $ */
/* $NetBSD: vnd.c,v 1.26 1996/03/30 23:06:11 christos Exp $ */
/*
@@ -85,6 +85,7 @@ struct vnd_softc {
char sc_file[VNDNLEN]; /* file we're covering */
int sc_flags; /* flags */
+ uint16_t sc_type; /* d_type we are emulating */
size_t sc_size; /* size of vnd in sectors */
size_t sc_secsize; /* sector size in bytes */
size_t sc_nsectors; /* # of sectors per track */
@@ -224,7 +225,7 @@ vndgetdisklabel(dev_t dev, struct vnd_softc *sc, struct disklabel *lp,
lp->d_ncylinders = sc->sc_size / lp->d_secpercyl;
strncpy(lp->d_typename, "vnd device", sizeof(lp->d_typename));
- lp->d_type = DTYPE_VND;
+ lp->d_type = sc->sc_type;
strncpy(lp->d_packname, "fictitious", sizeof(lp->d_packname));
DL_SETDSIZE(lp, sc->sc_size);
lp->d_version = 1;
@@ -502,6 +503,7 @@ fail:
}
/* Set geometry for device. */
+ sc->sc_type = vio->vnd_type;
sc->sc_secsize = vio->vnd_secsize;
sc->sc_ntracks = vio->vnd_ntracks;
sc->sc_nsectors = vio->vnd_nsectors;