From abf1fd048184c1886f83a22972517e98786d4708 Mon Sep 17 00:00:00 2001 From: Kenneth R Westerback Date: Thu, 26 Mar 2015 16:32:17 +0000 Subject: Allow input/printing/conversion of terabyte sizes. Which GPT partitons will eventually be able to use. --- sbin/fdisk/misc.c | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) (limited to 'sbin/fdisk/misc.c') 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; -- cgit v1.2.3