summaryrefslogtreecommitdiffstats
path: root/disk-utils/fdisk.c
diff options
context:
space:
mode:
authorKarel Zak2015-01-19 11:24:48 +0100
committerKarel Zak2015-01-19 11:24:48 +0100
commit354f8cc8cf06de44656fb83705c57062d04d1565 (patch)
treea880a881ba452dff0a14d4f704026779e901a93b /disk-utils/fdisk.c
parentlibmount: revert "read mtab on remount" idea (diff)
downloadkernel-qcow2-util-linux-354f8cc8cf06de44656fb83705c57062d04d1565.tar.gz
kernel-qcow2-util-linux-354f8cc8cf06de44656fb83705c57062d04d1565.tar.xz
kernel-qcow2-util-linux-354f8cc8cf06de44656fb83705c57062d04d1565.zip
libfdiskL add API to print SIZE field in bytes
The patch also add --bytes to fdisk and fdisk. Signed-off-by: Karel Zak <kzak@redhat.com>
Diffstat (limited to 'disk-utils/fdisk.c')
-rw-r--r--disk-utils/fdisk.c9
1 files changed, 8 insertions, 1 deletions
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 <type> recognize specified partition table type only\n"), out);
fputs(_(" -u, --units[=<unit>] 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 <number> 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);
}