diff options
author | Theo de Raadt <deraadt@cvs.openbsd.org> | 2007-06-06 16:42:08 +0000 |
---|---|---|
committer | Theo de Raadt <deraadt@cvs.openbsd.org> | 2007-06-06 16:42:08 +0000 |
commit | d11216cf36578f6f06482da63b45f1cf02b7ec1d (patch) | |
tree | 008bf85dd65940c398ccaedb1376261a1e08d850 /sys/arch/hppa64 | |
parent | 32d210caa068e883bc0c0c7804fd07bc1fefdcad (diff) |
a fair sprinking of knf, code movement, and sometimes character-by-character
accuracy so that the variious disksubr.c's can be compared easier.
setdisklabel() starts taking an int for openmask.
ok krw, and read by quite a few other people
Diffstat (limited to 'sys/arch/hppa64')
-rw-r--r-- | sys/arch/hppa64/hppa64/disksubr.c | 61 |
1 files changed, 21 insertions, 40 deletions
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; |