/* * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public * License v2 as published by the Free Software Foundation. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * General Public License for more details. * * You should have received a copy of the GNU General Public * License along with this program; if not, write to the * Free Software Foundation, Inc., 59 Temple Place - Suite 330, * Boston, MA 021110-1307, USA. */ #define _GNU_SOURCE #include #include #include #include "kerncompat.h" #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 */ /* the following fields are run-time filled by the program */ char **cmds; /* array of subcommands */ int ncmds; /* number of subcommand */ }; 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_find_newer, 2, "subvolume find-new", " \n" "List the recently modified files in a filesystem." }, { do_defrag, -1, "filesystem defragment", "[-vcf] [-s start] [-l len] [-t size] | [|...]\n" "Defragment a file or a directory." }, { do_set_default_subvol, 2, "subvolume set-default", " \n" "Set the subvolume of the filesystem which will be mounted\n" "as default." }, { 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", "[|