diff options
author | Denys Vlasenko <vda.linux@googlemail.com> | 2017-08-07 02:55:33 +0200 |
---|---|---|
committer | Denys Vlasenko <vda.linux@googlemail.com> | 2017-08-07 02:55:33 +0200 |
commit | 115e0a719950f8f716f73d5e36e9483df9dbbf1e (patch) | |
tree | 8606214e5ebf11461e75501f1bc6314b42016df3 /miscutils | |
parent | 4dea1edd08a45c5987448719e56ee61a20fb9210 (diff) | |
download | busybox-w32-115e0a719950f8f716f73d5e36e9483df9dbbf1e.tar.gz busybox-w32-115e0a719950f8f716f73d5e36e9483df9dbbf1e.tar.bz2 busybox-w32-115e0a719950f8f716f73d5e36e9483df9dbbf1e.zip |
ubi_tools: a bit smaller applet resolution code
function old new delta
ubi_tools_main 1241 1235 -6
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
Diffstat (limited to 'miscutils')
-rw-r--r-- | miscutils/ubi_tools.c | 21 |
1 files changed, 15 insertions, 6 deletions
diff --git a/miscutils/ubi_tools.c b/miscutils/ubi_tools.c index c6ba22adf..d9b76b69c 100644 --- a/miscutils/ubi_tools.c +++ b/miscutils/ubi_tools.c | |||
@@ -67,12 +67,21 @@ | |||
67 | #endif | 67 | #endif |
68 | #include <mtd/ubi-user.h> | 68 | #include <mtd/ubi-user.h> |
69 | 69 | ||
70 | #define do_attach (ENABLE_UBIATTACH && applet_name[3] == 'a') | 70 | #define UBI_APPLET_CNT (0 \ |
71 | #define do_detach (ENABLE_UBIDETACH && applet_name[3] == 'd') | 71 | + ENABLE_UBIATTACH \ |
72 | #define do_mkvol (ENABLE_UBIMKVOL && applet_name[3] == 'm') | 72 | + ENABLE_UBIDETACH \ |
73 | #define do_rmvol (ENABLE_UBIRMVOL && applet_name[4] == 'm') | 73 | + ENABLE_UBIMKVOL \ |
74 | #define do_rsvol (ENABLE_UBIRSVOL && applet_name[4] == 's') | 74 | + ENABLE_UBIRMVOL \ |
75 | #define do_update (ENABLE_UBIUPDATEVOL && applet_name[3] == 'u') | 75 | + ENABLE_UBIRSVOL \ |
76 | + ENABLE_UBIUPDATEVOL \ | ||
77 | ) | ||
78 | |||
79 | #define do_attach (ENABLE_UBIATTACH && (UBI_APPLET_CNT == 1 || applet_name[4] == 't')) | ||
80 | #define do_detach (ENABLE_UBIDETACH && (UBI_APPLET_CNT == 1 || applet_name[4] == 'e')) | ||
81 | #define do_mkvol (ENABLE_UBIMKVOL && (UBI_APPLET_CNT == 1 || applet_name[4] == 'k')) | ||
82 | #define do_rmvol (ENABLE_UBIRMVOL && (UBI_APPLET_CNT == 1 || applet_name[4] == 'm')) | ||
83 | #define do_rsvol (ENABLE_UBIRSVOL && (UBI_APPLET_CNT == 1 || applet_name[4] == 's')) | ||
84 | #define do_update (ENABLE_UBIUPDATEVOL && (UBI_APPLET_CNT == 1 || applet_name[4] == 'p')) | ||
76 | 85 | ||
77 | static unsigned get_num_from_file(const char *path, unsigned max, const char *errmsg) | 86 | static unsigned get_num_from_file(const char *path, unsigned max, const char *errmsg) |
78 | { | 87 | { |