[git commit] modprobe-small: fix help messages for aliased module-related applets

Denys Vlasenko vda.linux at googlemail.com
Sat Apr 19 13:04:39 UTC 2014


commit: http://git.busybox.net/busybox/commit/?id=5fd3ddfb243f8f3a8ef471ff8c323a76cf815574
branch: http://git.busybox.net/busybox/commit/?id=refs/heads/master

Signed-off-by: Denys Vlasenko <vda.linux at googlemail.com>
---
 include/applets.src.h     |   50 ++++++++++++++++++++++----------------------
 modutils/insmod.c         |    2 +-
 modutils/modprobe-small.c |   18 ++++++---------
 modutils/modprobe.c       |    2 +-
 scripts/trylink           |    2 +-
 5 files changed, 35 insertions(+), 39 deletions(-)

diff --git a/include/applets.src.h b/include/applets.src.h
index 7dbd4c7..aedcf22 100644
--- a/include/applets.src.h
+++ b/include/applets.src.h
@@ -8,7 +8,7 @@
 
 /*
 name  - applet name as it is typed on command line
-name2 - applet name, converted to C (ether-wake: name2 = ether_wake)
+help  - applet name, converted to C (ether-wake: help = ether_wake)
 main  - corresponding <applet>_main to call (bzcat: main = bunzip2)
 l     - location to install link to: [/usr]/[s]bin
 s     - suid type:
@@ -24,46 +24,46 @@ s     - suid type:
 
 #if defined(PROTOTYPES)
 # define APPLET(name,l,s)                    int name##_main(int argc, char **argv) MAIN_EXTERNALLY_VISIBLE;
-# define APPLET_ODDNAME(name,main,l,s,name2) int main##_main(int argc, char **argv) MAIN_EXTERNALLY_VISIBLE;
-# define APPLET_NOEXEC(name,main,l,s,name2)  int main##_main(int argc, char **argv) MAIN_EXTERNALLY_VISIBLE;
-# define APPLET_NOFORK(name,main,l,s,name2)  int main##_main(int argc, char **argv) MAIN_EXTERNALLY_VISIBLE;
+# define APPLET_ODDNAME(name,main,l,s,help)  int main##_main(int argc, char **argv) MAIN_EXTERNALLY_VISIBLE;
+# define APPLET_NOEXEC(name,main,l,s,help)   int main##_main(int argc, char **argv) MAIN_EXTERNALLY_VISIBLE;
+# define APPLET_NOFORK(name,main,l,s,help)   int main##_main(int argc, char **argv) MAIN_EXTERNALLY_VISIBLE;
 
-#elif defined(NAME_MAIN_CNAME)
-# define APPLET(name,l,s)                    name name##_main name
-# define APPLET_ODDNAME(name,main,l,s,name2) name main##_main name2
-# define APPLET_NOEXEC(name,main,l,s,name2)  name main##_main name2
-# define APPLET_NOFORK(name,main,l,s,name2)  name main##_main name2
+#elif defined(NAME_MAIN)
+# define APPLET(name,l,s)                    name name##_main
+# define APPLET_ODDNAME(name,main,l,s,help)  name main##_main
+# define APPLET_NOEXEC(name,main,l,s,help)   name main##_main
+# define APPLET_NOFORK(name,main,l,s,help)   name main##_main
 
 #elif defined(MAKE_USAGE) && ENABLE_FEATURE_VERBOSE_USAGE
 # define APPLET(name,l,s)                    MAKE_USAGE(#name, name##_trivial_usage name##_full_usage)
-# define APPLET_ODDNAME(name,main,l,s,name2) MAKE_USAGE(#name, name2##_trivial_usage name2##_full_usage)
-# define APPLET_NOEXEC(name,main,l,s,name2)  MAKE_USAGE(#name, name2##_trivial_usage name2##_full_usage)
-# define APPLET_NOFORK(name,main,l,s,name2)  MAKE_USAGE(#name, name2##_trivial_usage name2##_full_usage)
+# define APPLET_ODDNAME(name,main,l,s,help)  MAKE_USAGE(#name, help##_trivial_usage help##_full_usage)
+# define APPLET_NOEXEC(name,main,l,s,help)   MAKE_USAGE(#name, help##_trivial_usage help##_full_usage)
+# define APPLET_NOFORK(name,main,l,s,help)   MAKE_USAGE(#name, help##_trivial_usage help##_full_usage)
 
 #elif defined(MAKE_USAGE) && !ENABLE_FEATURE_VERBOSE_USAGE
 # define APPLET(name,l,s)                    MAKE_USAGE(#name, name##_trivial_usage)
-# define APPLET_ODDNAME(name,main,l,s,name2) MAKE_USAGE(#name, name2##_trivial_usage)
-# define APPLET_NOEXEC(name,main,l,s,name2)  MAKE_USAGE(#name, name2##_trivial_usage)
-# define APPLET_NOFORK(name,main,l,s,name2)  MAKE_USAGE(#name, name2##_trivial_usage)
+# define APPLET_ODDNAME(name,main,l,s,help)  MAKE_USAGE(#name, help##_trivial_usage)
+# define APPLET_NOEXEC(name,main,l,s,help)   MAKE_USAGE(#name, help##_trivial_usage)
+# define APPLET_NOFORK(name,main,l,s,help)   MAKE_USAGE(#name, help##_trivial_usage)
 
 #elif defined(MAKE_LINKS)
 # define APPLET(name,l,c)                    LINK l name
-# define APPLET_ODDNAME(name,main,l,s,name2) LINK l name
-# define APPLET_NOEXEC(name,main,l,s,name2)  LINK l name
-# define APPLET_NOFORK(name,main,l,s,name2)  LINK l name
+# define APPLET_ODDNAME(name,main,l,s,help)  LINK l name
+# define APPLET_NOEXEC(name,main,l,s,help)   LINK l name
+# define APPLET_NOFORK(name,main,l,s,help)   LINK l name
 
 #elif defined(MAKE_SUID)
 # define APPLET(name,l,s)                    SUID s l name
-# define APPLET_ODDNAME(name,main,l,s,name2) SUID s l name
-# define APPLET_NOEXEC(name,main,l,s,name2)  SUID s l name
-# define APPLET_NOFORK(name,main,l,s,name2)  SUID s l name
+# define APPLET_ODDNAME(name,main,l,s,help)  SUID s l name
+# define APPLET_NOEXEC(name,main,l,s,help)   SUID s l name
+# define APPLET_NOFORK(name,main,l,s,help)   SUID s l name
 
 #else
   static struct bb_applet applets[] = { /*    name, main, location, need_suid */
 # define APPLET(name,l,s)                    { #name, #name, l, s },
-# define APPLET_ODDNAME(name,main,l,s,name2) { #name, #main, l, s },
-# define APPLET_NOEXEC(name,main,l,s,name2)  { #name, #main, l, s, 1 },
-# define APPLET_NOFORK(name,main,l,s,name2)  { #name, #main, l, s, 1, 1 },
+# define APPLET_ODDNAME(name,main,l,s,help)  { #name, #main, l, s },
+# define APPLET_NOEXEC(name,main,l,s,help)   { #name, #main, l, s, 1 },
+# define APPLET_NOFORK(name,main,l,s,help)   { #name, #main, l, s, 1, 1 },
 #endif
 
 #if ENABLE_INSTALL_NO_USR
@@ -391,7 +391,7 @@ IF_WHOAMI(APPLET_NOFORK(whoami, whoami, BB_DIR_USR_BIN, BB_SUID_DROP, whoami))
 IF_YES(APPLET_NOFORK(yes, yes, BB_DIR_USR_BIN, BB_SUID_DROP, yes))
 IF_ZCIP(APPLET(zcip, BB_DIR_SBIN, BB_SUID_DROP))
 
-#if !defined(PROTOTYPES) && !defined(NAME_MAIN_CNAME) && !defined(MAKE_USAGE) \
+#if !defined(PROTOTYPES) && !defined(NAME_MAIN) && !defined(MAKE_USAGE) \
 	&& !defined(MAKE_LINKS) && !defined(MAKE_SUID)
 };
 #endif
diff --git a/modutils/insmod.c b/modutils/insmod.c
index 887d9f2..9c3c992 100644
--- a/modutils/insmod.c
+++ b/modutils/insmod.c
@@ -21,7 +21,7 @@
 //usage:	IF_NOT_FEATURE_2_4_MODULES("FILE ")
 //usage:	"[SYMBOL=VALUE]..."
 //usage:#define insmod_full_usage "\n\n"
-//usage:       "Load the specified kernel modules into the kernel"
+//usage:       "Load kernel module"
 //usage:	IF_FEATURE_2_4_MODULES( "\n"
 //usage:     "\n	-f	Force module to load into the wrong kernel version"
 //usage:     "\n	-k	Make module autoclean-able"
diff --git a/modutils/modprobe-small.c b/modutils/modprobe-small.c
index 5b78363..023755d 100644
--- a/modutils/modprobe-small.c
+++ b/modutils/modprobe-small.c
@@ -9,10 +9,10 @@
  */
 
 //applet:IF_MODPROBE_SMALL(APPLET(modprobe, BB_DIR_SBIN, BB_SUID_DROP))
-//applet:IF_MODPROBE_SMALL(APPLET_ODDNAME(depmod, modprobe, BB_DIR_SBIN, BB_SUID_DROP, modprobe))
-//applet:IF_MODPROBE_SMALL(APPLET_ODDNAME(insmod, modprobe, BB_DIR_SBIN, BB_SUID_DROP, modprobe))
-//applet:IF_MODPROBE_SMALL(APPLET_ODDNAME(lsmod, modprobe, BB_DIR_SBIN, BB_SUID_DROP, modprobe))
-//applet:IF_MODPROBE_SMALL(APPLET_ODDNAME(rmmod, modprobe, BB_DIR_SBIN, BB_SUID_DROP, modprobe))
+//applet:IF_MODPROBE_SMALL(APPLET_ODDNAME(depmod, modprobe, BB_DIR_SBIN, BB_SUID_DROP, depmod))
+//applet:IF_MODPROBE_SMALL(APPLET_ODDNAME(insmod, modprobe, BB_DIR_SBIN, BB_SUID_DROP, insmod))
+//applet:IF_MODPROBE_SMALL(APPLET_ODDNAME(lsmod, modprobe, BB_DIR_SBIN, BB_SUID_DROP, lsmod))
+//applet:IF_MODPROBE_SMALL(APPLET_ODDNAME(rmmod, modprobe, BB_DIR_SBIN, BB_SUID_DROP, rmmod))
 
 #include "libbb.h"
 /* After libbb.h, since it needs sys/types.h on some systems */
@@ -583,7 +583,7 @@ static void process_module(char *name, const char *cmdline_options)
 // for the given alias. For example,
 // "pci:v00008086d00007010sv00000000sd00000000bc01sc01i80" matches
 // ata_piix because it has an alias "pci:v00008086d00007010sv*sd*bc*sc*i*"
-// and ata_generic, it has an alias "alias=pci:v*d*sv*sd*bc01sc01i*"
+// and ata_generic, it has an alias "pci:v*d*sv*sd*bc01sc01i*"
 // Standard modprobe would load them both.
 // In this code, find_alias() returns only the first matching module.
 
@@ -703,10 +703,6 @@ The following options are useful for people managing distributions:
 
 //usage:#if ENABLE_MODPROBE_SMALL
 
-//// Note: currently, help system shows modprobe --help text for all aliased cmds
-//// (see APPLET_ODDNAME macro definition).
-//// All other help texts defined below are not used. FIXME?
-
 //usage:#define depmod_trivial_usage NOUSAGE_STR
 //usage:#define depmod_full_usage ""
 
@@ -720,7 +716,7 @@ The following options are useful for people managing distributions:
 //usage:	IF_NOT_FEATURE_2_4_MODULES("FILE ")
 //usage:	"[SYMBOL=VALUE]..."
 //usage:#define insmod_full_usage "\n\n"
-//usage:       "Load the specified kernel modules into the kernel"
+//usage:       "Load kernel module"
 //usage:	IF_FEATURE_2_4_MODULES( "\n"
 //usage:     "\n	-f	Force module to load into the wrong kernel version"
 //usage:     "\n	-k	Make module autoclean-able"
@@ -745,7 +741,7 @@ The following options are useful for people managing distributions:
 //usage:       "$ rmmod tulip\n"
 
 //usage:#define modprobe_trivial_usage
-//usage:	"[-qfwrsv] MODULE [symbol=value]..."
+//usage:	"[-qfwrsv] MODULE [SYMBOL=VALUE]..."
 //usage:#define modprobe_full_usage "\n\n"
 //usage:       "	-r	Remove MODULE (stacks) or do autoclean"
 //usage:     "\n	-q	Quiet"
diff --git a/modutils/modprobe.c b/modutils/modprobe.c
index 7f7446d..f08f085 100644
--- a/modutils/modprobe.c
+++ b/modutils/modprobe.c
@@ -87,7 +87,7 @@
 //usage:
 //usage:#define modprobe_trivial_usage
 //usage:	"[-alrqvsD" IF_FEATURE_MODPROBE_BLACKLIST("b") "]"
-//usage:	" MODULE [symbol=value]..."
+//usage:	" MODULE [SYMBOL=VALUE]..."
 //usage:#define modprobe_full_usage "\n\n"
 //usage:       "	-a	Load multiple MODULEs"
 //usage:     "\n	-l	List (MODULE is a pattern)"
diff --git a/scripts/trylink b/scripts/trylink
index e471699..8509523 100755
--- a/scripts/trylink
+++ b/scripts/trylink
@@ -268,7 +268,7 @@ fi
 
 if test "$CONFIG_FEATURE_INDIVIDUAL" = y; then
     echo "Linking individual applets against libbusybox (see $sharedlib_dir/*)"
-    gcc -DNAME_MAIN_CNAME -E -include include/autoconf.h include/applets.h \
+    gcc -DNAME_MAIN -E -include include/autoconf.h include/applets.h \
     | grep -v "^#" \
     | grep -v "^$" \
     > applet_lst.tmp


More information about the busybox-cvs mailing list