diff options
43 files changed, 215 insertions, 109 deletions
diff --git a/sys/arch/alpha/alpha/disksubr.c b/sys/arch/alpha/alpha/disksubr.c index 2c8aab565cc..2031a7b70c3 100644 --- a/sys/arch/alpha/alpha/disksubr.c +++ b/sys/arch/alpha/alpha/disksubr.c @@ -1,4 +1,4 @@ -/* $OpenBSD: disksubr.c,v 1.22 1998/05/02 03:33:33 millert Exp $ */ +/* $OpenBSD: disksubr.c,v 1.23 1998/10/03 21:18:54 millert Exp $ */ /* $NetBSD: disksubr.c,v 1.21 1996/05/03 19:42:03 christos Exp $ */ /* @@ -71,15 +71,15 @@ #if defined(DISKLABEL_I386) || defined(DISKLABEL_ALPHA) || defined(DISKLABEL_AMIGA) || defined(DISKLABEL_ALL) void swapdisklabel __P((struct disklabel *d)); char *readbsdlabel __P((struct buf *, void (*) __P((struct buf *)), int, int, - int, int, struct disklabel *)); + int, int, struct disklabel *, int)); #endif #if defined(DISKLABEL_I386) || defined(DISKLABEL_ALL) char *readdoslabel __P((struct buf *, void (*) __P((struct buf *)), - struct disklabel *, struct cpu_disklabel *, int *, int *)); + struct disklabel *, struct cpu_disklabel *, int *, int *, int)); #endif #if defined(DISKLABEL_AMIGA) || defined(DISKLABEL_ALL) char *readamigalabel __P((struct buf *, void (*) __P((struct buf *)), - struct disklabel *, struct cpu_disklabel *)); + struct disklabel *, struct cpu_disklabel *, int)); #endif static enum disklabel_tag probe_order[] = { LABELPROBES, -1 }; @@ -144,11 +144,12 @@ swapdisklabel(dlp) * Try to read a standard BSD disklabel at a certain sector. */ char * -readbsdlabel(bp, strat, cyl, sec, off, endian, lp) +readbsdlabel(bp, strat, cyl, sec, off, endian, lp, spoofonly) struct buf *bp; void (*strat) __P((struct buf *)); int cyl, sec, off, endian; struct disklabel *lp; + int spoofonly; { struct disklabel *dlp; char *msg = NULL; @@ -158,6 +159,10 @@ readbsdlabel(bp, strat, cyl, sec, off, endian, lp) if (endian != LITTLE_ENDIAN && endian != BIG_ENDIAN) panic("readbsdlabel: unsupported byteorder %d", endian); + /* don't read the on-disk label if we are in spoofed-only mode */ + if (spoofonly) + return (NULL); + bp->b_blkno = sec; bp->b_cylin = cyl; bp->b_bcount = lp->d_secsize; @@ -223,11 +228,12 @@ readbsdlabel(bp, strat, cyl, sec, off, endian, lp) * Returns null on success and an error string on failure. */ char * -readdisklabel(dev, strat, lp, osdep) +readdisklabel(dev, strat, lp, osdep, spoofonly) dev_t dev; void (*strat) __P((struct buf *)); struct disklabel *lp; struct cpu_disklabel *osdep; + int spoofonly; { struct buf *bp; char *msg = "no disk label"; @@ -259,13 +265,13 @@ readdisklabel(dev, strat, lp, osdep) case DLT_ALPHA: #if defined(DISKLABEL_ALPHA) || defined(DISKLABEL_ALL) msg = readbsdlabel(bp, strat, 0, ALPHA_LABELSECTOR, - ALPHA_LABELOFFSET, LITTLE_ENDIAN, lp); + ALPHA_LABELOFFSET, LITTLE_ENDIAN, lp, spoofonly); #endif break; case DLT_I386: #if defined(DISKLABEL_I386) || defined(DISKLABEL_ALL) - msg = readdoslabel(bp, strat, lp, osdep, 0, 0); + msg = readdoslabel(bp, strat, lp, osdep, 0, 0, spoofonly); if (msg) /* Fallback alternative */ fallbacklabel = *lp; @@ -274,7 +280,7 @@ readdisklabel(dev, strat, lp, osdep) case DLT_AMIGA: #if defined(DISKLABEL_AMIGA) || defined(DISKLABEL_ALL) - msg = readamigalabel(bp, strat, lp, osdep); + msg = readamigalabel(bp, strat, lp, osdep, spoofonly); #endif break; @@ -317,13 +323,14 @@ readdisklabel(dev, strat, lp, osdep) * MBR is valid. */ char * -readdoslabel(bp, strat, lp, osdep, partoffp, cylp) +readdoslabel(bp, strat, lp, osdep, partoffp, cylp, spoofonly) struct buf *bp; void (*strat) __P((struct buf *)); struct disklabel *lp; struct cpu_disklabel *osdep; int *partoffp; int *cylp; + int spoofonly; { struct dos_partition *dp = osdep->u._i386.dosparts, *dp2; struct dkbad *db, *bdp = &DKBAD(osdep); @@ -477,7 +484,7 @@ donot: /* next, dig out disk label */ msg = readbsdlabel(bp, strat, cyl, dospartoff + I386_LABELSECTOR, -1, - LITTLE_ENDIAN, lp); + LITTLE_ENDIAN, lp, spoofonly); if (msg) return (msg); @@ -534,16 +541,17 @@ donot: * XXX RDB parsing is missing still. */ char * -readamigalabel(bp, strat, lp, osdep) +readamigalabel(bp, strat, lp, osdep, spoofonly) struct buf *bp; void (*strat) __P((struct buf *)); struct disklabel *lp; struct cpu_disklabel *osdep; + int spoofonly; { char *msg; msg = readbsdlabel(bp, strat, 0, AMIGA_LABELSECTOR, AMIGA_LABELOFFSET, - BIG_ENDIAN, lp); + BIG_ENDIAN, lp, spoofonly); return (msg); } #endif @@ -649,7 +657,7 @@ writedisklabel(dev, strat, lp, osdep) case DLT_ALPHA: #if defined(DISKLABEL_ALPHA) || defined(DISKLABEL_ALL) msg = readbsdlabel(bp, strat, 0, ALPHA_LABELSECTOR, - ALPHA_LABELOFFSET, LITTLE_ENDIAN, &dl); + ALPHA_LABELOFFSET, LITTLE_ENDIAN, &dl, 0); labeloffset = ALPHA_LABELOFFSET; endian = LITTLE_ENDIAN; #endif @@ -658,7 +666,7 @@ writedisklabel(dev, strat, lp, osdep) case DLT_I386: #if defined(DISKLABEL_I386) || defined(DISKLABEL_ALL) msg = readdoslabel(bp, strat, &dl, &cdl, &partoff, - &cyl); + &cyl, 0); labeloffset = I386_LABELOFFSET; endian = LITTLE_ENDIAN; #endif @@ -666,7 +674,7 @@ writedisklabel(dev, strat, lp, osdep) case DLT_AMIGA: #if defined(DISKLABEL_AMIGA) || defined(DISKLABEL_ALL) - msg = readamigalabel(bp, strat, &dl, &cdl); + msg = readamigalabel(bp, strat, &dl, &cdl, 0); labeloffset = AMIGA_LABELOFFSET; endian = BIG_ENDIAN; #endif diff --git a/sys/arch/amiga/amiga/disksubr.c b/sys/arch/amiga/amiga/disksubr.c index 83266878699..4a75f4a6442 100644 --- a/sys/arch/amiga/amiga/disksubr.c +++ b/sys/arch/amiga/amiga/disksubr.c @@ -1,4 +1,4 @@ -/* $OpenBSD: disksubr.c,v 1.16 1998/03/26 12:41:28 niklas Exp $ */ +/* $OpenBSD: disksubr.c,v 1.17 1998/10/03 21:18:54 millert Exp $ */ /* $NetBSD: disksubr.c,v 1.27 1996/10/13 03:06:34 christos Exp $ */ /* @@ -92,11 +92,12 @@ dk_establish(dk, dev) * Returns null on success and an error string on failure. */ char * -readdisklabel(dev, strat, lp, clp) +readdisklabel(dev, strat, lp, clp, spoofonly) dev_t dev; void (*strat)(struct buf *); struct disklabel *lp; struct cpu_disklabel *clp; + int spoofonly; { struct disklabel *dlp; struct adostype adt; @@ -131,6 +132,10 @@ readdisklabel(dev, strat, lp, clp) lp->d_partitions[RAW_PART].p_size = 0x1fffffff; lp->d_partitions[RAW_PART].p_offset = 0; + /* don't read the on-disk label if we are in spoofed-only mode */ + if (spoofonly) + return (NULL); + /* obtain buffer to probe drive with */ bp = (void *)geteblk((int)lp->d_secsize); diff --git a/sys/arch/arc/dev/fd.c b/sys/arch/arc/dev/fd.c index 3a98739bb0f..815376cb382 100644 --- a/sys/arch/arc/dev/fd.c +++ b/sys/arch/arc/dev/fd.c @@ -1,4 +1,4 @@ -/* $OpenBSD: fd.c,v 1.5 1997/04/19 17:19:52 pefo Exp $ */ +/* $OpenBSD: fd.c,v 1.6 1998/10/03 21:18:57 millert Exp $ */ /* $NetBSD: fd.c,v 1.78 1995/07/04 07:23:09 mycroft Exp $ */ /*- @@ -1109,7 +1109,7 @@ fdioctl(dev, cmd, addr, flag) buffer.d_type = DTYPE_FLOPPY; buffer.d_secsize = FDC_BSIZE; - if (readdisklabel(dev, fdstrategy, &buffer, NULL) != NULL) + if (readdisklabel(dev, fdstrategy, &buffer, NULL, 0) != NULL) return EINVAL; *(struct disklabel *)addr = buffer; diff --git a/sys/arch/arm32/arm32/disksubr.c b/sys/arch/arm32/arm32/disksubr.c index ff8c676993e..aea222b325a 100644 --- a/sys/arch/arm32/arm32/disksubr.c +++ b/sys/arch/arm32/arm32/disksubr.c @@ -107,11 +107,12 @@ filecore_checksum(bootblock) */ char * -readdisklabel(dev, strat, lp, osdep) +readdisklabel(dev, strat, lp, osdep, spoofonly) dev_t dev; void (*strat)(); struct disklabel *lp; struct cpu_disklabel *osdep; + int spoofony; { struct riscbsd_partition *rp = osdep->partitions; struct dkbad *bdp = &osdep->bad; @@ -144,6 +145,9 @@ readdisklabel(dev, strat, lp, osdep) lp->d_partitions[RAW_PART].p_size = 0x1fffffff; } + if (spoofonly) + return (NULL); + /* obtain buffer to probe drive with */ bp = geteblk((int)lp->d_secsize); diff --git a/sys/arch/arm32/mainbus/fd.c b/sys/arch/arm32/mainbus/fd.c index a5960924123..db8316cf288 100644 --- a/sys/arch/arm32/mainbus/fd.c +++ b/sys/arch/arm32/mainbus/fd.c @@ -1222,7 +1222,7 @@ fdioctl(dev, cmd, addr, flag) buffer.d_type = DTYPE_FLOPPY; buffer.d_secsize = FDC_BSIZE; - if (readdisklabel(dev, fdstrategy, &buffer, NULL) != NULL) + if (readdisklabel(dev, fdstrategy, &buffer, NULL, 0) != NULL) return EINVAL; *(struct disklabel *)addr = buffer; diff --git a/sys/arch/arm32/mainbus/wd.c b/sys/arch/arm32/mainbus/wd.c index 00613810f1f..04b78437d28 100644 --- a/sys/arch/arm32/mainbus/wd.c +++ b/sys/arch/arm32/mainbus/wd.c @@ -1049,7 +1049,7 @@ wdgetdisklabel(wd) if (wd->sc_state > RECAL) wd->sc_state = RECAL; errstring = readdisklabel(MAKEWDDEV(0, wd->sc_dev.dv_unit, RAW_PART), - wdstrategy, lp, wd->sc_dk.dk_cpulabel); + wdstrategy, lp, wd->sc_dk.dk_cpulabel, 0); if (errstring) { /* * This probably happened because the drive's default @@ -1060,7 +1060,7 @@ wdgetdisklabel(wd) if (wd->sc_state > GEOMETRY) wd->sc_state = GEOMETRY; errstring = readdisklabel(MAKEWDDEV(0, wd->sc_dev.dv_unit, RAW_PART), - wdstrategy, lp, wd->sc_dk.dk_cpulabel); + wdstrategy, lp, wd->sc_dk.dk_cpulabel, 0); } if (errstring) { printf("%s: %s\n", wd->sc_dev.dv_xname, errstring); diff --git a/sys/arch/hp300/dev/hd.c b/sys/arch/hp300/dev/hd.c index 3d0a20e893c..5a8a5c9e7a5 100644 --- a/sys/arch/hp300/dev/hd.c +++ b/sys/arch/hp300/dev/hd.c @@ -1,4 +1,4 @@ -/* $OpenBSD: hd.c,v 1.9 1998/05/07 05:19:34 millert Exp $ */ +/* $OpenBSD: hd.c,v 1.10 1998/10/03 21:18:57 millert Exp $ */ /* $NetBSD: rd.c,v 1.33 1997/07/10 18:14:08 kleink Exp $ */ /* @@ -522,7 +522,7 @@ hdgetinfo(dev) /* * Now try to read the disklabel */ - errstring = readdisklabel(hdlabdev(dev), hdstrategy, lp, NULL); + errstring = readdisklabel(hdlabdev(dev), hdstrategy, lp, NULL, 0); if (errstring) { printf("%s: WARNING: %s, defining `c' partition as entire disk\n", rs->sc_dev.dv_xname, errstring); diff --git a/sys/arch/hp300/dev/sd.c b/sys/arch/hp300/dev/sd.c index 5632a750324..602605d396b 100644 --- a/sys/arch/hp300/dev/sd.c +++ b/sys/arch/hp300/dev/sd.c @@ -1,4 +1,4 @@ -/* $OpenBSD: sd.c,v 1.19 1998/05/07 05:19:33 millert Exp $ */ +/* $OpenBSD: sd.c,v 1.20 1998/10/03 21:18:57 millert Exp $ */ /* $NetBSD: sd.c,v 1.34 1997/07/10 18:14:10 kleink Exp $ */ /* @@ -499,7 +499,7 @@ sdgetinfo(dev) lp->d_magic2 = DISKMAGIC; lp->d_checksum = dkcksum(lp); - errstring = readdisklabel(sdlabdev(dev), sdstrategy, lp, NULL); + errstring = readdisklabel(sdlabdev(dev), sdstrategy, lp, NULL, 0); } if (errstring) { diff --git a/sys/arch/hp300/hp300/disksubr.c b/sys/arch/hp300/hp300/disksubr.c index 4d5c6a07281..afd5bf4cf2b 100644 --- a/sys/arch/hp300/hp300/disksubr.c +++ b/sys/arch/hp300/hp300/disksubr.c @@ -1,4 +1,4 @@ -/* $OpenBSD: disksubr.c,v 1.8 1998/05/02 05:09:59 millert Exp $ */ +/* $OpenBSD: disksubr.c,v 1.9 1998/10/03 21:18:54 millert Exp $ */ /* $NetBSD: disksubr.c,v 1.9 1997/04/01 03:12:13 scottr Exp $ */ /* @@ -65,11 +65,12 @@ dk_establish(dk, dev) * string on failure. */ char * -readdisklabel(dev, strat, lp, osdep) +readdisklabel(dev, strat, lp, osdep, spoofonly) dev_t dev; void (*strat) __P((struct buf *)); struct disklabel *lp; struct cpu_disklabel *osdep; + int spoofonly; { struct buf *bp; struct disklabel *dlp; @@ -89,6 +90,10 @@ readdisklabel(dev, strat, lp, osdep) lp->d_partitions[0].p_size = 0x1fffffff; lp->d_partitions[0].p_offset = 0; + /* don't read the on-disk label if we are in spoofed-only mode */ + if (spoofonly) + return (NULL); + bp = geteblk((int)lp->d_secsize); bp->b_dev = dev; bp->b_blkno = LABELSECTOR; @@ -97,7 +102,7 @@ readdisklabel(dev, strat, lp, osdep) bp->b_cylinder = LABELSECTOR / lp->d_secpercyl; (*strat)(bp); if (biowait(bp)) - msg = "I/O error"; + msg = "disk label I/O error"; else for (dlp = (struct disklabel *)bp->b_data; dlp <= (struct disklabel *)((char *)bp->b_data + DEV_BSIZE - sizeof(*dlp)); diff --git a/sys/arch/i386/i386/disksubr.c b/sys/arch/i386/i386/disksubr.c index 71c9bfc2292..128dead0b9c 100644 --- a/sys/arch/i386/i386/disksubr.c +++ b/sys/arch/i386/i386/disksubr.c @@ -1,4 +1,4 @@ -/* $OpenBSD: disksubr.c,v 1.33 1998/02/24 04:22:41 deraadt Exp $ */ +/* $OpenBSD: disksubr.c,v 1.34 1998/10/03 21:18:54 millert Exp $ */ /* $NetBSD: disksubr.c,v 1.21 1996/05/03 19:42:03 christos Exp $ */ /* @@ -74,11 +74,12 @@ dk_establish(dk, dev) * Returns null on success and an error string on failure. */ char * -readdisklabel(dev, strat, lp, osdep) +readdisklabel(dev, strat, lp, osdep, spoofonly) dev_t dev; void (*strat) __P((struct buf *)); register struct disklabel *lp; struct cpu_disklabel *osdep; + int spoofonly; { struct dos_partition *dp = osdep->dosparts, *dp2; struct dkbad *bdp = &DKBAD(osdep); @@ -241,6 +242,10 @@ donot: lp->d_npartitions = MAXPARTITIONS; } + /* don't read the on-disk label if we are in spoofed-only mode */ + if (spoofonly) + goto done; + /* next, dig out disk label */ bp->b_blkno = dospartoff + LABELSECTOR; bp->b_cylin = cyl; diff --git a/sys/arch/kbus/dev/xd.c b/sys/arch/kbus/dev/xd.c index 85d74ea5a96..69b73428fd7 100644 --- a/sys/arch/kbus/dev/xd.c +++ b/sys/arch/kbus/dev/xd.c @@ -302,7 +302,7 @@ xdgetdisklabel(xd, b) err = readdisklabel(MAKEDISKDEV(0, xd->sc_dev.dv_unit, RAW_PART), xddummystrat, - xd->sc_dk.dk_label, xd->sc_dk.dk_cpulabel); + xd->sc_dk.dk_label, xd->sc_dk.dk_cpulabel, 0); if (err) { printf("%s: %s\n", xd->sc_dev.dv_xname, err); return(XD_ERR_FAIL); diff --git a/sys/arch/kbus/kbus/disksubr.c b/sys/arch/kbus/kbus/disksubr.c index 2d36381401a..b88ee680f00 100644 --- a/sys/arch/kbus/kbus/disksubr.c +++ b/sys/arch/kbus/kbus/disksubr.c @@ -1,4 +1,4 @@ -/* $OpenBSD: disksubr.c,v 1.2 1997/10/16 11:06:01 gingold Exp $ */ +/* $OpenBSD: disksubr.c,v 1.3 1998/10/03 21:18:55 millert Exp $ */ /* $NetBSD: disksubr.c,v 1.16 1996/04/28 20:25:59 thorpej Exp $ */ /* @@ -90,11 +90,12 @@ dk_establish(dk, dev) * Returns null on success and an error string on failure. */ char * -readdisklabel(dev, strat, lp, clp) +readdisklabel(dev, strat, lp, clp, spoofonly) dev_t dev; void (*strat) __P((struct buf *)); struct disklabel *lp; struct cpu_disklabel *clp; + int spoofonly; { struct buf *bp; struct disklabel *dlp; @@ -119,6 +120,11 @@ readdisklabel(dev, strat, lp, clp) if (iso_disklabelspoof(dev, strat, lp) == 0) return (NULL); #endif + + /* don't read the on-disk label if we are in spoofed-only mode */ + if (spoofonly) + return (NULL); + /* obtain buffer to probe drive with */ bp = geteblk((int)lp->d_secsize); diff --git a/sys/arch/mac68k/mac68k/disksubr.c b/sys/arch/mac68k/mac68k/disksubr.c index d79a5abb3d6..b541b841147 100644 --- a/sys/arch/mac68k/mac68k/disksubr.c +++ b/sys/arch/mac68k/mac68k/disksubr.c @@ -1,4 +1,4 @@ -/* $OpenBSD: disksubr.c,v 1.8 1998/02/14 07:01:06 gene Exp $ */ +/* $OpenBSD: disksubr.c,v 1.9 1998/10/03 21:18:55 millert Exp $ */ /* $NetBSD: disksubr.c,v 1.22 1997/11/26 04:18:20 briggs Exp $ */ /* @@ -474,11 +474,12 @@ done: * then we assume that it's a real disklabel and return it. */ char * -readdisklabel(dev, strat, lp, osdep) +readdisklabel(dev, strat, lp, osdep, spoofonly) dev_t dev; void (*strat)(struct buf *); register struct disklabel *lp; struct cpu_disklabel *osdep; + int spoofonly; { register struct buf *bp; char *msg = NULL; @@ -490,6 +491,11 @@ readdisklabel(dev, strat, lp, osdep) if (lp->d_secpercyl == 0) { return msg = "Zero secpercyl"; } + + /* don't read the on-disk label if we are in spoofed-only mode */ + if (spoofonly) + return (NULL); + bp = geteblk((int)lp->d_secsize * MAXPARTITIONS); bp->b_dev = dev; diff --git a/sys/arch/mips/mips/disksubr.c b/sys/arch/mips/mips/disksubr.c index 45d27a1fe34..a3a748829ce 100644 --- a/sys/arch/mips/mips/disksubr.c +++ b/sys/arch/mips/mips/disksubr.c @@ -1,4 +1,4 @@ -/* $OpenBSD: disksubr.c,v 1.5 1998/03/16 09:03:29 pefo Exp $ */ +/* $OpenBSD: disksubr.c,v 1.6 1998/10/03 21:18:55 millert Exp $ */ /* $NetBSD: disksubr.c,v 1.21 1996/05/03 19:42:03 christos Exp $ */ /* @@ -77,11 +77,12 @@ dk_establish(dk, dev) * Returns null on success and an error string on failure. */ char * -readdisklabel(dev, strat, lp, osdep) +readdisklabel(dev, strat, lp, osdep, spoofonly) dev_t dev; void (*strat) __P((struct buf *)); struct disklabel *lp; struct cpu_disklabel *osdep; + int spoofonly; { struct dos_partition *dp = osdep->dosparts, *dp2; struct dkbad *bdp = &DKBAD(osdep); @@ -244,6 +245,10 @@ donot: lp->d_npartitions = MAXPARTITIONS; } + /* don't read the on-disk label if we are in spoofed-only mode */ + if (spoofonly) + goto done; + /* next, dig out disk label */ bp->b_blkno = dospartoff + LABELSECTOR; bp->b_cylin = cyl; diff --git a/sys/arch/mvme68k/mvme68k/disksubr.c b/sys/arch/mvme68k/mvme68k/disksubr.c index b26f95ddf2b..68daab081da 100644 --- a/sys/arch/mvme68k/mvme68k/disksubr.c +++ b/sys/arch/mvme68k/mvme68k/disksubr.c @@ -1,4 +1,4 @@ -/* $OpenBSD: disksubr.c,v 1.15 1997/10/02 01:01:22 deraadt Exp $ */ +/* $OpenBSD: disksubr.c,v 1.16 1998/10/03 21:18:55 millert Exp $ */ /* * Copyright (c) 1995 Dale Rahn. @@ -106,15 +106,34 @@ dk_establish(dk, dev) * Returns null on success and an error string on failure. */ char * -readdisklabel(dev, strat, lp, clp) +readdisklabel(dev, strat, lp, clp, spoofonly) dev_t dev; void (*strat)(); struct disklabel *lp; struct cpu_disklabel *clp; + int spoofonly; { struct buf *bp; char *msg = NULL; + /* minimal requirements for archetypal disk label */ + if (lp->d_secsize == 0) + lp->d_secsize = DEV_BSIZE; + if (lp->d_secperunit == 0) + lp->d_secperunit = 0x1fffffff; + lp->d_npartitions = RAW_PART + 1; + for (i = 0; i < RAW_PART; i++) { + lp->d_partitions[i].p_size = 0; + lp->d_partitions[i].p_offset = 0; + } + if (lp->d_partitions[0].p_size == 0) + lp->d_partitions[0].p_size = 0x1fffffff; + lp->d_partitions[0].p_offset = 0; + + /* don't read the on-disk label if we are in spoofed-only mode */ + if (spoofonly) + return (NULL); + /* obtain buffer to probe drive with */ bp = geteblk((int)lp->d_secsize); @@ -144,7 +163,7 @@ readdisklabel(dev, strat, lp, clp) } cputobsdlabel(lp, clp); #ifdef DEBUG - if(disksubr_debug > 0) { + if (disksubr_debug > 0) { printlp(lp, "readdisklabel:bsd label"); printclp(clp, "readdisklabel:cpu label"); } diff --git a/sys/arch/mvme88k/mvme88k/disksubr.c b/sys/arch/mvme88k/mvme88k/disksubr.c index 2f25fbf3e16..a0aea8214cc 100644 --- a/sys/arch/mvme88k/mvme88k/disksubr.c +++ b/sys/arch/mvme88k/mvme88k/disksubr.c @@ -64,15 +64,34 @@ dk_establish() * Returns null on success and an error string on failure. */ char * -readdisklabel(dev, strat, lp, clp) +readdisklabel(dev, strat, lp, clp, spoofonly) dev_t dev; void (*strat)(); struct disklabel *lp; struct cpu_disklabel *clp; + int spoofonly; { struct buf *bp; char *msg = NULL; + /* minimal requirements for archetypal disk label */ + if (lp->d_secsize == 0) + lp->d_secsize = DEV_BSIZE; + if (lp->d_secperunit == 0) + lp->d_secperunit = 0x1fffffff; + lp->d_npartitions = RAW_PART + 1; + for (i = 0; i < RAW_PART; i++) { + lp->d_partitions[i].p_size = 0; + lp->d_partitions[i].p_offset = 0; + } + if (lp->d_partitions[0].p_size == 0) + lp->d_partitions[0].p_size = 0x1fffffff; + lp->d_partitions[0].p_offset = 0; + + /* don't read the on-disk label if we are in spoofed-only mode */ + if (spoofonly) + return (NULL); + /* obtain buffer to probe drive with */ bp = geteblk((int)lp->d_secsize); diff --git a/sys/arch/pc532/pc532/disksubr.c b/sys/arch/pc532/pc532/disksubr.c index 597a01aa878..7934a307cff 100644 --- a/sys/arch/pc532/pc532/disksubr.c +++ b/sys/arch/pc532/pc532/disksubr.c @@ -52,11 +52,12 @@ * Returns null on success and an error string on failure. */ char * -readdisklabel(dev, strat, lp, osdep) +readdisklabel(dev, strat, lp, osdep, spoofonly) dev_t dev; void (*strat)(); register struct disklabel *lp; struct cpu_disklabel *osdep; + int spoofonly; { register struct buf *bp; struct disklabel *dlp; diff --git a/sys/arch/pmax/dev/rz.c b/sys/arch/pmax/dev/rz.c index ed072017170..43f5ea0a609 100644 --- a/sys/arch/pmax/dev/rz.c +++ b/sys/arch/pmax/dev/rz.c @@ -1,4 +1,4 @@ -/* $OpenBSD: rz.c,v 1.14 1998/05/12 15:52:09 millert Exp $ */ +/* $OpenBSD: rz.c,v 1.15 1998/10/03 21:18:58 millert Exp $ */ /* $NetBSD: rz.c,v 1.38 1998/05/08 00:05:19 simonb Exp $ */ /* @@ -149,10 +149,6 @@ static struct size rzdefaultpart[MAXPARTITIONS] = { }; -extern char * -readdisklabel __P((dev_t dev, void (*strat) __P((struct buf *bp)), - struct disklabel *lp, struct cpu_disklabel *osdep)); - /* * Ultrix disklabel declarations */ @@ -913,7 +909,7 @@ rzgetinfo(dev) /* * Now try to read the disklabel */ - if ((msg = readdisklabel(dev, rzstrategy, lp, &cd)) == NULL) + if ((msg = readdisklabel(dev, rzstrategy, lp, &cd, 0)) == NULL) return; printf("rz%d: WARNING: %s\n", unit, msg); diff --git a/sys/arch/pmax/pmax/disksubr.c b/sys/arch/pmax/pmax/disksubr.c index 76ffdf98e7f..b340fa04a52 100644 --- a/sys/arch/pmax/pmax/disksubr.c +++ b/sys/arch/pmax/pmax/disksubr.c @@ -1,4 +1,4 @@ -/* $OpenBSD: disksubr.c,v 1.13 1998/05/10 04:01:23 millert Exp $ */ +/* $OpenBSD: disksubr.c,v 1.14 1998/10/03 21:18:56 millert Exp $ */ /* $NetBSD: disksubr.c,v 1.14 1997/01/15 00:55:43 jonathan Exp $ */ /* @@ -55,10 +55,6 @@ compat_label __P((dev_t dev, void (*strat) __P((struct buf *bp)), #endif -char* readdisklabel __P((dev_t dev, void (*strat) __P((struct buf *bp)), - register struct disklabel *lp, - struct cpu_disklabel *osdep)); - /* * Attempt to read a disk label from a device * using the indicated stategy routine. @@ -68,11 +64,12 @@ char* readdisklabel __P((dev_t dev, void (*strat) __P((struct buf *bp)), * Returns null on success and an error string on failure. */ char * -readdisklabel(dev, strat, lp, osdep) +readdisklabel(dev, strat, lp, osdep, spoofonly) dev_t dev; void (*strat) __P((struct buf *bp)); register struct disklabel *lp; struct cpu_disklabel *osdep; + int spoofonly; { register struct buf *bp; struct disklabel *dlp; @@ -85,6 +82,10 @@ readdisklabel(dev, strat, lp, osdep) lp->d_partitions[0].p_size = 0x1fffffff; lp->d_partitions[0].p_offset = 0; + /* don't read the on-disk label if we are in spoofed-only mode */ + if (spoofonly) + return (NULL); + bp = geteblk((int)lp->d_secsize); bp->b_dev = dev; bp->b_blkno = LABELSECTOR; @@ -93,7 +94,8 @@ readdisklabel(dev, strat, lp, osdep) bp->b_cylin = LABELSECTOR / lp->d_secpercyl; (*strat)(bp); if (biowait(bp)) { - msg = "I/O error"; + /* XXX we return the faked label built so far */ + msg = "disk label I/O error"; } else { dlp = (struct disklabel *)bp->b_un.b_addr + LABELOFFSET; if (dlp->d_magic == DISKMAGIC && dlp->d_magic2 == DISKMAGIC) { diff --git a/sys/arch/powerpc/powerpc/disksubr.c b/sys/arch/powerpc/powerpc/disksubr.c index 1bde954d7ab..227df3182b4 100644 --- a/sys/arch/powerpc/powerpc/disksubr.c +++ b/sys/arch/powerpc/powerpc/disksubr.c @@ -1,4 +1,4 @@ -/* $OpenBSD: disksubr.c,v 1.10 1998/03/31 18:21:30 mickey Exp $ */ +/* $OpenBSD: disksubr.c,v 1.11 1998/10/03 21:18:56 millert Exp $ */ /* $NetBSD: disksubr.c,v 1.21 1996/05/03 19:42:03 christos Exp $ */ /* @@ -77,11 +77,12 @@ dk_establish(dk, dev) * Returns null on success and an error string on failure. */ char * -readdisklabel(dev, strat, lp, osdep) +readdisklabel(dev, strat, lp, osdep, spoofonly) dev_t dev; void (*strat) __P((struct buf *)); register struct disklabel *lp; struct cpu_disklabel *osdep; + int spoofonly; { struct dos_partition *dp = osdep->dosparts, *dp2; struct dkbad *bdp = &DKBAD(osdep); @@ -243,6 +244,10 @@ donot: lp->d_npartitions = MAXPARTITIONS; } + /* don't read the on-disk label if we are in spoofed-only mode */ + if (spoofonly) + goto done; + /* next, dig out disk label */ bp->b_blkno = dospartoff + LABELSECTOR; bp->b_cylin = cyl; diff --git a/sys/arch/sparc/dev/fd.c b/sys/arch/sparc/dev/fd.c index 5abf64edaca..b1d8864e257 100644 --- a/sys/arch/sparc/dev/fd.c +++ b/sys/arch/sparc/dev/fd.c @@ -1,4 +1,4 @@ -/* $OpenBSD: fd.c,v 1.22 1997/09/20 12:24:17 deraadt Exp $ */ +/* $OpenBSD: fd.c,v 1.23 1998/10/03 21:18:58 millert Exp $ */ /* $NetBSD: fd.c,v 1.51 1997/05/24 20:16:19 pk Exp $ */ /*- @@ -1814,7 +1814,7 @@ fdgetdisklabel(dev) /* * Call the generic disklabel extraction routine. */ - errstring = readdisklabel(dev, fdstrategy, lp, clp); + errstring = readdisklabel(dev, fdstrategy, lp, clp, 0); if (errstring) { printf("%s: %s\n", fd->sc_dv.dv_xname, errstring); return; diff --git a/sys/arch/sparc/dev/xd.c b/sys/arch/sparc/dev/xd.c index 43307349c5e..dba45d7667a 100644 --- a/sys/arch/sparc/dev/xd.c +++ b/sys/arch/sparc/dev/xd.c @@ -1,4 +1,4 @@ -/* $OpenBSD: xd.c,v 1.12 1998/03/01 08:42:19 johns Exp $ */ +/* $OpenBSD: xd.c,v 1.13 1998/10/03 21:18:58 millert Exp $ */ /* $NetBSD: xd.c,v 1.37 1997/07/29 09:58:16 fair Exp $ */ /* @@ -306,7 +306,7 @@ xdgetdisklabel(xd, b) err = readdisklabel(MAKEDISKDEV(0, xd->sc_dev.dv_unit, RAW_PART), xddummystrat, - xd->sc_dk.dk_label, xd->sc_dk.dk_cpulabel); + xd->sc_dk.dk_label, xd->sc_dk.dk_cpulabel, 0); if (err) { printf("%s: %s\n", xd->sc_dev.dv_xname, err); return(XD_ERR_FAIL); diff --git a/sys/arch/sparc/dev/xy.c b/sys/arch/sparc/dev/xy.c index 50d250b5c32..0f548225f38 100644 --- a/sys/arch/sparc/dev/xy.c +++ b/sys/arch/sparc/dev/xy.c @@ -1,4 +1,4 @@ -/* $OpenBSD: xy.c,v 1.10 1997/08/08 21:46:51 niklas Exp $ */ +/* $OpenBSD: xy.c,v 1.11 1998/10/03 21:18:58 millert Exp $ */ /* $NetBSD: xy.c,v 1.26 1997/07/19 21:43:56 pk Exp $ */ /* @@ -246,7 +246,7 @@ xygetdisklabel(xy, b) err = readdisklabel(MAKEDISKDEV(0, xy->sc_dev.dv_unit, RAW_PART), xydummystrat, - xy->sc_dk.dk_label, xy->sc_dk.dk_cpulabel); + xy->sc_dk.dk_label, xy->sc_dk.dk_cpulabel, 0); if (err) { printf("%s: %s\n", xy->sc_dev.dv_xname, err); return(XY_ERR_FAIL); diff --git a/sys/arch/sparc/sparc/disksubr.c b/sys/arch/sparc/sparc/disksubr.c index 80376d7e33e..3de46d07cc5 100644 --- a/sys/arch/sparc/sparc/disksubr.c +++ b/sys/arch/sparc/sparc/disksubr.c @@ -1,4 +1,4 @@ -/* $OpenBSD: disksubr.c,v 1.20 1998/05/02 03:57:51 millert Exp $ */ +/* $OpenBSD: disksubr.c,v 1.21 1998/10/03 21:18:56 millert Exp $ */ /* $NetBSD: disksubr.c,v 1.16 1996/04/28 20:25:59 thorpej Exp $ */ /* @@ -132,11 +132,12 @@ dk_establish(dk, dev) * Returns null on success and an error string on failure. */ char * -readdisklabel(dev, strat, lp, clp) +readdisklabel(dev, strat, lp, clp, spoofonly) dev_t dev; void (*strat) __P((struct buf *)); struct disklabel *lp; struct cpu_disklabel *clp; + int spoofonly; { struct buf *bp; struct disklabel *dlp; @@ -157,6 +158,10 @@ readdisklabel(dev, strat, lp, clp) lp->d_bbsize = 8192; lp->d_sbsize = 64*1024; /* XXX ? */ + /* don't read the on-disk label if we are in spoofed-only mode */ + if (spoofonly) + return (NULL); + /* obtain buffer to probe drive with */ bp = geteblk((int)lp->d_secsize); diff --git a/sys/arch/sun3/dev/xd.c b/sys/arch/sun3/dev/xd.c index 48c6160d22b..1df712217ce 100644 --- a/sys/arch/sun3/dev/xd.c +++ b/sys/arch/sun3/dev/xd.c @@ -1,4 +1,4 @@ -/* $OpenBSD: xd.c,v 1.11 1997/08/08 21:46:53 niklas Exp $ */ +/* $OpenBSD: xd.c,v 1.12 1998/10/03 21:18:58 millert Exp $ */ /* $NetBSD: xd.c,v 1.10 1996/10/13 03:47:39 christos Exp $ */ /* @@ -309,7 +309,7 @@ xdgetdisklabel(xd, b) err = readdisklabel(MAKEDISKDEV(0, xd->sc_dev.dv_unit, RAW_PART), xddummystrat, - xd->sc_dk.dk_label, xd->sc_dk.dk_cpulabel); + xd->sc_dk.dk_label, xd->sc_dk.dk_cpulabel, 0); if (err) { printf("%s: %s\n", xd->sc_dev.dv_xname, err); return(XD_ERR_FAIL); diff --git a/sys/arch/sun3/dev/xy.c b/sys/arch/sun3/dev/xy.c index c09c3deb1c6..47cf8ea0b53 100644 --- a/sys/arch/sun3/dev/xy.c +++ b/sys/arch/sun3/dev/xy.c @@ -1,4 +1,4 @@ -/* $OpenBSD: xy.c,v 1.10 1997/08/08 21:46:54 niklas Exp $ */ +/* $OpenBSD: xy.c,v 1.11 1998/10/03 21:18:59 millert Exp $ */ /* $NetBSD: xy.c,v 1.11 1996/10/13 03:47:40 christos Exp $ */ /* @@ -251,7 +251,7 @@ xygetdisklabel(xy, b) err = readdisklabel(MAKEDISKDEV(0, xy->sc_dev.dv_unit, RAW_PART), xydummystrat, - xy->sc_dk.dk_label, xy->sc_dk.dk_cpulabel); + xy->sc_dk.dk_label, xy->sc_dk.dk_cpulabel, 0); if (err) { printf("%s: %s\n", xy->sc_dev.dv_xname, err); return(XY_ERR_FAIL); diff --git a/sys/arch/sun3/sun3/disksubr.c b/sys/arch/sun3/sun3/disksubr.c index 8d76bbc71b6..8f5b69510ee 100644 --- a/sys/arch/sun3/sun3/disksubr.c +++ b/sys/arch/sun3/sun3/disksubr.c @@ -1,4 +1,4 @@ -/* $OpenBSD: disksubr.c,v 1.12 1997/10/01 22:54:22 deraadt Exp $ */ +/* $OpenBSD: disksubr.c,v 1.13 1998/10/03 21:18:56 millert Exp $ */ /* $NetBSD: disksubr.c,v 1.14 1996/09/26 18:10:21 gwr Exp $ */ /* @@ -79,11 +79,12 @@ static int disklabel_bsd_to_sun(struct disklabel *, char *); * Returns null on success and an error string on failure. */ char * -readdisklabel(dev, strat, lp, clp) +readdisklabel(dev, strat, lp, clp, spoofonly) dev_t dev; void (*strat) __P((struct buf *)); struct disklabel *lp; struct cpu_disklabel *clp; + int spoofonly; { struct buf *bp; struct disklabel *dlp; @@ -101,6 +102,10 @@ readdisklabel(dev, strat, lp, clp) /* obtain buffer to probe drive with */ bp = geteblk((int)lp->d_secsize); + /* don't read the on-disk label if we are in spoofed-only mode */ + if (spoofonly) + return (NULL); + /* next, dig out disk label */ bp->b_dev = dev; bp->b_blkno = LABELSECTOR; diff --git a/sys/arch/vax/mba/hp.c b/sys/arch/vax/mba/hp.c index 186faed847a..633d6a04aa5 100644 --- a/sys/arch/vax/mba/hp.c +++ b/sys/arch/vax/mba/hp.c @@ -1,4 +1,4 @@ -/* $OpenBSD: hp.c,v 1.8 1997/09/12 09:23:59 maja Exp $ */ +/* $OpenBSD: hp.c,v 1.9 1998/10/03 21:18:59 millert Exp $ */ /* $NetBSD: hp.c,v 1.15 1997/06/24 01:09:37 thorpej Exp $ */ /* * Copyright (c) 1996 Ludd, University of Lule}, Sweden. @@ -163,7 +163,7 @@ hpattach(parent, self, aux) * Read in label. */ if ((msg = readdisklabel(makedev(0, self->dv_unit * 8), hpstrategy, - dl, NULL)) != NULL) + dl, NULL, 0)) != NULL) printf(": %s", msg); printf(": %s, size = %d sectors\n", dl->d_typename, dl->d_secperunit); /* diff --git a/sys/arch/vax/mscp/mscp_disk.c b/sys/arch/vax/mscp/mscp_disk.c index 11644806151..24450c28d67 100644 --- a/sys/arch/vax/mscp/mscp_disk.c +++ b/sys/arch/vax/mscp/mscp_disk.c @@ -1,4 +1,4 @@ -/* $OpenBSD: mscp_disk.c,v 1.5 1997/09/12 09:25:51 maja Exp $ */ +/* $OpenBSD: mscp_disk.c,v 1.6 1998/10/03 21:18:59 millert Exp $ */ /* $NetBSD: mscp_disk.c,v 1.13 1997/06/24 01:12:40 thorpej Exp $ */ /* * Copyright (c) 1996 Ludd, University of Lule}, Sweden. @@ -240,7 +240,7 @@ ra_putonline(ra) printf("%s", ra->ra_dev.dv_xname); if ((msg = readdisklabel(raminor(ra->ra_dev.dv_unit, 0), - rastrategy, dl, NULL)) != NULL) + rastrategy, dl, NULL, 0)) != NULL) printf(": %s", msg); else ra->ra_havelabel = 1; diff --git a/sys/arch/vax/vax/disksubr.c b/sys/arch/vax/vax/disksubr.c index 8b213eeca28..f9f998e24c4 100644 --- a/sys/arch/vax/vax/disksubr.c +++ b/sys/arch/vax/vax/disksubr.c @@ -1,4 +1,4 @@ -/* $OpenBSD: disksubr.c,v 1.9 1997/09/12 09:30:54 maja Exp $ */ +/* $OpenBSD: disksubr.c,v 1.10 1998/10/03 21:18:56 millert Exp $ */ /* $NetBSD: disksubr.c,v 1.13 1997/07/06 22:38:26 ragge Exp $ */ /* @@ -118,11 +118,12 @@ bad: * Returns null on success and an error string on failure. */ char * -readdisklabel(dev, strat, lp, osdep) +readdisklabel(dev, strat, lp, osdep, spoofonly) dev_t dev; void (*strat) __P((struct buf *)); register struct disklabel *lp; struct cpu_disklabel *osdep; + int spoofonly; { register struct buf *bp; struct disklabel *dlp; @@ -135,6 +136,10 @@ readdisklabel(dev, strat, lp, osdep) lp->d_partitions[2].p_offset = 0; } + /* don't read the on-disk label if we are in spoofed-only mode */ + if (spoofonly) + return (NULL); + bp = geteblk((int)lp->d_secsize); bp->b_dev = dev; bp->b_blkno = LABELSECTOR; diff --git a/sys/arch/wgrisc/dev/flash.c b/sys/arch/wgrisc/dev/flash.c index 1eb45bfb884..44641a401fc 100644 --- a/sys/arch/wgrisc/dev/flash.c +++ b/sys/arch/wgrisc/dev/flash.c @@ -1,4 +1,4 @@ -/* $OpenBSD: flash.c,v 1.2 1997/08/24 12:01:13 pefo Exp $ */ +/* $OpenBSD: flash.c,v 1.3 1998/10/03 21:18:59 millert Exp $ */ /* * Copyright (c) 1997 Per Fogelstrom @@ -844,7 +844,7 @@ flgetdisklabel(dev, sc) /* * Call the generic disklabel extraction routine */ - errstring = readdisklabel(FLLABELDEV(dev), flstrategy, lp, &clp); + errstring = readdisklabel(FLLABELDEV(dev), flstrategy, lp, &clp, 0); if (errstring) { printf("%s: %s\n", sc->sc_dev.dv_xname, errstring); } diff --git a/sys/arch/wgrisc/wgrisc/disksubr.c b/sys/arch/wgrisc/wgrisc/disksubr.c index 177dc34f278..4161ac28cc4 100644 --- a/sys/arch/wgrisc/wgrisc/disksubr.c +++ b/sys/arch/wgrisc/wgrisc/disksubr.c @@ -1,4 +1,4 @@ -/* $OpenBSD: disksubr.c,v 1.9 1998/02/24 04:22:43 deraadt Exp $ */ +/* $OpenBSD: disksubr.c,v 1.10 1998/10/03 21:18:57 millert Exp $ */ /* $NetBSD: disksubr.c,v 1.21 1996/05/03 19:42:03 christos Exp $ */ /* @@ -77,11 +77,12 @@ dk_establish(dk, dev) * Returns null on success and an error string on failure. */ char * -readdisklabel(dev, strat, lp, osdep) +readdisklabel(dev, strat, lp, osdep, spoofonly) dev_t dev; void (*strat) __P((struct buf *)); register struct disklabel *lp; struct cpu_disklabel *osdep; + int spoofonly; { struct dos_partition *dp = osdep->dosparts, *dp2; struct dkbad *bdp = &DKBAD(osdep); @@ -240,6 +241,10 @@ donot: lp->d_npartitions = MAXPARTITIONS; } + /* don't read the on-disk label if we are in spoofed-only mode */ + if (spoofonly) + goto done; + /* next, dig out disk label */ bp->b_blkno = dospartoff + LABELSECTOR; bp->b_cylin = cyl; diff --git a/sys/dev/atapi/acd.c b/sys/dev/atapi/acd.c index 2efee890feb..344a24fb7ab 100644 --- a/sys/dev/atapi/acd.c +++ b/sys/dev/atapi/acd.c @@ -1,4 +1,4 @@ -/* $OpenBSD: acd.c,v 1.32 1998/07/12 01:20:20 deraadt Exp $ */ +/* $OpenBSD: acd.c,v 1.33 1998/10/03 21:18:59 millert Exp $ */ /* * Copyright (c) 1996 Manuel Bouyer. All rights reserved. @@ -1070,10 +1070,10 @@ acdgetdisklabel(acd) * does not yet work, for unknown reasons. */ errstring = readdisklabel(MAKECDDEV(0, acd->sc_dev.dv_unit, - data_track), acdstrategy, lp, acd->sc_dk.dk_cpulabel); + data_track), acdstrategy, lp, acd->sc_dk.dk_cpulabel, 0); #else errstring = readdisklabel(MAKECDDEV(0, acd->sc_dev.dv_unit, - RAW_PART), acdstrategy, lp, acd->sc_dk.dk_cpulabel); + RAW_PART), acdstrategy, lp, acd->sc_dk.dk_cpulabel, 0); #endif /*if (errstring) printf("%s: %s\n", acd->sc_dev.dv_xname, errstring);*/ diff --git a/sys/dev/ccd.c b/sys/dev/ccd.c index 575b5693981..97543402345 100644 --- a/sys/dev/ccd.c +++ b/sys/dev/ccd.c @@ -1,4 +1,4 @@ -/* $OpenBSD: ccd.c,v 1.36 1998/08/04 21:26:35 millert Exp $ */ +/* $OpenBSD: ccd.c,v 1.37 1998/10/03 21:19:00 millert Exp $ */ /* $NetBSD: ccd.c,v 1.33 1996/05/05 04:21:14 thorpej Exp $ */ /*- @@ -1591,7 +1591,7 @@ ccdgetdisklabel(dev) * Call the generic disklabel extraction routine. */ errstring = readdisklabel(CCDLABELDEV(dev), ccdstrategy, - cs->sc_dkdev.dk_label, cs->sc_dkdev.dk_cpulabel); + cs->sc_dkdev.dk_label, cs->sc_dkdev.dk_cpulabel, 0); if (errstring) ccdmakedisklabel(cs); diff --git a/sys/dev/isa/fd.c b/sys/dev/isa/fd.c index 53a5fc92566..3d81c2add55 100644 --- a/sys/dev/isa/fd.c +++ b/sys/dev/isa/fd.c @@ -1,4 +1,4 @@ -/* $OpenBSD: fd.c,v 1.38 1998/08/08 23:01:13 downsj Exp $ */ +/* $OpenBSD: fd.c,v 1.39 1998/10/03 21:19:00 millert Exp $ */ /* $NetBSD: fd.c,v 1.90 1996/05/12 23:12:03 mycroft Exp $ */ /*- @@ -992,7 +992,7 @@ fdioctl(dev, cmd, addr, flag, p) lp->d_magic2 = DISKMAGIC; lp->d_checksum = dkcksum(lp); - errstring = readdisklabel(dev, fdstrategy, lp, &cdl); + errstring = readdisklabel(dev, fdstrategy, lp, &cdl, 0); if (errstring) { /*printf("%s: %s\n", fd->sc_dev.dv_xname, errstring); */ } diff --git a/sys/dev/isa/mcd.c b/sys/dev/isa/mcd.c index 602aee9a684..b88a7deb020 100644 --- a/sys/dev/isa/mcd.c +++ b/sys/dev/isa/mcd.c @@ -1,4 +1,4 @@ -/* $OpenBSD: mcd.c,v 1.24 1998/04/26 21:02:49 provos Exp $ */ +/* $OpenBSD: mcd.c,v 1.25 1998/10/03 21:19:00 millert Exp $ */ /* $NetBSD: mcd.c,v 1.60 1998/01/14 12:14:41 drochner Exp $ */ /* @@ -747,7 +747,7 @@ mcdgetdefaultlabel(dev, sc, lp) * Call the generic disklabel extraction routine */ errstring = readdisklabel(MCDLABELDEV(dev), mcdstrategy, lp, - sc->sc_dk.dk_cpulabel); + sc->sc_dk.dk_cpulabel, 0); if (errstring) { /*printf("%s: %s\n", sc->sc_dev.dv_xname, errstring);*/ return; diff --git a/sys/dev/isa/wd.c b/sys/dev/isa/wd.c index 772bd590d5d..ae447d4ecc5 100644 --- a/sys/dev/isa/wd.c +++ b/sys/dev/isa/wd.c @@ -1,4 +1,4 @@ -/* $OpenBSD: wd.c,v 1.36 1998/10/01 04:23:54 millert Exp $ */ +/* $OpenBSD: wd.c,v 1.37 1998/10/03 21:19:00 millert Exp $ */ /* $NetBSD: wd.c,v 1.150 1996/05/12 23:54:03 mycroft Exp $ */ /* @@ -577,7 +577,7 @@ wdgetdisklabel(dev, wd) if (d_link->sc_state > RECAL) d_link->sc_state = RECAL; errstring = readdisklabel(WDLABELDEV(dev), wdstrategy, lp, - wd->sc_dk.dk_cpulabel); + wd->sc_dk.dk_cpulabel, 0); if (errstring) { /* * This probably happened because the drive's default @@ -588,7 +588,7 @@ wdgetdisklabel(dev, wd) if (d_link->sc_state > GEOMETRY) d_link->sc_state = GEOMETRY; errstring = readdisklabel(WDLABELDEV(dev), wdstrategy, lp, - wd->sc_dk.dk_cpulabel); + wd->sc_dk.dk_cpulabel, 0); } if (errstring) { /*printf("%s: %s\n", wd->sc_dev.dv_xname, errstring);*/ diff --git a/sys/dev/ofw/ofdisk.c b/sys/dev/ofw/ofdisk.c index 132f87017a6..91ce384821a 100644 --- a/sys/dev/ofw/ofdisk.c +++ b/sys/dev/ofw/ofdisk.c @@ -1,4 +1,4 @@ -/* $OpenBSD: ofdisk.c,v 1.3 1997/11/07 08:07:22 niklas Exp $ */ +/* $OpenBSD: ofdisk.c,v 1.4 1998/10/03 21:19:01 millert Exp $ */ /* $NetBSD: ofdisk.c,v 1.3 1996/10/13 01:38:13 christos Exp $ */ /* @@ -176,8 +176,8 @@ ofdopen(dev, flags, fmt, p) lp->d_partitions[RAW_PART].p_offset = 0; lp->d_partitions[RAW_PART].p_size = lp->d_secperunit; - readdisklabel(MAKEDISKDEV(major(dev), unit, RAW_PART), ofdstrategy, - lp, of->sc_dk.dk_cpulabel); + readdisklabel(MAKEDISKDEV(major(dev), unit, RAW_PART), + ofdstrategy, lp, of->sc_dk.dk_cpulabel, 0); } switch (fmt) { diff --git a/sys/dev/ramdisk.c b/sys/dev/ramdisk.c index be0809ee45a..2d6bcf448c0 100644 --- a/sys/dev/ramdisk.c +++ b/sys/dev/ramdisk.c @@ -1,4 +1,4 @@ -/* $OpenBSD: ramdisk.c,v 1.7 1997/10/18 10:37:03 deraadt Exp $ */ +/* $OpenBSD: ramdisk.c,v 1.8 1998/10/03 21:19:00 millert Exp $ */ /* $NetBSD: ramdisk.c,v 1.8 1996/04/12 08:30:09 leo Exp $ */ /* @@ -521,7 +521,7 @@ rdgetdisklabel(dev, sc) /* * Call the generic disklabel extraction routine */ - errstring = readdisklabel(RDLABELDEV(dev), rdstrategy, &lp, &clp); + errstring = readdisklabel(RDLABELDEV(dev), rdstrategy, &lp, &clp, 0); if (errstring) { /*printf("%s: %s\n", sc->sc_dev.dv_xname, errstring);*/ return NULL; diff --git a/sys/dev/vnd.c b/sys/dev/vnd.c index 41d1c176deb..6ec83b670f8 100644 --- a/sys/dev/vnd.c +++ b/sys/dev/vnd.c @@ -1,4 +1,4 @@ -/* $OpenBSD: vnd.c,v 1.22 1998/08/04 22:01:54 millert Exp $ */ +/* $OpenBSD: vnd.c,v 1.23 1998/10/03 21:19:00 millert Exp $ */ /* $NetBSD: vnd.c,v 1.26 1996/03/30 23:06:11 christos Exp $ */ /* @@ -294,7 +294,7 @@ vndgetdisklabel(dev, sc) * Call the generic disklabel extraction routine */ errstring = readdisklabel(VNDLABELDEV(dev), vndstrategy, lp, - sc->sc_dk.dk_cpulabel); + sc->sc_dk.dk_cpulabel, 0); if (errstring) { /*printf("%s: %s\n", sc->sc_dev.dv_xname, errstring);*/ return; diff --git a/sys/scsi/cd.c b/sys/scsi/cd.c index 81134c93de9..0ac433201c6 100644 --- a/sys/scsi/cd.c +++ b/sys/scsi/cd.c @@ -1,4 +1,4 @@ -/* $OpenBSD: cd.c,v 1.32 1998/07/13 00:21:16 csapuntz Exp $ */ +/* $OpenBSD: cd.c,v 1.33 1998/10/03 21:19:01 millert Exp $ */ /* $NetBSD: cd.c,v 1.100 1997/04/02 02:29:30 mycroft Exp $ */ /* @@ -1100,7 +1100,7 @@ cdgetdisklabel(dev, cd) * Call the generic disklabel extraction routine */ errstring = readdisklabel(CDLABELDEV(dev), cdstrategy, lp, - cd->sc_dk.dk_cpulabel); + cd->sc_dk.dk_cpulabel, 0); if (errstring) { /*printf("%s: %s\n", cd->sc_dev.dv_xname, errstring);*/ return; diff --git a/sys/scsi/sd.c b/sys/scsi/sd.c index b7b3cb127f3..b2749826155 100644 --- a/sys/scsi/sd.c +++ b/sys/scsi/sd.c @@ -1,4 +1,4 @@ -/* $OpenBSD: sd.c,v 1.30 1998/10/01 05:11:11 millert Exp $ */ +/* $OpenBSD: sd.c,v 1.31 1998/10/03 21:19:01 millert Exp $ */ /* $NetBSD: sd.c,v 1.111 1997/04/02 02:29:41 mycroft Exp $ */ /* @@ -863,7 +863,7 @@ sdgetdisklabel(dev, sd) * Call the generic disklabel extraction routine */ errstring = readdisklabel(SDLABELDEV(dev), sdstrategy, lp, - sd->sc_dk.dk_cpulabel); + sd->sc_dk.dk_cpulabel, 0); if (errstring) { /*printf("%s: %s\n", sd->sc_dev.dv_xname, errstring);*/ return; diff --git a/sys/sys/disklabel.h b/sys/sys/disklabel.h index 7d220f16e45..109cb32c0c7 100644 --- a/sys/sys/disklabel.h +++ b/sys/sys/disklabel.h @@ -1,4 +1,4 @@ -/* $OpenBSD: disklabel.h,v 1.15 1998/05/17 03:09:39 mickey Exp $ */ +/* $OpenBSD: disklabel.h,v 1.16 1998/10/03 21:19:01 millert Exp $ */ /* $NetBSD: disklabel.h,v 1.41 1996/05/10 23:07:37 mark Exp $ */ /* @@ -350,7 +350,7 @@ u_int dkcksum __P((struct disklabel *)); int setdisklabel __P((struct disklabel *, struct disklabel *, u_long, struct cpu_disklabel *)); char *readdisklabel __P((dev_t, void (*)(struct buf *), struct disklabel *, - struct cpu_disklabel *)); + struct cpu_disklabel *, int)); int writedisklabel __P((dev_t, void (*)(struct buf *), struct disklabel *, struct cpu_disklabel *)); int bounds_check_with_label __P((struct buf *, struct disklabel *, |