btrfs-progs: tests: test mkfs.btrfs fails on small backing size thin provision device
[btrfs-progs-unstable/devel.git] / help.h
bloba1405942adaeb200c4f7efc8160a5e6129ae9b4b
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_HELP_H__
18 #define __BTRFS_HELP_H__
20 #define GETOPT_VAL_SI 256
21 #define GETOPT_VAL_IEC 257
22 #define GETOPT_VAL_RAW 258
23 #define GETOPT_VAL_HUMAN_READABLE 259
24 #define GETOPT_VAL_KBYTES 260
25 #define GETOPT_VAL_MBYTES 261
26 #define GETOPT_VAL_GBYTES 262
27 #define GETOPT_VAL_TBYTES 263
29 #define GETOPT_VAL_HELP 270
31 #define ARGV0_BUF_SIZE PATH_MAX
33 #define HELPINFO_UNITS_LONG \
34 "--raw raw numbers in bytes", \
35 "--human-readable human friendly numbers, base 1024 (default)", \
36 "--iec use 1024 as a base (KiB, MiB, GiB, TiB)", \
37 "--si use 1000 as a base (kB, MB, GB, TB)", \
38 "--kbytes show sizes in KiB, or kB with --si", \
39 "--mbytes show sizes in MiB, or MB with --si", \
40 "--gbytes show sizes in GiB, or GB with --si", \
41 "--tbytes show sizes in TiB, or TB with --si"
43 #define HELPINFO_UNITS_SHORT_LONG \
44 "-b|--raw raw numbers in bytes", \
45 "-h|--human-readable", \
46 " human friendly numbers, base 1024 (default)", \
47 "-H human friendly numbers, base 1000", \
48 "--iec use 1024 as a base (KiB, MiB, GiB, TiB)", \
49 "--si use 1000 as a base (kB, MB, GB, TB)", \
50 "-k|--kbytes show sizes in KiB, or kB with --si", \
51 "-m|--mbytes show sizes in MiB, or MB with --si", \
52 "-g|--gbytes show sizes in GiB, or GB with --si", \
53 "-t|--tbytes show sizes in TiB, or TB with --si"
55 struct cmd_struct;
56 struct cmd_group;
58 __attribute__((noreturn))
59 void usage(const char * const *usagestr);
60 void usage_command(const struct cmd_struct *cmd, int full, int err);
61 void usage_command_group(const struct cmd_group *grp, int all, int err);
62 void usage_command_group_short(const struct cmd_group *grp);
64 __attribute__((noreturn))
65 void help_unknown_token(const char *arg, const struct cmd_group *grp);
66 __attribute__((noreturn))
67 void help_ambiguous_token(const char *arg, const struct cmd_group *grp);
69 void help_command_group(const struct cmd_group *grp, int argc, char **argv);
71 int check_argc_exact(int nargs, int expected);
72 int check_argc_min(int nargs, int expected);
73 int check_argc_max(int nargs, int expected);
74 void clean_args_no_options(int argc, char *argv[], const char * const *usage);
75 void clean_args_no_options_relaxed(int argc, char *argv[]);
77 void fixup_argv0(char **argv, const char *token);
78 void set_argv0(char **argv);
79 const char *get_argv0_buf(void);
81 #endif