summaryrefslogtreecommitdiffstats
path: root/sbin/disklabel/editor.c
diff options
context:
space:
mode:
authorkrw <krw@openbsd.org>2009-05-11 23:15:42 +0000
committerkrw <krw@openbsd.org>2009-05-11 23:15:42 +0000
commit1f5ea54918e2b2556fe4e9749e567302395c0e46 (patch)
tree466f883747eff4ffe1dd659e8211d5162e0b1bf9 /sbin/disklabel/editor.c
parentvery long lines in comments are ugly (diff)
downloadwireguard-openbsd-1f5ea54918e2b2556fe4e9749e567302395c0e46.tar.xz
wireguard-openbsd-1f5ea54918e2b2556fe4e9749e567302395c0e46.zip
Make sure last, catch-all, auto-allocated partition ends on a
cylinder boundary if SUN_CYLCHECK is defined. Don't bother rounding any partition size to cylinder boundary if SUN_CYLCHECK is not defined. Should fix warning message on sparc64 noticed by dlg@. ok deraadt@
Diffstat (limited to 'sbin/disklabel/editor.c')
-rw-r--r--sbin/disklabel/editor.c12
1 files changed, 10 insertions, 2 deletions
diff --git a/sbin/disklabel/editor.c b/sbin/disklabel/editor.c
index d5bdf5acbad..9d532f80156 100644
--- a/sbin/disklabel/editor.c
+++ b/sbin/disklabel/editor.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: editor.c,v 1.205 2009/05/11 23:09:44 deraadt Exp $ */
+/* $OpenBSD: editor.c,v 1.206 2009/05/11 23:15:42 krw Exp $ */
/*
* Copyright (c) 1997-2000 Todd C. Miller <Todd.Miller@courtesan.com>
@@ -17,7 +17,7 @@
*/
#ifndef lint
-static char rcsid[] = "$OpenBSD: editor.c,v 1.205 2009/05/11 23:09:44 deraadt Exp $";
+static char rcsid[] = "$OpenBSD: editor.c,v 1.206 2009/05/11 23:15:42 krw Exp $";
#endif /* not lint */
#include <sys/types.h>
@@ -582,18 +582,26 @@ again:
secs = ap->maxsz;
else
secs = totsecs;
+#ifdef SUN_CYLCHECK
+ goto cylinderalign;
+#endif
} else {
secs = ap->minsz;
if (xtrasecs > 0)
secs += (xtrasecs / 100) * ap->rate;
if (secs > ap->maxsz)
secs = ap->maxsz;
+#ifdef SUN_CYLCHECK
+cylinderalign:
secs = ((secs + cylsecs - 1) / cylsecs) * cylsecs;
+#endif
totsecs -= secs;
+#ifdef SUN_CYLCHECK
while (totsecs < 0) {
secs -= cylsecs;
totsecs += cylsecs;
}
+#endif
}
/* Find largest chunk of free space. */