aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPascal Bellard <pascal.bellard@ads-lu.com>2010-06-07 01:16:45 +0200
committerDenys Vlasenko <vda.linux@googlemail.com>2010-06-07 01:18:53 +0200
commitb82b34e06d0f8b91a1a30a847e0b1dd80ed0a046 (patch)
tree17527de763a7e688023cb72a8ead602293b3b7b9
parente3657dcdd655ec96fc6bf38c40dd6a6f015a83de (diff)
downloadbusybox-w32-b82b34e06d0f8b91a1a30a847e0b1dd80ed0a046.tar.gz
busybox-w32-b82b34e06d0f8b91a1a30a847e0b1dd80ed0a046.tar.bz2
busybox-w32-b82b34e06d0f8b91a1a30a847e0b1dd80ed0a046.zip
modprobe: add support for -l and -s. Remove some unsupported options
Fixed some goofs in help text function old new delta modprobe_main 494 653 +159 packed_usage 27129 27145 +16 insmod_main 98 95 -3 Signed-off-by: Pascal Bellard <pascal.bellard@ads-lu.com> Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
-rw-r--r--include/usage.src.h111
-rw-r--r--modutils/insmod.c22
-rw-r--r--modutils/modprobe-small.c13
-rw-r--r--modutils/modprobe.c171
-rw-r--r--modutils/modutils.h41
-rw-r--r--util-linux/losetup.c2
6 files changed, 194 insertions, 166 deletions
diff --git a/include/usage.src.h b/include/usage.src.h
index f9f457871..878e7a282 100644
--- a/include/usage.src.h
+++ b/include/usage.src.h
@@ -2148,28 +2148,6 @@ INSERT
2148 "\ninotifyd waits for PROG to exit." \ 2148 "\ninotifyd waits for PROG to exit." \
2149 "\nWhen x event happens for all FILEs, inotifyd exits." \ 2149 "\nWhen x event happens for all FILEs, inotifyd exits." \
2150 2150
2151/* 2.6 style insmod has no options and required filename
2152 * (not module name - .ko can't be omitted) */
2153#define insmod_trivial_usage \
2154 IF_FEATURE_2_4_MODULES("[OPTIONS] MODULE ") \
2155 IF_NOT_FEATURE_2_4_MODULES("FILE ") \
2156 "[symbol=value]..."
2157#define insmod_full_usage "\n\n" \
2158 "Load the specified kernel modules into the kernel" \
2159 IF_FEATURE_2_4_MODULES( "\n" \
2160 "\nOptions:" \
2161 "\n -f Force module to load into the wrong kernel version" \
2162 "\n -k Make module autoclean-able" \
2163 "\n -v Verbose" \
2164 "\n -q Quiet" \
2165 "\n -L Lock to prevent simultaneous loads of a module" \
2166 IF_FEATURE_INSMOD_LOAD_MAP( \
2167 "\n -m Output load map to stdout" \
2168 ) \
2169 "\n -o NAME Set internal module name to NAME" \
2170 "\n -x Don't export externs" \
2171 )
2172
2173/* -v, -b, -c are ignored */ 2151/* -v, -b, -c are ignored */
2174#define install_trivial_usage \ 2152#define install_trivial_usage \
2175 "[-cdDsp] [-o USER] [-g GRP] [-m MODE] [SOURCE]... DEST" 2153 "[-cdDsp] [-o USER] [-g GRP] [-m MODE] [SOURCE]... DEST"
@@ -2973,95 +2951,6 @@ INSERT
2973 "$ ls -la /tmp/temp.mWiLjM\n" \ 2951 "$ ls -la /tmp/temp.mWiLjM\n" \
2974 "-rw------- 1 andersen andersen 0 Apr 25 17:10 /tmp/temp.mWiLjM\n" 2952 "-rw------- 1 andersen andersen 0 Apr 25 17:10 /tmp/temp.mWiLjM\n"
2975 2953
2976#define modprobe_trivial_usage \
2977 IF_MODPROBE_SMALL("[-qfwrsv] MODULE [symbol=value]...") \
2978 IF_NOT_MODPROBE_SMALL("[-" \
2979 IF_FEATURE_2_4_MODULES("k")"nqrsv" \
2980 IF_FEATURE_MODPROBE_BLACKLIST("b")"] MODULE [symbol=value]...")
2981#define modprobe_full_usage "\n\n" \
2982 "Options:" \
2983 IF_MODPROBE_SMALL( \
2984 "\n -q Quiet" \
2985 "\n -f Force" \
2986 "\n -w Wait for unload" \
2987 "\n -r Remove module (stacks) or do autoclean" \
2988 "\n -s Report via syslog instead of stderr" \
2989 "\n -v Verbose" \
2990 ) \
2991 IF_NOT_MODPROBE_SMALL( \
2992 IF_FEATURE_2_4_MODULES( \
2993 "\n -k Make module autoclean-able" \
2994 ) \
2995 "\n -n Dry run" \
2996 "\n -q Quiet" \
2997 "\n -r Remove module (stacks) or do autoclean" \
2998 "\n -s Report via syslog instead of stderr" \
2999 "\n -v Verbose" \
3000 IF_FEATURE_MODPROBE_BLACKLIST( \
3001 "\n -b Apply blacklist to module names too" \
3002 ) \
3003 )
3004
3005#define modprobe_notes_usage \
3006"modprobe can (un)load a stack of modules, passing each module options (when\n" \
3007"loading). modprobe uses a configuration file to determine what option(s) to\n" \
3008"pass each module it loads.\n" \
3009"\n" \
3010"The configuration file is searched (in this order):\n" \
3011"\n" \
3012" /etc/modprobe.conf (2.6 only)\n" \
3013" /etc/modules.conf\n" \
3014" /etc/conf.modules (deprecated)\n" \
3015"\n" \
3016"They all have the same syntax (see below). If none is present, it is\n" \
3017"_not_ an error; each loaded module is then expected to load without\n" \
3018"options. Once a file is found, the others are tested for.\n" \
3019"\n" \
3020"/etc/modules.conf entry format:\n" \
3021"\n" \
3022" alias <alias_name> <mod_name>\n" \
3023" Makes it possible to modprobe alias_name, when there is no such module.\n" \
3024" It makes sense if your mod_name is long, or you want a more representative\n" \
3025" name for that module (eg. 'scsi' in place of 'aha7xxx').\n" \
3026" This makes it also possible to use a different set of options (below) for\n" \
3027" the module and the alias.\n" \
3028" A module can be aliased more than once.\n" \
3029"\n" \
3030" options <mod_name|alias_name> <symbol=value...>\n" \
3031" When loading module mod_name (or the module aliased by alias_name), pass\n" \
3032" the \"symbol=value\" pairs as option to that module.\n" \
3033"\n" \
3034"Sample /etc/modules.conf file:\n" \
3035"\n" \
3036" options tulip irq=3\n" \
3037" alias tulip tulip2\n" \
3038" options tulip2 irq=4 io=0x308\n" \
3039"\n" \
3040"Other functionality offered by 'classic' modprobe is not available in\n" \
3041"this implementation.\n" \
3042"\n" \
3043"If module options are present both in the config file, and on the command line,\n" \
3044"then the options from the command line will be passed to the module _after_\n" \
3045"the options from the config file. That way, you can have defaults in the config\n" \
3046"file, and override them for a specific usage from the command line.\n"
3047#define modprobe_example_usage \
3048 "(with the above /etc/modules.conf):\n\n" \
3049 "$ modprobe tulip\n" \
3050 " will load the module 'tulip' with default option 'irq=3'\n\n" \
3051 "$ modprobe tulip irq=5\n" \
3052 " will load the module 'tulip' with option 'irq=5', thus overriding the default\n\n" \
3053 "$ modprobe tulip2\n" \
3054 " will load the module 'tulip' with default options 'irq=4 io=0x308',\n" \
3055 " which are the default for alias 'tulip2'\n\n" \
3056 "$ modprobe tulip2 irq=8\n" \
3057 " will load the module 'tulip' with default options 'irq=4 io=0x308 irq=8',\n" \
3058 " which are the default for alias 'tulip2' overridden by the option 'irq=8'\n\n" \
3059 " from the command line\n\n" \
3060 "$ modprobe tulip2 irq=2 io=0x210\n" \
3061 " will load the module 'tulip' with default options 'irq=4 io=0x308 irq=4 io=0x210',\n" \
3062 " which are the default for alias 'tulip2' overridden by the options 'irq=2 io=0x210'\n\n" \
3063 " from the command line\n"
3064
3065#define more_trivial_usage \ 2954#define more_trivial_usage \
3066 "[FILE]..." 2955 "[FILE]..."
3067#define more_full_usage "\n\n" \ 2956#define more_full_usage "\n\n" \
diff --git a/modutils/insmod.c b/modutils/insmod.c
index c4fb9279d..b88446c10 100644
--- a/modutils/insmod.c
+++ b/modutils/insmod.c
@@ -10,6 +10,28 @@
10#include "libbb.h" 10#include "libbb.h"
11#include "modutils.h" 11#include "modutils.h"
12 12
13/* 2.6 style insmod has no options and required filename
14 * (not module name - .ko can't be omitted) */
15
16//usage:#define insmod_trivial_usage
17//usage: IF_FEATURE_2_4_MODULES("[OPTIONS] MODULE ")
18//usage: IF_NOT_FEATURE_2_4_MODULES("FILE ")
19//usage: "[symbol=value]..."
20//usage:#define insmod_full_usage "\n\n"
21//usage: "Load the specified kernel modules into the kernel"
22//usage: IF_FEATURE_2_4_MODULES( "\n"
23//usage: "\nOptions:"
24//usage: "\n -f Force module to load into the wrong kernel version"
25//usage: "\n -k Make module autoclean-able"
26//usage: "\n -v Verbose"
27//usage: "\n -q Quiet"
28//usage: "\n -L Lock: prevent simultaneous loads"
29//usage: IF_FEATURE_INSMOD_LOAD_MAP(
30//usage: "\n -m Output load map to stdout"
31//usage: )
32//usage: "\n -x Don't export externs"
33//usage: )
34
13int insmod_main(int argc, char **argv) MAIN_EXTERNALLY_VISIBLE; 35int insmod_main(int argc, char **argv) MAIN_EXTERNALLY_VISIBLE;
14int insmod_main(int argc UNUSED_PARAM, char **argv) 36int insmod_main(int argc UNUSED_PARAM, char **argv)
15{ 37{
diff --git a/modutils/modprobe-small.c b/modutils/modprobe-small.c
index cf22b9471..0e1874ed4 100644
--- a/modutils/modprobe-small.c
+++ b/modutils/modprobe-small.c
@@ -685,6 +685,19 @@ The following options are useful for people managing distributions:
685 Use the file instead of the current kernel symbols 685 Use the file instead of the current kernel symbols
686*/ 686*/
687 687
688//usage:#if ENABLE_MODPROBE_SMALL
689//usage:#define modprobe_trivial_usage
690//usage: "[-qfwrsv] MODULE [symbol=value]..."
691//usage:#define modprobe_full_usage "\n\n"
692//usage: "Options:"
693//usage: "\n -r Remove MODULE (stacks) or do autoclean"
694//usage: "\n -q Quiet"
695//usage: "\n -v Verbose"
696//usage: "\n -f Force"
697//usage: "\n -w Wait for unload"
698//usage: "\n -s Report via syslog instead of stderr"
699//usage:#endif /* ENABLE_MODPROBE_SMALL */
700
688int modprobe_main(int argc, char **argv) MAIN_EXTERNALLY_VISIBLE; 701int modprobe_main(int argc, char **argv) MAIN_EXTERNALLY_VISIBLE;
689int modprobe_main(int argc UNUSED_PARAM, char **argv) 702int modprobe_main(int argc UNUSED_PARAM, char **argv)
690{ 703{
diff --git a/modutils/modprobe.c b/modutils/modprobe.c
index 69b9e4687..b4de65b1f 100644
--- a/modutils/modprobe.c
+++ b/modutils/modprobe.c
@@ -20,6 +20,104 @@
20//#define DBG(fmt, ...) bb_error_msg("%s: " fmt, __func__, ## __VA_ARGS__) 20//#define DBG(fmt, ...) bb_error_msg("%s: " fmt, __func__, ## __VA_ARGS__)
21#define DBG(...) ((void)0) 21#define DBG(...) ((void)0)
22 22
23//usage:#if !ENABLE_MODPROBE_SMALL
24//usage:#define modprobe_notes_usage
25//usage: "modprobe can (un)load a stack of modules, passing each module options (when\n"
26//usage: "loading). modprobe uses a configuration file to determine what option(s) to\n"
27//usage: "pass each module it loads.\n"
28//usage: "\n"
29//usage: "The configuration file is searched (in this order):\n"
30//usage: "\n"
31//usage: " /etc/modprobe.conf (2.6 only)\n"
32//usage: " /etc/modules.conf\n"
33//usage: " /etc/conf.modules (deprecated)\n"
34//usage: "\n"
35//usage: "They all have the same syntax (see below). If none is present, it is\n"
36//usage: "_not_ an error; each loaded module is then expected to load without\n"
37//usage: "options. Once a file is found, the others are tested for.\n"
38//usage: "\n"
39//usage: "/etc/modules.conf entry format:\n"
40//usage: "\n"
41//usage: " alias <alias_name> <mod_name>\n"
42//usage: " Makes it possible to modprobe alias_name, when there is no such module.\n"
43//usage: " It makes sense if your mod_name is long, or you want a more representative\n"
44//usage: " name for that module (eg. 'scsi' in place of 'aha7xxx').\n"
45//usage: " This makes it also possible to use a different set of options (below) for\n"
46//usage: " the module and the alias.\n"
47//usage: " A module can be aliased more than once.\n"
48//usage: "\n"
49//usage: " options <mod_name|alias_name> <symbol=value...>\n"
50//usage: " When loading module mod_name (or the module aliased by alias_name), pass\n"
51//usage: " the \"symbol=value\" pairs as option to that module.\n"
52//usage: "\n"
53//usage: "Sample /etc/modules.conf file:\n"
54//usage: "\n"
55//usage: " options tulip irq=3\n"
56//usage: " alias tulip tulip2\n"
57//usage: " options tulip2 irq=4 io=0x308\n"
58//usage: "\n"
59//usage: "Other functionality offered by 'classic' modprobe is not available in\n"
60//usage: "this implementation.\n"
61//usage: "\n"
62//usage: "If module options are present both in the config file, and on the command line,\n"
63//usage: "then the options from the command line will be passed to the module _after_\n"
64//usage: "the options from the config file. That way, you can have defaults in the config\n"
65//usage: "file, and override them for a specific usage from the command line.\n"
66//usage:#define modprobe_example_usage
67//usage: "(with the above /etc/modules.conf):\n\n"
68//usage: "$ modprobe tulip\n"
69//usage: " will load the module 'tulip' with default option 'irq=3'\n\n"
70//usage: "$ modprobe tulip irq=5\n"
71//usage: " will load the module 'tulip' with option 'irq=5', thus overriding the default\n\n"
72//usage: "$ modprobe tulip2\n"
73//usage: " will load the module 'tulip' with default options 'irq=4 io=0x308',\n"
74//usage: " which are the default for alias 'tulip2'\n\n"
75//usage: "$ modprobe tulip2 irq=8\n"
76//usage: " will load the module 'tulip' with default options 'irq=4 io=0x308 irq=8',\n"
77//usage: " which are the default for alias 'tulip2' overridden by the option 'irq=8'\n\n"
78//usage: " from the command line\n\n"
79//usage: "$ modprobe tulip2 irq=2 io=0x210\n"
80//usage: " will load the module 'tulip' with default options 'irq=4 io=0x308 irq=4 io=0x210',\n"
81//usage: " which are the default for alias 'tulip2' overridden by the options 'irq=2 io=0x210'\n\n"
82//usage: " from the command line\n"
83//usage:
84//usage:#define modprobe_trivial_usage
85//usage: "[-alrqvs"
86//usage: IF_FEATURE_MODPROBE_BLACKLIST("b")
87//usage: "] MODULE [symbol=value]..."
88//usage:#define modprobe_full_usage "\n\n"
89//usage: "Options:"
90//usage: "\n -a Load multiple MODULEs"
91//usage: "\n -l List (MODULE is a pattern)"
92//usage: "\n -r Remove MODULE (stacks) or do autoclean"
93//usage: "\n -q Quiet"
94//usage: "\n -v Verbose"
95//usage: "\n -s Log to syslog"
96//usage: IF_FEATURE_MODPROBE_BLACKLIST(
97//usage: "\n -b Apply blacklist to module names too"
98//usage: )
99//usage:#endif /* !ENABLE_MODPROBE_SMALL */
100
101/* Note that usage text doesn't document various 2.4 options
102 * we pull in through INSMOD_OPTS define */
103
104#define MODPROBE_COMPLEMENTARY "q-v:v-q:l--ar:a--lr:r--al"
105#define MODPROBE_OPTS "alr" IF_FEATURE_MODPROBE_BLACKLIST("b")
106//#define MODPROBE_COMPLEMENTARY "q-v:v-q:l--acr:a--lr:r--al"
107//#define MODPROBE_OPTS "acd:lnrt:C:" IF_FEATURE_MODPROBE_BLACKLIST("b")
108enum {
109 MODPROBE_OPT_INSERT_ALL = (INSMOD_OPT_UNUSED << 0), /* a */
110 //MODPROBE_OPT_DUMP_ONLY= (INSMOD_OPT_UNUSED << x), /* c */
111 //MODPROBE_OPT_DIRNAME = (INSMOD_OPT_UNUSED << x), /* d */
112 MODPROBE_OPT_LIST_ONLY = (INSMOD_OPT_UNUSED << 1), /* l */
113 //MODPROBE_OPT_SHOW_ONLY= (INSMOD_OPT_UNUSED << x), /* n */
114 MODPROBE_OPT_REMOVE = (INSMOD_OPT_UNUSED << 2), /* r */
115 //MODPROBE_OPT_RESTRICT = (INSMOD_OPT_UNUSED << x), /* t */
116 //MODPROBE_OPT_VERONLY = (INSMOD_OPT_UNUSED << x), /* V */
117 //MODPROBE_OPT_CONFIGFILE=(INSMOD_OPT_UNUSED << x), /* C */
118 MODPROBE_OPT_BLACKLIST = (INSMOD_OPT_UNUSED << 3) * ENABLE_FEATURE_MODPROBE_BLACKLIST,
119};
120
23#define MODULE_FLAG_LOADED 0x0001 121#define MODULE_FLAG_LOADED 0x0001
24#define MODULE_FLAG_NEED_DEPS 0x0002 122#define MODULE_FLAG_NEED_DEPS 0x0002
25/* "was seen in modules.dep": */ 123/* "was seen in modules.dep": */
@@ -37,32 +135,6 @@ struct module_entry { /* I'll call it ME. */
37 llist_t *deps; /* strings. modules we depend on */ 135 llist_t *deps; /* strings. modules we depend on */
38}; 136};
39 137
40/* NB: INSMOD_OPT_SILENT bit suppresses ONLY non-existent modules,
41 * not deleted ones (those are still listed in modules.dep).
42 * module-init-tools version 3.4:
43 * # modprobe bogus
44 * FATAL: Module bogus not found. [exitcode 1]
45 * # modprobe -q bogus [silent, exitcode still 1]
46 * but:
47 * # rm kernel/drivers/net/dummy.ko
48 * # modprobe -q dummy
49 * FATAL: Could not open '/lib/modules/xxx/kernel/drivers/net/dummy.ko': No such file or directory
50 * [exitcode 1]
51 */
52#define MODPROBE_OPTS "acdlnrt:VC:" IF_FEATURE_MODPROBE_BLACKLIST("b")
53enum {
54 MODPROBE_OPT_INSERT_ALL = (INSMOD_OPT_UNUSED << 0), /* a */
55 MODPROBE_OPT_DUMP_ONLY = (INSMOD_OPT_UNUSED << 1), /* c */
56 MODPROBE_OPT_D = (INSMOD_OPT_UNUSED << 2), /* d */
57 MODPROBE_OPT_LIST_ONLY = (INSMOD_OPT_UNUSED << 3), /* l */
58 MODPROBE_OPT_SHOW_ONLY = (INSMOD_OPT_UNUSED << 4), /* n */
59 MODPROBE_OPT_REMOVE = (INSMOD_OPT_UNUSED << 5), /* r */
60 MODPROBE_OPT_RESTRICT = (INSMOD_OPT_UNUSED << 6), /* t */
61 MODPROBE_OPT_VERONLY = (INSMOD_OPT_UNUSED << 7), /* V */
62 MODPROBE_OPT_CONFIGFILE = (INSMOD_OPT_UNUSED << 8), /* C */
63 MODPROBE_OPT_BLACKLIST = (INSMOD_OPT_UNUSED << 9) * ENABLE_FEATURE_MODPROBE_BLACKLIST,
64};
65
66struct globals { 138struct globals {
67 llist_t *db; /* MEs of all modules ever seen (caching for speed) */ 139 llist_t *db; /* MEs of all modules ever seen (caching for speed) */
68 llist_t *probes; /* MEs of module(s) requested on cmdline */ 140 llist_t *probes; /* MEs of module(s) requested on cmdline */
@@ -264,6 +336,18 @@ static char *parse_and_add_kcmdline_module_options(char *options, const char *mo
264 * -errno on open/read error, 336 * -errno on open/read error,
265 * errno on init_module() error 337 * errno on init_module() error
266 */ 338 */
339/* NB: INSMOD_OPT_SILENT bit suppresses ONLY non-existent modules,
340 * not deleted ones (those are still listed in modules.dep).
341 * module-init-tools version 3.4:
342 * # modprobe bogus
343 * FATAL: Module bogus not found. [exitcode 1]
344 * # modprobe -q bogus [silent, exitcode still 1]
345 * but:
346 * # rm kernel/drivers/net/dummy.ko
347 * # modprobe -q dummy
348 * FATAL: Could not open '/lib/modules/xxx/kernel/drivers/net/dummy.ko': No such file or directory
349 * [exitcode 1]
350 */
267static int do_modprobe(struct module_entry *m) 351static int do_modprobe(struct module_entry *m)
268{ 352{
269 struct module_entry *m2 = m2; /* for compiler */ 353 struct module_entry *m2 = m2; /* for compiler */
@@ -395,13 +479,38 @@ int modprobe_main(int argc UNUSED_PARAM, char **argv)
395 unsigned opt; 479 unsigned opt;
396 struct module_entry *me; 480 struct module_entry *me;
397 481
398 opt_complementary = "q-v:v-q"; 482 opt_complementary = MODPROBE_COMPLEMENTARY;
399 opt = getopt32(argv, INSMOD_OPTS MODPROBE_OPTS INSMOD_ARGS, NULL, NULL); 483 opt = getopt32(argv, INSMOD_OPTS MODPROBE_OPTS INSMOD_ARGS);
400 argv += optind; 484 argv += optind;
401 485
402 if (opt & (MODPROBE_OPT_DUMP_ONLY | MODPROBE_OPT_LIST_ONLY | 486 if (opt & MODPROBE_OPT_LIST_ONLY) {
403 MODPROBE_OPT_SHOW_ONLY)) 487 char name[MODULE_NAME_LEN];
404 bb_error_msg_and_die("not supported"); 488 char *colon, *tokens[2];
489 parser_t *p = config_open2(CONFIG_DEFAULT_DEPMOD_FILE, xfopen_for_read);
490
491 while (config_read(p, tokens, 2, 1, "# \t", PARSE_NORMAL)) {
492 colon = last_char_is(tokens[0], ':');
493 if (!colon)
494 continue;
495 *colon = '\0';
496 filename2modname(tokens[0], name);
497 if (!argv[0])
498 puts(tokens[0]);
499 else {
500 int i;
501 for (i = 0; argv[i]; i++) {
502 if (fnmatch(argv[i], name, 0) == 0) {
503 puts(tokens[0]);
504 }
505 }
506 }
507 }
508 return EXIT_SUCCESS;
509 }
510
511 /* Yes, for some reason -l ignores -s... */
512 if (opt & INSMOD_OPT_SYSLOG)
513 logmode = LOGMODE_SYSLOG;
405 514
406 if (!argv[0]) { 515 if (!argv[0]) {
407 if (opt & MODPROBE_OPT_REMOVE) { 516 if (opt & MODPROBE_OPT_REMOVE) {
diff --git a/modutils/modutils.h b/modutils/modutils.h
index 131a5087b..d46870ca6 100644
--- a/modutils/modutils.h
+++ b/modutils/modutils.h
@@ -23,32 +23,27 @@ int string_to_llist(char *string, llist_t **llist, const char *delim) FAST_FUNC;
23char *filename2modname(const char *filename, char *modname) FAST_FUNC; 23char *filename2modname(const char *filename, char *modname) FAST_FUNC;
24char *parse_cmdline_module_options(char **argv) FAST_FUNC; 24char *parse_cmdline_module_options(char **argv) FAST_FUNC;
25 25
26/* insmod for 2.4 and modprobe's options (insmod 2.6 has no options at all): */
26#define INSMOD_OPTS \ 27#define INSMOD_OPTS \
27 "vq" \ 28 "vqs" \
28 IF_FEATURE_2_4_MODULES("sLo:fkx") \ 29 IF_FEATURE_2_4_MODULES("Lfkx" IF_FEATURE_INSMOD_LOAD_MAP("m"))
29 IF_FEATURE_INSMOD_LOAD_MAP("m") 30#define INSMOD_ARGS /* (was meant to support -o NAME) , NULL */
30
31#define INSMOD_ARGS IF_FEATURE_2_4_MODULES(, NULL)
32 31
33enum { 32enum {
34 INSMOD_OPT_VERBOSE = 0x0001, 33 INSMOD_OPT_VERBOSE = (1 << 0),
35 INSMOD_OPT_SILENT = 0x0002, 34 INSMOD_OPT_SILENT = (1 << 1),
36 INSMOD_OPT_SYSLOG = 0x0004 * ENABLE_FEATURE_2_4_MODULES, 35 INSMOD_OPT_SYSLOG = (1 << 2),
37 INSMOD_OPT_LOCK = 0x0008 * ENABLE_FEATURE_2_4_MODULES, 36 //INSMOD_OPT_OUTPUTNAME = (1 << x) - not supported yet
38 INSMOD_OPT_OUTPUTNAME = 0x0010 * ENABLE_FEATURE_2_4_MODULES, 37 INSMOD_OPT_LOCK = (1 << 3) * ENABLE_FEATURE_2_4_MODULES,
39 INSMOD_OPT_FORCE = 0x0020 * ENABLE_FEATURE_2_4_MODULES, 38 INSMOD_OPT_FORCE = (1 << 4) * ENABLE_FEATURE_2_4_MODULES,
40 INSMOD_OPT_KERNELD = 0x0040 * ENABLE_FEATURE_2_4_MODULES, 39 INSMOD_OPT_KERNELD = (1 << 5) * ENABLE_FEATURE_2_4_MODULES,
41 INSMOD_OPT_NO_EXPORT = 0x0080 * ENABLE_FEATURE_2_4_MODULES, 40 INSMOD_OPT_NO_EXPORT = (1 << 6) * ENABLE_FEATURE_2_4_MODULES,
42 INSMOD_OPT_PRINT_MAP = 0x0100 * ENABLE_FEATURE_INSMOD_LOAD_MAP, 41 INSMOD_OPT_PRINT_MAP = (1 << 7) * ENABLE_FEATURE_INSMOD_LOAD_MAP,
43#if ENABLE_FEATURE_2_4_MODULES 42 INSMOD_OPT_UNUSED =
44# if ENABLE_FEATURE_INSMOD_LOAD_MAP 43 (INSMOD_OPT_PRINT_MAP ? INSMOD_OPT_PRINT_MAP
45 INSMOD_OPT_UNUSED = 0x0200, 44 : INSMOD_OPT_NO_EXPORT ? INSMOD_OPT_NO_EXPORT
46# else 45 : INSMOD_OPT_SYSLOG
47 INSMOD_OPT_UNUSED = 0x0100, 46 ) << 1
48# endif
49#else
50 INSMOD_OPT_UNUSED = 0x0004,
51#endif
52}; 47};
53 48
54#if ENABLE_FEATURE_INSMOD_TRY_MMAP 49#if ENABLE_FEATURE_INSMOD_TRY_MMAP
diff --git a/util-linux/losetup.c b/util-linux/losetup.c
index e44773a07..0f5914c88 100644
--- a/util-linux/losetup.c
+++ b/util-linux/losetup.c
@@ -23,7 +23,7 @@ int losetup_main(int argc UNUSED_PARAM, char **argv)
23 }; 23 };
24 24
25 /* max 2 args, all opts are mutually exclusive */ 25 /* max 2 args, all opts are mutually exclusive */
26 opt_complementary = "?2:d--of:o--df:f-do"; 26 opt_complementary = "?2:d--of:o--df:f--do";
27 opt = getopt32(argv, "do:f", &opt_o); 27 opt = getopt32(argv, "do:f", &opt_o);
28 argv += optind; 28 argv += optind;
29 29