X-Git-Url: http://review.tizen.org/git/?a=blobdiff_plain;f=btrfs.c;h=2d39f2ced3e81b3d425b12971306df76495583d6;hb=eb9dd12d0ed77aae427f7c348fd3cd1ab153ed9c;hp=a8553646ff6e6acf5bba4d350e71914364c92f8c;hpb=97a3182fbf1b9086a90fcb40d4af197c376e6b5e;p=platform%2Fupstream%2Fbtrfs-progs.git diff --git a/btrfs.c b/btrfs.c index a855364..2d39f2c 100644 --- a/btrfs.c +++ b/btrfs.c @@ -14,413 +14,294 @@ * Boston, MA 021110-1307, USA. */ -#define _GNU_SOURCE #include #include #include +#include -#include "kerncompat.h" -#include "btrfs_cmds.h" -#include "version.h" - -#define BASIC_HELP 0 -#define ADVANCED_HELP 1 - -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; from the 2nd line onward they - are automatically indented */ - char *adv_help; /* advanced help message; from the 2nd line - onward they are automatically indented */ - - /* the following fields are run-time filled by the program */ - char **cmds; /* array of subcommands */ - int ncmds; /* number of subcommand */ -}; - -static struct Command commands[] = { +#include "volumes.h" +#include "crc32c.h" +#include "commands.h" +#include "utils.h" +#include "help.h" - /* - avoid short commands different for the case only - */ - { do_clone, -2, - "subvolume snapshot", "[-r] [/]\n" - "Create a writable/readonly snapshot of the subvolume with\n" - "the name in the directory.", - NULL - }, - { do_delete_subvolume, 1, - "subvolume delete", "\n" - "Delete the subvolume .", - NULL - }, - { do_create_subvol, 1, - "subvolume create", "[/]\n" - "Create a subvolume in (or the current directory if\n" - "not passed).", - NULL - }, - { do_subvol_list, -1, "subvolume list", "[-p] \n" - "List the snapshot/subvolume of a filesystem.", - "[-p] \n" - "List the snapshot/subvolume of a filesystem.\n" - "-p print parent ID" - }, - { do_set_default_subvol, 2, - "subvolume set-default", " \n" - "Set the subvolume of the filesystem which will be mounted\n" - "as default.", - NULL - }, - { do_find_newer, 2, "subvolume find-new", " \n" - "List the recently modified files in a filesystem.", - NULL - }, - { do_defrag, -1, - "filesystem defragment", "[-vf] [-c[zlib,lzo]] [-s start] [-l len] [-t size] | [|...]\n" - "Defragment a file or a directory.", - "[-vcf] [-s start] [-l len] [-t size] | [|...]\n" - "Defragment file data or directory metadata.\n" - "-v be verbose\n" - "-c compress the file while defragmenting\n" - "-f flush data to disk immediately after defragmenting\n" - "-s start defragment only from byte onward\n" - "-l len defragment only up to len bytes\n" - "-t size minimal size of file to be considered for defragmenting\n" - }, - { do_fssync, 1, - "filesystem sync", "\n" - "Force a sync on the filesystem .", - NULL - }, - { 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.", - NULL - }, - { do_show_filesystem, 999, - "filesystem show", "[||