linux-btrfs.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 0/4] btrfs-progs: Use common function to parse unit arguments
@ 2015-08-27 13:38 Zhao Lei
  2015-08-27 13:38 ` [PATCH 1/4] btrfs-progs: Introduce get_unit_mode_from_arg for common use Zhao Lei
                   ` (4 more replies)
  0 siblings, 5 replies; 7+ messages in thread
From: Zhao Lei @ 2015-08-27 13:38 UTC (permalink / raw)
  To: linux-btrfs; +Cc: Zhao Lei

We are using separate code for parse unit mode in current code,
result is each command have different argument for unit mode:

 # btrfs filesystem show --help
   ...
   --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
   ...
 #
 # btrfs filesystem df --help
   ...
   -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
   ...
 #

This patchset introduce common function to parse arguments for setting
unit: get_unit_mode_from_arg()
and common help message for unit argument,
to make every tool in btrfs have same interface for setting unit.

The merit are:
1: Unify current each 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

Zhao Lei (4):
  btrfs-progs: Introduce get_unit_mode_from_arg for common use
  btrfs-progs: Use common unit parser for btrfs filesystem command
  btrfs-progs: Use common unit parser for btrfs device command
  btrfs-progs: Use common unit parser for btrfs qgroup command

 cmds-device.c     |  74 ++++-----------------------------
 cmds-fi-usage.c   |  79 ++++-------------------------------
 cmds-filesystem.c | 121 ++++++------------------------------------------------
 cmds-qgroup.c     |  47 ++-------------------
 utils.c           |  70 +++++++++++++++++++++++++++++++
 utils.h           |  14 +++++++
 6 files changed, 114 insertions(+), 291 deletions(-)

-- 
1.8.5.1


^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2015-08-31  1:57 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-08-27 13:38 [PATCH 0/4] btrfs-progs: Use common function to parse unit arguments Zhao Lei
2015-08-27 13:38 ` [PATCH 1/4] btrfs-progs: Introduce get_unit_mode_from_arg for common use Zhao Lei
2015-08-27 13:38 ` [PATCH 2/4] btrfs-progs: Use common unit parser for btrfs filesystem command Zhao Lei
2015-08-27 13:38 ` [PATCH 3/4] btrfs-progs: Use common unit parser for btrfs device command Zhao Lei
2015-08-27 13:38 ` [PATCH 4/4] btrfs-progs: Use common unit parser for btrfs qgroup command Zhao Lei
2015-08-28 17:24 ` [PATCH 0/4] btrfs-progs: Use common function to parse unit arguments David Sterba
2015-08-31  1:56   ` Zhao Lei

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).