btrfs-progs: fi du: add long options for units

Drop -h, add just the common long options for now.

Signed-off-by: David Sterba <dsterba@suse.com>
This commit is contained in:
David Sterba 2016-02-24 16:19:16 +01:00
parent 54dea513c6
commit aad4b1f081

View File

@ -279,15 +279,6 @@ static void clear_seen_inodes(void)
} }
} }
const char * const cmd_filesystem_du_usage[] = {
"btrfs filesystem du [options] <path> [<path>..]",
"Summarize disk usage of each file.",
"-h|--human-readable",
" human friendly numbers, base 1024 (default)",
"-s display only a total for each argument",
NULL
};
/* /*
* Inline extents are skipped because they do not take data space, * Inline extents are skipped because they do not take data space,
* delalloc and unknown are skipped because we do not know how much * delalloc and unknown are skipped because we do not know how much
@ -533,28 +524,32 @@ out:
return ret; return ret;
} }
const char * const cmd_filesystem_du_usage[] = {
"btrfs filesystem du [options] <path> [<path>..]",
"Summarize disk usage of each file.",
HELPINFO_UNITS_LONG,
"-s display only a total for each argument",
NULL
};
int cmd_filesystem_du(int argc, char **argv) int cmd_filesystem_du(int argc, char **argv)
{ {
int ret = 0, error = 0; int ret = 0, error = 0;
int i; int i;
unit_mode = get_unit_mode_from_arg(&argc, argv, 1);
optind = 1; optind = 1;
while (1) { while (1) {
int long_index;
static const struct option long_options[] = { static const struct option long_options[] = {
{ "summarize", no_argument, NULL, 's'}, { "summarize", no_argument, NULL, 's'},
{ "human-readable", no_argument, NULL, 'h'},
{ NULL, 0, NULL, 0 } { NULL, 0, NULL, 0 }
}; };
int c = getopt_long(argc, argv, "sh", long_options, int c = getopt_long(argc, argv, "s", long_options, NULL);
&long_index);
if (c < 0) if (c < 0)
break; break;
switch (c) { switch (c) {
case 'h':
unit_mode = UNITS_HUMAN;
break;
case 's': case 's':
summarize = 1; summarize = 1;
break; break;