diff options
author | Kenneth R Westerback <krw@cvs.openbsd.org> | 2009-06-02 16:23:46 +0000 |
---|---|---|
committer | Kenneth R Westerback <krw@cvs.openbsd.org> | 2009-06-02 16:23:46 +0000 |
commit | b294de3389ef86f3261202c035f47a77b9e18435 (patch) | |
tree | f6d01089269d31ea876b4aa6863711351bfadbac /sbin/disklabel/editor.c | |
parent | da5b5ff410d49e53c9352edc0f04e3f54516fa23 (diff) |
Add '-h' flag, and '*' as a unit specifier for 'p' Editor command.
Both cause partition sizes to be displayed using a human readable
format with the units automatically chosen by looking at the smallest
partition in the disk label. Remove forceable humanization in 'A'
code and use '-h' in install scripts.
Prodded & ok deraadt@, verbiage tweaks from jmc@
Diffstat (limited to 'sbin/disklabel/editor.c')
-rw-r--r-- | sbin/disklabel/editor.c | 17 |
1 files changed, 4 insertions, 13 deletions
diff --git a/sbin/disklabel/editor.c b/sbin/disklabel/editor.c index b8cfb71ed8f..8e1c3f6bdb8 100644 --- a/sbin/disklabel/editor.c +++ b/sbin/disklabel/editor.c @@ -1,4 +1,4 @@ -/* $OpenBSD: editor.c,v 1.214 2009/05/31 19:39:45 krw Exp $ */ +/* $OpenBSD: editor.c,v 1.215 2009/06/02 16:23:45 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.214 2009/05/31 19:39:45 krw Exp $"; +static char rcsid[] = "$OpenBSD: editor.c,v 1.215 2009/06/02 16:23:45 krw Exp $"; #endif /* not lint */ #include <sys/types.h> @@ -71,9 +71,6 @@ struct space_allocation { char *mp; }; -#define MEG(x) ((x) * 1024LL * (1024 / 512)) -#define GIG(x) (MEG(x) * 1024LL) - /* entries for swap and var are changed by editor_allocspace() */ const struct space_allocation alloc_big[] = { { MEG(80), GIG(1), 5, "/" }, @@ -517,13 +514,6 @@ editor_allocspace(struct disklabel *lp_org) /* How big is the OpenBSD portion of the disk? */ find_bounds(lp_org); - if (print_unit == '\0') { - if (DL_BLKTOSEC(lp_org, MEG(10 * 1024)) > (ending_sector - - starting_sector)) - print_unit = 'm'; - else - print_unit = 'g'; - } cylsecs = lp_org->d_secpercyl; again: @@ -2300,9 +2290,10 @@ psize(daddr64_t sz, char unit, struct disklabel *lp) void display_edit(struct disklabel *lp, char unit, u_int64_t fr) { + struct partition *pp; int i; - unit = toupper(unit); + unit = canonical_unit(lp, unit); printf("OpenBSD area: "); psize(starting_sector, 0, lp); |