aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDavid Sterba <dsterba@suse.cz>2015-01-21 18:47:24 +0100
committerDavid Sterba <dsterba@suse.cz>2015-01-21 18:56:28 +0100
commit58a39524619f38d193b8adc3d57888ec07b612aa (patch)
tree877a5e4487d232197b8cc8bfb043a97ab7ab1633
parenta5b66a81bf6007b3c3b3b108ffcb4cbd75287d57 (diff)
downloadbtrfs-progs-58a39524619f38d193b8adc3d57888ec07b612aa.tar.gz
btrfs-progs-58a39524619f38d193b8adc3d57888ec07b612aa.tar.xz
btrfs-progs-58a39524619f38d193b8adc3d57888ec07b612aa.zip
btrfs-progs: add --human-readable option where applicable
Add an alias to -h to 'filesystem usage', 'filesystem df' and 'device usage' commands, same as the traditional 'df'. Signed-off-by: David Sterba <dsterba@suse.cz>
-rw-r--r--Documentation/btrfs-device.txt2
-rw-r--r--Documentation/btrfs-filesystem.txt4
-rw-r--r--Documentation/btrfs-qgroup.txt2
-rw-r--r--cmds-device.c6
-rw-r--r--cmds-fi-disk_usage.c6
-rw-r--r--cmds-filesystem.c6
-rw-r--r--cmds-qgroup.c7
7 files changed, 27 insertions, 6 deletions
diff --git a/Documentation/btrfs-device.txt b/Documentation/btrfs-device.txt
index cc8daa7..66be6b3 100644
--- a/Documentation/btrfs-device.txt
+++ b/Documentation/btrfs-device.txt
@@ -105,7 +105,7 @@ Show detailed information about internal allocations in devices.
+
-b|--raw::::
raw numbers in bytes, without the 'B' suffix
--h::::
+-h|--human-readable::::
print human friendly numbers, base 1024, this is the default
-H::::
print human friendly numbers, base 1000
diff --git a/Documentation/btrfs-filesystem.txt b/Documentation/btrfs-filesystem.txt
index d15e7d8..cefdc8e 100644
--- a/Documentation/btrfs-filesystem.txt
+++ b/Documentation/btrfs-filesystem.txt
@@ -24,7 +24,7 @@ Show space usage information for a mount point.
+
-b|--raw::::
raw numbers in bytes, without the 'B' suffix
--h::::
+-h|--human-readable::::
print human friendly numbers, base 1024, this is the default
-H::::
print human friendly numbers, base 1000
@@ -132,7 +132,7 @@ Show detailed information about internal filesystem usage.
+
-b|--raw::::
raw numbers in bytes, without the 'B' suffix
--h::::
+-h|--human-readable::::
print human friendly numbers, base 1024, this is the default
-H::::
print human friendly numbers, base 1000
diff --git a/Documentation/btrfs-qgroup.txt b/Documentation/btrfs-qgroup.txt
index 8d15cee..3ea55df 100644
--- a/Documentation/btrfs-qgroup.txt
+++ b/Documentation/btrfs-qgroup.txt
@@ -91,6 +91,8 @@ list all qgroups which impact the given path(include ancestral qgroups)
list all qgroups which impact the given path(exclude ancestral qgroups)
--raw::::
raw numbers in bytes, without the 'B' suffix.
+--human-readable::::
+print human friendly numbers, base 1024, this is the default
--iec::::
select the 1024 base for the following options, according to the IEC standard.
--si::::
diff --git a/cmds-device.c b/cmds-device.c
index ce4406f..5f7ad91 100644
--- a/cmds-device.c
+++ b/cmds-device.c
@@ -454,7 +454,8 @@ const char * const cmd_device_usage_usage[] = {
"btrfs device usage [options] <path> [<path>..]",
"Show detailed information about internal allocations in devices.",
"-b|--raw raw numbers in bytes",
- "-h human friendly numbers, base 1024 (default)",
+ "-h|--human-readable",
+ " human friendly numbers, base 1024 (default)",
"-H human friendly numbers, base 1000",
"--iec use 1024 as a base (KiB, MiB, GiB, TiB)",
"--si use 1000 as a base (kB, MB, GB, TB)",
@@ -511,6 +512,8 @@ int cmd_device_usage(int argc, char **argv)
{ "tbytes", no_argument, NULL, 't'},
{ "si", no_argument, NULL, GETOPT_VAL_SI},
{ "iec", no_argument, NULL, GETOPT_VAL_IEC},
+ { "human-readable", no_argument, NULL,
+ GETOPT_VAL_HUMAN_READABLE},
};
int c = getopt_long(argc, argv, "bhHkmgt", long_options,
&long_index);
@@ -533,6 +536,7 @@ int cmd_device_usage(int argc, char **argv)
case 't':
units_set_base(&unit_mode, UNITS_TBYTES);
break;
+ case GETOPT_VAL_HUMAN_READABLE:
case 'h':
unit_mode = UNITS_HUMAN_BINARY;
break;
diff --git a/cmds-fi-disk_usage.c b/cmds-fi-disk_usage.c
index 5e8e39b..faf8698 100644
--- a/cmds-fi-disk_usage.c
+++ b/cmds-fi-disk_usage.c
@@ -849,7 +849,8 @@ const char * const cmd_filesystem_usage_usage[] = {
"btrfs filesystem usage [options] <path> [<path>..]",
"Show detailed information about internal filesystem usage .",
"-b|--raw raw numbers in bytes",
- "-h human friendly numbers, base 1024 (default)",
+ "-h|--human-readable",
+ " human friendly numbers, base 1024 (default)",
"-H human friendly numbers, base 1000",
"--iec use 1024 as a base (KiB, MiB, GiB, TiB)",
"--si use 1000 as a base (kB, MB, GB, TB)",
@@ -879,6 +880,8 @@ int cmd_filesystem_usage(int argc, char **argv)
{ "tbytes", no_argument, NULL, 't'},
{ "si", no_argument, NULL, GETOPT_VAL_SI},
{ "iec", no_argument, NULL, GETOPT_VAL_IEC},
+ { "human-readable", no_argument, NULL,
+ GETOPT_VAL_HUMAN_READABLE},
};
int c = getopt_long(argc, argv, "bhHkmgtT", long_options,
&long_index);
@@ -901,6 +904,7 @@ int cmd_filesystem_usage(int argc, char **argv)
case 't':
units_set_base(&unit_mode, UNITS_TBYTES);
break;
+ case GETOPT_VAL_HUMAN_READABLE:
case 'h':
unit_mode = UNITS_HUMAN_BINARY;
break;
diff --git a/cmds-filesystem.c b/cmds-filesystem.c
index a99ddc8..ec422e3 100644
--- a/cmds-filesystem.c
+++ b/cmds-filesystem.c
@@ -126,7 +126,8 @@ static const char * const cmd_filesystem_df_usage[] = {
"btrfs filesystem df [options] <path>",
"Show space usage information for a mount point",
"-b|--raw raw numbers in bytes",
- "-h human friendly numbers, base 1024 (default)",
+ "-h|--human-readable",
+ " human friendly numbers, base 1024 (default)",
"-H human friendly numbers, base 1000",
"--iec use 1024 as a base (KiB, MiB, GiB, TiB)",
"--si use 1000 as a base (kB, MB, GB, TB)",
@@ -218,6 +219,8 @@ static int cmd_filesystem_df(int argc, char **argv)
{ "tbytes", no_argument, NULL, 't'},
{ "si", no_argument, NULL, GETOPT_VAL_SI},
{ "iec", no_argument, NULL, GETOPT_VAL_IEC},
+ { "human-readable", no_argument, NULL,
+ GETOPT_VAL_HUMAN_READABLE},
};
int c = getopt_long(argc, argv, "bhHkmgt", long_options,
&long_index);
@@ -239,6 +242,7 @@ static int cmd_filesystem_df(int argc, char **argv)
case 't':
units_set_base(&unit_mode, UNITS_TBYTES);
break;
+ case GETOPT_VAL_HUMAN_READABLE:
case 'h':
unit_mode = UNITS_HUMAN_BINARY;
break;
diff --git a/cmds-qgroup.c b/cmds-qgroup.c
index 5ee7162..456f06e 100644
--- a/cmds-qgroup.c
+++ b/cmds-qgroup.c
@@ -217,6 +217,8 @@ static const char * const cmd_qgroup_show_usage[] = {
"-f list all qgroups which impact the given path"
"(exclude ancestral qgroups)",
"--raw raw numbers in bytes",
+ "--human-readable",
+ " human firendly numbers in given base, 1024 by default",
"--iec use 1024 as a base (KiB, MiB, GiB, TiB)",
"--si use 1000 as a base (kB, MB, GB, TB)",
"--kbytes show sizes in KiB, or kB with --si",
@@ -260,6 +262,8 @@ static int cmd_qgroup_show(int argc, char **argv)
{"tbytes", no_argument, NULL, GETOPT_VAL_TBYTES},
{"si", no_argument, NULL, GETOPT_VAL_SI},
{"iec", no_argument, NULL, GETOPT_VAL_IEC},
+ { "human-readable", no_argument, NULL,
+ GETOPT_VAL_HUMAN_READABLE},
{0, 0, 0, 0}
};
c = getopt_long(argc, argv, "pcreFf",
@@ -317,6 +321,9 @@ static int cmd_qgroup_show(int argc, char **argv)
case GETOPT_VAL_IEC:
units_set_mode(&unit_mode, UNITS_BINARY);
break;
+ case GETOPT_VAL_HUMAN_READABLE:
+ unit_mode = UNITS_HUMAN_BINARY;
+ break;
default:
usage(cmd_qgroup_show_usage);
}