aboutsummaryrefslogtreecommitdiff
path: root/modutils/modprobe-small.c
diff options
context:
space:
mode:
authorDenys Vlasenko <vda.linux@googlemail.com>2016-12-23 15:12:27 +0100
committerDenys Vlasenko <vda.linux@googlemail.com>2016-12-23 15:13:16 +0100
commita1cd0d9849946e0627484ec6b6435837c853a113 (patch)
tree23c7c643bd0af2859beff3876bdbaa20953bdb5f /modutils/modprobe-small.c
parentce3a98a222a2191ef4a22e90c49a51dfa7279e07 (diff)
downloadbusybox-w32-a1cd0d9849946e0627484ec6b6435837c853a113.tar.gz
busybox-w32-a1cd0d9849946e0627484ec6b6435837c853a113.tar.bz2
busybox-w32-a1cd0d9849946e0627484ec6b6435837c853a113.zip
modprobe-small: make applets individually selectable
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
Diffstat (limited to 'modutils/modprobe-small.c')
-rw-r--r--modutils/modprobe-small.c24
1 files changed, 12 insertions, 12 deletions
diff --git a/modutils/modprobe-small.c b/modutils/modprobe-small.c
index e3a349b4e..652ff4dfa 100644
--- a/modutils/modprobe-small.c
+++ b/modutils/modprobe-small.c
@@ -25,11 +25,11 @@
25//config: help 25//config: help
26//config: Check if the module is already loaded. 26//config: Check if the module is already loaded.
27 27
28//applet:IF_MODPROBE_SMALL(APPLET(modprobe, BB_DIR_SBIN, BB_SUID_DROP)) 28//applet:IF_MODPROBE(IF_MODPROBE_SMALL(APPLET(modprobe, BB_DIR_SBIN, BB_SUID_DROP)))
29//applet:IF_MODPROBE_SMALL(APPLET_ODDNAME(depmod, modprobe, BB_DIR_SBIN, BB_SUID_DROP, depmod)) 29//applet:IF_DEPMOD(IF_MODPROBE_SMALL(APPLET_ODDNAME(depmod, modprobe, BB_DIR_SBIN, BB_SUID_DROP, depmod)))
30//applet:IF_MODPROBE_SMALL(APPLET_ODDNAME(insmod, modprobe, BB_DIR_SBIN, BB_SUID_DROP, insmod)) 30//applet:IF_INSMOD(IF_MODPROBE_SMALL(APPLET_ODDNAME(insmod, modprobe, BB_DIR_SBIN, BB_SUID_DROP, insmod)))
31//applet:IF_MODPROBE_SMALL(APPLET_ODDNAME(lsmod, modprobe, BB_DIR_SBIN, BB_SUID_DROP, lsmod)) 31//applet:IF_LSMOD(IF_MODPROBE_SMALL(APPLET_ODDNAME(lsmod, modprobe, BB_DIR_SBIN, BB_SUID_DROP, lsmod)))
32//applet:IF_MODPROBE_SMALL(APPLET_ODDNAME(rmmod, modprobe, BB_DIR_SBIN, BB_SUID_DROP, rmmod)) 32//applet:IF_RMMOD(IF_MODPROBE_SMALL(APPLET_ODDNAME(rmmod, modprobe, BB_DIR_SBIN, BB_SUID_DROP, rmmod)))
33 33
34//kbuild:lib-$(CONFIG_MODPROBE_SMALL) += modprobe-small.o 34//kbuild:lib-$(CONFIG_MODPROBE_SMALL) += modprobe-small.o
35 35
@@ -930,7 +930,7 @@ int modprobe_main(int argc UNUSED_PARAM, char **argv)
930 IF_FEATURE_MODPROBE_SMALL_OPTIONS_ON_CMDLINE(char *options;) 930 IF_FEATURE_MODPROBE_SMALL_OPTIONS_ON_CMDLINE(char *options;)
931 931
932 /* are we lsmod? -> just dump /proc/modules */ 932 /* are we lsmod? -> just dump /proc/modules */
933 if ('l' == applet0) { 933 if (ENABLE_LSMOD && 'l' == applet0) {
934 xprint_and_close_file(xfopen_for_read("/proc/modules")); 934 xprint_and_close_file(xfopen_for_read("/proc/modules"));
935 return EXIT_SUCCESS; 935 return EXIT_SUCCESS;
936 } 936 }
@@ -940,14 +940,14 @@ int modprobe_main(int argc UNUSED_PARAM, char **argv)
940 /* Prevent ugly corner cases with no modules at all */ 940 /* Prevent ugly corner cases with no modules at all */
941 modinfo = xzalloc(sizeof(modinfo[0])); 941 modinfo = xzalloc(sizeof(modinfo[0]));
942 942
943 if ('i' != applet0) { /* not insmod */ 943 if (!ENABLE_INSMOD || 'i' != applet0) { /* not insmod */
944 /* Goto modules directory */ 944 /* Goto modules directory */
945 xchdir(CONFIG_DEFAULT_MODULES_DIR); 945 xchdir(CONFIG_DEFAULT_MODULES_DIR);
946 } 946 }
947 uname(&uts); /* never fails */ 947 uname(&uts); /* never fails */
948 948
949 /* depmod? */ 949 /* depmod? */
950 if ('d' == applet0) { 950 if (ENABLE_DEPMOD && 'd' == applet0) {
951 /* Supported: 951 /* Supported:
952 * -n: print result to stdout 952 * -n: print result to stdout
953 * -a: process all modules (default) 953 * -a: process all modules (default)
@@ -986,11 +986,11 @@ int modprobe_main(int argc UNUSED_PARAM, char **argv)
986 argv += optind; 986 argv += optind;
987 987
988 /* are we rmmod? -> simulate modprobe -r */ 988 /* are we rmmod? -> simulate modprobe -r */
989 if ('r' == applet0) { 989 if (ENABLE_RMMOD && 'r' == applet0) {
990 option_mask32 |= OPT_r; 990 option_mask32 |= OPT_r;
991 } 991 }
992 992
993 if ('i' != applet0) { /* not insmod */ 993 if (!ENABLE_INSMOD || 'i' != applet0) { /* not insmod */
994 /* Goto $VERSION directory */ 994 /* Goto $VERSION directory */
995 xchdir(uts.release); 995 xchdir(uts.release);
996 } 996 }
@@ -1014,7 +1014,7 @@ int modprobe_main(int argc UNUSED_PARAM, char **argv)
1014 argv[1] = NULL; 1014 argv[1] = NULL;
1015#endif 1015#endif
1016 1016
1017 if ('i' == applet0) { /* insmod */ 1017 if (ENABLE_INSMOD && 'i' == applet0) { /* insmod */
1018 size_t len; 1018 size_t len;
1019 void *map; 1019 void *map;
1020 1020
@@ -1034,7 +1034,7 @@ int modprobe_main(int argc UNUSED_PARAM, char **argv)
1034 } 1034 }
1035 1035
1036 /* Try to load modprobe.dep.bb */ 1036 /* Try to load modprobe.dep.bb */
1037 if ('r' != applet0) { /* not rmmod */ 1037 if (!ENABLE_RMMOD || 'r' != applet0) { /* not rmmod */
1038 load_dep_bb(); 1038 load_dep_bb();
1039 } 1039 }
1040 1040