From d675085a67fba325c7c35dbf3b2ec544354f7742 Mon Sep 17 00:00:00 2001 From: Ilya Dryomov Date: Fri, 3 Feb 2012 21:00:17 +0200 Subject: Btrfs-progs: switch all existing commands to a new parser The new infrastructure offloads checking number of arguments passed to a command to individual command handlers. Fix them up accordingly. Signed-off-by: Ilya Dryomov --- cmds-filesystem.c | 170 ++++++++++++++++++++++++++++++++++++++++-------------- 1 file changed, 127 insertions(+), 43 deletions(-) (limited to 'cmds-filesystem.c') diff --git a/cmds-filesystem.c b/cmds-filesystem.c index 2e607d2c..828ca0c7 100644 --- a/cmds-filesystem.c +++ b/cmds-filesystem.c @@ -31,17 +31,31 @@ #include "version.h" -#include "btrfs_cmds.h" +#include "commands.h" #include "btrfslabel.h" -int do_df_filesystem(int nargs, char **argv) +static const char filesystem_cmd_group_usage[] = + "btrfs filesystem [] []"; + +static const char * const cmd_df_usage[] = { + "btrfs filesystem df ", + "Show space usage information for a mount point", + NULL +}; + +static int cmd_df(int argc, char **argv) { struct btrfs_ioctl_space_args *sargs; u64 count = 0, i; int ret; int fd; int e; - char *path = argv[1]; + char *path; + + if (check_argc_exact(argc, 2)) + usage(cmd_df_usage); + + path = argv[1]; fd = open_file_or_dir(path); if (fd < 0) { @@ -195,7 +209,14 @@ static void print_one_uuid(struct btrfs_fs_devices *fs_devices) printf("\n"); } -int do_show_filesystem(int argc, char **argv) +static const char * const cmd_show_usage[] = { + "btrfs filesystem show [--all-devices] [|