summaryrefslogtreecommitdiffstats
path: root/disk-utils/sfdisk.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/sfdisk.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/sfdisk.c')
-rw-r--r--disk-utils/sfdisk.c10
1 files changed, 8 insertions, 2 deletions
diff --git a/disk-utils/sfdisk.c b/disk-utils/sfdisk.c
index 499dd8f64..d609c55a6 100644
--- a/disk-utils/sfdisk.c
+++ b/disk-utils/sfdisk.c
@@ -1335,6 +1335,7 @@ static void __attribute__ ((__noreturn__)) usage(FILE *out)
fputs(USAGE_OPTIONS, out);
fputs(_(" -A, --append append partitions to existing partition table\n"), out);
+ fputs(_(" --bytes print SIZE in bytes rather than in human readable format\n"), out);
fputs(_(" -b, --backup backup partition table sectors (see -O)\n"), out);
fputs(_(" -f, --force disable all consistency checking\n"), out);
fputs(_(" -o, --output <list> output columns\n"), out);
@@ -1378,6 +1379,7 @@ int main(int argc, char *argv[])
OPT_PARTLABEL,
OPT_PARTTYPE,
OPT_PARTATTRS,
+ OPT_BYTES
};
static const struct option longopts[] = {
@@ -1385,6 +1387,7 @@ int main(int argc, char *argv[])
{ "append", no_argument, NULL, 'A' },
{ "backup", no_argument, NULL, 'b' },
{ "backup-file", required_argument, NULL, 'O' },
+ { "bytes", no_argument, NULL, OPT_BYTES },
{ "dump", no_argument, NULL, 'd' },
{ "help", no_argument, NULL, 'h' },
{ "force", no_argument, NULL, 'f' },
@@ -1422,6 +1425,8 @@ int main(int argc, char *argv[])
textdomain(PACKAGE);
atexit(close_stdout);
+ sfdisk_init(sf);
+
while ((c = getopt_long(argc, argv, "aAbcdfghlLo:O:nN:qsTu:vVX:Y:",
longopts, &longidx)) != -1) {
switch(c) {
@@ -1517,13 +1522,14 @@ int main(int argc, char *argv[])
case OPT_NOREREAD:
sf->noreread = 1;
break;
-
+ case OPT_BYTES:
+ fdisk_set_size_unit(sf->cxt, FDISK_SIZEUNIT_BYTES);
+ break;
default:
usage(stderr);
}
}
- sfdisk_init(sf);
if (outarg)
init_fields(NULL, outarg, NULL);