summaryrefslogtreecommitdiff
path: root/commands.h
Commit message (Collapse)AuthorAge
* btrfs-progs: move command definitions to commands.hDavid Sterba2017-08-24
| | | | | | | There are some trivial helpers, we can group the command declarations in one place. Signed-off-by: David Sterba <dsterba@suse.com>
* btrfs-progs: move prefixcmp helper to utilsDavid Sterba2017-03-08
| | | | Signed-off-by: David Sterba <dsterba@suse.com>
* btrfs-progs: move help defines to own headerDavid Sterba2017-03-08
| | | | Signed-off-by: David Sterba <dsterba@suse.com>
* btrfs-progs: clean up commands.hAnand Jain2016-06-01
| | | | | | | | | | | This function is declared in utils.h so remove it from commands.h int test_issubvolume(const char *path); This function does not exists delete the declaration get_subvol_name(char *mnt, char *full_path); Signed-off-by: Anand Jain <anand.jain@oracle.com> Signed-off-by: David Sterba <dsterba@suse.com>
* btrfs-progs: let test_issubvolume return the exact errorDavid Sterba2016-01-14
| | | | | | Return any error from stat, minor cleanups. Signed-off-by: David Sterba <dsterba@suse.com>
* btrfs-progs: alias btrfs device delete to btrfs device removeOmar Sandoval2015-06-26
| | | | | | | | There's an awkward asymmetry between btrfs device add and btrfs device delete. Resolve this by aliasing delete to remove. Signed-off-by: Omar Sandoval <osandov@fb.com> Signed-off-by: David Sterba <dsterba@suse.cz>
* btrfs-progs: replace struct cmd_group->hidden with flagsOmar Sandoval2015-06-26
| | | | | | | | We're also going to want to support aliases, so rather than adding another member, replace "hidden" with a "flags" member. Signed-off-by: Omar Sandoval <osandov@fb.com> Signed-off-by: David Sterba <dsterba@suse.cz>
* btrfs-progs: print compact help for btrfsDavid Sterba2015-06-09
| | | | | | | | Running 'btrfs' without arguments will print complete help that spans a lot of lines and is really helpful. Print only subcommand group names with short descriptions, similar to what 'git' does. Signed-off-by: David Sterba <dsterba@suse.cz>
* btrfs-progs: unify header file inclusion protectionsDavid Sterba2015-01-21
| | | | | | There are missing ifdefs or defines with very generic names. Signed-off-by: David Sterba <dsterba@suse.cz>
* btrfs-progs: move the check_argc_* functions into utils.cGui Hecheng2014-08-22
| | | | | | | | | | | | | | To let the independent tools(e.g. btrfs-image, btrfs-convert, etc.) share the convenience of check_argc_* functions, just move it into utils.c. Also add a new function "set_argv0" to set the correct tool name: *btrfs-image*: too few arguments The original btrfs* tools work as before. Signed-off-by: Gui Hecheng <guihc.fnst@cn.fujitsu.com> [moved argv0 and check_argc to utils.*] Signed-off-by: David Sterba <dsterba@suse.cz>
* btrfs-progs: move find_mount_root to utils.[ch]Qu Wenruo2014-03-21
| | | | | | | | Move find_mount_root to utils.[ch] for general use. Signed-off-by: Qu Wenruo <quwenruo@cn.fuijitsu.com> Signed-off-by: David Sterba <dsterba@suse.cz> Signed-off-by: Chris Mason <clm@fb.com>
* Btrfs-progs: introduce btrfs property subgroupAlexander Block2014-01-31
| | | | | | | | | | | | | | | "btrfs filesystem property" is a generic interface to set/get properties on filesystem objects (inodes/subvolumes/filesystems /devs). This patch adds the generic framework for properties and also implements two properties. The first is the read-only property for subvolumes and the second is the label property for devices. Signed-off-by: Alexander Block <ablock84@googlemail.com> Signed-off-by: Filipe David Borba Manana <fdmanana@gmail.com> Signed-off-by: David Sterba <dsterba@suse.cz> Signed-off-by: Chris Mason <clm@fb.com>
* Btrfs-progs: add super-recover to recover bad supersWang Shilong2013-10-16
| | | | | | | | | | | | | | | | | | | | | | | | | | | | Until now if one of device's first superblock is corrupt,btrfs will fail to mount. Luckily, btrfs have at least two superblocks for every disk. In theory, if silent corrupting happens when we are writting superblocks into disk, we must hold at least one good superblock. One side effect is that user must gurantee that the disk must be a btrfs disk. Otherwise, this tool may destroy other fs.(This is also reason why btrfs only use first superblock in every disk to mount) This little program will try to correct bad superblocks from good superblocks with max generation. There will be five kinds of return values: 0: all supers are valid, no need to recover 1: usage or syntax error 2: recover all bad superblocks successfully 3: fail to recover bad superblocks 4: abort to recover bad superblocks Signed-off-by: Wang Shilong <wangsl.fnst@cn.fujitsu.com> Signed-off-by: David Sterba <dsterba@suse.cz> Signed-off-by: Chris Mason <chris.mason@fusionio.com>
* btrfs-progs: introduce rescue command groupDavid Sterba2013-10-16
| | | | | | | | Add an empty 1st level command namespace that will collect specialized recovery tools like chunk-recover, zero-log, select-super and similar. Signed-off-by: David Sterba <dsterba@suse.cz> Signed-off-by: Chris Mason <chris.mason@fusionio.com>
* btrfs-progs: fix -Wmissing-noreturnChris West (Faux)2013-10-16
| | | | | | Signed-off-by: "Chris West (Faux)" <git@goeswhere.com> Signed-off-by: David Sterba <dsterba@suse.cz> Signed-off-by: Chris Mason <chris.mason@fusionio.com>
* btrfs-progs: use NULL instead of 0Zach Brown2013-09-03
| | | | | | | | | These were mostly in option structs but there were a few gross string pointer arguments given as 0. Signed-off-by: Zach Brown <zab@redhat.com> Signed-off-by: David Sterba <dsterba@suse.cz> Signed-off-by: Chris Mason <chris.mason@fusionio.com>
* btrfs-progs: drop weird indirections & dead code from send/receiveEric Sandeen2013-09-03
| | | | | | | | | | | | | cmds-recieve.c & cmds-send.c seem to have weird wrappers and indirections, and "groups" of commands which have only one member, which are never referenced in the code. I think these can be removed. Signed-off-by: Eric Sandeen <sandeen@redhat.com> Reviewed-by: Stefan Behrens <sbehrens@giantdisaster.de> Signed-off-by: David Sterba <dsterba@suse.cz> Signed-off-by: Chris Mason <chris.mason@fusionio.com>
* Btrfs-progs: Add chunk recover function - using old chunk itemsMiao Xie2013-07-03
| | | | | | | | | | | | | | | | | | Add chunk-recover program to check or rebuild chunk tree when the system chunk array or chunk tree is broken. Due to the importance of the system chunk array and chunk tree, if one of them is broken, the whole btrfs will be broken even other data are OK. But we have some hint(fsid, checksum...) to salvage the old metadata. So this function will first scan the whole file system and collect the needed data(chunk/block group/dev extent), and check for the references between them. If the references are OK, the chunk tree can be rebuilt and luckily the file system will be mountable. Signed-off-by: Qu Wenruo <quwenruo@cn.fujitsu.com> Signed-off-by: Miao Xie <miaox@cn.fujitsu.com> Signed-off-by: Chris Mason <chris.mason@fusionio.com>
* Btrfs-progs: add restore command to btrfsIan Kumlien2013-02-12
| | | | | | | | Add 'btrfs restore' command which previously existed as a separate utility btrfs-restore. Signed-off-by: Ian Kumlien <pomac@demius.net> Signed-off-by: David Sterba <dsterba@suse.cz>
* Btrfs-progs: add btrfsck functionality to btrfsIan Kumlien2013-02-12
| | | | | | | | This patch includes the functionality of btrfs, it's found as "btrfs check". Signed-off-by: Ian Kumlien <pomac@demius.net> Signed-off-by: David Sterba <dsterba@suse.cz>
* Btrfs-progs: make get_subvol_name non cmds-send specificAnand Jain2013-02-01
| | | | | | | | get_subvol_name can be used other than the just with in cmds-send.c so this patch will make it possible with out changing the original intentions. Signed-off-by: Anand Jain <anand.jain@oracle.com>
* Btrfs-progs: put find_mount_root() in commands.hAnand Jain2013-02-01
| | | | | | A useful function need to define it in a header file. Signed-off-by: Anand Jain <anand.jain@oracle.com>
* Btrfs-progs: Complete the help information of btrfs send/receiveChen Yang2013-02-01
| | | | | | | | | | When typing command "btrfs send --help" or "btrfs receive --help", the help information of the commands is incomplete, which only shows a short usage. This patch helps to display the complete infomation of the commands. Signed-off-by: Cheng Yang <chenyang.fnst@cn.fujitsu.com>
* Btrfs-progs: add support for device replace procedureStefan Behrens2013-01-31
| | | | | | | | | | | This is the user mode part of the device replace patch series. The command group "btrfs replace" is added with three commands: - btrfs replace start srcdev|srcdevid targetdev [-Bfr] mount_point - btrfs replace status mount_point [-1] - btrfs replace cancel mount_point Signed-off-by: Stefan Behrens <sbehrens@giantdisaster.de>
* Btrfs-progs: move open_file_or_dir() to utils.cAnand Jain2013-01-30
| | | | | | | | | | | The definition of the function open_file_or_dir() is moved from common.c to utils.c in order to be able to share some common code between scrub and the device stats in the following step. That common code uses open_file_or_dir(). Since open_file_or_dir() makes use of the function dirfd(3), the required XOPEN version was raised from 6 to 7. Signed-off-by: Anand Jain <anand.jain@oracle.com> Original-Signed-off-by: Stefan Behrens <sbehrens@giantdisaster.de>
* Btrfs progs: quota groups supportArne Jansen2012-09-04
| | | | | Signed-off-by: Jan Schmidt <list.btrfs@jan-o-sch.net> Signed-off-by: Arne Jansen <sensille@gmx.net>
* Btrfs-progs: add btrfs send/receive commandsAlexander Block2012-07-26
| | | | | | | | | | Add user space commands for btrfs send/receive. Signed-off-by: Alexander Block <ablock84@googlemail.com> Reviewed-by: David Sterba <dave@jikos.cz> Reviewed-by: Arne Jansen <sensille@gmx.net> Reviewed-by: Jan Schmidt <list.btrfs@jan-o-sch.net> Reviewed-by: Alex Lyakas <alex.bolshoy.btrfs@gmail.com>
* Btrfs-progs: allow multi-line command group synopsisIlya Dryomov2012-02-08
| | | | Signed-off-by: Ilya Dryomov <idryomov@gmail.com>
* Btrfs-progs: add 'balance' command group infrastructureIlya Dryomov2012-02-03
| | | | | | | Add balance command group under both 'btrfs' and 'btrfs filesystem'. Preserve the old 'btrfs filesystem balance <path>' behaviour. Signed-off-by: Ilya Dryomov <idryomov@gmail.com>
* Btrfs-progs: switch all existing commands to a new parserIlya Dryomov2012-02-03
| | | | | | | 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 <idryomov@gmail.com>
* Btrfs-progs: implement new subcommand parserIlya Dryomov2012-02-03
This completely replaces the existing subcommand infrastructure, which is not flexible enough to accomodate our needs. Instead of a global command table we now have per-level tables and command group handlers, which allows command-group-specific handling of options and subcommands. The new parser exports a clear interface and gets out of the way - all control over how matching is done is passed to commands and command group handlers. One side effect of this is that command implementors have to check the number of arguments themselves - patch to fix up all existing commands follows. Signed-off-by: Ilya Dryomov <idryomov@gmail.com>