diff options
author | Todd C. Miller <millert@cvs.openbsd.org> | 1998-05-06 17:46:03 +0000 |
---|---|---|
committer | Todd C. Miller <millert@cvs.openbsd.org> | 1998-05-06 17:46:03 +0000 |
commit | ff73d37590f1298bb8246494306b2f11465127b2 (patch) | |
tree | 0e50ca940150842f92e42d0863d4cfc124b949ff /sys/arch | |
parent | b9b8c5848c0001f09c9fe36ab5d64342de5f7cb9 (diff) |
setdisklabel:
o extra sanity checks and support for invalidating old label
like on other ports.
Diffstat (limited to 'sys/arch')
-rw-r--r-- | sys/arch/pmax/pmax/disksubr.c | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/sys/arch/pmax/pmax/disksubr.c b/sys/arch/pmax/pmax/disksubr.c index 76ccc58fae0..d0e43b779aa 100644 --- a/sys/arch/pmax/pmax/disksubr.c +++ b/sys/arch/pmax/pmax/disksubr.c @@ -202,9 +202,21 @@ setdisklabel(olp, nlp, openmask, osdep) register i; register struct partition *opp, *npp; + /* sanity clause */ + if (nlp->d_secpercyl == 0 || nlp->d_secsize == 0 || + (nlp->d_secsize % DEV_BSIZE) != 0) + return(EINVAL); + + /* special case to allow disklabel to be invalidated */ + if (nlp->d_magic == 0xffffffff) { + *olp = *nlp; + return (0); + } + if (nlp->d_magic != DISKMAGIC || nlp->d_magic2 != DISKMAGIC || dkcksum(nlp) != 0) return (EINVAL); + while ((i = ffs((long)openmask)) != 0) { i--; openmask &= ~(1 << i); |