diff options
author | Kenneth R Westerback <krw@cvs.openbsd.org> | 2015-03-26 16:32:17 +0000 |
---|---|---|
committer | Kenneth R Westerback <krw@cvs.openbsd.org> | 2015-03-26 16:32:17 +0000 |
commit | abf1fd048184c1886f83a22972517e98786d4708 (patch) | |
tree | 4cc9f7306902d2fc161e0c33ddbe09dcf018f0ec /sbin/fdisk/misc.c | |
parent | f52b6ee20dbec7f900c088e6da95e16720e51509 (diff) |
Allow input/printing/conversion of terabyte sizes. Which GPT partitons
will eventually be able to use.
Diffstat (limited to 'sbin/fdisk/misc.c')
-rw-r--r-- | sbin/fdisk/misc.c | 18 |
1 files changed, 10 insertions, 8 deletions
diff --git a/sbin/fdisk/misc.c b/sbin/fdisk/misc.c index 94cd3044f2d..e070ac868e6 100644 --- a/sbin/fdisk/misc.c +++ b/sbin/fdisk/misc.c @@ -1,4 +1,4 @@ -/* $OpenBSD: misc.c,v 1.46 2015/03/26 14:08:12 krw Exp $ */ +/* $OpenBSD: misc.c,v 1.47 2015/03/26 16:32:16 krw Exp $ */ /* * Copyright (c) 1997 Tobias Weingartner @@ -30,12 +30,13 @@ #include "part.h" struct unit_type unit_types[] = { - {"b", 1 , "Bytes"}, - {" ", 0 , "Sectors"}, /* Filled in from disklabel. */ - {"K", 1024 , "Kilobytes"}, - {"M", 1024 * 1024 , "Megabytes"}, - {"G", 1024 * 1024 *1024 , "Gigabytes"}, - {NULL, 0 , NULL }, + { "b" , 1LL , "Bytes" }, + { " " , 0LL , "Sectors" }, + { "K" , 1024LL , "Kilobytes" }, + { "M" , 1024LL * 1024 , "Megabytes" }, + { "G" , 1024LL * 1024 *1024 , "Gigabytes" }, + { "T" , 1024LL * 1024 * 1024 * 1024 , "Terabytes" }, + { NULL , 0 , NULL }, }; int @@ -194,9 +195,10 @@ ask_yn(const char *str) u_int64_t getuint64(char *prompt, u_int64_t oval, u_int64_t maxval) { + const int secsize = unit_types[SECTORS].conversion; char buf[BUFSIZ], *endptr, *p, operator = '\0'; size_t n; - int mult = 1, secsize = unit_types[SECTORS].conversion; + int64_t mult = 1; double d, d2; int secpercyl, saveerr; char unit; |