diff options
author | Kenneth R Westerback <krw@cvs.openbsd.org> | 2007-06-07 02:55:13 +0000 |
---|---|---|
committer | Kenneth R Westerback <krw@cvs.openbsd.org> | 2007-06-07 02:55:13 +0000 |
commit | 572bcf7550756be8a3c77f603b85107ecd0ed711 (patch) | |
tree | 9783b5b60d44f323766a8138d156c885cf9ee152 /sys/arch | |
parent | 82e0666f1407874b64db25cbcb158c5e7b685c2f (diff) |
Eliminate unnecessary duplicate defines *_LABELSECTOR and
*_LABELOFFSET. Don't use osdep->labelsector since it will always be
LABELSECTOR, since we don't support extended DOS partitions holding
the OpenBSD disk label.
No functional change. Now only Alpha and Vax bounds_check_with_label
differ by more than comments.
Diffstat (limited to 'sys/arch')
-rw-r--r-- | sys/arch/hppa/hppa/disksubr.c | 26 | ||||
-rw-r--r-- | sys/arch/hppa/include/disklabel.h | 11 | ||||
-rw-r--r-- | sys/arch/hppa64/hppa64/disksubr.c | 26 | ||||
-rw-r--r-- | sys/arch/hppa64/include/disklabel.h | 11 | ||||
-rw-r--r-- | sys/arch/mips64/include/disklabel.h | 11 | ||||
-rw-r--r-- | sys/arch/mips64/mips64/disksubr.c | 26 |
6 files changed, 33 insertions, 78 deletions
diff --git a/sys/arch/hppa/hppa/disksubr.c b/sys/arch/hppa/hppa/disksubr.c index e7e99200561..30f652bc002 100644 --- a/sys/arch/hppa/hppa/disksubr.c +++ b/sys/arch/hppa/hppa/disksubr.c @@ -1,4 +1,4 @@ -/* $OpenBSD: disksubr.c,v 1.56 2007/06/07 00:28:17 krw Exp $ */ +/* $OpenBSD: disksubr.c,v 1.57 2007/06/07 02:55:11 krw Exp $ */ /* * Copyright (c) 1999 Michael Shalayeff @@ -166,10 +166,6 @@ readdisklabel(dev_t dev, void (*strat)(struct buf *), *lp = minilabel; } } - /* Record metainformation about the disklabel. */ - if (msg == NULL) { - osdep->labelsector = bp->b_blkno; - } #if defined(CD9660) if (msg && iso_disklabelspoof(dev, strat, lp) == 0) @@ -227,7 +223,7 @@ readdoslabel(struct buf *bp, void (*strat)(struct buf *), /* do dos partitions in the process of getting disklabel? */ dospartoff = 0; - cyl = I386_LABELSECTOR / lp->d_secpercyl; + cyl = LABELSECTOR / lp->d_secpercyl; /* * Read dos partition table, follow extended partitions. @@ -382,7 +378,7 @@ notfat: *cylp = cyl; /* next, dig out disk label */ - msg = readbsdlabel(bp, strat, cyl, dospartoff + I386_LABELSECTOR, -1, + msg = readbsdlabel(bp, strat, cyl, dospartoff + LABELSECTOR, -1, lp, spoofonly); return (msg); @@ -541,8 +537,8 @@ readliflabel(struct buf *bp, void (*strat)(struct buf *), if (partoffp) *partoffp = fsoff; - return readbsdlabel(bp, strat, 0, fsoff + HPPA_LABELSECTOR, - HPPA_LABELOFFSET, lp, spoofonly); + return readbsdlabel(bp, strat, 0, fsoff + LABELSECTOR, + LABELOFFSET, lp, spoofonly); } /* @@ -624,19 +620,13 @@ writedisklabel(dev_t dev, void (*strat)(struct buf *), bp = geteblk((int)lp->d_secsize); bp->b_dev = dev; - /* - * I once played with the thought of using osdep->label{tag,sector} - * as a cache for knowing where (and what) to write. However, now I - * think it might be useful to reprobe if someone has written - * a newer disklabel of another type with disklabel(8) and -r. - */ dl = *lp; msg = readliflabel(bp, strat, &dl, &cdl, &partoff, &cyl, 0); - labeloffset = HPPA_LABELOFFSET; + labeloffset = LABELOFFSET; if (msg) { dl = *lp; msg = readdoslabel(bp, strat, &dl, &cdl, &partoff, &cyl, 0); - labeloffset = I386_LABELOFFSET; + labeloffset = LABELOFFSET; } if (msg) { if (partoff == -1) @@ -672,7 +662,7 @@ bounds_check_with_label(struct buf *bp, struct disklabel *lp, #define blockpersec(count, lp) ((count) * (((lp)->d_secsize) / DEV_BSIZE)) struct partition *p = lp->d_partitions + DISKPART(bp->b_dev); int labelsector = blockpersec(DL_GETPOFFSET(&lp->d_partitions[RAW_PART]), lp) + - osdep->labelsector; + LABELSECTOR; int sz = howmany(bp->b_bcount, DEV_BSIZE); /* avoid division by zero */ diff --git a/sys/arch/hppa/include/disklabel.h b/sys/arch/hppa/include/disklabel.h index bd55a73966e..a810e85eab3 100644 --- a/sys/arch/hppa/include/disklabel.h +++ b/sys/arch/hppa/include/disklabel.h @@ -1,4 +1,4 @@ -/* $OpenBSD: disklabel.h,v 1.16 2006/10/20 23:47:42 krw Exp $ */ +/* $OpenBSD: disklabel.h,v 1.17 2007/06/07 02:55:12 krw Exp $ */ /* $NetBSD: disklabel.h,v 1.1 1995/02/13 23:07:34 cgd Exp $ */ /* @@ -34,13 +34,8 @@ #ifndef _MACHINE_DISKLABEL_H_ #define _MACHINE_DISKLABEL_H_ -#define HPPA_LABELSECTOR 1 /* sector containing label */ -#define HPPA_LABELOFFSET 0 /* offset of label in sector */ -#define I386_LABELSECTOR 1 /* sector containing label */ -#define I386_LABELOFFSET 0 /* offset of label in sector */ - -#define LABELSECTOR HPPA_LABELSECTOR -#define LABELOFFSET HPPA_LABELOFFSET +#define LABELSECTOR 1 +#define LABELOFFSET 0 #define MAXPARTITIONS 16 /* number of partitions */ #define RAW_PART 2 /* raw partition: xx?c */ diff --git a/sys/arch/hppa64/hppa64/disksubr.c b/sys/arch/hppa64/hppa64/disksubr.c index d99940532b2..9feb21e710d 100644 --- a/sys/arch/hppa64/hppa64/disksubr.c +++ b/sys/arch/hppa64/hppa64/disksubr.c @@ -1,4 +1,4 @@ -/* $OpenBSD: disksubr.c,v 1.39 2007/06/07 00:28:17 krw Exp $ */ +/* $OpenBSD: disksubr.c,v 1.40 2007/06/07 02:55:12 krw Exp $ */ /* * Copyright (c) 1999 Michael Shalayeff @@ -166,10 +166,6 @@ readdisklabel(dev_t dev, void (*strat)(struct buf *), *lp = minilabel; } } - /* Record metainformation about the disklabel. */ - if (msg == NULL) { - osdep->labelsector = bp->b_blkno; - } #if defined(CD9660) if (msg && iso_disklabelspoof(dev, strat, lp) == 0) @@ -227,7 +223,7 @@ readdoslabel(struct buf *bp, void (*strat)(struct buf *), /* do dos partitions in the process of getting disklabel? */ dospartoff = 0; - cyl = I386_LABELSECTOR / lp->d_secpercyl; + cyl = LABELSECTOR / lp->d_secpercyl; /* * Read dos partition table, follow extended partitions. @@ -382,7 +378,7 @@ notfat: *cylp = cyl; /* next, dig out disk label */ - msg = readbsdlabel(bp, strat, cyl, dospartoff + I386_LABELSECTOR, -1, + msg = readbsdlabel(bp, strat, cyl, dospartoff + LABELSECTOR, -1, lp, spoofonly); return (msg); @@ -541,8 +537,8 @@ readliflabel(struct buf *bp, void (*strat)(struct buf *), if (partoffp) *partoffp = fsoff; - return readbsdlabel(bp, strat, 0, fsoff + HPPA_LABELSECTOR, - HPPA_LABELOFFSET, lp, spoofonly); + return readbsdlabel(bp, strat, 0, fsoff + LABELSECTOR, + LABELOFFSET, lp, spoofonly); } /* @@ -624,19 +620,13 @@ writedisklabel(dev_t dev, void (*strat)(struct buf *), bp = geteblk((int)lp->d_secsize); bp->b_dev = dev; - /* - * I once played with the thought of using osdep->label{tag,sector} - * as a cache for knowing where (and what) to write. However, now I - * think it might be useful to reprobe if someone has written - * a newer disklabel of another type with disklabel(8) and -r. - */ dl = *lp; msg = readliflabel(bp, strat, &dl, &cdl, &partoff, &cyl, 0); - labeloffset = HPPA_LABELOFFSET; + labeloffset = LABELOFFSET; if (msg) { dl = *lp; msg = readdoslabel(bp, strat, &dl, &cdl, &partoff, &cyl, 0); - labeloffset = I386_LABELOFFSET; + labeloffset = LABELOFFSET; } if (msg) { if (partoff == -1) @@ -672,7 +662,7 @@ bounds_check_with_label(struct buf *bp, struct disklabel *lp, #define blockpersec(count, lp) ((count) * (((lp)->d_secsize) / DEV_BSIZE)) struct partition *p = lp->d_partitions + DISKPART(bp->b_dev); int labelsector = blockpersec(DL_GETPOFFSET(&lp->d_partitions[RAW_PART]), lp) + - osdep->labelsector; + LABELSECTOR; int sz = howmany(bp->b_bcount, DEV_BSIZE); /* avoid division by zero */ diff --git a/sys/arch/hppa64/include/disklabel.h b/sys/arch/hppa64/include/disklabel.h index 9004cc4183b..83ea80baf88 100644 --- a/sys/arch/hppa64/include/disklabel.h +++ b/sys/arch/hppa64/include/disklabel.h @@ -1,4 +1,4 @@ -/* $OpenBSD: disklabel.h,v 1.10 2006/10/20 23:47:42 krw Exp $ */ +/* $OpenBSD: disklabel.h,v 1.11 2007/06/07 02:55:12 krw Exp $ */ /* $NetBSD: disklabel.h,v 1.1 1995/02/13 23:07:34 cgd Exp $ */ /* @@ -34,13 +34,8 @@ #ifndef _MACHINE_DISKLABEL_H_ #define _MACHINE_DISKLABEL_H_ -#define HPPA_LABELSECTOR 1 /* sector containing label */ -#define HPPA_LABELOFFSET 0 /* offset of label in sector */ -#define I386_LABELSECTOR 1 /* sector containing label */ -#define I386_LABELOFFSET 0 /* offset of label in sector */ - -#define LABELSECTOR HPPA_LABELSECTOR -#define LABELOFFSET HPPA_LABELOFFSET +#define LABELSECTOR 1 +#define LABELOFFSET 0 #define MAXPARTITIONS 16 /* number of partitions */ #define RAW_PART 2 /* raw partition: xx?c */ diff --git a/sys/arch/mips64/include/disklabel.h b/sys/arch/mips64/include/disklabel.h index 0e33042e0fe..7d2fac63bb2 100644 --- a/sys/arch/mips64/include/disklabel.h +++ b/sys/arch/mips64/include/disklabel.h @@ -1,4 +1,4 @@ -/* $OpenBSD: disklabel.h,v 1.12 2006/10/20 23:47:43 krw Exp $ */ +/* $OpenBSD: disklabel.h,v 1.13 2007/06/07 02:55:12 krw Exp $ */ /* $NetBSD: disklabel.h,v 1.1 1995/02/13 23:07:34 cgd Exp $ */ /* @@ -34,13 +34,8 @@ #ifndef _MACHINE_DISKLABEL_H_ #define _MACHINE_DISKLABEL_H_ -#define SGI_LABELSECTOR 1 /* sector containing label */ -#define SGI_LABELOFFSET 0 /* offset of label in sector */ -#define I386_LABELSECTOR 1 /* sector containing label */ -#define I386_LABELOFFSET 0 /* offset of label in sector */ - -#define LABELSECTOR SGI_LABELSECTOR -#define LABELOFFSET SGI_LABELOFFSET +#define LABELSECTOR 1 +#define LABELOFFSET 0 #define MAXPARTITIONS 16 /* number of partitions */ #define RAW_PART 2 /* raw partition: xx?c */ diff --git a/sys/arch/mips64/mips64/disksubr.c b/sys/arch/mips64/mips64/disksubr.c index dc3db50d47c..4b3b12b3ad7 100644 --- a/sys/arch/mips64/mips64/disksubr.c +++ b/sys/arch/mips64/mips64/disksubr.c @@ -1,4 +1,4 @@ -/* $OpenBSD: disksubr.c,v 1.45 2007/06/07 00:28:17 krw Exp $ */ +/* $OpenBSD: disksubr.c,v 1.46 2007/06/07 02:55:12 krw Exp $ */ /* * Copyright (c) 1999 Michael Shalayeff @@ -171,10 +171,6 @@ readdisklabel(dev_t dev, void (*strat)(struct buf *), *lp = minilabel; } } - /* Record metainformation about the disklabel. */ - if (msg == NULL) { - osdep->labelsector = bp->b_blkno; - } #if defined(CD9660) if (msg && iso_disklabelspoof(dev, strat, lp) == 0) @@ -237,7 +233,7 @@ readdoslabel(bp, strat, lp, osdep, partoffp, cylp, spoofonly) /* do dos partitions in the process of getting disklabel? */ dospartoff = 0; - cyl = I386_LABELSECTOR / lp->d_secpercyl; + cyl = LABELSECTOR / lp->d_secpercyl; /* * Read dos partition table, follow extended partitions. @@ -392,7 +388,7 @@ notfat: *cylp = cyl; /* next, dig out disk label */ - msg = readbsdlabel(bp, strat, cyl, dospartoff + I386_LABELSECTOR, -1, + msg = readbsdlabel(bp, strat, cyl, dospartoff + LABELSECTOR, -1, lp, spoofonly); return (msg); @@ -470,8 +466,8 @@ readsgilabel(bp, strat, lp, osdep, partoffp, cylp, spoofonly) if (partoffp) *partoffp = fsoffs; - msg = readbsdlabel(bp, strat, 0, fsoffs + SGI_LABELSECTOR, - SGI_LABELOFFSET, lp, spoofonly); + msg = readbsdlabel(bp, strat, 0, fsoffs + LABELSECTOR, + LABELOFFSET, lp, spoofonly); return msg; } @@ -583,19 +579,13 @@ writedisklabel(dev_t dev, void (*strat)(struct buf *), bp = geteblk((int)lp->d_secsize); bp->b_dev = dev; - /* - * I once played with the thought of using osdep->label{tag,sector} - * as a cache for knowing where (and what) to write. However, now I - * think it might be useful to reprobe if someone has written - * a newer disklabel of another type with disklabel(8) and -r. - */ dl = *lp; msg = readsgilabel(bp, strat, &dl, &cdl, &partoff, &cyl, 0); - labeloffset = SGI_LABELOFFSET; + labeloffset = LABELOFFSET; if (msg) { dl = *lp; msg = readdoslabel(bp, strat, &dl, &cdl, &partoff, &cyl, 0); - labeloffset = I386_LABELOFFSET; + labeloffset = LABELOFFSET; } if (msg) { if (partoff == -1) @@ -631,7 +621,7 @@ bounds_check_with_label(struct buf *bp, struct disklabel *lp, #define blockpersec(count, lp) ((count) * (((lp)->d_secsize) / DEV_BSIZE)) struct partition *p = lp->d_partitions + DISKPART(bp->b_dev); int labelsector = blockpersec(DL_GETPOFFSET(&lp->d_partitions[RAW_PART]), lp) + - osdep->labelsector; + LABELSECTOR; int sz = howmany(bp->b_bcount, DEV_BSIZE); /* avoid division by zero */ |