mirror of
https://github.com/openbsd/src.git
synced 2024-12-22 16:42:56 -08:00
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@
This commit is contained in:
parent
583d809535
commit
958ded8abe
@ -1,4 +1,4 @@
|
||||
/* $OpenBSD: vnconfig.c,v 1.12 2022/10/04 06:52:52 kn Exp $ */
|
||||
/* $OpenBSD: vnconfig.c,v 1.13 2023/05/14 18:34:02 krw Exp $ */
|
||||
/*
|
||||
* Copyright (c) 1993 University of Utah.
|
||||
* Copyright (c) 1990, 1993
|
||||
@ -300,6 +300,7 @@ config(char *file, char *dev, struct disklabel *dp, char *key, size_t keylen)
|
||||
|
||||
memset(&vndio, 0, sizeof vndio);
|
||||
vndio.vnd_file = file;
|
||||
vndio.vnd_type = (dp && dp->d_type) ? dp->d_type : DTYPE_VND;
|
||||
vndio.vnd_secsize = (dp && dp->d_secsize) ? dp->d_secsize : DEV_BSIZE;
|
||||
vndio.vnd_nsectors = (dp && dp->d_nsectors) ? dp->d_nsectors : 100;
|
||||
vndio.vnd_ntracks = (dp && dp->d_ntracks) ? dp->d_ntracks : 1;
|
||||
|
@ -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;
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $OpenBSD: vndioctl.h,v 1.11 2019/11/18 22:32:45 jca Exp $ */
|
||||
/* $OpenBSD: vndioctl.h,v 1.12 2023/05/14 18:34:02 krw Exp $ */
|
||||
/* $NetBSD: vndioctl.h,v 1.5 1995/01/25 04:46:30 cgd Exp $ */
|
||||
|
||||
/*
|
||||
@ -48,13 +48,14 @@
|
||||
* Ioctl definitions for file (vnode) disk pseudo-device.
|
||||
*/
|
||||
struct vnd_ioctl {
|
||||
char *vnd_file; /* pathname of file to mount */
|
||||
size_t vnd_secsize; /* sector size in bytes */
|
||||
size_t vnd_nsectors; /* number of sectors in a track */
|
||||
size_t vnd_ntracks; /* number of tracks per cylinder (i.e. heads) */
|
||||
off_t vnd_size; /* (returned) size of disk */
|
||||
u_char *vnd_key;
|
||||
int vnd_keylen;
|
||||
char *vnd_file; /* pathname of file to mount */
|
||||
size_t vnd_secsize; /* sector size in bytes */
|
||||
size_t vnd_nsectors; /* number of sectors in a track */
|
||||
size_t vnd_ntracks; /* number of tracks per cylinder */
|
||||
off_t vnd_size; /* (returned) size of disk */
|
||||
u_char *vnd_key;
|
||||
int vnd_keylen;
|
||||
uint16_t vnd_type; /* DTYPE being emulated */
|
||||
};
|
||||
|
||||
/*
|
||||
|
Loading…
Reference in New Issue
Block a user