From 8db24ffd6547f4051a73e32d3237e9c38c40cac3 Mon Sep 17 00:00:00 2001 From: Theo de Raadt Date: Sat, 9 Jun 2007 04:08:40 +0000 Subject: by hand i carefully found that all the differences in setdisklabel() implimentations were simply either missing code, or spacing and such. setdisklabel() can become MI now. --- sys/arch/mac68k/mac68k/disksubr.c | 53 +-------------------------------------- 1 file changed, 1 insertion(+), 52 deletions(-) (limited to 'sys/arch/mac68k') diff --git a/sys/arch/mac68k/mac68k/disksubr.c b/sys/arch/mac68k/mac68k/disksubr.c index 64383e3e82d..567f8456fe0 100644 --- a/sys/arch/mac68k/mac68k/disksubr.c +++ b/sys/arch/mac68k/mac68k/disksubr.c @@ -1,4 +1,4 @@ -/* $OpenBSD: disksubr.c,v 1.42 2007/06/08 05:34:28 deraadt Exp $ */ +/* $OpenBSD: disksubr.c,v 1.43 2007/06/09 04:08:39 deraadt Exp $ */ /* $NetBSD: disksubr.c,v 1.22 1997/11/26 04:18:20 briggs Exp $ */ /* @@ -428,57 +428,6 @@ done: return (msg); } -/* - * Check new disk label for sensibility before setting it. - */ -int -setdisklabel(struct disklabel *olp, struct disklabel *nlp, - u_int openmask, struct cpu_disklabel *osdep) -{ - int i; - 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(openmask)) != 0) { - i--; - openmask &= ~(1 << i); - if (nlp->d_npartitions <= i) - return (EBUSY); - opp = &olp->d_partitions[i]; - npp = &nlp->d_partitions[i]; - if (DL_GETPOFFSET(npp) != DL_GETPOFFSET(opp) || - DL_GETPSIZE(npp) < DL_GETPSIZE(opp)) - return (EBUSY); - /* - * Copy internally-set partition information - * if new label doesn't include it. XXX - */ - if (npp->p_fstype == FS_UNUSED && opp->p_fstype != FS_UNUSED) { - npp->p_fstype = opp->p_fstype; - npp->p_fragblock = opp->p_fragblock; - npp->p_cpg = opp->p_cpg; - } - } - nlp->d_checksum = 0; - nlp->d_checksum = dkcksum(nlp); - *olp = *nlp; - return (0); -} - /* * Write disk label back to device after modification. * -- cgit v1.2.3