Btrfs progs v4.17.1
[btrfs-progs-unstable/devel.git] / commands.h
blob76991f2b28d591264bd4a1440a66bc9c9c42ce0b
1 /*
2 * This program is free software; you can redistribute it and/or
3 * modify it under the terms of the GNU General Public
4 * License v2 as published by the Free Software Foundation.
6 * This program is distributed in the hope that it will be useful,
7 * but WITHOUT ANY WARRANTY; without even the implied warranty of
8 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
9 * General Public License for more details.
11 * You should have received a copy of the GNU General Public
12 * License along with this program; if not, write to the
13 * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
14 * Boston, MA 021110-1307, USA.
17 #ifndef __BTRFS_COMMANDS_H__
18 #define __BTRFS_COMMANDS_H__
20 enum {
21 CMD_HIDDEN = (1 << 0), /* should not be in help listings */
22 CMD_ALIAS = (1 << 1), /* alias of next command in cmd_group */
25 struct cmd_struct {
26 const char *token;
27 int (*fn)(int, char **);
30 * Usage strings
32 * A NULL-terminated array of the following format:
34 * usagestr[0] - one-line synopsis (required)
35 * usagestr[1] - one-line short description (required)
36 * usagestr[2..m] - a long (possibly multi-line) description
37 * (optional)
38 * usagestr[m + 1] - an empty line separator (required if at least one
39 * option string is given, not needed otherwise)
40 * usagestr[m + 2..n] - option strings, one option per line
41 * (optional)
42 * usagestr[n + 1] - NULL terminator
44 * Options (if present) should always (even if there is no long
45 * description) be prepended with an empty line. Supplied strings are
46 * indented but otherwise printed as-is, no automatic wrapping is done.
48 * Grep for cmd_*_usage[] for examples.
50 const char * const *usagestr;
52 /* should be NULL if token is not a subgroup */
53 const struct cmd_group *next;
55 /* CMD_* flags above */
56 int flags;
59 #define NULL_CMD_STRUCT {NULL, NULL, NULL, NULL, 0}
61 struct cmd_group {
62 const char * const *usagestr;
63 const char *infostr;
65 const struct cmd_struct commands[];
68 int handle_command_group(const struct cmd_group *grp, int argc,
69 char **argv);
71 extern const char * const generic_cmd_help_usage[];
73 extern const struct cmd_group subvolume_cmd_group;
74 extern const struct cmd_group filesystem_cmd_group;
75 extern const struct cmd_group balance_cmd_group;
76 extern const struct cmd_group device_cmd_group;
77 extern const struct cmd_group scrub_cmd_group;
78 extern const struct cmd_group inspect_cmd_group;
79 extern const struct cmd_group property_cmd_group;
80 extern const struct cmd_group quota_cmd_group;
81 extern const struct cmd_group qgroup_cmd_group;
82 extern const struct cmd_group replace_cmd_group;
83 extern const struct cmd_group rescue_cmd_group;
85 extern const char * const cmd_send_usage[];
86 extern const char * const cmd_receive_usage[];
87 extern const char * const cmd_check_usage[];
88 extern const char * const cmd_chunk_recover_usage[];
89 extern const char * const cmd_super_recover_usage[];
90 extern const char * const cmd_restore_usage[];
91 extern const char * const cmd_rescue_usage[];
92 extern const char * const cmd_inspect_dump_super_usage[];
93 extern const char * const cmd_inspect_dump_tree_usage[];
94 extern const char * const cmd_inspect_tree_stats_usage[];
95 extern const char * const cmd_filesystem_du_usage[];
96 extern const char * const cmd_filesystem_usage_usage[];
98 int cmd_subvolume(int argc, char **argv);
99 int cmd_filesystem(int argc, char **argv);
100 int cmd_filesystem_du(int argc, char **argv);
101 int cmd_filesystem_usage(int argc, char **argv);
102 int cmd_balance(int argc, char **argv);
103 int cmd_device(int argc, char **argv);
104 int cmd_scrub(int argc, char **argv);
105 int cmd_check(int argc, char **argv);
106 int cmd_chunk_recover(int argc, char **argv);
107 int cmd_super_recover(int argc, char **argv);
108 int cmd_inspect(int argc, char **argv);
109 int cmd_inspect_dump_super(int argc, char **argv);
110 int cmd_inspect_dump_tree(int argc, char **argv);
111 int cmd_inspect_tree_stats(int argc, char **argv);
112 int cmd_property(int argc, char **argv);
113 int cmd_send(int argc, char **argv);
114 int cmd_receive(int argc, char **argv);
115 int cmd_quota(int argc, char **argv);
116 int cmd_qgroup(int argc, char **argv);
117 int cmd_replace(int argc, char **argv);
118 int cmd_restore(int argc, char **argv);
119 int cmd_select_super(int argc, char **argv);
120 int cmd_dump_super(int argc, char **argv);
121 int cmd_debug_tree(int argc, char **argv);
122 int cmd_rescue(int argc, char **argv);
124 #endif