summaryrefslogtreecommitdiff
path: root/sbin
diff options
context:
space:
mode:
authorKenneth R Westerback <krw@cvs.openbsd.org>2015-03-26 16:32:17 +0000
committerKenneth R Westerback <krw@cvs.openbsd.org>2015-03-26 16:32:17 +0000
commitabf1fd048184c1886f83a22972517e98786d4708 (patch)
tree4cc9f7306902d2fc161e0c33ddbe09dcf018f0ec /sbin
parentf52b6ee20dbec7f900c088e6da95e16720e51509 (diff)
Allow input/printing/conversion of terabyte sizes. Which GPT partitons
will eventually be able to use.
Diffstat (limited to 'sbin')
-rw-r--r--sbin/fdisk/misc.c18
-rw-r--r--sbin/fdisk/misc.h4
2 files changed, 12 insertions, 10 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;
diff --git a/sbin/fdisk/misc.h b/sbin/fdisk/misc.h
index 30e781ccd45..fb956437764 100644
--- a/sbin/fdisk/misc.h
+++ b/sbin/fdisk/misc.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: misc.h,v 1.25 2015/03/26 14:08:12 krw Exp $ */
+/* $OpenBSD: misc.h,v 1.26 2015/03/26 16:32:16 krw Exp $ */
/*
* Copyright (c) 1997 Tobias Weingartner
@@ -21,7 +21,7 @@
struct unit_type {
char *abbr;
- int conversion;
+ int64_t conversion;
char *lname;
};
extern struct unit_type unit_types[];