diff options
author | Kang-Che Sung <explorer09@gmail.com> | 2017-01-31 21:09:17 +0800 |
---|---|---|
committer | Denys Vlasenko <vda.linux@googlemail.com> | 2017-02-01 10:14:05 +0100 |
commit | b1d6a2c6247bae0b9f1903ba0e0d16c56f4ef556 (patch) | |
tree | afc10aba770e711341483ef13b95ab3ac4916f9b /modutils/modprobe-small.c | |
parent | 264cb01540cdd995e7c376fd8bcef94e09e31819 (diff) | |
download | busybox-w32-b1d6a2c6247bae0b9f1903ba0e0d16c56f4ef556.tar.gz busybox-w32-b1d6a2c6247bae0b9f1903ba0e0d16c56f4ef556.tar.bz2 busybox-w32-b1d6a2c6247bae0b9f1903ba0e0d16c56f4ef556.zip |
cmdline module options can be disabled on "big" modutils
Allow module options on command line to be disabled on "big" modutils.
Config FEATURE_MODPROBE_SMALL_OPTIONS_ON_CMDLINE is renamed to
FEATURE_CMDLINE_MODULE_OPTIONS and no longer depends on !MODPROBE_SMALL
(I'm not sure if disabling this is useful on "big" modutils, but at
least the macro can serve as a marker and ensure both implementations
of same feature have consistent behavior.)
Signed-off-by: Kang-Che Sung <explorer09@gmail.com>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
Diffstat (limited to 'modutils/modprobe-small.c')
-rw-r--r-- | modutils/modprobe-small.c | 23 |
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 */ |