diff options
author | Theo de Raadt <deraadt@cvs.openbsd.org> | 2007-06-17 00:32:22 +0000 |
---|---|---|
committer | Theo de Raadt <deraadt@cvs.openbsd.org> | 2007-06-17 00:32:22 +0000 |
commit | ad5e118396fcd2a9b7b0e050d2afe54576f65cba (patch) | |
tree | 99adb4a0ec68c89788a0b5d911d2e6cc6cc58d9b /sbin/disklabel/disklabel.c | |
parent | ea009c71d607b258f0ac14f65c465aed5c53f364 (diff) |
On Sun machines, disklabels coming from the kernel will now have a d_flags
bit D_VENDOR if they face the Sun cylinder / start-at-zero semantics. Other
disklabels found on these architectures do not have these issues, and do
not need to be constrained. checked by otto
Diffstat (limited to 'sbin/disklabel/disklabel.c')
-rw-r--r-- | sbin/disklabel/disklabel.c | 27 |
1 files changed, 16 insertions, 11 deletions
diff --git a/sbin/disklabel/disklabel.c b/sbin/disklabel/disklabel.c index 6c3bdd49bf9..b64099e807f 100644 --- a/sbin/disklabel/disklabel.c +++ b/sbin/disklabel/disklabel.c @@ -1,4 +1,4 @@ -/* $OpenBSD: disklabel.c,v 1.113 2007/06/08 19:08:35 otto Exp $ */ +/* $OpenBSD: disklabel.c,v 1.114 2007/06/17 00:32:21 deraadt Exp $ */ /* * Copyright (c) 1987, 1993 @@ -39,7 +39,7 @@ static const char copyright[] = #endif /* not lint */ #ifndef lint -static const char rcsid[] = "$OpenBSD: disklabel.c,v 1.113 2007/06/08 19:08:35 otto Exp $"; +static const char rcsid[] = "$OpenBSD: disklabel.c,v 1.114 2007/06/17 00:32:21 deraadt Exp $"; #endif /* not lint */ #include <sys/param.h> @@ -1083,6 +1083,8 @@ display(FILE *f, struct disklabel *lp, char **mp, char unit, int edit, fprintf(f, "flags:"); if (lp->d_flags & D_BADSECT) fprintf(f, " badsect"); + if (lp->d_flags & D_VENDOR) + fprintf(f, " vendor"); putc('\n', f); } fprintf(f, "bytes/sector: %u\n", lp->d_secsize); @@ -1656,16 +1658,19 @@ checklabel(struct disklabel *lp) if (DL_GETPSIZE(pp) == 0 && DL_GETPOFFSET(pp) != 0) warnx("warning, partition %c: size 0, but offset %lld", part, DL_GETPSIZE(pp)); -#ifdef CYLCHECK - if (i != RAW_PART && DL_GETPSIZE(pp) % lp->d_secpercyl) - warnx("warning, partition %c: size %% cylinder-size != 0", - part); - if (i != RAW_PART && DL_GETPOFFSET(pp) % lp->d_secpercyl) - warnx("warning, partition %c: offset %% cylinder-size != 0", - part); +#ifdef SUN_CYLCHECK + if (lp->d_flags & D_VENDOR) { + if (i != RAW_PART && DL_GETPSIZE(pp) % lp->d_secpercyl) + warnx("warning, partition %c: size %% " + "cylinder-size != 0", part); + if (i != RAW_PART && DL_GETPOFFSET(pp) % lp->d_secpercyl) + warnx("warning, partition %c: offset %% " + "cylinder-size != 0", part); + } #endif -#ifdef AAT0 - if (i == 0 && DL_GETPSIZE(pp) != 0 && DL_GETPOFFSET(pp) != 0) { +#ifdef SUN_AAT0 + if ((lp->d_flags & D_VENDOR) && + i == 0 && DL_GETPSIZE(pp) != 0 && DL_GETPOFFSET(pp) != 0) { warnx("this architecture requires partition 'a' to " "start at sector 0"); errors++; |