aboutsummaryrefslogtreecommitdiff
path: root/modutils/modprobe-small.c
diff options
context:
space:
mode:
Diffstat (limited to 'modutils/modprobe-small.c')
-rw-r--r--modutils/modprobe-small.c23
1 files changed, 8 insertions, 15 deletions
diff --git a/modutils/modprobe-small.c b/modutils/modprobe-small.c
index 325f8376b..04242634b 100644
--- a/modutils/modprobe-small.c
+++ b/modutils/modprobe-small.c
@@ -10,13 +10,6 @@
10 10
11/* config MODPROBE_SMALL is defined in Config.src to ensure better "make config" order */ 11/* config MODPROBE_SMALL is defined in Config.src to ensure better "make config" order */
12 12
13//config:config FEATURE_MODPROBE_SMALL_OPTIONS_ON_CMDLINE
14//config: bool "Accept module options on modprobe command line"
15//config: default y
16//config: depends on MODPROBE_SMALL && (INSMOD || MODPROBE)
17//config: help
18//config: Allow insmod and modprobe take module options from command line.
19//config:
20//config:config FEATURE_MODPROBE_SMALL_CHECK_ALREADY_LOADED 13//config:config FEATURE_MODPROBE_SMALL_CHECK_ALREADY_LOADED
21//config: bool "Skip loading of already loaded modules" 14//config: bool "Skip loading of already loaded modules"
22//config: default y 15//config: default y
@@ -690,7 +683,7 @@ static int rmmod(const char *filename)
690 * NB: also called by depmod with bogus name "/", 683 * NB: also called by depmod with bogus name "/",
691 * just in order to force modprobe.dep.bb creation. 684 * just in order to force modprobe.dep.bb creation.
692*/ 685*/
693#if !ENABLE_FEATURE_MODPROBE_SMALL_OPTIONS_ON_CMDLINE 686#if !ENABLE_FEATURE_CMDLINE_MODULE_OPTIONS
694#define process_module(a,b) process_module(a) 687#define process_module(a,b) process_module(a)
695#define cmdline_options "" 688#define cmdline_options ""
696#endif 689#endif
@@ -735,7 +728,7 @@ static int process_module(char *name, const char *cmdline_options)
735 options = xmalloc_open_read_close(opt_filename, NULL); 728 options = xmalloc_open_read_close(opt_filename, NULL);
736 if (options) 729 if (options)
737 replace(options, '\n', ' '); 730 replace(options, '\n', ' ');
738#if ENABLE_FEATURE_MODPROBE_SMALL_OPTIONS_ON_CMDLINE 731#if ENABLE_FEATURE_CMDLINE_MODULE_OPTIONS
739 if (cmdline_options) { 732 if (cmdline_options) {
740 /* NB: cmdline_options always have one leading ' ' 733 /* NB: cmdline_options always have one leading ' '
741 * (see main()), we remove it here */ 734 * (see main()), we remove it here */
@@ -910,7 +903,7 @@ The following options are useful for people managing distributions:
910//usage:#define depmod_full_usage "" 903//usage:#define depmod_full_usage ""
911 904
912//usage:#define insmod_trivial_usage 905//usage:#define insmod_trivial_usage
913//usage: "FILE" IF_FEATURE_MODPROBE_SMALL_OPTIONS_ON_CMDLINE(" [SYMBOL=VALUE]...") 906//usage: "FILE" IF_FEATURE_CMDLINE_MODULE_OPTIONS(" [SYMBOL=VALUE]...")
914//usage:#define insmod_full_usage "\n\n" 907//usage:#define insmod_full_usage "\n\n"
915//usage: "Load kernel module" 908//usage: "Load kernel module"
916 909
@@ -920,7 +913,7 @@ The following options are useful for people managing distributions:
920//usage: "Unload kernel modules" 913//usage: "Unload kernel modules"
921 914
922//usage:#define modprobe_trivial_usage 915//usage:#define modprobe_trivial_usage
923//usage: "[-rq] MODULE" IF_FEATURE_MODPROBE_SMALL_OPTIONS_ON_CMDLINE(" [SYMBOL=VALUE]...") 916//usage: "[-rq] MODULE" IF_FEATURE_CMDLINE_MODULE_OPTIONS(" [SYMBOL=VALUE]...")
924//usage:#define modprobe_full_usage "\n\n" 917//usage:#define modprobe_full_usage "\n\n"
925//usage: " -r Remove MODULE" 918//usage: " -r Remove MODULE"
926//usage: "\n -q Quiet" 919//usage: "\n -q Quiet"
@@ -934,7 +927,7 @@ int modprobe_main(int argc UNUSED_PARAM, char **argv)
934 int exitcode; 927 int exitcode;
935#endif 928#endif
936 struct utsname uts; 929 struct utsname uts;
937 IF_FEATURE_MODPROBE_SMALL_OPTIONS_ON_CMDLINE(char *options = NULL;) 930 IF_FEATURE_CMDLINE_MODULE_OPTIONS(char *options = NULL;)
938 931
939 INIT_G(); 932 INIT_G();
940 933
@@ -998,7 +991,7 @@ int modprobe_main(int argc UNUSED_PARAM, char **argv)
998 if (!ONLY_APPLET) 991 if (!ONLY_APPLET)
999 option_mask32 |= OPT_r; 992 option_mask32 |= OPT_r;
1000 } else if (!ENABLE_MODPROBE || !(option_mask32 & OPT_r)) { 993 } else if (!ENABLE_MODPROBE || !(option_mask32 & OPT_r)) {
1001# if ENABLE_FEATURE_MODPROBE_SMALL_OPTIONS_ON_CMDLINE 994# if ENABLE_FEATURE_CMDLINE_MODULE_OPTIONS
1002 /* If not rmmod/-r, parse possible module options given on command line. 995 /* If not rmmod/-r, parse possible module options given on command line.
1003 * insmod/modprobe takes one module name, the rest are parameters. */ 996 * insmod/modprobe takes one module name, the rest are parameters. */
1004 char **arg = argv; 997 char **arg = argv;
@@ -1023,7 +1016,7 @@ int modprobe_main(int argc UNUSED_PARAM, char **argv)
1023 if (!map) 1016 if (!map)
1024 bb_perror_msg_and_die("can't read '%s'", *argv); 1017 bb_perror_msg_and_die("can't read '%s'", *argv);
1025 if (init_module(map, len, 1018 if (init_module(map, len,
1026 (IF_FEATURE_MODPROBE_SMALL_OPTIONS_ON_CMDLINE(options ? options : ) "") 1019 (IF_FEATURE_CMDLINE_MODULE_OPTIONS(options ? options : ) "")
1027 ) != 0 1020 ) != 0
1028 ) { 1021 ) {
1029 bb_error_msg_and_die("can't insert '%s': %s", 1022 bb_error_msg_and_die("can't insert '%s': %s",
@@ -1045,7 +1038,7 @@ int modprobe_main(int argc UNUSED_PARAM, char **argv)
1045 } while (*++argv); 1038 } while (*++argv);
1046 1039
1047 if (ENABLE_FEATURE_CLEAN_UP) { 1040 if (ENABLE_FEATURE_CLEAN_UP) {
1048 IF_FEATURE_MODPROBE_SMALL_OPTIONS_ON_CMDLINE(free(options);) 1041 IF_FEATURE_CMDLINE_MODULE_OPTIONS(free(options);)
1049 } 1042 }
1050 return exitcode; 1043 return exitcode;
1051#endif /* MODPROBE || INSMOD || RMMOD */ 1044#endif /* MODPROBE || INSMOD || RMMOD */