summaryrefslogtreecommitdiff
path: root/cmds-device.c
diff options
context:
space:
mode:
authorDavid Sterba <dsterba@suse.com>2016-12-08 19:12:10 +0100
committerDavid Sterba <dsterba@suse.com>2016-12-14 15:06:36 +0100
commit01bafdbc90452a17a9de6095fcdf0a9adca98dd2 (patch)
tree738a1dcb9625c71a8e7489db69e48165e54abca3 /cmds-device.c
parent9468d9285ad5542855ae2963995f31036b9f943e (diff)
btrfs-progs: dev stats: add long option for -z
Signed-off-by: David Sterba <dsterba@suse.com>
Diffstat (limited to 'cmds-device.c')
-rw-r--r--cmds-device.c15
1 files changed, 12 insertions, 3 deletions
diff --git a/cmds-device.c b/cmds-device.c
index aeaaa1d9..ba0e4368 100644
--- a/cmds-device.c
+++ b/cmds-device.c
@@ -375,7 +375,7 @@ static const char * const cmd_device_stats_usage[] = {
"btrfs device stats [-z] <path>|<device>",
"Show current device IO stats.",
"",
- "-z show current stats and reset values to zero",
+ "-z|--reset show current stats and reset values to zero",
"-s return non-zero if any stat counter is not zero",
NULL
};
@@ -388,13 +388,22 @@ static int cmd_device_stats(int argc, char **argv)
int ret;
int fdmnt;
int i;
- int c;
int err = 0;
int status = 0;
__u64 flags = 0;
DIR *dirstream = NULL;
- while ((c = getopt(argc, argv, "zs")) != -1) {
+ while (1) {
+ int c;
+ static const struct option long_options[] = {
+ {"reset", no_argument, NULL, 'z'},
+ {NULL, 0, NULL, 0}
+ };
+
+ c = getopt_long(argc, argv, "zs", long_options, NULL);
+ if (c < 0)
+ break;
+
switch (c) {
case 'z':
flags = BTRFS_DEV_STATS_RESET;