summaryrefslogtreecommitdiff
path: root/util-linux
diff options
context:
space:
mode:
authorDenys Vlasenko2016-12-12 19:56:31 +0100
committerDenys Vlasenko2016-12-12 19:56:31 +0100
commite184a883567ee3fd735644416e4bd683f1894ac5 (patch)
tree7eae83fb609ecc41c44803e5969db5b1bb726f10 /util-linux
parent76de3257f7133a760c3d8908a99b850ea2d0f0b0 (diff)
downloadbusybox-e184a883567ee3fd735644416e4bd683f1894ac5.zip
busybox-e184a883567ee3fd735644416e4bd683f1894ac5.tar.gz
df: implement -B n<suff> and -B <suff> formats of -B option
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
Diffstat (limited to 'util-linux')
-rw-r--r--util-linux/fstrim.c25
1 files changed, 3 insertions, 22 deletions
diff --git a/util-linux/fstrim.c b/util-linux/fstrim.c
index 51400ef..fc51878 100644
--- a/util-linux/fstrim.c
+++ b/util-linux/fstrim.c
@@ -47,25 +47,6 @@ struct fstrim_range {
#define FITRIM _IOWR('X', 121, struct fstrim_range)
#endif
-static const struct suffix_mult fstrim_sfx[] = {
- { "KiB", 1024 },
- { "kiB", 1024 },
- { "K", 1024 },
- { "k", 1024 },
- { "MiB", 1048576 },
- { "miB", 1048576 },
- { "M", 1048576 },
- { "m", 1048576 },
- { "GiB", 1073741824 },
- { "giB", 1073741824 },
- { "G", 1073741824 },
- { "g", 1073741824 },
- { "KB", 1000 },
- { "MB", 1000000 },
- { "GB", 1000000000 },
- { "", 0 }
-};
-
int fstrim_main(int argc, char **argv) MAIN_EXTERNALLY_VISIBLE;
int fstrim_main(int argc UNUSED_PARAM, char **argv)
{
@@ -98,11 +79,11 @@ int fstrim_main(int argc UNUSED_PARAM, char **argv)
range.len = ULLONG_MAX;
if (opts & OPT_o)
- range.start = xatoull_sfx(arg_o, fstrim_sfx);
+ range.start = xatoull_sfx(arg_o, kmg_i_suffixes);
if (opts & OPT_l)
- range.len = xatoull_sfx(arg_l, fstrim_sfx);
+ range.len = xatoull_sfx(arg_l, kmg_i_suffixes);
if (opts & OPT_m)
- range.minlen = xatoull_sfx(arg_m, fstrim_sfx);
+ range.minlen = xatoull_sfx(arg_m, kmg_i_suffixes);
mp = argv[optind];
if (find_block_device(mp)) {