diff options
author | Theo de Raadt <deraadt@cvs.openbsd.org> | 2009-06-04 21:13:04 +0000 |
---|---|---|
committer | Theo de Raadt <deraadt@cvs.openbsd.org> | 2009-06-04 21:13:04 +0000 |
commit | 493210897221d7a7520ed88494339623a8d0cbb9 (patch) | |
tree | 437b23c9f66b7621e795b1a7278f3e5786b0ff8a /sys | |
parent | feadbccc8166eb1acafe6168fece9b1756dfb533 (diff) |
Recycle four ancient fields in the disklabel structure, replacing them with
bounds information, ie. the zone of the disk that OpenBSD can use. Have each
pre-disklabel parser (MBR, DPME, or per-arch MD disklabel parsers) figure out
this area and pass it up to userland. Then, delete all the same disk parsing
code from disklabel(8) since the kernel passes it up. Lots and lots of - signs
in the disklabel(8) code.
Tested on as many platforms as possible, the fallout will be repaired as time
goes on. To test, use disklabel -d <drive> and validate that the bounds do not
overlap any boot blocks. This same information is used by disklabel -A...
OK for the concept from krw, miod, and drahn
Diffstat (limited to 'sys')
-rw-r--r-- | sys/arch/alpha/alpha/disksubr.c | 4 | ||||
-rw-r--r-- | sys/arch/hp300/hp300/disksubr.c | 4 | ||||
-rw-r--r-- | sys/arch/hppa/hppa/disksubr.c | 8 | ||||
-rw-r--r-- | sys/arch/luna88k/luna88k/disksubr.c | 6 | ||||
-rw-r--r-- | sys/arch/macppc/macppc/disksubr.c | 16 | ||||
-rw-r--r-- | sys/arch/sgi/sgi/disksubr.c | 8 | ||||
-rw-r--r-- | sys/arch/socppc/socppc/disksubr.c | 16 | ||||
-rw-r--r-- | sys/arch/sparc/sparc/disksubr.c | 12 | ||||
-rw-r--r-- | sys/arch/sparc64/sparc64/disksubr.c | 6 | ||||
-rw-r--r-- | sys/arch/vax/vax/disksubr.c | 6 | ||||
-rw-r--r-- | sys/kern/subr_disk.c | 25 | ||||
-rw-r--r-- | sys/sys/disklabel.h | 34 |
12 files changed, 88 insertions, 57 deletions
diff --git a/sys/arch/alpha/alpha/disksubr.c b/sys/arch/alpha/alpha/disksubr.c index 30fed88279c..9d35841482c 100644 --- a/sys/arch/alpha/alpha/disksubr.c +++ b/sys/arch/alpha/alpha/disksubr.c @@ -1,4 +1,4 @@ -/* $OpenBSD: disksubr.c,v 1.92 2008/06/12 06:58:31 deraadt Exp $ */ +/* $OpenBSD: disksubr.c,v 1.93 2009/06/04 21:13:00 deraadt Exp $ */ /* $NetBSD: disksubr.c,v 1.21 1996/05/03 19:42:03 christos Exp $ */ /* @@ -74,7 +74,7 @@ readdisklabel(dev_t dev, void (*strat)(struct buf *), goto done; } - msg = checkdisklabel(bp->b_data + LABELOFFSET, lp); + msg = checkdisklabel(bp->b_data + LABELOFFSET, lp, 0, DL_GETDSIZE(lp)); if (msg == NULL) goto done; diff --git a/sys/arch/hp300/hp300/disksubr.c b/sys/arch/hp300/hp300/disksubr.c index 8b1df78cbeb..c7750499c1f 100644 --- a/sys/arch/hp300/hp300/disksubr.c +++ b/sys/arch/hp300/hp300/disksubr.c @@ -1,4 +1,4 @@ -/* $OpenBSD: disksubr.c,v 1.44 2008/06/12 06:58:33 deraadt Exp $ */ +/* $OpenBSD: disksubr.c,v 1.45 2009/06/04 21:13:01 deraadt Exp $ */ /* $NetBSD: disksubr.c,v 1.9 1997/04/01 03:12:13 scottr Exp $ */ /* @@ -75,7 +75,7 @@ readdisklabel(dev_t dev, void (*strat)(struct buf *), goto done; } - msg = checkdisklabel(bp->b_data + LABELOFFSET, lp); + msg = checkdisklabel(bp->b_data + LABELOFFSET, lp, 0, DL_GETDSIZE(lp)); if (msg == NULL) goto done; diff --git a/sys/arch/hppa/hppa/disksubr.c b/sys/arch/hppa/hppa/disksubr.c index 8c46091d841..df0df856259 100644 --- a/sys/arch/hppa/hppa/disksubr.c +++ b/sys/arch/hppa/hppa/disksubr.c @@ -1,4 +1,4 @@ -/* $OpenBSD: disksubr.c,v 1.72 2008/06/12 06:58:34 deraadt Exp $ */ +/* $OpenBSD: disksubr.c,v 1.73 2009/06/04 21:13:01 deraadt Exp $ */ /* * Copyright (c) 1999 Michael Shalayeff @@ -213,6 +213,9 @@ finished: if (partoffp) *partoffp = fsoff; + DL_SETBSTART(lp, fsoff); + DL_SETBEND(lp, DL_GETDSIZE(lp)); /* XXX */ + if (spoofonly) goto done; @@ -227,7 +230,8 @@ finished: goto done; } - return checkdisklabel(bp->b_data + LABELOFFSET, lp); + return checkdisklabel(bp->b_data + LABELOFFSET, lp, fsoff, + DL_GETDSIZE(lp)); /* XXX */ done: if (dbp) { diff --git a/sys/arch/luna88k/luna88k/disksubr.c b/sys/arch/luna88k/luna88k/disksubr.c index f7b4647c345..a8a30325008 100644 --- a/sys/arch/luna88k/luna88k/disksubr.c +++ b/sys/arch/luna88k/luna88k/disksubr.c @@ -1,4 +1,4 @@ -/* $OpenBSD: disksubr.c,v 1.40 2009/05/21 23:45:48 krw Exp $ */ +/* $OpenBSD: disksubr.c,v 1.41 2009/06/04 21:13:01 deraadt Exp $ */ /* $NetBSD: disksubr.c,v 1.12 2002/02/19 17:09:44 wiz Exp $ */ /* @@ -138,7 +138,7 @@ readdisklabel(dev_t dev, void (*strat)(struct buf *), goto done; } - msg = checkdisklabel(bp->b_data + LABELOFFSET, lp); + msg = checkdisklabel(bp->b_data + LABELOFFSET, lp, 0, DL_GETDSIZE(lp)); if (msg == NULL) goto done; @@ -312,7 +312,7 @@ disklabel_om_to_bsd(struct sun_disklabel *sl, struct disklabel *lp) lp->d_checksum = 0; lp->d_checksum = dkcksum(lp); - return (checkdisklabel(lp, lp)); + return (checkdisklabel(lp, lp, 0, DL_GETDSIZE(lp))); } /* diff --git a/sys/arch/macppc/macppc/disksubr.c b/sys/arch/macppc/macppc/disksubr.c index c0b3769fa33..494ea445e79 100644 --- a/sys/arch/macppc/macppc/disksubr.c +++ b/sys/arch/macppc/macppc/disksubr.c @@ -1,4 +1,4 @@ -/* $OpenBSD: disksubr.c,v 1.61 2008/08/24 12:56:17 krw Exp $ */ +/* $OpenBSD: disksubr.c,v 1.62 2009/06/04 21:13:02 deraadt Exp $ */ /* $NetBSD: disksubr.c,v 1.21 1996/05/03 19:42:03 christos Exp $ */ /* @@ -106,11 +106,9 @@ readdpmelabel(struct buf *bp, void (*strat)(struct buf *), struct disklabel *lp, int *partoffp, int spoofonly) { int i, part_cnt, n, hfspartoff = -1; + u_int hfspartlen; struct part_map_entry *part; - if (partoffp) - *partoffp = hfspartoff; - /* First check for a DPME (HFS) disklabel */ bp->b_blkno = 1; bp->b_bcount = lp->d_secsize; @@ -145,6 +143,7 @@ readdpmelabel(struct buf *bp, void (*strat)(struct buf *), if (strcmp(part->pmPartType, PART_TYPE_OPENBSD) == 0) { hfspartoff = part->pmPyPartStart - LABELSECTOR; + hfspartlen = part->pmPartBlkCnt; if (partoffp) { *partoffp = hfspartoff; return (NULL); @@ -163,12 +162,14 @@ readdpmelabel(struct buf *bp, void (*strat)(struct buf *), pp->p_fstype = FS_HFS; n++; } + + DL_SETBSTART(lp, hfspartoff); + DL_SETBEND(lp, hfspartoff + hfspartlen); } + if (hfspartoff == -1) return ("no OpenBSD partition inside DPME label"); - lp->d_npartitions = MAXPARTITIONS; - if (spoofonly) return (NULL); @@ -180,7 +181,8 @@ readdpmelabel(struct buf *bp, void (*strat)(struct buf *), if (biowait(bp)) return("disk label I/O error"); - return checkdisklabel(bp->b_data + LABELOFFSET, lp); + return checkdisklabel(bp->b_data + LABELOFFSET, lp, hfspartoff, + hfspartoff + hfspartlen); } /* diff --git a/sys/arch/sgi/sgi/disksubr.c b/sys/arch/sgi/sgi/disksubr.c index 7a0646fb8fe..4be24dee9c4 100644 --- a/sys/arch/sgi/sgi/disksubr.c +++ b/sys/arch/sgi/sgi/disksubr.c @@ -1,4 +1,4 @@ -/* $OpenBSD: disksubr.c,v 1.13 2009/05/28 17:05:50 miod Exp $ */ +/* $OpenBSD: disksubr.c,v 1.14 2009/06/04 21:13:02 deraadt Exp $ */ /* * Copyright (c) 1999 Michael Shalayeff @@ -117,6 +117,7 @@ readsgilabel(struct buf *bp, void (*strat)(struct buf *), char *msg = NULL; int i, *p, cs = 0; int fsoffs = 0; + u_int fslen; int offset; if (partoffp) @@ -142,6 +143,7 @@ readsgilabel(struct buf *bp, void (*strat)(struct buf *), goto done; } fsoffs = dlp->partitions[0].first * (dlp->dp.dp_secbytes / DEV_BSIZE); + fslen = dlp->partitions[0].blocks * (dlp->dp.dp_secbytes / DEV_BSIZE); /* * If the disklabel is about to be written to disk, don't modify it! @@ -189,6 +191,8 @@ readsgilabel(struct buf *bp, void (*strat)(struct buf *), } } + DL_GETBSTART(lp, fsoffs); + DL_GETBSIZE(lp, fsoffs + fslen); lp->d_version = 1; lp->d_flags = D_VENDOR; lp->d_checksum = 0; @@ -208,7 +212,7 @@ finished: goto done; } - return checkdisklabel(bp->b_data + offset, lp); + return checkdisklabel(bp->b_data + offset, lp, fsoffs, fsoffs + fslen); done: return (msg); diff --git a/sys/arch/socppc/socppc/disksubr.c b/sys/arch/socppc/socppc/disksubr.c index 7cba2a80a9a..4ecf30af00a 100644 --- a/sys/arch/socppc/socppc/disksubr.c +++ b/sys/arch/socppc/socppc/disksubr.c @@ -1,4 +1,4 @@ -/* $OpenBSD: disksubr.c,v 1.5 2008/08/24 12:56:17 krw Exp $ */ +/* $OpenBSD: disksubr.c,v 1.6 2009/06/04 21:13:02 deraadt Exp $ */ /* $NetBSD: disksubr.c,v 1.21 1996/05/03 19:42:03 christos Exp $ */ /* @@ -106,11 +106,9 @@ readdpmelabel(struct buf *bp, void (*strat)(struct buf *), struct disklabel *lp, int *partoffp, int spoofonly) { int i, part_cnt, n, hfspartoff = -1; + u_int hfspartlen; struct part_map_entry *part; - if (partoffp) - *partoffp = hfspartoff; - /* First check for a DPME (HFS) disklabel */ bp->b_blkno = 1; bp->b_bcount = lp->d_secsize; @@ -145,6 +143,7 @@ readdpmelabel(struct buf *bp, void (*strat)(struct buf *), if (strcmp(part->pmPartType, PART_TYPE_OPENBSD) == 0) { hfspartoff = part->pmPyPartStart - LABELSECTOR; + hfspartlen = part->pmPartBlkCnt; if (partoffp) { *partoffp = hfspartoff; return (NULL); @@ -163,12 +162,14 @@ readdpmelabel(struct buf *bp, void (*strat)(struct buf *), pp->p_fstype = FS_HFS; n++; } + + DL_SETBSTART(lp, hfspartoff); + DL_SETBEND(lp, hfspartoff + hfspartlen); } + if (hfspartoff == -1) return ("no OpenBSD partition inside DPME label"); - lp->d_npartitions = MAXPARTITIONS; - if (spoofonly) return (NULL); @@ -180,7 +181,8 @@ readdpmelabel(struct buf *bp, void (*strat)(struct buf *), if (biowait(bp)) return("disk label I/O error"); - return checkdisklabel(bp->b_data + LABELOFFSET, lp); + return checkdisklabel(bp->b_data + LABELOFFSET, lp, hfspartoff, + hfspartoff + hfspartlen); } /* diff --git a/sys/arch/sparc/sparc/disksubr.c b/sys/arch/sparc/sparc/disksubr.c index 2b89a538017..2e1ee4a9dd1 100644 --- a/sys/arch/sparc/sparc/disksubr.c +++ b/sys/arch/sparc/sparc/disksubr.c @@ -1,4 +1,4 @@ -/* $OpenBSD: disksubr.c,v 1.80 2009/05/13 01:31:58 krw Exp $ */ +/* $OpenBSD: disksubr.c,v 1.81 2009/06/04 21:13:02 deraadt Exp $ */ /* $NetBSD: disksubr.c,v 1.16 1996/04/28 20:25:59 thorpej Exp $ */ /* @@ -97,7 +97,7 @@ readdisklabel(dev_t dev, void (*strat)(struct buf *), } #endif /* NCD > 0 */ - /* get a buffer and initialize it */ + /* get buffer and initialize it */ bp = geteblk((int)lp->d_secsize); bp->b_dev = dev; @@ -119,7 +119,7 @@ readdisklabel(dev_t dev, void (*strat)(struct buf *), goto done; } - msg = checkdisklabel(bp->b_data + LABELOFFSET, lp); + msg = checkdisklabel(bp->b_data + LABELOFFSET, lp, 0, DL_GETDSIZE(lp)); if (msg == NULL) goto done; @@ -159,7 +159,7 @@ writedisklabel(dev_t dev, void (*strat)(struct buf *), struct disklabel *lp) struct buf *bp = NULL; int error; - /* get a buffer and initialize it */ + /* get buffer and initialize it */ bp = geteblk((int)lp->d_secsize); bp->b_dev = dev; @@ -234,7 +234,7 @@ sun_extended_sum(struct sun_disklabel *sl, void *end) * * The BSD label is cleared out before this is called. */ -char * +static char * disklabel_sun_to_bsd(struct sun_disklabel *sl, struct disklabel *lp) { struct sun_preamble *preamble = (struct sun_preamble *)sl; @@ -385,7 +385,7 @@ disklabel_sun_to_bsd(struct sun_disklabel *sl, struct disklabel *lp) lp->d_checksum = 0; lp->d_checksum = dkcksum(lp); - return (checkdisklabel(lp, lp)); + return (checkdisklabel(lp, lp, 0, DL_GETDSIZE(lp))); } /* diff --git a/sys/arch/sparc64/sparc64/disksubr.c b/sys/arch/sparc64/sparc64/disksubr.c index 2bb7ddc9d67..5c210d13284 100644 --- a/sys/arch/sparc64/sparc64/disksubr.c +++ b/sys/arch/sparc64/sparc64/disksubr.c @@ -1,4 +1,4 @@ -/* $OpenBSD: disksubr.c,v 1.55 2009/05/13 01:31:58 krw Exp $ */ +/* $OpenBSD: disksubr.c,v 1.56 2009/06/04 21:13:02 deraadt Exp $ */ /* $NetBSD: disksubr.c,v 1.13 2000/12/17 22:39:18 pk Exp $ */ /* @@ -112,7 +112,7 @@ readdisklabel(dev_t dev, void (*strat)(struct buf *), goto done; } - msg = checkdisklabel(bp->b_data + LABELOFFSET, lp); + msg = checkdisklabel(bp->b_data + LABELOFFSET, lp, 0, DL_GETDSIZE(lp)); if (msg == NULL) goto done; @@ -378,7 +378,7 @@ disklabel_sun_to_bsd(struct sun_disklabel *sl, struct disklabel *lp) lp->d_checksum = 0; lp->d_checksum = dkcksum(lp); - return (checkdisklabel(lp, lp)); + return (checkdisklabel(lp, lp, 0, DL_GETDSIZE(lp))); } /* diff --git a/sys/arch/vax/vax/disksubr.c b/sys/arch/vax/vax/disksubr.c index ab73c279126..03be0cb3357 100644 --- a/sys/arch/vax/vax/disksubr.c +++ b/sys/arch/vax/vax/disksubr.c @@ -1,4 +1,4 @@ -/* $OpenBSD: disksubr.c,v 1.58 2008/08/14 11:41:30 martin Exp $ */ +/* $OpenBSD: disksubr.c,v 1.59 2009/06/04 21:13:02 deraadt Exp $ */ /* $NetBSD: disksubr.c,v 1.21 1999/06/30 18:48:06 ragge Exp $ */ /* @@ -71,6 +71,8 @@ readdisklabel(dev_t dev, void (*strat)(struct buf *), bp = geteblk((int)lp->d_secsize); bp->b_dev = dev; + DL_SETBSTART(lp, 16); + if (spoofonly) goto done; @@ -83,7 +85,7 @@ readdisklabel(dev_t dev, void (*strat)(struct buf *), goto done; } - msg = checkdisklabel(bp->b_data + LABELOFFSET, lp); + msg = checkdisklabel(bp->b_data + LABELOFFSET, lp, 16, DL_GETDSIZE(lp)); if (msg == NULL) goto done; diff --git a/sys/kern/subr_disk.c b/sys/kern/subr_disk.c index 81d7da5e4fe..435db496073 100644 --- a/sys/kern/subr_disk.c +++ b/sys/kern/subr_disk.c @@ -1,4 +1,4 @@ -/* $OpenBSD: subr_disk.c,v 1.91 2009/06/03 22:09:30 thib Exp $ */ +/* $OpenBSD: subr_disk.c,v 1.92 2009/06/04 21:13:02 deraadt Exp $ */ /* $NetBSD: subr_disk.c,v 1.17 1996/03/16 23:17:08 christos Exp $ */ /* @@ -209,6 +209,8 @@ initdisklabel(struct disklabel *lp) if (DL_GETPSIZE(&lp->d_partitions[RAW_PART]) == 0) DL_SETPSIZE(&lp->d_partitions[RAW_PART], DL_GETDSIZE(lp)); DL_SETPOFFSET(&lp->d_partitions[RAW_PART], 0); + DL_SETBSTART(lp, 0); + DL_SETBEND(lp, DL_GETDSIZE(lp)); lp->d_version = 1; lp->d_bbsize = 8192; lp->d_sbsize = 64*1024; /* XXX ? */ @@ -220,7 +222,8 @@ initdisklabel(struct disklabel *lp) * a newer version if needed, etc etc. */ char * -checkdisklabel(void *rlp, struct disklabel *lp) +checkdisklabel(void *rlp, struct disklabel *lp, + u_int64_t boundstart, u_int64_t boundend) { struct disklabel *dlp = rlp; struct __partitionv0 *v0pp; @@ -281,10 +284,6 @@ checkdisklabel(void *rlp, struct disklabel *lp) dlp->d_rpm = swap16(dlp->d_rpm); dlp->d_interleave = swap16(dlp->d_interleave); - dlp->d_trackskew = swap16(dlp->d_trackskew); - dlp->d_cylskew = swap16(dlp->d_cylskew); - dlp->d_headswitch = swap32(dlp->d_headswitch); - dlp->d_trkseek = swap32(dlp->d_trkseek); dlp->d_flags = swap32(dlp->d_flags); for (i = 0; i < NDDATA; i++) @@ -361,6 +360,8 @@ checkdisklabel(void *rlp, struct disklabel *lp) DL_SETDSIZE(lp, disksize); DL_SETPSIZE(&lp->d_partitions[RAW_PART], disksize); DL_SETPOFFSET(&lp->d_partitions[RAW_PART], 0); + DL_SETBSTART(lp, boundstart); + DL_SETBEND(lp, boundend); lp->d_checksum = 0; lp->d_checksum = dkcksum(lp); @@ -380,12 +381,11 @@ char * readdoslabel(struct buf *bp, void (*strat)(struct buf *), struct disklabel *lp, int *partoffp, int spoofonly) { + u_int64_t dospartoff = 0, dospartend = DL_GETBEND(lp); + int i, ourpart = -1, wander = 1, n = 0, loop = 0, offset; struct dos_partition dp[NDOSPART], *dp2; - u_int32_t extoff = 0; daddr64_t part_blkno = DOSBBSECTOR; - int dospartoff = 0, i, ourpart = -1; - int wander = 1, n = 0, loop = 0; - int offset; + u_int32_t extoff = 0; if (lp->d_secpercyl == 0) return ("invalid label, d_secpercyl == 0"); @@ -444,6 +444,7 @@ readdoslabel(struct buf *bp, void (*strat)(struct buf *), */ dp2 = &dp[ourpart]; dospartoff = letoh32(dp2->dp_start) + part_blkno; + dospartend = dospartoff + letoh32(dp2->dp_size); /* found our OpenBSD partition, finish up */ if (partoffp) @@ -574,6 +575,8 @@ donot: lp->d_partitions['i' - 'a'].p_fstype = FS_MSDOS; } notfat: + DL_SETBSTART(lp, dospartoff); + DL_SETBEND(lp, dospartend); /* record the OpenBSD partition's placement for the caller */ if (partoffp) @@ -593,7 +596,7 @@ notfat: return ("disk label I/O error"); /* sub-MBR disklabels are always at a LABELOFFSET of 0 */ - return checkdisklabel(bp->b_data + offset, lp); + return checkdisklabel(bp->b_data + offset, lp, dospartoff, dospartend); } /* diff --git a/sys/sys/disklabel.h b/sys/sys/disklabel.h index 7ce4fee97c6..67909e7840b 100644 --- a/sys/sys/disklabel.h +++ b/sys/sys/disklabel.h @@ -1,4 +1,4 @@ -/* $OpenBSD: disklabel.h,v 1.44 2008/08/10 15:52:50 krw Exp $ */ +/* $OpenBSD: disklabel.h,v 1.45 2009/06/04 21:13:02 deraadt Exp $ */ /* $NetBSD: disklabel.h,v 1.41 1996/05/10 23:07:37 mark Exp $ */ /* @@ -141,10 +141,10 @@ struct disklabel { */ u_int16_t d_rpm; /* rotational speed */ u_int16_t d_interleave; /* hardware sector interleave */ - u_int16_t d_trackskew; /* sector 0 skew, per track */ - u_int16_t d_cylskew; /* sector 0 skew, per cylinder */ - u_int32_t d_headswitch; /* head switch time, usec */ - u_int32_t d_trkseek; /* track-to-track seek, usec */ + u_int16_t d_bstarth; /* start of useable region (high part) */ + u_int16_t d_bendh; /* size of useable region (high part) */ + u_int32_t d_bstart; /* start of useable region */ + u_int32_t d_bend; /* end of useable region */ u_int32_t d_flags; /* generic flags */ #define NDDATA 5 u_int32_t d_drivedata[NDDATA]; /* drive-type specific information */ @@ -207,25 +207,39 @@ struct __partitionv0 { /* the partition table */ (DISKLABELV1_FFS_BSIZE(i) / DISKLABELV1_FFS_FRAG(i))) #define DL_GETPSIZE(p) (((u_int64_t)(p)->p_sizeh << 32) + (p)->p_size) -#define DL_GETPOFFSET(p) (((u_int64_t)(p)->p_offseth << 32) + (p)->p_offset) -#define DL_GETDSIZE(d) (((u_int64_t)(d)->d_secperunith << 32) + \ - (d)->d_secperunit) - #define DL_SETPSIZE(p, n) do { \ daddr64_t x = (n); \ (p)->p_sizeh = x >> 32; \ (p)->p_size = x; \ } while (0) +#define DL_GETPOFFSET(p) (((u_int64_t)(p)->p_offseth << 32) + (p)->p_offset) #define DL_SETPOFFSET(p, n) do { \ daddr64_t x = (n); \ (p)->p_offseth = x >> 32; \ (p)->p_offset = x; \ } while (0) + +#define DL_GETDSIZE(d) (((u_int64_t)(d)->d_secperunith << 32) + \ + (d)->d_secperunit) #define DL_SETDSIZE(d, n) do { \ daddr64_t x = (n); \ (d)->d_secperunith = x >> 32; \ (d)->d_secperunit = x; \ } while (0) +#define DL_GETBSTART(d) (((u_int64_t)(d)->d_bstarth << 32) + \ + (d)->d_bstart) +#define DL_SETBSTART(d, n) do { \ + daddr64_t x = (n); \ + (d)->d_bstarth = x >> 32; \ + (d)->d_bstart = x; \ + } while (0) +#define DL_GETBEND(d) (((u_int64_t)(d)->d_bendh << 32) + \ + (d)->d_bend) +#define DL_SETBEND(d, n) do { \ + daddr64_t x = (n); \ + (d)->d_bendh = x >> 32; \ + (d)->d_bend = x; \ + } while (0) #define DL_BLKSPERSEC(d) ((d)->d_secsize / DEV_BSIZE) #define DL_SECTOBLK(d, n) ((n) * DL_BLKSPERSEC(d)) @@ -458,7 +472,7 @@ void diskerr(struct buf *, char *, char *, int, int, struct disklabel *); void disksort(struct buf *, struct buf *); u_int dkcksum(struct disklabel *); char *initdisklabel(struct disklabel *); -char *checkdisklabel(void *, struct disklabel *); +char *checkdisklabel(void *, struct disklabel *, u_int64_t, u_int64_t); int setdisklabel(struct disklabel *, struct disklabel *, u_int); char *readdisklabel(dev_t, void (*)(struct buf *), struct disklabel *, int); int writedisklabel(dev_t, void (*)(struct buf *), struct disklabel *); |