diff options
author | 2009-04-12 01:01:24 +0000 | |
---|---|---|
committer | 2009-04-12 01:01:24 +0000 | |
commit | d2b6991bd2319a1ce93fd8cf4a2e397a934d4477 (patch) | |
tree | 1a51a0518b850bd435bf1757277bcf5d46d087cb /sbin/disklabel/editor.c | |
parent | Always display any mountpoint info available. Thus a simple -A will (diff) | |
download | wireguard-openbsd-d2b6991bd2319a1ce93fd8cf4a2e397a934d4477.tar.xz wireguard-openbsd-d2b6991bd2319a1ce93fd8cf4a2e397a934d4477.zip |
When auto-allocating, check the size of the disk and display
offset/size information in MB if the disk is <10G, and in GB
otherwise. '-p' will override this default.
Diffstat (limited to 'sbin/disklabel/editor.c')
-rw-r--r-- | sbin/disklabel/editor.c | 11 |
1 files changed, 9 insertions, 2 deletions
diff --git a/sbin/disklabel/editor.c b/sbin/disklabel/editor.c index 48fbc431569..1b40da801f9 100644 --- a/sbin/disklabel/editor.c +++ b/sbin/disklabel/editor.c @@ -1,4 +1,4 @@ -/* $OpenBSD: editor.c,v 1.190 2009/04/11 23:57:56 krw Exp $ */ +/* $OpenBSD: editor.c,v 1.191 2009/04/12 01:01:24 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.190 2009/04/11 23:57:56 krw Exp $"; +static char rcsid[] = "$OpenBSD: editor.c,v 1.191 2009/04/12 01:01:24 krw Exp $"; #endif /* not lint */ #include <sys/types.h> @@ -475,6 +475,13 @@ editor_allocspace(struct disklabel *lp) /* How big is the OpenBSD portion of the disk? */ find_bounds(lp); + if (print_unit == '\0') { + if (DL_BLKTOSEC(lp, MEG(10 * 1024)) > (ending_sector - + starting_sector)) + print_unit = 'm'; + else + print_unit = 'g'; + } cylsecs = lp->d_secpercyl; xtrasecs = totsecs = editor_countfree(lp); |