aboutsummaryrefslogtreecommitdiffstats
path: root/utils.h
diff options
context:
space:
mode:
authorZhao Lei <zhaolei@cn.fujitsu.com>2015-08-31 19:03:41 +0800
committerDavid Sterba <dsterba@suse.com>2015-08-31 19:25:14 +0200
commit656731013a626c859da0e1b80c31514ed4255f9c (patch)
treee419c36fb611bed8f62bb77802f36ecfb5904e4d /utils.h
parentf7ad593ca0561c799c2c3cb25f4ecc1c99913440 (diff)
downloadbtrfs-progs-656731013a626c859da0e1b80c31514ed4255f9c.tar.gz
btrfs-progs-656731013a626c859da0e1b80c31514ed4255f9c.tar.xz
btrfs-progs-656731013a626c859da0e1b80c31514ed4255f9c.zip
btrfs-progs: Introduce get_unit_mode_from_arg for common use
We are using separate code for parsing unit mode in current code, better to use common function. This patch introduces a common function to specify units as arguments and a common help message, to make every tool in btrfs having same unit argument. The benefits are: 1: Unify current tool's arguments for unit 2: Make tools in future easy to implement such argument 3: Changes (enhancement) in common function have effect on all relative tools Signed-off-by: Zhao Lei <zhaolei@cn.fujitsu.com> Signed-off-by: David Sterba <dsterba@suse.com>
Diffstat (limited to 'utils.h')
-rw-r--r--utils.h24
1 files changed, 24 insertions, 0 deletions
diff --git a/utils.h b/utils.h
index 10d68e9..dce0a47 100644
--- a/utils.h
+++ b/utils.h
@@ -245,4 +245,28 @@ int btrfs_check_nodesize(u32 nodesize, u32 sectorsize);
const char *get_argv0_buf(void);
+#define HELPINFO_OUTPUT_UNIT \
+ "--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_OUTPUT_UNIT_DF \
+ "-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);
+
#endif