diff options
Diffstat (limited to 'sys/arch')
-rw-r--r-- | sys/arch/alpha/alpha/disksubr.c | 44 | ||||
-rw-r--r-- | sys/arch/amd64/amd64/disksubr.c | 22 | ||||
-rw-r--r-- | sys/arch/arm/arm/disksubr.c | 25 | ||||
-rw-r--r-- | sys/arch/aviion/aviion/disksubr.c | 25 | ||||
-rw-r--r-- | sys/arch/hp300/hp300/disksubr.c | 27 | ||||
-rw-r--r-- | sys/arch/hppa/hppa/disksubr.c | 55 | ||||
-rw-r--r-- | sys/arch/hppa64/hppa64/disksubr.c | 61 | ||||
-rw-r--r-- | sys/arch/i386/i386/disksubr.c | 16 | ||||
-rw-r--r-- | sys/arch/landisk/landisk/disksubr.c | 27 | ||||
-rw-r--r-- | sys/arch/luna88k/luna88k/disksubr.c | 39 | ||||
-rw-r--r-- | sys/arch/mac68k/mac68k/disksubr.c | 58 | ||||
-rw-r--r-- | sys/arch/macppc/macppc/disksubr.c | 20 | ||||
-rw-r--r-- | sys/arch/mips64/mips64/disksubr.c | 40 | ||||
-rw-r--r-- | sys/arch/mvme68k/mvme68k/disksubr.c | 130 | ||||
-rw-r--r-- | sys/arch/mvme88k/mvme88k/disksubr.c | 39 | ||||
-rw-r--r-- | sys/arch/mvmeppc/mvmeppc/disksubr.c | 25 | ||||
-rw-r--r-- | sys/arch/sparc/sparc/disksubr.c | 105 | ||||
-rw-r--r-- | sys/arch/sparc64/sparc64/disksubr.c | 71 | ||||
-rw-r--r-- | sys/arch/vax/vax/disksubr.c | 43 |
19 files changed, 281 insertions, 591 deletions
diff --git a/sys/arch/alpha/alpha/disksubr.c b/sys/arch/alpha/alpha/disksubr.c index 479879eb215..2e0dbec03da 100644 --- a/sys/arch/alpha/alpha/disksubr.c +++ b/sys/arch/alpha/alpha/disksubr.c @@ -1,4 +1,4 @@ -/* $OpenBSD: disksubr.c,v 1.73 2007/06/05 00:38:12 deraadt Exp $ */ +/* $OpenBSD: disksubr.c,v 1.74 2007/06/06 16:42:01 deraadt Exp $ */ /* $NetBSD: disksubr.c,v 1.21 1996/05/03 19:42:03 christos Exp $ */ /* @@ -57,12 +57,8 @@ char *readdoslabel(struct buf *, void (*)(struct buf *), * Try to read a standard BSD disklabel at a certain sector. */ char * -readbsdlabel(bp, strat, cyl, sec, off, lp, spoofonly) - struct buf *bp; - void (*strat)(struct buf *); - int cyl, sec, off; - struct disklabel *lp; - int spoofonly; +readbsdlabel(struct buf *bp, void (*strat)(struct buf *), + int cyl, int sec, int off, struct disklabel *lp, int spoofonly) { struct disklabel *dlp; char *msg = NULL; @@ -124,12 +120,8 @@ readbsdlabel(bp, strat, cyl, sec, off, lp, spoofonly) * Returns null on success and an error string on failure. */ char * -readdisklabel(dev, strat, lp, osdep, spoofonly) - dev_t dev; - void (*strat)(struct buf *); - struct disklabel *lp; - struct cpu_disklabel *osdep; - int spoofonly; +readdisklabel(dev_t dev, void (*strat)(struct buf *), + struct disklabel *lp, struct cpu_disklabel *osdep, int spoofonly) { struct buf *bp = NULL; char *msg = "no disk label"; @@ -208,14 +200,9 @@ done: * MBR is valid. */ char * -readdoslabel(bp, strat, lp, osdep, partoffp, cylp, spoofonly) - struct buf *bp; - void (*strat)(struct buf *); - struct disklabel *lp; - struct cpu_disklabel *osdep; - int *partoffp; - int *cylp; - int spoofonly; +readdoslabel(struct buf *bp, void (*strat)(struct buf *), + struct disklabel *lp, struct cpu_disklabel *osdep, + int *partoffp, int *cylp, int spoofonly) { struct dos_partition dp[NDOSPART], *dp2; struct partition *pp; @@ -403,10 +390,8 @@ notfat: * before setting it. */ int -setdisklabel(olp, nlp, openmask, osdep) - struct disklabel *olp, *nlp; - u_long openmask; - struct cpu_disklabel *osdep; +setdisklabel(struct disklabel *olp, struct disklabel *nlp, + u_int openmask, struct cpu_disklabel *osdep) { int i; struct partition *opp, *npp; @@ -436,7 +421,7 @@ setdisklabel(olp, nlp, openmask, osdep) /* XXX missing check if other dos partitions will be overwritten */ while (openmask != 0) { - i = ffs((long)openmask) - 1; + i = ffs(openmask) - 1; openmask &= ~(1 << i); if (nlp->d_npartitions <= i) return (EBUSY); @@ -466,11 +451,8 @@ setdisklabel(olp, nlp, openmask, osdep) * Write disk label back to device after modification. */ int -writedisklabel(dev, strat, lp, osdep) - dev_t dev; - void (*strat)(struct buf *); - struct disklabel *lp; - struct cpu_disklabel *osdep; +writedisklabel(dev_t dev, void (*strat)(struct buf *), + struct disklabel *lp, struct cpu_disklabel *osdep) { char *msg = "no disk label"; struct buf *bp; diff --git a/sys/arch/amd64/amd64/disksubr.c b/sys/arch/amd64/amd64/disksubr.c index a0a19e0d6d8..47e36a46727 100644 --- a/sys/arch/amd64/amd64/disksubr.c +++ b/sys/arch/amd64/amd64/disksubr.c @@ -1,4 +1,4 @@ -/* $OpenBSD: disksubr.c,v 1.37 2007/06/05 00:38:13 deraadt Exp $ */ +/* $OpenBSD: disksubr.c,v 1.38 2007/06/06 16:42:03 deraadt Exp $ */ /* $NetBSD: disksubr.c,v 1.21 1996/05/03 19:42:03 christos Exp $ */ /* @@ -66,13 +66,13 @@ bios_diskinfo_t *bios_getdiskinfo(dev_t dev); char * -readdisklabel(dev_t dev, void (*strat)(struct buf *), struct disklabel *lp, - struct cpu_disklabel *osdep, int spoofonly) +readdisklabel(dev_t dev, void (*strat)(struct buf *), + struct disklabel *lp, struct cpu_disklabel *osdep, int spoofonly) { struct dos_partition dp[NDOSPART], *dp2; + struct partition *pp; struct disklabel *dlp; bios_diskinfo_t *pdi; - struct partition *pp; unsigned long extoff = 0; unsigned int fattest; struct buf *bp = NULL; @@ -143,7 +143,7 @@ readdisklabel(dev_t dev, void (*strat)(struct buf *), struct disklabel *lp, bp->b_flags = B_BUSY | B_READ; bp->b_cylinder = part_blkno / lp->d_secpercyl; (*strat)(bp); - + /* if successful, wander through dos partition table */ if (biowait(bp)) { msg = "dos partition I/O error"; @@ -216,9 +216,9 @@ donot: case DOSPTYP_FAT12: case DOSPTYP_FAT16S: case DOSPTYP_FAT16B: - case DOSPTYP_FAT32: case DOSPTYP_FAT32L: case DOSPTYP_FAT16L: + case DOSPTYP_FAT32: pp->p_fstype = FS_MSDOS; n++; break; @@ -269,7 +269,7 @@ donot: } notfat: - /* Don't read the on-disk label if we are in spoofed-only mode. */ + /* don't read the on-disk label if we are in spoofed-only mode */ if (spoofonly) goto done; @@ -325,8 +325,8 @@ done: * before setting it. */ int -setdisklabel(struct disklabel *olp, struct disklabel *nlp, u_long openmask, - struct cpu_disklabel *osdep) +setdisklabel(struct disklabel *olp, struct disklabel *nlp, + u_int openmask, struct cpu_disklabel *osdep) { int i; struct partition *opp, *npp; @@ -380,8 +380,8 @@ setdisklabel(struct disklabel *olp, struct disklabel *nlp, u_long openmask, * XXX cannot handle OpenBSD partitions in extended partitions! */ int -writedisklabel(dev_t dev, void (*strat)(struct buf *), struct disklabel *lp, - struct cpu_disklabel *osdep) +writedisklabel(dev_t dev, void (*strat)(struct buf *), + struct disklabel *lp, struct cpu_disklabel *osdep) { struct dos_partition dp[NDOSPART], *dp2; struct disklabel *dlp; diff --git a/sys/arch/arm/arm/disksubr.c b/sys/arch/arm/arm/disksubr.c index 6fc8947caab..2e7b9b3024e 100644 --- a/sys/arch/arm/arm/disksubr.c +++ b/sys/arch/arm/arm/disksubr.c @@ -1,4 +1,4 @@ -/* $OpenBSD: disksubr.c,v 1.32 2007/06/05 00:38:14 deraadt Exp $ */ +/* $OpenBSD: disksubr.c,v 1.33 2007/06/06 16:42:04 deraadt Exp $ */ /* $NetBSD: disksubr.c,v 1.21 1996/05/03 19:42:03 christos Exp $ */ /* @@ -60,12 +60,8 @@ * Returns null on success and an error string on failure. */ char * -readdisklabel(dev, strat, lp, osdep, spoofonly) - dev_t dev; - void (*strat)(struct buf *); - struct disklabel *lp; - struct cpu_disklabel *osdep; - int spoofonly; +readdisklabel(dev_t dev, void (*strat)(struct buf *), + struct disklabel *lp, struct cpu_disklabel *osdep, int spoofonly) { struct dos_partition dp[NDOSPART], *dp2; struct partition *pp; @@ -120,7 +116,7 @@ readdisklabel(dev, strat, lp, osdep, spoofonly) bp->b_flags = B_BUSY | B_READ; bp->b_cylinder = part_blkno / lp->d_secpercyl; (*strat)(bp); - + /* if successful, wander through dos partition table */ if (biowait(bp)) { msg = "dos partition I/O error"; @@ -301,10 +297,8 @@ done: * before setting it. */ int -setdisklabel(olp, nlp, openmask, osdep) - struct disklabel *olp, *nlp; - u_long openmask; - struct cpu_disklabel *osdep; +setdisklabel(struct disklabel *olp, struct disklabel *nlp, + u_int openmask, struct cpu_disklabel *osdep) { int i; struct partition *opp, *npp; @@ -358,11 +352,8 @@ setdisklabel(olp, nlp, openmask, osdep) * XXX cannot handle OpenBSD partitions in extended partitions! */ int -writedisklabel(dev, strat, lp, osdep) - dev_t dev; - void (*strat)(struct buf *); - struct disklabel *lp; - struct cpu_disklabel *osdep; +writedisklabel(dev_t dev, void (*strat)(struct buf *), + struct disklabel *lp, struct cpu_disklabel *osdep) { struct dos_partition dp[NDOSPART], *dp2; struct disklabel *dlp; diff --git a/sys/arch/aviion/aviion/disksubr.c b/sys/arch/aviion/aviion/disksubr.c index 625a03e3ee2..02f6b44b5d7 100644 --- a/sys/arch/aviion/aviion/disksubr.c +++ b/sys/arch/aviion/aviion/disksubr.c @@ -1,4 +1,4 @@ -/* $OpenBSD: disksubr.c,v 1.23 2007/06/05 00:38:14 deraadt Exp $ */ +/* $OpenBSD: disksubr.c,v 1.24 2007/06/06 16:42:06 deraadt Exp $ */ /* $NetBSD: disksubr.c,v 1.21 1996/05/03 19:42:03 christos Exp $ */ /* @@ -60,12 +60,8 @@ * Returns null on success and an error string on failure. */ char * -readdisklabel(dev, strat, lp, osdep, spoofonly) - dev_t dev; - void (*strat)(struct buf *); - struct disklabel *lp; - struct cpu_disklabel *osdep; - int spoofonly; +readdisklabel(dev_t dev, void (*strat)(struct buf *), + struct disklabel *lp, struct cpu_disklabel *osdep, int spoofonly) { struct dos_partition dp[NDOSPART], *dp2; struct partition *pp; @@ -120,7 +116,7 @@ readdisklabel(dev, strat, lp, osdep, spoofonly) bp->b_flags = B_BUSY | B_READ; bp->b_cylinder = part_blkno / lp->d_secpercyl; (*strat)(bp); - + /* if successful, wander through dos partition table */ if (biowait(bp)) { msg = "dos partition I/O error"; @@ -301,10 +297,8 @@ done: * before setting it. */ int -setdisklabel(olp, nlp, openmask, osdep) - struct disklabel *olp, *nlp; - u_long openmask; - struct cpu_disklabel *osdep; +setdisklabel(struct disklabel *olp, struct disklabel *nlp, + u_int openmask, struct cpu_disklabel *osdep) { int i; struct partition *opp, *npp; @@ -358,11 +352,8 @@ setdisklabel(olp, nlp, openmask, osdep) * XXX cannot handle OpenBSD partitions in extended partitions! */ int -writedisklabel(dev, strat, lp, osdep) - dev_t dev; - void (*strat)(struct buf *); - struct disklabel *lp; - struct cpu_disklabel *osdep; +writedisklabel(dev_t dev, void (*strat)(struct buf *), + struct disklabel *lp, struct cpu_disklabel *osdep) { struct dos_partition dp[NDOSPART], *dp2; struct disklabel *dlp; diff --git a/sys/arch/hp300/hp300/disksubr.c b/sys/arch/hp300/hp300/disksubr.c index 64f0be6fdff..b9eb0e4cd4a 100644 --- a/sys/arch/hp300/hp300/disksubr.c +++ b/sys/arch/hp300/hp300/disksubr.c @@ -1,4 +1,4 @@ -/* $OpenBSD: disksubr.c,v 1.31 2007/06/05 02:38:36 krw Exp $ */ +/* $OpenBSD: disksubr.c,v 1.32 2007/06/06 16:42:06 deraadt Exp $ */ /* $NetBSD: disksubr.c,v 1.9 1997/04/01 03:12:13 scottr Exp $ */ /* @@ -52,12 +52,8 @@ * string on failure. */ char * -readdisklabel(dev, strat, lp, osdep, spoofonly) - dev_t dev; - void (*strat)(struct buf *); - struct disklabel *lp; - struct cpu_disklabel *osdep; - int spoofonly; +readdisklabel(dev_t dev, void (*strat)(struct buf *), + struct disklabel *lp, struct cpu_disklabel *osdep, int spoofonly) { struct buf *bp = NULL; struct disklabel *dlp; @@ -133,10 +129,8 @@ done: * Check new disk label for sensibility before setting it. */ int -setdisklabel(olp, nlp, openmask, osdep) - struct disklabel *olp, *nlp; - u_long openmask; - struct cpu_disklabel *osdep; +setdisklabel(struct disklabel *olp, struct disklabel *nlp, + u_int openmask, struct cpu_disklabel *osdep) { int i; struct partition *opp, *npp; @@ -144,7 +138,7 @@ setdisklabel(olp, nlp, openmask, osdep) if (nlp->d_magic != DISKMAGIC || nlp->d_magic2 != DISKMAGIC || dkcksum(nlp) != 0) return (EINVAL); - while ((i = ffs((long)openmask)) != 0) { + while ((i = ffs(openmask)) != 0) { i--; openmask &= ~(1 << i); if (nlp->d_npartitions <= i) @@ -174,11 +168,8 @@ setdisklabel(olp, nlp, openmask, osdep) * Write disk label back to device after modification. */ int -writedisklabel(dev, strat, lp, osdep) - dev_t dev; - void (*strat)(struct buf *); - struct disklabel *lp; - struct cpu_disklabel *osdep; +writedisklabel(dev_t dev, void (*strat)(struct buf *), + struct disklabel *lp, struct cpu_disklabel *osdep) { struct buf *bp; struct disklabel *dlp; @@ -260,7 +251,7 @@ bounds_check_with_label(struct buf *bp, struct disklabel *lp, /* Otherwise, truncate request. */ bp->b_bcount = sz << DEV_BSHIFT; } - + /* Overwriting disk label? */ if (bp->b_blkno + blockpersec(DL_GETPOFFSET(p), lp) <= labelsector && (bp->b_flags & B_READ) == 0 && !wlabel) { diff --git a/sys/arch/hppa/hppa/disksubr.c b/sys/arch/hppa/hppa/disksubr.c index 09711c3afa4..75d0aafe7d5 100644 --- a/sys/arch/hppa/hppa/disksubr.c +++ b/sys/arch/hppa/hppa/disksubr.c @@ -1,4 +1,4 @@ -/* $OpenBSD: disksubr.c,v 1.53 2007/06/05 00:38:15 deraadt Exp $ */ +/* $OpenBSD: disksubr.c,v 1.54 2007/06/06 16:42:06 deraadt Exp $ */ /* * Copyright (c) 1999 Michael Shalayeff @@ -61,12 +61,8 @@ char *readliflabel(struct buf *, void (*)(struct buf *), * Try to read a standard BSD disklabel at a certain sector. */ char * -readbsdlabel(bp, strat, cyl, sec, off, lp, spoofonly) - struct buf *bp; - void (*strat)(struct buf *); - int cyl, sec, off; - struct disklabel *lp; - int spoofonly; +readbsdlabel(struct buf *bp, void (*strat)(struct buf *), + int cyl, int sec, int off, struct disklabel *lp, int spoofonly) { struct disklabel *dlp; char *msg = NULL; @@ -128,12 +124,8 @@ readbsdlabel(bp, strat, cyl, sec, off, lp, spoofonly) * Returns null on success and an error string on failure. */ char * -readdisklabel(dev, strat, lp, osdep, spoofonly) - dev_t dev; - void (*strat)(struct buf *); - struct disklabel *lp; - struct cpu_disklabel *osdep; - int spoofonly; +readdisklabel(dev_t dev, void (*strat)(struct buf *), + struct disklabel *lp, struct cpu_disklabel *osdep, int spoofonly) { struct buf *bp = NULL; char *msg = "no disk label"; @@ -211,14 +203,9 @@ done: * MBR is valid. */ char * -readdoslabel(bp, strat, lp, osdep, partoffp, cylp, spoofonly) - struct buf *bp; - void (*strat)(struct buf *); - struct disklabel *lp; - struct cpu_disklabel *osdep; - int *partoffp; - int *cylp; - int spoofonly; +readdoslabel(struct buf *bp, void (*strat)(struct buf *), + struct disklabel *lp, struct cpu_disklabel *osdep, + int *partoffp, int *cylp, int spoofonly) { struct dos_partition dp[NDOSPART], *dp2; struct partition *pp; @@ -402,14 +389,9 @@ notfat: } char * -readliflabel (bp, strat, lp, osdep, partoffp, cylp, spoofonly) - struct buf *bp; - void (*strat)(struct buf *); - struct disklabel *lp; - struct cpu_disklabel *osdep; - int *partoffp; - int *cylp; - int spoofonly; +readliflabel(struct buf *bp, void (*strat)(struct buf *), + struct disklabel *lp, struct cpu_disklabel *osdep, + int *partoffp, int *cylp, int spoofonly) { int fsoff; @@ -568,10 +550,8 @@ readliflabel (bp, strat, lp, osdep, partoffp, cylp, spoofonly) * before setting it. */ int -setdisklabel(olp, nlp, openmask, osdep) - struct disklabel *olp, *nlp; - u_long openmask; - struct cpu_disklabel *osdep; +setdisklabel(struct disklabel *olp, struct disklabel *nlp, + u_int openmask, struct cpu_disklabel *osdep) { int i; struct partition *opp, *npp; @@ -601,7 +581,7 @@ setdisklabel(olp, nlp, openmask, osdep) /* XXX missing check if other dos partitions will be overwritten */ while (openmask != 0) { - i = ffs((long)openmask) - 1; + i = ffs(openmask) - 1; openmask &= ~(1 << i); if (nlp->d_npartitions <= i) return (EBUSY); @@ -631,11 +611,8 @@ setdisklabel(olp, nlp, openmask, osdep) * Write disk label back to device after modification. */ int -writedisklabel(dev, strat, lp, osdep) - dev_t dev; - void (*strat)(struct buf *); - struct disklabel *lp; - struct cpu_disklabel *osdep; +writedisklabel(dev_t dev, void (*strat)(struct buf *), + struct disklabel *lp, struct cpu_disklabel *osdep) { char *msg = "no disk label"; struct buf *bp; diff --git a/sys/arch/hppa64/hppa64/disksubr.c b/sys/arch/hppa64/hppa64/disksubr.c index d5bb99c2c7f..37f6050133c 100644 --- a/sys/arch/hppa64/hppa64/disksubr.c +++ b/sys/arch/hppa64/hppa64/disksubr.c @@ -1,4 +1,4 @@ -/* $OpenBSD: disksubr.c,v 1.36 2007/06/05 00:38:15 deraadt Exp $ */ +/* $OpenBSD: disksubr.c,v 1.37 2007/06/06 16:42:06 deraadt Exp $ */ /* * Copyright (c) 1999 Michael Shalayeff @@ -61,12 +61,8 @@ char *readliflabel(struct buf *, void (*)(struct buf *), * Try to read a standard BSD disklabel at a certain sector. */ char * -readbsdlabel(bp, strat, cyl, sec, off, lp, spoofonly) - struct buf *bp; - void (*strat)(struct buf *); - int cyl, sec, off; - struct disklabel *lp; - int spoofonly; +readbsdlabel(struct buf *bp, void (*strat)(struct buf *), + int cyl, int sec, int off, struct disklabel *lp, int spoofonly) { struct disklabel *dlp; char *msg = NULL; @@ -128,12 +124,8 @@ readbsdlabel(bp, strat, cyl, sec, off, lp, spoofonly) * Returns null on success and an error string on failure. */ char * -readdisklabel(dev, strat, lp, osdep, spoofonly) - dev_t dev; - void (*strat)(struct buf *); - struct disklabel *lp; - struct cpu_disklabel *osdep; - int spoofonly; +readdisklabel(dev_t dev, void (*strat)(struct buf *), + struct disklabel *lp, struct cpu_disklabel *osdep, int spoofonly) { struct buf *bp = NULL; char *msg = "no disk label"; @@ -183,6 +175,10 @@ readdisklabel(dev, strat, lp, osdep, spoofonly) if (msg && iso_disklabelspoof(dev, strat, lp) == 0) msg = NULL; #endif +#if defined(UDF) + if (msg && udf_disklabelspoof(dev, strat, lp) == 0) + msg = NULL; +#endif /* If there was an error, still provide a decent fake one. */ if (msg) @@ -207,14 +203,9 @@ done: * MBR is valid. */ char * -readdoslabel(bp, strat, lp, osdep, partoffp, cylp, spoofonly) - struct buf *bp; - void (*strat)(struct buf *); - struct disklabel *lp; - struct cpu_disklabel *osdep; - int *partoffp; - int *cylp; - int spoofonly; +readdoslabel(struct buf *bp, void (*strat)(struct buf *), + struct disklabel *lp, struct cpu_disklabel *osdep, + int *partoffp, int *cylp, int spoofonly) { struct dos_partition dp[NDOSPART], *dp2; struct partition *pp; @@ -398,14 +389,9 @@ notfat: } char * -readliflabel (bp, strat, lp, osdep, partoffp, cylp, spoofonly) - struct buf *bp; - void (*strat)(struct buf *); - struct disklabel *lp; - struct cpu_disklabel *osdep; - int *partoffp; - int *cylp; - int spoofonly; +readliflabel(struct buf *bp, void (*strat)(struct buf *), + struct disklabel *lp, struct cpu_disklabel *osdep, + int *partoffp, int *cylp, int spoofonly) { int fsoff; @@ -564,10 +550,8 @@ readliflabel (bp, strat, lp, osdep, partoffp, cylp, spoofonly) * before setting it. */ int -setdisklabel(olp, nlp, openmask, osdep) - struct disklabel *olp, *nlp; - u_long openmask; - struct cpu_disklabel *osdep; +setdisklabel(struct disklabel *olp, struct disklabel *nlp, + u_int openmask, struct cpu_disklabel *osdep) { int i; struct partition *opp, *npp; @@ -597,7 +581,7 @@ setdisklabel(olp, nlp, openmask, osdep) /* XXX missing check if other dos partitions will be overwritten */ while (openmask != 0) { - i = ffs((long)openmask) - 1; + i = ffs(openmask) - 1; openmask &= ~(1 << i); if (nlp->d_npartitions <= i) return (EBUSY); @@ -627,11 +611,8 @@ setdisklabel(olp, nlp, openmask, osdep) * Write disk label back to device after modification. */ int -writedisklabel(dev, strat, lp, osdep) - dev_t dev; - void (*strat)(struct buf *); - struct disklabel *lp; - struct cpu_disklabel *osdep; +writedisklabel(dev_t dev, void (*strat)(struct buf *), + struct disklabel *lp, struct cpu_disklabel *osdep) { char *msg = "no disk label"; struct buf *bp; @@ -652,7 +633,7 @@ writedisklabel(dev, strat, lp, osdep) dl = *lp; msg = readliflabel(bp, strat, &dl, &cdl, &partoff, &cyl, 0); labeloffset = HPPA_LABELOFFSET; - if (msg) { + if (msg) { dl = *lp; msg = readdoslabel(bp, strat, &dl, &cdl, &partoff, &cyl, 0); labeloffset = I386_LABELOFFSET; diff --git a/sys/arch/i386/i386/disksubr.c b/sys/arch/i386/i386/disksubr.c index e233087352a..ef955d27a98 100644 --- a/sys/arch/i386/i386/disksubr.c +++ b/sys/arch/i386/i386/disksubr.c @@ -1,4 +1,4 @@ -/* $OpenBSD: disksubr.c,v 1.77 2007/06/05 00:38:15 deraadt Exp $ */ +/* $OpenBSD: disksubr.c,v 1.78 2007/06/06 16:42:06 deraadt Exp $ */ /* $NetBSD: disksubr.c,v 1.21 1996/05/03 19:42:03 christos Exp $ */ /* @@ -66,8 +66,8 @@ bios_diskinfo_t *bios_getdiskinfo(dev_t dev); char * -readdisklabel(dev_t dev, void (*strat)(struct buf *), struct disklabel *lp, - struct cpu_disklabel *osdep, int spoofonly) +readdisklabel(dev_t dev, void (*strat)(struct buf *), + struct disklabel *lp, struct cpu_disklabel *osdep, int spoofonly) { struct dos_partition dp[NDOSPART], *dp2; struct partition *pp; @@ -216,9 +216,9 @@ donot: case DOSPTYP_FAT12: case DOSPTYP_FAT16S: case DOSPTYP_FAT16B: - case DOSPTYP_FAT32: case DOSPTYP_FAT32L: case DOSPTYP_FAT16L: + case DOSPTYP_FAT32: pp->p_fstype = FS_MSDOS; n++; break; @@ -325,8 +325,8 @@ done: * before setting it. */ int -setdisklabel(struct disklabel *olp, struct disklabel *nlp, u_long openmask, - struct cpu_disklabel *osdep) +setdisklabel(struct disklabel *olp, struct disklabel *nlp, + u_int openmask, struct cpu_disklabel *osdep) { int i; struct partition *opp, *npp; @@ -380,8 +380,8 @@ setdisklabel(struct disklabel *olp, struct disklabel *nlp, u_long openmask, * XXX cannot handle OpenBSD partitions in extended partitions! */ int -writedisklabel(dev_t dev, void (*strat)(struct buf *), struct disklabel *lp, - struct cpu_disklabel *osdep) +writedisklabel(dev_t dev, void (*strat)(struct buf *), + struct disklabel *lp, struct cpu_disklabel *osdep) { struct dos_partition dp[NDOSPART], *dp2; struct disklabel *dlp; diff --git a/sys/arch/landisk/landisk/disksubr.c b/sys/arch/landisk/landisk/disksubr.c index 9e88527ccee..74f6161b793 100644 --- a/sys/arch/landisk/landisk/disksubr.c +++ b/sys/arch/landisk/landisk/disksubr.c @@ -1,4 +1,4 @@ -/* $OpenBSD: disksubr.c,v 1.20 2007/06/05 00:38:16 deraadt Exp $ */ +/* $OpenBSD: disksubr.c,v 1.21 2007/06/06 16:42:06 deraadt Exp $ */ /* $NetBSD: disksubr.c,v 1.21 1996/05/03 19:42:03 christos Exp $ */ /* @@ -60,12 +60,8 @@ * Returns null on success and an error string on failure. */ char * -readdisklabel(dev, strat, lp, osdep, spoofonly) - dev_t dev; - void (*strat)(struct buf *); - struct disklabel *lp; - struct cpu_disklabel *osdep; - int spoofonly; +readdisklabel(dev_t dev, void (*strat)(struct buf *), + struct disklabel *lp, struct cpu_disklabel *osdep, int spoofonly) { struct dos_partition dp[NDOSPART], *dp2; struct partition *pp; @@ -90,7 +86,7 @@ readdisklabel(dev, strat, lp, osdep, spoofonly) lp->d_npartitions = RAW_PART + 1; for (i = 0; i < RAW_PART; i++) { DL_SETPSIZE(&lp->d_partitions[i], 0); - DL_SETPSIZE(&lp->d_partitions[i], 0); + DL_SETPOFFSET(&lp->d_partitions[i], 0); } if (DL_GETPSIZE(&lp->d_partitions[i]) == 0) DL_SETPSIZE(&lp->d_partitions[i], DL_GETDSIZE(lp)); @@ -120,7 +116,7 @@ readdisklabel(dev, strat, lp, osdep, spoofonly) bp->b_flags = B_BUSY | B_READ; bp->b_cylinder = part_blkno / lp->d_secpercyl; (*strat)(bp); - + /* if successful, wander through dos partition table */ if (biowait(bp)) { msg = "dos partition I/O error"; @@ -301,10 +297,8 @@ done: * before setting it. */ int -setdisklabel(olp, nlp, openmask, osdep) - struct disklabel *olp, *nlp; - u_long openmask; - struct cpu_disklabel *osdep; +setdisklabel(struct disklabel *olp, struct disklabel *nlp, + u_int openmask, struct cpu_disklabel *osdep) { int i; struct partition *opp, *npp; @@ -358,11 +352,8 @@ setdisklabel(olp, nlp, openmask, osdep) * XXX cannot handle OpenBSD partitions in extended partitions! */ int -writedisklabel(dev, strat, lp, osdep) - dev_t dev; - void (*strat)(struct buf *); - struct disklabel *lp; - struct cpu_disklabel *osdep; +writedisklabel(dev_t dev, void (*strat)(struct buf *), + struct disklabel *lp, struct cpu_disklabel *osdep) { struct dos_partition dp[NDOSPART], *dp2; struct disklabel *dlp; diff --git a/sys/arch/luna88k/luna88k/disksubr.c b/sys/arch/luna88k/luna88k/disksubr.c index 8ff3bb18ac7..298c516f1dd 100644 --- a/sys/arch/luna88k/luna88k/disksubr.c +++ b/sys/arch/luna88k/luna88k/disksubr.c @@ -1,4 +1,4 @@ -/* $OpenBSD: disksubr.c,v 1.16 2007/06/05 02:38:36 krw Exp $ */ +/* $OpenBSD: disksubr.c,v 1.17 2007/06/06 16:42:06 deraadt Exp $ */ /* $NetBSD: disksubr.c,v 1.12 2002/02/19 17:09:44 wiz Exp $ */ /* @@ -37,7 +37,7 @@ * * Credits: * This file was based mostly on the i386/disksubr.c file: - * @(#)ufs_disksubr.c 7.16 (Berkeley) 5/4/91 + * @(#)ufs_disksubr.c 7.16 (Berkeley) 5/4/91 * The functions: disklabel_sun_to_bsd, disklabel_bsd_to_sun * were originally taken from arch/sparc/scsi/sun_disklabel.c * (which was written by Theo de Raadt) and then substantially @@ -112,12 +112,8 @@ int disklabel_bsd_to_om(struct disklabel *, char *); * Returns null on success and an error string on failure. */ char * -readdisklabel(dev, strat, lp, clp, spoofonly) - dev_t dev; - void (*strat)(struct buf *); - struct disklabel *lp; - struct cpu_disklabel *clp; - int spoofonly; +readdisklabel(dev_t dev, void (*strat)(struct buf *), + struct disklabel *lp, struct cpu_disklabel *clp, int spoofonly) { struct buf *bp = NULL; struct disklabel *dlp; @@ -186,7 +182,7 @@ readdisklabel(dev, strat, lp, clp, spoofonly) dlp = (struct disklabel *)(clp->cd_block + LABELOFFSET); if (dlp->d_magic == DISKMAGIC && dlp->d_magic2 == DISKMAGIC) { if (dkcksum(dlp) == 0) { - *lp = *dlp; /* struct assignment */ + *lp = *dlp; /* struct assignment */ msg = NULL; goto done; } @@ -218,10 +214,8 @@ done: * before setting it. */ int -setdisklabel(olp, nlp, openmask, clp) - struct disklabel *olp, *nlp; - u_long openmask; - struct cpu_disklabel *clp; +setdisklabel(struct disklabel *olp, struct disklabel *nlp, + u_int openmask, struct cpu_disklabel *clp) { struct partition *opp, *npp; int i; @@ -265,11 +259,8 @@ setdisklabel(olp, nlp, openmask, clp) * Current label is already in clp->cd_block[] */ int -writedisklabel(dev, strat, lp, clp) - dev_t dev; - void (*strat)(struct buf *); - struct disklabel *lp; - struct cpu_disklabel *clp; +writedisklabel(dev_t dev, void (*strat)(struct buf *), + struct disklabel *lp, struct cpu_disklabel *clp) { struct buf *bp; struct disklabel *dlp; @@ -277,7 +268,7 @@ writedisklabel(dev, strat, lp, clp) /* implant OpenBSD disklabel at LABELOFFSET. */ dlp = (struct disklabel *)(clp->cd_block + LABELOFFSET); - *dlp = *lp; /* struct assignment */ + *dlp = *lp; /* struct assignment */ error = disklabel_bsd_to_om(lp, clp->cd_block); if (error) @@ -292,7 +283,7 @@ writedisklabel(dev, strat, lp, clp) bp->b_blkno = LABELSECTOR; bp->b_cylinder = 0; bp->b_bcount = lp->d_secsize; - bp->b_flags |= B_WRITE; + bp->b_flags = B_WRITE; (*strat)(bp); error = biowait(bp); brelse(bp); @@ -382,9 +373,7 @@ sun_fstypes[8] = { * The BSD label is cleared out before this is called. */ char * -disklabel_om_to_bsd(cp, lp) - char *cp; - struct disklabel *lp; +disklabel_om_to_bsd(char *cp, struct disklabel *lp) { struct sun_disklabel *sl; struct partition *npp; @@ -481,9 +470,7 @@ disklabel_om_to_bsd(cp, lp) * Returns zero or error code. */ int -disklabel_bsd_to_om(lp, cp) - struct disklabel *lp; - char *cp; +disklabel_bsd_to_om(struct disklabel *lp, char *cp) { struct sun_disklabel *sl; struct partition *npp; diff --git a/sys/arch/mac68k/mac68k/disksubr.c b/sys/arch/mac68k/mac68k/disksubr.c index a1b6cb6a606..976e0cd8d94 100644 --- a/sys/arch/mac68k/mac68k/disksubr.c +++ b/sys/arch/mac68k/mac68k/disksubr.c @@ -1,4 +1,4 @@ -/* $OpenBSD: disksubr.c,v 1.38 2007/06/05 00:38:16 deraadt Exp $ */ +/* $OpenBSD: disksubr.c,v 1.39 2007/06/06 16:42:06 deraadt Exp $ */ /* $NetBSD: disksubr.c,v 1.22 1997/11/26 04:18:20 briggs Exp $ */ /* @@ -104,9 +104,8 @@ char *read_mac_label(char *, struct disklabel *, struct cpu_disklabel *); * Find an entry in the disk label that is unused and return it * or -1 if no entry */ -int -getFreeLabelEntry(lp) - struct disklabel *lp; +int +getFreeLabelEntry(struct disklabel *lp) { int i; @@ -122,9 +121,8 @@ getFreeLabelEntry(lp) /* * figure out what the type of the given part is and return it */ -int -whichType(part) - struct partmapentry *part; +int +whichType(struct partmapentry *part) { struct blockzeroblock *bzb; @@ -176,10 +174,7 @@ whichType(part) * of part types. */ int -fixPartTable(partTable, size, base) - struct partmapentry *partTable; - long size; - char *base; +fixPartTable(struct partmapentry *partTable, long size, char *base) { int i; struct partmapentry *pmap; @@ -207,7 +202,7 @@ fixPartTable(partTable, size, base) return NUM_PARTS_PROBED; } -void +void setPart(struct partmapentry *part, struct disklabel *lp, int fstype, int slot) { DL_SETPSIZE(&lp->d_partitions[slot], part->pmPartBlkCnt); @@ -216,13 +211,9 @@ setPart(struct partmapentry *part, struct disklabel *lp, int fstype, int slot) part->pmPartType[0] = '\0'; } -int -getNamedType(part, num_parts, lp, type, alt, maxslot) - struct partmapentry *part; - int num_parts; - struct disklabel *lp; - int type, alt; - int *maxslot; +int +getNamedType(struct partmapentry *part, int num_parts, struct disklabel *lp, + int type, int alt, int *maxslot) { struct blockzeroblock *bzb; int i; @@ -274,7 +265,7 @@ skip: * A: root * B: Swap * C: Whole disk - * + * * AKB -- I added to Mike's original algorithm by searching for a bzbCluster * of zero for root, first. This allows A/UX to live on cluster 1 and * NetBSD to live on cluster 0--regardless of the actual order on the @@ -349,7 +340,7 @@ read_mac_label(char *dlbuf, struct disklabel *lp, struct cpu_disklabel *osdep) * routine. The label must be partly set up before this: secpercyl and * anything required in the strategy routine (e.g., sector size) must be * filled in before calling us. Returns null on success and an error - * string on failure. + * string on failure. * * This will read sector zero. If this contains what looks like a valid * Macintosh boot sector, we attempt to fill in the disklabel structure. @@ -357,12 +348,8 @@ read_mac_label(char *dlbuf, struct disklabel *lp, struct cpu_disklabel *osdep) * then we assume that it's a real disklabel and return it. */ char * -readdisklabel(dev, strat, lp, osdep, spoofonly) - dev_t dev; - void (*strat)(struct buf *); - struct disklabel *lp; - struct cpu_disklabel *osdep; - int spoofonly; +readdisklabel(dev_t dev, void (*strat)(struct buf *), + struct disklabel *lp, struct cpu_disklabel *osdep, int spoofonly) { struct buf *bp = NULL; char *msg = NULL; @@ -444,10 +431,8 @@ done: * Check new disk label for sensibility before setting it. */ int -setdisklabel(olp, nlp, openmask, osdep) - struct disklabel *olp, *nlp; - u_long openmask; - struct cpu_disklabel *osdep; +setdisklabel(struct disklabel *olp, struct disklabel *nlp, + u_int openmask, struct cpu_disklabel *osdep) { int i; struct partition *opp, *npp; @@ -467,7 +452,7 @@ setdisklabel(olp, nlp, openmask, osdep) dkcksum(nlp) != 0) return (EINVAL); - while ((i = ffs((long)openmask)) != 0) { + while ((i = ffs(openmask)) != 0) { i--; openmask &= ~(1 << i); if (nlp->d_npartitions <= i) @@ -500,11 +485,8 @@ setdisklabel(olp, nlp, openmask, osdep) * refuse to write a disklabel if the media has a MacOS signature. */ int -writedisklabel(dev, strat, lp, osdep) - dev_t dev; - void (*strat)(struct buf *); - struct disklabel *lp; - struct cpu_disklabel *osdep; +writedisklabel(dev_t dev, void (*strat)(struct buf *), + struct disklabel *lp, struct cpu_disklabel *osdep) { struct buf *bp; struct disklabel *dlp; @@ -540,7 +522,7 @@ writedisklabel(dev, strat, lp, osdep) error = EINVAL; goto done; } - + dlp = (struct disklabel *)(bp->b_data + LABELOFFSET); bcopy(lp, dlp, sizeof(struct disklabel)); bp->b_flags = B_BUSY | B_WRITE; diff --git a/sys/arch/macppc/macppc/disksubr.c b/sys/arch/macppc/macppc/disksubr.c index 92320bff4e8..c4792457d20 100644 --- a/sys/arch/macppc/macppc/disksubr.c +++ b/sys/arch/macppc/macppc/disksubr.c @@ -1,4 +1,4 @@ -/* $OpenBSD: disksubr.c,v 1.42 2007/06/05 00:38:17 deraadt Exp $ */ +/* $OpenBSD: disksubr.c,v 1.43 2007/06/06 16:42:06 deraadt Exp $ */ /* $NetBSD: disksubr.c,v 1.21 1996/05/03 19:42:03 christos Exp $ */ /* @@ -350,8 +350,7 @@ notfat: found_disklabel: for (dlp = (struct disklabel *)bp->b_data; - dlp <= (struct disklabel *)(bp->b_data + - lp->d_secsize - sizeof(*dlp)); + dlp <= (struct disklabel *)(bp->b_data + lp->d_secsize - sizeof(*dlp)); dlp = (struct disklabel *)((char *)dlp + sizeof(long))) { if (dlp->d_magic != DISKMAGIC || dlp->d_magic2 != DISKMAGIC) { if (msg == NULL) @@ -389,8 +388,8 @@ done: * before setting it. */ int -setdisklabel(struct disklabel *olp, struct disklabel *nlp, u_long openmask, - struct cpu_disklabel *osdep) +setdisklabel(struct disklabel *olp, struct disklabel *nlp, + u_int openmask, struct cpu_disklabel *osdep) { int i; struct partition *opp, *npp; @@ -444,8 +443,8 @@ setdisklabel(struct disklabel *olp, struct disklabel *nlp, u_long openmask, * XXX cannot handle OpenBSD partitions in extended partitions! */ int -writedisklabel(dev_t dev, void (*strat)(struct buf *), struct disklabel *lp, - struct cpu_disklabel *osdep) +writedisklabel(dev_t dev, void (*strat)(struct buf *), + struct disklabel *lp, struct cpu_disklabel *osdep) { struct dos_partition dp[NDOSPART], *dp2; struct disklabel *dlp; @@ -481,6 +480,7 @@ writedisklabel(dev_t dev, void (*strat)(struct buf *), struct disklabel *lp, /* do dos partitions in the process of getting disklabel? */ dospartoff = 0; cyl = LABELSECTOR / lp->d_secpercyl; + /* read master boot record */ bp->b_blkno = DOSBBSECTOR; bp->b_bcount = lp->d_secsize; @@ -495,8 +495,7 @@ writedisklabel(dev_t dev, void (*strat)(struct buf *), struct disklabel *lp, bcopy(bp->b_data + DOSPARTOFF, dp, sizeof(dp)); for (dp2=dp, i=0; i < NDOSPART && ourpart == -1; i++, dp2++) - if (letoh32(dp2->dp_size) && dp2->dp_typ == - DOSPTYP_OPENBSD) + if (letoh32(dp2->dp_size) && dp2->dp_typ == DOSPTYP_OPENBSD) ourpart = i; if (ourpart != -1) { @@ -521,8 +520,7 @@ writedisklabel(dev_t dev, void (*strat)(struct buf *), struct disklabel *lp, if ((error = biowait(bp)) != 0) goto done; for (dlp = (struct disklabel *)bp->b_data; - dlp <= (struct disklabel *)(bp->b_data + lp->d_secsize - - sizeof(*dlp)); + dlp <= (struct disklabel *)(bp->b_data + lp->d_secsize - sizeof(*dlp)); dlp = (struct disklabel *)((char *)dlp + sizeof(long))) { if (dlp->d_magic == DISKMAGIC && dlp->d_magic2 == DISKMAGIC && dkcksum(dlp) == 0) { diff --git a/sys/arch/mips64/mips64/disksubr.c b/sys/arch/mips64/mips64/disksubr.c index e24069bb02b..dd82015753a 100644 --- a/sys/arch/mips64/mips64/disksubr.c +++ b/sys/arch/mips64/mips64/disksubr.c @@ -1,4 +1,4 @@ -/* $OpenBSD: disksubr.c,v 1.42 2007/06/05 00:38:17 deraadt Exp $ */ +/* $OpenBSD: disksubr.c,v 1.43 2007/06/06 16:42:06 deraadt Exp $ */ /* * Copyright (c) 1999 Michael Shalayeff @@ -62,12 +62,9 @@ void map_sgi_label(struct disklabel *, struct sgilabel *); * Try to read a standard BSD disklabel at a certain sector. */ char * -readbsdlabel(bp, strat, cyl, sec, off, lp, spoofonly) - struct buf *bp; - void (*strat)(struct buf *); - int cyl, sec, off; - struct disklabel *lp; - int spoofonly; +readbsdlabel(struct buf *bp, void (*strat)(struct buf *), + int cyl, int sec, int off, struct disklabel *lp, + int spoofonly; { struct disklabel *dlp; char *msg = NULL; @@ -129,12 +126,8 @@ readbsdlabel(bp, strat, cyl, sec, off, lp, spoofonly) * Returns null on success and an error string on failure. */ char * -readdisklabel(dev, strat, lp, osdep, spoofonly) - dev_t dev; - void (*strat)(struct buf *); - struct disklabel *lp; - struct cpu_disklabel *osdep; - int spoofonly; +readdisklabel(dev_t dev, void (*strat)(struct buf *), + struct disklabel *lp, struct cpu_disklabel *osdep, int spoofonly) { struct buf *bp = NULL; char *msg = "no disk label"; @@ -169,7 +162,7 @@ readdisklabel(dev, strat, lp, osdep, spoofonly) /* Fallback alternative XXX valid lp returned? */ fallbacklabel = *lp; *lp = minilabel; - } + } if (msg) { msg = readdoslabel(bp, strat, lp, osdep, 0, 0, spoofonly); if (msg) { @@ -406,7 +399,7 @@ notfat: } /* - * + * */ char * readsgilabel(bp, strat, lp, osdep, partoffp, cylp, spoofonly) @@ -453,7 +446,7 @@ readsgilabel(bp, strat, lp, osdep, partoffp, cylp, spoofonly) i = sizeof(struct sgilabel) / sizeof(int); while(i--) cs += *p++; - if (cs != 0) + if (cs != 0) return "sgilabel checksum error"; /* Set up partitions i-l if there is no BSD label. */ @@ -516,10 +509,8 @@ static struct {int m; int b;} maptab[] = { * before setting it. */ int -setdisklabel(olp, nlp, openmask, osdep) - struct disklabel *olp, *nlp; - u_long openmask; - struct cpu_disklabel *osdep; +setdisklabel(struct disklabel *olp, struct disklabel *nlp, + u_int openmask, struct cpu_disklabel *osdep) { int i; struct partition *opp, *npp; @@ -549,7 +540,7 @@ setdisklabel(olp, nlp, openmask, osdep) /* XXX missing check if other dos partitions will be overwritten */ while (openmask != 0) { - i = ffs((long)openmask) - 1; + i = ffs(openmask) - 1; openmask &= ~(1 << i); if (nlp->d_npartitions <= i) return (EBUSY); @@ -579,11 +570,8 @@ setdisklabel(olp, nlp, openmask, osdep) * Write disk label back to device after modification. */ int -writedisklabel(dev, strat, lp, osdep) - dev_t dev; - void (*strat)(struct buf *); - struct disklabel *lp; - struct cpu_disklabel *osdep; +writedisklabel(dev_t dev, void (*strat)(struct buf *), + struct disklabel *lp, struct cpu_disklabel *osdep) { char *msg = "no disk label"; struct buf *bp; diff --git a/sys/arch/mvme68k/mvme68k/disksubr.c b/sys/arch/mvme68k/mvme68k/disksubr.c index 481689a60aa..2f11d83e071 100644 --- a/sys/arch/mvme68k/mvme68k/disksubr.c +++ b/sys/arch/mvme68k/mvme68k/disksubr.c @@ -1,9 +1,9 @@ -/* $OpenBSD: disksubr.c,v 1.44 2007/06/05 02:38:37 krw Exp $ */ +/* $OpenBSD: disksubr.c,v 1.45 2007/06/06 16:42:06 deraadt Exp $ */ /* * Copyright (c) 1998 Steve Murphree, Jr. * Copyright (c) 1995 Dale Rahn. * All rights reserved. - * + * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: @@ -34,10 +34,8 @@ #include <sys/disklabel.h> #include <sys/disk.h> -static void bsdtocpulabel(struct disklabel *lp, - struct cpu_disklabel *clp); -static void cputobsdlabel(struct disklabel *lp, - struct cpu_disklabel *clp); +void bsdtocpulabel(struct disklabel *, struct cpu_disklabel *); +void cputobsdlabel(struct disklabel *, struct cpu_disklabel *); /* * Attempt to read a disk label from a device @@ -45,16 +43,12 @@ static void cputobsdlabel(struct disklabel *lp, * The label must be partly set up before this: * secpercyl and anything required in the strategy routine * (e.g., sector size) must be filled in before calling us. - * Returns null on success and an error string on failure. + * Returns NULL on success and an error string on failure. */ char * -readdisklabel(dev, strat, lp, clp, spoofonly) - dev_t dev; - void (*strat)(struct buf *); - struct disklabel *lp; - struct cpu_disklabel *clp; - int spoofonly; +readdisklabel(dev_t dev, void (*strat)(struct buf *), + struct disklabel *lp, struct cpu_disklabel *clp, int spoofonly) { struct buf *bp = NULL; char *msg = NULL; @@ -141,10 +135,8 @@ done: * before setting it. */ int -setdisklabel(olp, nlp, openmask, clp) - struct disklabel *olp, *nlp; - u_long openmask; - struct cpu_disklabel *clp; +setdisklabel(struct disklabel *olp, struct disklabel *nlp, + u_int openmask, struct cpu_disklabel *clp) { int i; struct partition *opp, *npp; @@ -164,7 +156,7 @@ setdisklabel(olp, nlp, openmask, clp) dkcksum(nlp) != 0) return (EINVAL); - while ((i = ffs((long)openmask)) != 0) { + while ((i = ffs(openmask)) != 0) { i--; openmask &= ~(1 << i); if (nlp->d_npartitions <= i) @@ -185,8 +177,8 @@ setdisklabel(olp, nlp, openmask, clp) } } - nlp->d_checksum = 0; - nlp->d_checksum = dkcksum(nlp); + nlp->d_checksum = 0; + nlp->d_checksum = dkcksum(nlp); *olp = *nlp; return (0); } @@ -195,11 +187,8 @@ setdisklabel(olp, nlp, openmask, clp) * Write disk label back to device after modification. */ int -writedisklabel(dev, strat, lp, clp) - dev_t dev; - void (*strat)(struct buf *); - struct disklabel *lp; - struct cpu_disklabel *clp; +writedisklabel(dev_t dev, void (*strat)(struct buf *), + struct disklabel *lp, struct cpu_disklabel *clp) { struct buf *bp; int error; @@ -250,10 +239,9 @@ writedisklabel(dev, strat, lp, clp) bp->b_flags = B_INVAL | B_AGE | B_READ; brelse(bp); } - return (error); + return (error); } - int bounds_check_with_label(struct buf *bp, struct disklabel *lp, struct cpu_disklabel *osdep, int wlabel) @@ -309,10 +297,8 @@ bad: } -static void -bsdtocpulabel(lp, clp) - struct disklabel *lp; - struct cpu_disklabel *clp; +void +bsdtocpulabel(struct disklabel *lp, struct cpu_disklabel *clp) { char *tmot = "MOTOROLA"; char *id = "M68K"; @@ -382,86 +368,8 @@ bsdtocpulabel(lp, clp) } } -struct cpu_disklabel_old { - /* VID */ - u_char vid_id[4]; - u_char vid_0[16]; - u_int vid_oss; - u_short vid_osl; - u_char vid_1[4]; - u_short vid_osa_u; - u_short vid_osa_l; - u_char vid_2[2]; - u_short partitions; - u_char vid_vd[16]; - u_long bbsize; - u_long magic1; /* 4 */ - u_short type; /* 2 */ - u_short subtype; /* 2 */ - u_char packname[16]; /* 16 */ - u_long flags; /* 4 */ - u_long drivedata[5]; /* 4 */ - u_long spare[5]; /* 4 */ - u_short checksum; /* 2 */ - - u_long secpercyl; /* 4 */ - u_long secperunit; /* 4 */ - u_long headswitch; /* 4 */ - - u_char vid_3[4]; - u_int vid_cas; - u_char vid_cal; - u_char vid_4_0[3]; - u_char vid_4[64]; - u_char vid_4_1[28]; - u_long sbsize; - u_char vid_mot[8]; - - /* CFG */ - u_char cfg_0[4]; - u_short cfg_atm; - u_short cfg_prm; - u_short cfg_atw; - u_short cfg_rec; - - u_short sparespertrack; - u_short sparespercyl; - u_long acylinders; - u_short rpm; - u_short cylskew; - - u_char cfg_spt; - u_char cfg_hds; - u_short cfg_trk; - u_char cfg_ilv; - u_char cfg_sof; - u_short cfg_psm; - u_short cfg_shd; - u_char cfg_2[2]; - u_short cfg_pcom; - u_char cfg_3; - u_char cfg_ssr; - u_short cfg_rwcc; - u_short cfg_ecc; - u_short cfg_eatm; - u_short cfg_eprm; - u_short cfg_eatw; - u_char cfg_gpb1; - u_char cfg_gpb2; - u_char cfg_gpb3; - u_char cfg_gpb4; - u_char cfg_ssc; - u_char cfg_runit; - u_short cfg_rsvc1; - u_short cfg_rsvc2; - u_long magic2; - u_char cfg_4[192]; -}; - -static void -cputobsdlabel(lp, clp) - struct disklabel *lp; - struct cpu_disklabel *clp; +void +cputobsdlabel(struct disklabel *lp, struct cpu_disklabel *clp) { int i; diff --git a/sys/arch/mvme88k/mvme88k/disksubr.c b/sys/arch/mvme88k/mvme88k/disksubr.c index 0432df2d2c5..9a2a258aa4c 100644 --- a/sys/arch/mvme88k/mvme88k/disksubr.c +++ b/sys/arch/mvme88k/mvme88k/disksubr.c @@ -1,4 +1,4 @@ -/* $OpenBSD: disksubr.c,v 1.40 2007/06/05 02:38:37 krw Exp $ */ +/* $OpenBSD: disksubr.c,v 1.41 2007/06/06 16:42:06 deraadt Exp $ */ /* * Copyright (c) 1998 Steve Murphree, Jr. * Copyright (c) 1995 Dale Rahn. @@ -47,12 +47,8 @@ void cputobsdlabel(struct disklabel *, struct cpu_disklabel *); */ char * -readdisklabel(dev, strat, lp, clp, spoofonly) - dev_t dev; - void (*strat)(struct buf *); - struct disklabel *lp; - struct cpu_disklabel *clp; - int spoofonly; +readdisklabel(dev_t dev, void (*strat)(struct buf *), + struct disklabel *lp, struct cpu_disklabel *clp, int spoofonly) { struct buf *bp = NULL; char *msg = NULL; @@ -112,6 +108,7 @@ readdisklabel(dev, strat, lp, clp, spoofonly) goto done; } #endif + if (clp->magic1 != DISKMAGIC || clp->magic2 != DISKMAGIC) { msg = "no disk label"; goto done; @@ -138,10 +135,8 @@ done: * before setting it. */ int -setdisklabel(olp, nlp, openmask, clp) - struct disklabel *olp, *nlp; - u_long openmask; - struct cpu_disklabel *clp; +setdisklabel(struct disklabel *olp, struct disklabel *nlp, + u_int openmask, struct cpu_disklabel *clp) { int i; struct partition *opp, *npp; @@ -161,7 +156,7 @@ setdisklabel(olp, nlp, openmask, clp) dkcksum(nlp) != 0) return (EINVAL); - while ((i = ffs((long)openmask)) != 0) { + while ((i = ffs(openmask)) != 0) { i--; openmask &= ~(1 << i); if (nlp->d_npartitions <= i) @@ -182,8 +177,8 @@ setdisklabel(olp, nlp, openmask, clp) } } - nlp->d_checksum = 0; - nlp->d_checksum = dkcksum(nlp); + nlp->d_checksum = 0; + nlp->d_checksum = dkcksum(nlp); *olp = *nlp; return (0); } @@ -192,11 +187,8 @@ setdisklabel(olp, nlp, openmask, clp) * Write disk label back to device after modification. */ int -writedisklabel(dev, strat, lp, clp) - dev_t dev; - void (*strat)(struct buf *); - struct disklabel *lp; - struct cpu_disklabel *clp; +writedisklabel(dev_t dev, void (*strat)(struct buf *), + struct disklabel *lp, struct cpu_disklabel *clp) { struct buf *bp; int error; @@ -250,7 +242,6 @@ writedisklabel(dev, strat, lp, clp) return (error); } - int bounds_check_with_label(struct buf *bp, struct disklabel *lp, struct cpu_disklabel *osdep, int wlabel) @@ -307,9 +298,7 @@ bad: void -bsdtocpulabel(lp, clp) - struct disklabel *lp; - struct cpu_disklabel *clp; +bsdtocpulabel(struct disklabel *lp, struct cpu_disklabel *clp) { char *tmot = "MOTOROLA"; char *id = "M88K"; @@ -380,9 +369,7 @@ bsdtocpulabel(lp, clp) } void -cputobsdlabel(lp, clp) - struct disklabel *lp; - struct cpu_disklabel *clp; +cputobsdlabel(struct disklabel *lp, struct cpu_disklabel *clp) { int i; diff --git a/sys/arch/mvmeppc/mvmeppc/disksubr.c b/sys/arch/mvmeppc/mvmeppc/disksubr.c index f7498b32ebd..bef2fa99d68 100644 --- a/sys/arch/mvmeppc/mvmeppc/disksubr.c +++ b/sys/arch/mvmeppc/mvmeppc/disksubr.c @@ -1,4 +1,4 @@ -/* $OpenBSD: disksubr.c,v 1.38 2007/06/05 00:38:17 deraadt Exp $ */ +/* $OpenBSD: disksubr.c,v 1.39 2007/06/06 16:42:06 deraadt Exp $ */ /* $NetBSD: disksubr.c,v 1.21 1996/05/03 19:42:03 christos Exp $ */ /* @@ -63,12 +63,8 @@ * Returns null on success and an error string on failure. */ char * -readdisklabel(dev, strat, lp, osdep, spoofonly) - dev_t dev; - void (*strat)(struct buf *); - struct disklabel *lp; - struct cpu_disklabel *osdep; - int spoofonly; +readdisklabel(dev_t dev, void (*strat)(struct buf *), + struct disklabel *lp, struct cpu_disklabel *osdep, int spoofonly) { struct dos_partition dp[NDOSPART], *dp2; struct partition *pp; @@ -123,7 +119,7 @@ readdisklabel(dev, strat, lp, osdep, spoofonly) bp->b_flags = B_BUSY | B_READ; bp->b_cylinder = part_blkno / lp->d_secpercyl; (*strat)(bp); - + /* if successful, wander through dos partition table */ if (biowait(bp)) { msg = "dos partition I/O error"; @@ -304,10 +300,8 @@ done: * before setting it. */ int -setdisklabel(olp, nlp, openmask, osdep) - struct disklabel *olp, *nlp; - u_long openmask; - struct cpu_disklabel *osdep; +setdisklabel(struct disklabel *olp, struct disklabel *nlp, + u_int openmask, struct cpu_disklabel *osdep) { int i; struct partition *opp, *npp; @@ -361,11 +355,8 @@ setdisklabel(olp, nlp, openmask, osdep) * XXX cannot handle OpenBSD partitions in extended partitions! */ int -writedisklabel(dev, strat, lp, osdep) - dev_t dev; - void (*strat)(struct buf *); - struct disklabel *lp; - struct cpu_disklabel *osdep; +writedisklabel(dev_t dev, void (*strat)(struct buf *), + struct disklabel *lp, struct cpu_disklabel *osdep) { struct dos_partition dp[NDOSPART], *dp2; struct disklabel *dlp; diff --git a/sys/arch/sparc/sparc/disksubr.c b/sys/arch/sparc/sparc/disksubr.c index 52d93f284a6..23d2aade52c 100644 --- a/sys/arch/sparc/sparc/disksubr.c +++ b/sys/arch/sparc/sparc/disksubr.c @@ -1,4 +1,4 @@ -/* $OpenBSD: disksubr.c,v 1.50 2007/06/05 02:38:37 krw Exp $ */ +/* $OpenBSD: disksubr.c,v 1.51 2007/06/06 16:42:06 deraadt Exp $ */ /* $NetBSD: disksubr.c,v 1.16 1996/04/28 20:25:59 thorpej Exp $ */ /* @@ -39,22 +39,18 @@ #include <machine/cpu.h> #include <machine/autoconf.h> #include <dev/sun/disklabel.h> + #if defined(SUN4) #include <machine/oldmon.h> #endif #include "cd.h" -#if MAXPARTITIONS != 16 -#warn beware: Sun disklabel compatibility assumes MAXPARTITIONS == 16 -#endif - static char *disklabel_sun_to_bsd(char *, struct disklabel *); static int disklabel_bsd_to_sun(struct disklabel *, char *); -static __inline u_long sun_extended_sum(struct sun_disklabel *); +static __inline u_int sun_extended_sum(struct sun_disklabel *); #if NCD > 0 -/* XXX for comparison below. */ extern void cdstrategy(struct buf *); #endif @@ -71,12 +67,8 @@ extern void cdstrategy(struct buf *); * Returns null on success and an error string on failure. */ char * -readdisklabel(dev, strat, lp, clp, spoofonly) - dev_t dev; - void (*strat)(struct buf *); - struct disklabel *lp; - struct cpu_disklabel *clp; - int spoofonly; +readdisklabel(dev_t dev, void (*strat)(struct buf *), + struct disklabel *lp, struct cpu_disklabel *clp, int spoofonly) { struct buf *bp = NULL; struct disklabel *dlp; @@ -108,6 +100,23 @@ readdisklabel(dev, strat, lp, clp, spoofonly) if (spoofonly) goto done; +#if NCD > 0 + if (strat == cdstrategy) { +#if defined(CD9660) + if (iso_disklabelspoof(dev, strat, lp) == 0) { + msg = NULL; + goto done; + } +#endif +#if defined(UDF) + if (udf_disklabelspoof(dev, strat, lp) == 0) { + msg = NULL; + goto done; + } +#endif + } +#endif /* NCD > 0 */ + /* obtain buffer to probe drive with */ bp = geteblk((int)lp->d_secsize); @@ -130,32 +139,14 @@ readdisklabel(dev, strat, lp, clp, spoofonly) goto done; } -#if NCD > 0 - if (strat == cdstrategy) { -#if defined(CD9660) - if (iso_disklabelspoof(dev, strat, lp) == 0) { - msg = NULL; - goto done; - } -#endif -#if defined(UDF) - if (udf_disklabelspoof(dev, strat, lp) == 0) { - msg = NULL; - goto done; - } -#endif - } -#endif /* NCD > 0 */ - - /* Check for a Sun disk label (for PROM compatibility). */ - slp = (struct sun_disklabel *) clp->cd_block; + slp = (struct sun_disklabel *)clp->cd_block; if (slp->sl_magic == SUN_DKMAGIC) { msg = disklabel_sun_to_bsd(clp->cd_block, lp); goto done; } /* Check for a native disk label (PROM can not boot it). */ - dlp = (struct disklabel *) (clp->cd_block + LABELOFFSET); + dlp = (struct disklabel *)(clp->cd_block + LABELOFFSET); if (dlp->d_magic == DISKMAGIC) { if (dkcksum(dlp)) { msg = "disk label corrupted"; @@ -195,10 +186,8 @@ done: * before setting it. */ int -setdisklabel(olp, nlp, openmask, clp) - struct disklabel *olp, *nlp; - u_long openmask; - struct cpu_disklabel *clp; +setdisklabel(struct disklabel *olp, struct disklabel *nlp, + u_int openmask, struct cpu_disklabel *clp) { int i; struct partition *opp, *npp; @@ -218,7 +207,7 @@ setdisklabel(olp, nlp, openmask, clp) dkcksum(nlp) != 0) return (EINVAL); - while ((i = ffs((long)openmask)) != 0) { + while ((i = ffs(openmask)) != 0) { i--; openmask &= ~(1 << i); if (nlp->d_npartitions <= i) @@ -239,11 +228,8 @@ setdisklabel(olp, nlp, openmask, clp) * Current label is already in clp->cd_block[] */ int -writedisklabel(dev, strat, lp, clp) - dev_t dev; - void (*strat)(struct buf *); - struct disklabel *lp; - struct cpu_disklabel *clp; +writedisklabel(dev_t dev, void (*strat)(struct buf *), + struct disklabel *lp, struct cpu_disklabel *clp) { struct buf *bp; int error; @@ -364,23 +350,20 @@ sun_fstypes[16] = { * Given a struct sun_disklabel, assume it has an extended partition * table and compute the correct value for sl_xpsum. */ -static __inline u_long -sun_extended_sum(sl) - struct sun_disklabel *sl; +static __inline u_int +sun_extended_sum(struct sun_disklabel *sl) { - u_long lsum; - u_long *xp; - u_long *ep; + u_int sum, *xp, *ep; - xp = (u_long *) &sl->sl_xpmag; - ep = (u_long *) &sl->sl_xxx1[0]; + xp = (u_int *)&sl->sl_xpmag; + ep = (u_int *)&sl->sl_xxx1[0]; - lsum = 0; + sum = 0; for (; xp < ep; xp++) - lsum += *xp; - return(lsum); + sum += *xp; + return (sum); } - + /* * Given a SunOS disk label, set lp to a BSD disk label. * Returns NULL on success, else an error string. @@ -388,9 +371,7 @@ sun_extended_sum(sl) * The BSD label is cleared out before this is called. */ static char * -disklabel_sun_to_bsd(cp, lp) - char *cp; - struct disklabel *lp; +disklabel_sun_to_bsd(char *cp, struct disklabel *lp) { struct sun_disklabel *sl; struct partition *npp; @@ -507,9 +488,7 @@ disklabel_sun_to_bsd(cp, lp) * Returns zero or error code. */ static int -disklabel_bsd_to_sun(lp, cp) - struct disklabel *lp; - char *cp; +disklabel_bsd_to_sun(struct disklabel *lp, char *cp) { struct sun_disklabel *sl; struct partition *npp; @@ -603,9 +582,7 @@ disklabel_bsd_to_sun(lp, cp) * Return -1 if not found. */ int -isbad(bt, cyl, trk, sec) - struct dkbad *bt; - int cyl, trk, sec; +isbad(struct dkbad *bt, int cyl, int trk, int sec) { int i; long blk, bblk; diff --git a/sys/arch/sparc64/sparc64/disksubr.c b/sys/arch/sparc64/sparc64/disksubr.c index 3d81c93090a..bffd4adbc90 100644 --- a/sys/arch/sparc64/sparc64/disksubr.c +++ b/sys/arch/sparc64/sparc64/disksubr.c @@ -1,4 +1,4 @@ -/* $OpenBSD: disksubr.c,v 1.29 2007/06/05 02:38:37 krw Exp $ */ +/* $OpenBSD: disksubr.c,v 1.30 2007/06/06 16:42:06 deraadt Exp $ */ /* $NetBSD: disksubr.c,v 1.13 2000/12/17 22:39:18 pk Exp $ */ /* @@ -37,23 +37,18 @@ #include <sys/disklabel.h> #include <sys/disk.h> -#include <scsi/scsi_all.h> -#include <scsi/scsiconf.h> - -#include <dev/sun/disklabel.h> - -#include <machine/autoconf.h> #include <machine/cpu.h> +#include <machine/autoconf.h> +#include <dev/sun/disklabel.h> #include <dev/sbus/sbusvar.h> + #include "cd.h" static char *disklabel_sun_to_bsd(char *, struct disklabel *); static int disklabel_bsd_to_sun(struct disklabel *, char *); static __inline u_int sun_extended_sum(struct sun_disklabel *); -extern struct device *bootdv; - #if NCD > 0 extern void cdstrategy(struct buf *); #endif @@ -71,12 +66,8 @@ extern void cdstrategy(struct buf *); * Returns null on success and an error string on failure. */ char * -readdisklabel(dev, strat, lp, clp, spoofonly) - dev_t dev; - void (*strat)(struct buf *); - struct disklabel *lp; - struct cpu_disklabel *clp; - int spoofonly; +readdisklabel(dev_t dev, void (*strat)(struct buf *), + struct disklabel *lp, struct cpu_disklabel *clp, int spoofonly) { struct buf *bp = NULL; struct disklabel *dlp; @@ -133,7 +124,7 @@ readdisklabel(dev, strat, lp, clp, spoofonly) bp->b_blkno = LABELSECTOR; bp->b_cylinder = 0; bp->b_bcount = lp->d_secsize; - bp->b_flags |= B_BUSY | B_READ; + bp->b_flags = B_BUSY | B_READ; (*strat)(bp); /* if successful, locate disk label within block and validate */ @@ -147,14 +138,14 @@ readdisklabel(dev, strat, lp, clp, spoofonly) goto done; } - slp = (struct sun_disklabel *) clp->cd_block; + slp = (struct sun_disklabel *)clp->cd_block; if (slp->sl_magic == SUN_DKMAGIC) { msg = disklabel_sun_to_bsd(clp->cd_block, lp); goto done; } /* Check for a native disk label (PROM can not boot it). */ - dlp = (struct disklabel *) (clp->cd_block + LABELOFFSET); + dlp = (struct disklabel *)(clp->cd_block + LABELOFFSET); if (dlp->d_magic == DISKMAGIC) { if (dkcksum(dlp)) { msg = "disk label corrupted"; @@ -166,7 +157,7 @@ readdisklabel(dev, strat, lp, clp, spoofonly) } #if defined(CD9660) - if (iso_disklabelspoof(dev, strat, lp) == NULL) { + if (iso_disklabelspoof(dev, strat, lp) == 0) { msg = NULL; goto done; } @@ -194,10 +185,8 @@ done: * before setting it. */ int -setdisklabel(olp, nlp, openmask, clp) - struct disklabel *olp, *nlp; - u_long openmask; - struct cpu_disklabel *clp; +setdisklabel(struct disklabel *olp, struct disklabel *nlp, + u_int openmask, struct cpu_disklabel *clp) { int i; struct partition *opp, *npp; @@ -217,7 +206,7 @@ setdisklabel(olp, nlp, openmask, clp) dkcksum(nlp) != 0) return (EINVAL); - while ((i = ffs((long)openmask)) != 0) { + while ((i = ffs(openmask)) != 0) { i--; openmask &= ~(1 << i); if (nlp->d_npartitions <= i) @@ -238,16 +227,15 @@ setdisklabel(olp, nlp, openmask, clp) * Current label is already in clp->cd_block[] */ int -writedisklabel(dev, strat, lp, clp) - dev_t dev; - void (*strat)(struct buf *); - struct disklabel *lp; - struct cpu_disklabel *clp; +writedisklabel(dev_t dev, void (*strat)(struct buf *), + struct disklabel *lp, struct cpu_disklabel *clp) { struct buf *bp; int error; error = disklabel_bsd_to_sun(lp, clp->cd_block); + if (error) + return (error); #if 0 /* XXX - Allow writing native disk labels? */ { @@ -266,7 +254,7 @@ writedisklabel(dev, strat, lp, clp) bp->b_blkno = LABELSECTOR; bp->b_cylinder = 0; bp->b_bcount = lp->d_secsize; - bp->b_flags |= B_WRITE; + bp->b_flags = B_WRITE; (*strat)(bp); error = biowait(bp); brelse(bp); @@ -354,7 +342,7 @@ sun_fstypes[16] = { FS_BSDFFS, /* m */ FS_BSDFFS, /* n */ FS_BSDFFS, /* o */ - FS_BSDFFS, /* p */ + FS_BSDFFS /* p */ }; /* @@ -362,20 +350,17 @@ sun_fstypes[16] = { * table and compute the correct value for sl_xpsum. */ static __inline u_int -sun_extended_sum(sl) - struct sun_disklabel *sl; +sun_extended_sum(struct sun_disklabel *sl) { - u_int lsum; - u_int *xp; - u_int *ep; + u_int sum, *xp, *ep; xp = (u_int *)&sl->sl_xpmag; ep = (u_int *)&sl->sl_xxx1[0]; - lsum = 0; + sum = 0; for (; xp < ep; xp++) - lsum += *xp; - return(lsum); + sum += *xp; + return (sum); } /* @@ -385,9 +370,7 @@ sun_extended_sum(sl) * The BSD label is cleared out before this is called. */ static char * -disklabel_sun_to_bsd(cp, lp) - char *cp; - struct disklabel *lp; +disklabel_sun_to_bsd(char *cp, struct disklabel *lp) { struct sun_disklabel *sl; struct partition *npp; @@ -504,9 +487,7 @@ disklabel_sun_to_bsd(cp, lp) * Returns zero or error code. */ static int -disklabel_bsd_to_sun(lp, cp) - struct disklabel *lp; - char *cp; +disklabel_bsd_to_sun(struct disklabel *lp, char *cp) { struct sun_disklabel *sl; struct partition *npp; diff --git a/sys/arch/vax/vax/disksubr.c b/sys/arch/vax/vax/disksubr.c index be54a5f28c4..c6116937153 100644 --- a/sys/arch/vax/vax/disksubr.c +++ b/sys/arch/vax/vax/disksubr.c @@ -1,4 +1,4 @@ -/* $OpenBSD: disksubr.c,v 1.41 2007/06/05 02:38:37 krw Exp $ */ +/* $OpenBSD: disksubr.c,v 1.42 2007/06/06 16:42:07 deraadt Exp $ */ /* $NetBSD: disksubr.c,v 1.21 1999/06/30 18:48:06 ragge Exp $ */ /* @@ -95,7 +95,7 @@ bounds_check_with_label(struct buf *bp, struct disklabel *lp, } /* calculate cylinder for disksort to order transfers with */ - bp->b_cylinder = (bp->b_blkno + DL_GETPOFFSET(p)) / lp->d_secpercyl; + bp->b_cylinder = (bp->b_blkno + DL_GETPOFFSET(p)) / lp->d_secpercyl; return (1); bad: @@ -112,12 +112,8 @@ bad: * Returns null on success and an error string on failure. */ char * -readdisklabel(dev, strat, lp, osdep, spoofonly) - dev_t dev; - void (*strat)(struct buf *); - struct disklabel *lp; - struct cpu_disklabel *osdep; - int spoofonly; +readdisklabel(dev_t dev, void (*strat)(struct buf *), + struct disklabel *lp, struct cpu_disklabel *osdep, int spoofonly) { struct buf *bp = NULL; struct disklabel *dlp; @@ -192,10 +188,8 @@ done: * before setting it. */ int -setdisklabel(olp, nlp, openmask, osdep) - struct disklabel *olp, *nlp; - u_long openmask; - struct cpu_disklabel *osdep; +setdisklabel(struct disklabel *olp, struct disklabel *nlp, + u_int openmask, struct cpu_disklabel *osdep) { int i; struct partition *opp, *npp; @@ -210,12 +204,12 @@ setdisklabel(olp, nlp, openmask, osdep) *olp = *nlp; return (0); } - + if (nlp->d_magic != DISKMAGIC || nlp->d_magic2 != DISKMAGIC || dkcksum(nlp) != 0) return (EINVAL); - while ((i = ffs((long)openmask)) != 0) { + while ((i = ffs(openmask)) != 0) { i--; openmask &= ~(1 << i); if (nlp->d_npartitions <= i) @@ -246,11 +240,8 @@ setdisklabel(olp, nlp, openmask, osdep) * Always allow writing of disk label; even if the disk is unlabeled. */ int -writedisklabel(dev, strat, lp, osdep) - dev_t dev; - void (*strat)(struct buf *); - struct disklabel *lp; - struct cpu_disklabel *osdep; +writedisklabel(dev_t dev, void (*strat)(struct buf *), + struct disklabel *lp, struct cpu_disklabel *osdep) { struct buf *bp; struct disklabel *dlp; @@ -277,13 +268,12 @@ done: return (error); } -/* +/* * Print out the name of the device; ex. TK50, RA80. DEC uses a common * disk type encoding scheme for most of its disks. - */ -void -disk_printtype(unit, type) - int unit, type; + */ +void +disk_printtype(int unit, int type) { printf(" drive %d: %c%c", unit, (int)MSCP_MID_CHAR(2, type), (int)MSCP_MID_CHAR(1, type)); @@ -298,10 +288,7 @@ disk_printtype(unit, type) * also map it in. */ void -disk_reallymapin(bp, map, reg, flag) - struct buf *bp; - pt_entry_t *map; - int reg, flag; +disk_reallymapin(struct buf *bp, pt_entry_t *map, int reg, int flag) { struct proc *p; volatile pt_entry_t *io; |