From 4055cbd4f777a9dbe36e438c8c6fdaf232299600 Mon Sep 17 00:00:00 2001 From: Kenneth R Westerback Date: Sun, 14 May 2023 18:34:03 +0000 Subject: 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@ --- sys/dev/vnd.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'sys/dev/vnd.c') 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; -- cgit v1.2.3