From 354f8cc8cf06de44656fb83705c57062d04d1565 Mon Sep 17 00:00:00 2001 From: Karel Zak Date: Mon, 19 Jan 2015 11:24:48 +0100 Subject: libfdiskL add API to print SIZE field in bytes The patch also add --bytes to fdisk and fdisk. Signed-off-by: Karel Zak --- disk-utils/fdisk.c | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) (limited to 'disk-utils/fdisk.c') diff --git a/disk-utils/fdisk.c b/disk-utils/fdisk.c index bc1a231e3..6f20a310f 100644 --- a/disk-utils/fdisk.c +++ b/disk-utils/fdisk.c @@ -648,6 +648,7 @@ static void __attribute__ ((__noreturn__)) usage(FILE *out) fputs(_(" -t, --type recognize specified partition table type only\n"), out); fputs(_(" -u, --units[=] display units: 'cylinders' or 'sectors' (default)\n"), out); fputs(_(" -s, --getsz display device size in 512-byte sectors [DEPRECATED]\n"), out); + fputs(_(" --bytes print SIZE in bytes rather than in human readable format\n"), out); fputs(USAGE_SEPARATOR, out); fputs(_(" -C, --cylinders specify the number of cylinders\n"), out); @@ -677,8 +678,11 @@ int main(int argc, char **argv) int colormode = UL_COLORMODE_UNDEF; struct fdisk_context *cxt; char *outarg = NULL; - + enum { + OPT_BYTES = CHAR_MAX + 1 + }; static const struct option longopts[] = { + { "bytes", no_argument, NULL, OPT_BYTES }, { "color", optional_argument, NULL, 'L' }, { "compatibility", optional_argument, NULL, 'c' }, { "cylinders", required_argument, NULL, 'C' }, @@ -798,6 +802,9 @@ int main(int argc, char **argv) return EXIT_SUCCESS; case 'h': usage(stdout); + case OPT_BYTES: + fdisk_set_size_unit(cxt, FDISK_SIZEUNIT_BYTES); + break; default: usage(stderr); } -- cgit v1.2.3-55-g7522