mirror of
https://github.com/kdave/btrfs-progs
synced 2025-03-25 04:16:32 +00:00
btrfs-progs: move help defines to own header
Signed-off-by: David Sterba <dsterba@suse.com>
This commit is contained in:
parent
e235f12de2
commit
1c880f34f1
@ -31,6 +31,7 @@
|
||||
#include "transaction.h"
|
||||
#include "list.h"
|
||||
#include "utils.h"
|
||||
#include "help.h"
|
||||
|
||||
#define FIELD_BUF_LEN 80
|
||||
|
||||
|
@ -21,6 +21,7 @@
|
||||
#include "utils.h"
|
||||
#include "commands.h"
|
||||
#include "cmds-inspect-dump-tree.h"
|
||||
#include "help.h"
|
||||
|
||||
int main(int argc, char **argv)
|
||||
{
|
||||
|
@ -35,6 +35,7 @@
|
||||
#include "crc32c.h"
|
||||
#include "extent-cache.h"
|
||||
#include "find-root.h"
|
||||
#include "help.h"
|
||||
|
||||
static void find_root_usage(void)
|
||||
{
|
||||
|
@ -29,6 +29,7 @@
|
||||
#include "transaction.h"
|
||||
#include "list.h"
|
||||
#include "utils.h"
|
||||
#include "help.h"
|
||||
|
||||
#define BUFFER_SIZE SZ_64K
|
||||
|
||||
|
@ -29,6 +29,7 @@
|
||||
#include "transaction.h"
|
||||
#include "list.h"
|
||||
#include "utils.h"
|
||||
#include "help.h"
|
||||
|
||||
static void print_usage(void)
|
||||
{
|
||||
|
@ -24,6 +24,7 @@
|
||||
#include "disk-io.h"
|
||||
#include "transaction.h"
|
||||
#include "utils.h"
|
||||
#include "help.h"
|
||||
|
||||
__attribute__((noreturn)) static void print_usage(void)
|
||||
{
|
||||
|
1
btrfs.c
1
btrfs.c
@ -22,6 +22,7 @@
|
||||
#include "crc32c.h"
|
||||
#include "commands.h"
|
||||
#include "utils.h"
|
||||
#include "help.h"
|
||||
|
||||
static const char * const btrfs_cmd_group_usage[] = {
|
||||
"btrfs [--help] [--version] <group> [<group>...] <command> [<args>]",
|
||||
|
@ -32,6 +32,7 @@
|
||||
#include "transaction.h"
|
||||
#include "utils.h"
|
||||
#include "volumes.h"
|
||||
#include "help.h"
|
||||
|
||||
static char *device;
|
||||
static int force = 0;
|
||||
|
@ -32,6 +32,7 @@
|
||||
|
||||
#include "commands.h"
|
||||
#include "utils.h"
|
||||
#include "help.h"
|
||||
|
||||
static const char * const balance_cmd_group_usage[] = {
|
||||
"btrfs balance <command> [options] <path>",
|
||||
|
@ -42,6 +42,7 @@
|
||||
#include "backref.h"
|
||||
#include "ulist.h"
|
||||
#include "hash.h"
|
||||
#include "help.h"
|
||||
|
||||
enum task_position {
|
||||
TASK_EXTENTS,
|
||||
|
@ -32,6 +32,7 @@
|
||||
#include "cmds-fi-usage.h"
|
||||
|
||||
#include "commands.h"
|
||||
#include "help.h"
|
||||
|
||||
static const char * const device_cmd_group_usage[] = {
|
||||
"btrfs device <command> [<args>]",
|
||||
|
@ -40,6 +40,7 @@
|
||||
#include "rbtree.h"
|
||||
|
||||
#include "interval_tree_generic.h"
|
||||
#include "help.h"
|
||||
|
||||
static int summarize = 0;
|
||||
static unsigned unit_mode = UNITS_RAW;
|
||||
|
@ -31,6 +31,7 @@
|
||||
#include "commands.h"
|
||||
|
||||
#include "version.h"
|
||||
#include "help.h"
|
||||
|
||||
/*
|
||||
* Add the chunk info to the chunk_info list
|
||||
|
@ -38,6 +38,7 @@
|
||||
#include "list_sort.h"
|
||||
#include "disk-io.h"
|
||||
#include "cmds-fi-du.h"
|
||||
#include "help.h"
|
||||
|
||||
/*
|
||||
* for btrfs fi show, we maintain a hash of fsids we've already printed.
|
||||
|
@ -34,6 +34,7 @@
|
||||
#include "commands.h"
|
||||
#include "crc32c.h"
|
||||
#include "cmds-inspect-dump-super.h"
|
||||
#include "help.h"
|
||||
|
||||
static int check_csum_sblock(void *sb, int csum_size)
|
||||
{
|
||||
|
@ -32,6 +32,7 @@
|
||||
#include "commands.h"
|
||||
#include "utils.h"
|
||||
#include "cmds-inspect-dump-tree.h"
|
||||
#include "help.h"
|
||||
|
||||
static void print_extents(struct btrfs_root *root, struct extent_buffer *eb)
|
||||
{
|
||||
|
@ -36,6 +36,7 @@
|
||||
#include "utils.h"
|
||||
#include "commands.h"
|
||||
#include "cmds-inspect-tree-stats.h"
|
||||
#include "help.h"
|
||||
|
||||
static int verbose = 0;
|
||||
static int no_pretty = 0;
|
||||
|
@ -34,6 +34,7 @@
|
||||
#include "cmds-inspect-dump-tree.h"
|
||||
#include "cmds-inspect-dump-super.h"
|
||||
#include "cmds-inspect-tree-stats.h"
|
||||
#include "help.h"
|
||||
|
||||
static const char * const inspect_cmd_group_usage[] = {
|
||||
"btrfs inspect-internal <command> <args>",
|
||||
|
@ -26,6 +26,7 @@
|
||||
#include "props.h"
|
||||
#include "ctree.h"
|
||||
#include "utils.h"
|
||||
#include "help.h"
|
||||
|
||||
static const char * const property_cmd_group_usage[] = {
|
||||
"btrfs property get/set/list [-t <type>] <object> [<name>] [value]",
|
||||
|
@ -26,6 +26,7 @@
|
||||
#include "commands.h"
|
||||
#include "qgroup.h"
|
||||
#include "utils.h"
|
||||
#include "help.h"
|
||||
|
||||
static const char * const qgroup_cmd_group_usage[] = {
|
||||
"btrfs qgroup <command> [options] <path>",
|
||||
|
@ -24,6 +24,7 @@
|
||||
|
||||
#include "commands.h"
|
||||
#include "utils.h"
|
||||
#include "help.h"
|
||||
|
||||
static const char * const quota_cmd_group_usage[] = {
|
||||
"btrfs quota <command> [options] <path>",
|
||||
|
@ -50,6 +50,7 @@
|
||||
#include "send-stream.h"
|
||||
#include "send-utils.h"
|
||||
#include "send-dump.h"
|
||||
#include "help.h"
|
||||
|
||||
static int g_verbose = 0;
|
||||
|
||||
|
@ -37,7 +37,7 @@
|
||||
#include "disk-io.h"
|
||||
|
||||
#include "commands.h"
|
||||
|
||||
#include "help.h"
|
||||
|
||||
static int print_replace_status(int fd, const char *path, int once);
|
||||
static char *time2string(char *buf, size_t s, __u64 t);
|
||||
|
@ -24,6 +24,7 @@
|
||||
#include "disk-io.h"
|
||||
#include "commands.h"
|
||||
#include "utils.h"
|
||||
#include "help.h"
|
||||
|
||||
static const char * const rescue_cmd_group_usage[] = {
|
||||
"btrfs rescue <command> [options] <path>",
|
||||
|
@ -42,6 +42,7 @@
|
||||
#include "volumes.h"
|
||||
#include "utils.h"
|
||||
#include "commands.h"
|
||||
#include "help.h"
|
||||
|
||||
static char fs_name[PATH_MAX];
|
||||
static char path_name[PATH_MAX];
|
||||
|
@ -44,6 +44,7 @@
|
||||
#include "disk-io.h"
|
||||
|
||||
#include "commands.h"
|
||||
#include "help.h"
|
||||
|
||||
static const char * const scrub_cmd_group_usage[] = {
|
||||
"btrfs scrub <command> [options] <path>|<device>",
|
||||
|
@ -43,6 +43,7 @@
|
||||
|
||||
#include "send.h"
|
||||
#include "send-utils.h"
|
||||
#include "help.h"
|
||||
|
||||
#define SEND_BUFFER_SIZE SZ_64K
|
||||
|
||||
|
@ -37,6 +37,7 @@
|
||||
#include "utils.h"
|
||||
#include "btrfs-list.h"
|
||||
#include "utils.h"
|
||||
#include "help.h"
|
||||
|
||||
static int is_subvolume_cleaned(int fd, u64 subvolid)
|
||||
{
|
||||
|
11
commands.h
11
commands.h
@ -71,19 +71,8 @@ int prefixcmp(const char *str, const char *prefix);
|
||||
int handle_command_group(const struct cmd_group *grp, int argc,
|
||||
char **argv);
|
||||
|
||||
/* help.c */
|
||||
extern const char * const generic_cmd_help_usage[];
|
||||
|
||||
void usage(const char * const *usagestr) __attribute__((noreturn));
|
||||
void usage_command(const struct cmd_struct *cmd, int full, int err);
|
||||
void usage_command_group(const struct cmd_group *grp, int all, int err);
|
||||
void usage_command_group_short(const struct cmd_group *grp);
|
||||
|
||||
void help_unknown_token(const char *arg, const struct cmd_group *grp) __attribute__((noreturn));
|
||||
void help_ambiguous_token(const char *arg, const struct cmd_group *grp) __attribute__((noreturn));
|
||||
|
||||
void help_command_group(const struct cmd_group *grp, int argc, char **argv);
|
||||
|
||||
extern const struct cmd_group subvolume_cmd_group;
|
||||
extern const struct cmd_group filesystem_cmd_group;
|
||||
extern const struct cmd_group balance_cmd_group;
|
||||
|
@ -37,6 +37,7 @@
|
||||
#include "crc32c.h"
|
||||
#include "utils.h"
|
||||
#include "task-utils.h"
|
||||
#include "help.h"
|
||||
|
||||
#if BTRFSCONVERT_EXT2
|
||||
#include <ext2fs/ext2_fs.h>
|
||||
|
1
help.c
1
help.c
@ -21,6 +21,7 @@
|
||||
|
||||
#include "commands.h"
|
||||
#include "utils.h"
|
||||
#include "help.h"
|
||||
|
||||
#define USAGE_SHORT 1U
|
||||
#define USAGE_LONG 2U
|
||||
|
79
help.h
Normal file
79
help.h
Normal file
@ -0,0 +1,79 @@
|
||||
/*
|
||||
* 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.
|
||||
*/
|
||||
|
||||
#ifndef __BTRFS_HELP_H__
|
||||
#define __BTRFS_HELP_H__
|
||||
|
||||
#define GETOPT_VAL_SI 256
|
||||
#define GETOPT_VAL_IEC 257
|
||||
#define GETOPT_VAL_RAW 258
|
||||
#define GETOPT_VAL_HUMAN_READABLE 259
|
||||
#define GETOPT_VAL_KBYTES 260
|
||||
#define GETOPT_VAL_MBYTES 261
|
||||
#define GETOPT_VAL_GBYTES 262
|
||||
#define GETOPT_VAL_TBYTES 263
|
||||
|
||||
#define GETOPT_VAL_HELP 270
|
||||
|
||||
#define ARGV0_BUF_SIZE PATH_MAX
|
||||
|
||||
#define HELPINFO_UNITS_LONG \
|
||||
"--raw raw numbers in bytes", \
|
||||
"--human-readable human friendly numbers, base 1024 (default)", \
|
||||
"--iec use 1024 as a base (KiB, MiB, GiB, TiB)", \
|
||||
"--si use 1000 as a base (kB, MB, GB, TB)", \
|
||||
"--kbytes show sizes in KiB, or kB with --si", \
|
||||
"--mbytes show sizes in MiB, or MB with --si", \
|
||||
"--gbytes show sizes in GiB, or GB with --si", \
|
||||
"--tbytes show sizes in TiB, or TB with --si"
|
||||
|
||||
#define HELPINFO_UNITS_SHORT_LONG \
|
||||
"-b|--raw raw numbers in bytes", \
|
||||
"-h|--human-readable", \
|
||||
" human friendly numbers, base 1024 (default)", \
|
||||
"-H human friendly numbers, base 1000", \
|
||||
"--iec use 1024 as a base (KiB, MiB, GiB, TiB)", \
|
||||
"--si use 1000 as a base (kB, MB, GB, TB)", \
|
||||
"-k|--kbytes show sizes in KiB, or kB with --si", \
|
||||
"-m|--mbytes show sizes in MiB, or MB with --si", \
|
||||
"-g|--gbytes show sizes in GiB, or GB with --si", \
|
||||
"-t|--tbytes show sizes in TiB, or TB with --si"
|
||||
|
||||
struct cmd_struct;
|
||||
struct cmd_group;
|
||||
|
||||
void usage(const char * const *usagestr) __attribute__((noreturn));
|
||||
void usage_command(const struct cmd_struct *cmd, int full, int err);
|
||||
void usage_command_group(const struct cmd_group *grp, int all, int err);
|
||||
void usage_command_group_short(const struct cmd_group *grp);
|
||||
|
||||
void help_unknown_token(const char *arg, const struct cmd_group *grp) __attribute__((noreturn));
|
||||
void help_ambiguous_token(const char *arg, const struct cmd_group *grp) __attribute__((noreturn));
|
||||
|
||||
void help_command_group(const struct cmd_group *grp, int argc, char **argv);
|
||||
|
||||
int check_argc_exact(int nargs, int expected);
|
||||
int check_argc_min(int nargs, int expected);
|
||||
int check_argc_max(int nargs, int expected);
|
||||
void clean_args_no_options(int argc, char *argv[], const char * const *usage);
|
||||
void clean_args_no_options_relaxed(int argc, char *argv[],
|
||||
const char * const *usagestr);
|
||||
|
||||
void fixup_argv0(char **argv, const char *token);
|
||||
void set_argv0(char **argv);
|
||||
const char *get_argv0_buf(void);
|
||||
|
||||
#endif
|
@ -35,6 +35,7 @@
|
||||
#include "utils.h"
|
||||
#include "volumes.h"
|
||||
#include "extent_io.h"
|
||||
#include "help.h"
|
||||
|
||||
#define HEADER_MAGIC 0xbd5c25e27295668bULL
|
||||
#define MAX_PENDING_SIZE (256 * 1024)
|
||||
|
@ -43,6 +43,7 @@
|
||||
#include "transaction.h"
|
||||
#include "utils.h"
|
||||
#include "list_sort.h"
|
||||
#include "help.h"
|
||||
|
||||
static u64 index_cnt = 2;
|
||||
static int verbose = 1;
|
||||
|
1
utils.c
1
utils.c
@ -51,6 +51,7 @@
|
||||
#include "volumes.h"
|
||||
#include "ioctl.h"
|
||||
#include "commands.h"
|
||||
#include "help.h"
|
||||
|
||||
#ifndef BLKDISCARD
|
||||
#define BLKDISCARD _IO(0x12,119)
|
||||
|
47
utils.h
47
utils.h
@ -64,26 +64,6 @@
|
||||
|
||||
#define BTRFS_UUID_UNPARSED_SIZE 37
|
||||
|
||||
#define ARGV0_BUF_SIZE PATH_MAX
|
||||
|
||||
#define GETOPT_VAL_SI 256
|
||||
#define GETOPT_VAL_IEC 257
|
||||
#define GETOPT_VAL_RAW 258
|
||||
#define GETOPT_VAL_HUMAN_READABLE 259
|
||||
#define GETOPT_VAL_KBYTES 260
|
||||
#define GETOPT_VAL_MBYTES 261
|
||||
#define GETOPT_VAL_GBYTES 262
|
||||
#define GETOPT_VAL_TBYTES 263
|
||||
|
||||
#define GETOPT_VAL_HELP 270
|
||||
|
||||
int check_argc_exact(int nargs, int expected);
|
||||
int check_argc_min(int nargs, int expected);
|
||||
int check_argc_max(int nargs, int expected);
|
||||
|
||||
void fixup_argv0(char **argv, const char *token);
|
||||
void set_argv0(char **argv);
|
||||
|
||||
/*
|
||||
* Output modes of size
|
||||
*/
|
||||
@ -286,34 +266,7 @@ static inline u64 div_factor(u64 num, int factor)
|
||||
int btrfs_tree_search2_ioctl_supported(int fd);
|
||||
int btrfs_check_nodesize(u32 nodesize, u32 sectorsize, u64 features);
|
||||
|
||||
const char *get_argv0_buf(void);
|
||||
|
||||
#define HELPINFO_UNITS_LONG \
|
||||
"--raw raw numbers in bytes", \
|
||||
"--human-readable human friendly numbers, base 1024 (default)", \
|
||||
"--iec use 1024 as a base (KiB, MiB, GiB, TiB)", \
|
||||
"--si use 1000 as a base (kB, MB, GB, TB)", \
|
||||
"--kbytes show sizes in KiB, or kB with --si", \
|
||||
"--mbytes show sizes in MiB, or MB with --si", \
|
||||
"--gbytes show sizes in GiB, or GB with --si", \
|
||||
"--tbytes show sizes in TiB, or TB with --si"
|
||||
|
||||
#define HELPINFO_UNITS_SHORT_LONG \
|
||||
"-b|--raw raw numbers in bytes", \
|
||||
"-h|--human-readable", \
|
||||
" human friendly numbers, base 1024 (default)", \
|
||||
"-H human friendly numbers, base 1000", \
|
||||
"--iec use 1024 as a base (KiB, MiB, GiB, TiB)", \
|
||||
"--si use 1000 as a base (kB, MB, GB, TB)", \
|
||||
"-k|--kbytes show sizes in KiB, or kB with --si", \
|
||||
"-m|--mbytes show sizes in MiB, or MB with --si", \
|
||||
"-g|--gbytes show sizes in GiB, or GB with --si", \
|
||||
"-t|--tbytes show sizes in TiB, or TB with --si"
|
||||
|
||||
unsigned int get_unit_mode_from_arg(int *argc, char *argv[], int df_mode);
|
||||
void clean_args_no_options(int argc, char *argv[], const char * const *usage);
|
||||
void clean_args_no_options_relaxed(int argc, char *argv[],
|
||||
const char * const *usagestr);
|
||||
int string_is_numerical(const char *str);
|
||||
|
||||
#if DEBUG_VERBOSE_ERROR
|
||||
|
Loading…
Reference in New Issue
Block a user