X-Git-Url: http://review.tizen.org/git/?a=blobdiff_plain;f=btrfs.c;h=2d39f2ced3e81b3d425b12971306df76495583d6;hb=f435ddedcff81b0f381828390747ce8e7ad6cbd9;hp=20f741346de1986ed29be6ba4668b062f87f3b95;hpb=6d2cf042471cc728b5399b2beae54603739bc66a;p=platform%2Fupstream%2Fbtrfs-progs.git diff --git a/btrfs.c b/btrfs.c index 20f7413..2d39f2c 100644 --- a/btrfs.c +++ b/btrfs.c @@ -14,322 +14,294 @@ * Boston, MA 021110-1307, USA. */ - #include #include #include +#include -#include "btrfs_cmds.h" -#include "version.h" - -typedef int (*CommandFunction)(int argc, char **argv); - -struct Command { - CommandFunction func; /* function which implements the command */ - int nargs; /* if == 999, any number of arguments - if >= 0, number of arguments, - if < 0, _minimum_ number of arguments */ - char *verb; /* verb */ - char *help; /* help lines; form the 2nd onward they are - indented */ +#include "volumes.h" +#include "crc32c.h" +#include "commands.h" +#include "utils.h" +#include "help.h" - /* the following fields are run-time filled by the program */ - char **cmds; /* array of subcommands */ - int ncmds; /* number of subcommand */ +static const char * const btrfs_cmd_group_usage[] = { + "btrfs [--help] [--version] [...] []", + NULL }; -static struct Command commands[] = { - - /* - avoid short commands different for the case only - */ - { do_clone, 2, - "subvolume snapshot", " [/]\n" - "Create a writable snapshot of the subvolume with\n" - "the name in the directory." - }, - { do_delete_subvolume, 1, - "subvolume delete", "\n" - "Delete the subvolume ." - }, - { do_create_subvol, 1, - "subvolume create", "[/]\n" - "Create a subvolume in (or the current directory if\n" - "not passed)." - }, - { do_subvol_list, 1, "subvolume list", "\n" - "List the snapshot/subvolume of a filesystem." - }, - - { do_defrag, -1, - "filesystem defragment", "[-vcf] [-s start] [-l len] [-t size] | [|...]\n" - "Defragment a file or a directory." - }, - { do_fssync, 1, - "filesystem sync", "\n" - "Force a sync on the filesystem ." - }, - { do_resize, 2, - "filesystem resize", "[+/-][gkm]|max \n" - "Resize the file system. If 'max' is passed, the filesystem\n" - "will occupe all available space on the device." - }, - { do_show_filesystem, 999, - "filesystem show", "[|