[PATCH 2/3] btrfs-progs: cleanup device stat usage prompt

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



1. use usage() to replace the fprintf()
2. use check_argc_exact() to replace "argc != ..."

Signed-off-by: Gui Hecheng <guihc.fnst@xxxxxxxxxxxxxx>
---
 cmds-device.c | 13 ++++---------
 1 file changed, 4 insertions(+), 9 deletions(-)

diff --git a/cmds-device.c b/cmds-device.c
index ad59600..5009d9a 100644
--- a/cmds-device.c
+++ b/cmds-device.c
@@ -324,18 +324,13 @@ static int cmd_dev_stats(int argc, char **argv)
 			break;
 		case '?':
 		default:
-			fprintf(stderr, "ERROR: device stat args invalid.\n"
-					" device stat [-z] <path>|<device>\n"
-					" -z  to reset stats after reading.\n");
-			return 1;
+			usage(cmd_dev_stats_usage);
 		}
 	}
 
-	if (optind + 1 != argc) {
-		fprintf(stderr, "ERROR: device stat needs path|device as single"
-			" argument\n");
-		return 1;
-	}
+	argc = argc - optind;
+	if (check_argc_exact(argc, 1))
+		usage(cmd_dev_stats_usage);
 
 	dev_path = argv[optind];
 
-- 
1.8.1.4

--
To unsubscribe from this list: send the line "unsubscribe linux-btrfs" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html




[Index of Archives]     [Linux Filesystem Development]     [Linux NFS]     [Linux NILFS]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux