diff options
author | Denys Vlasenko | 2013-06-30 02:47:45 +0200 |
---|---|---|
committer | Denys Vlasenko | 2013-06-30 02:47:45 +0200 |
commit | e9b3fcc3e457642788f7011fe9f7fe9917156fa4 (patch) | |
tree | 5f350a92054f272442e5c11bd1f94d5323ca20fa /miscutils/ubi_tools.c | |
parent | f798ba97171b7ecac3ecc5b8e6a0e4eb1301a391 (diff) | |
download | busybox-e9b3fcc3e457642788f7011fe9f7fe9917156fa4.zip busybox-e9b3fcc3e457642788f7011fe9f7fe9917156fa4.tar.gz |
ubi_tools: enhance -s option to allow size multiplier to match mtd-utils
Based on patch by Paul B. Henson <henson@acm.org>
function old new delta
static.size_suffixes - 32 +32
ubi_tools_main 1141 1148 +7
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
Diffstat (limited to 'miscutils/ubi_tools.c')
-rw-r--r-- | miscutils/ubi_tools.c | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/miscutils/ubi_tools.c b/miscutils/ubi_tools.c index 3305987..d923f1c 100644 --- a/miscutils/ubi_tools.c +++ b/miscutils/ubi_tools.c @@ -92,6 +92,13 @@ static unsigned get_num_from_file(const char *path, unsigned max, const char *er int ubi_tools_main(int argc, char **argv) MAIN_EXTERNALLY_VISIBLE; int ubi_tools_main(int argc UNUSED_PARAM, char **argv) { + static const struct suffix_mult size_suffixes[] = { + { "KiB", 1024 }, + { "MiB", 1024*1024 }, + { "GiB", 1024*1024*1024 }, + { "", 0 } + }; + unsigned opts; char *ubi_ctrl; int fd; @@ -140,7 +147,7 @@ int ubi_tools_main(int argc UNUSED_PARAM, char **argv) #define OPTION_t (1 << 6) if (opts & OPTION_s) - size_bytes = xatoull(size_bytes_str); + size_bytes = xatoull_sfx(size_bytes_str, size_suffixes); argv += optind; ubi_ctrl = *argv++; |