diff options
Diffstat (limited to 'modutils/modprobe-small.c')
-rw-r--r-- | modutils/modprobe-small.c | 41 |
1 files changed, 28 insertions, 13 deletions
diff --git a/modutils/modprobe-small.c b/modutils/modprobe-small.c index 431b8aeb2..053a7df89 100644 --- a/modutils/modprobe-small.c +++ b/modutils/modprobe-small.c | |||
@@ -79,6 +79,7 @@ int lsmod_main(int argc UNUSED_PARAM, char **argv UNUSED_PARAM) | |||
79 | #define is_rmmod (ENABLE_RMMOD && (ONLY_APPLET || applet_name[0] == 'r')) | 79 | #define is_rmmod (ENABLE_RMMOD && (ONLY_APPLET || applet_name[0] == 'r')) |
80 | 80 | ||
81 | enum { | 81 | enum { |
82 | DEPMOD_OPT_n = (1 << 0), /* dry-run, print to stdout */ | ||
82 | OPT_q = (1 << 0), /* be quiet */ | 83 | OPT_q = (1 << 0), /* be quiet */ |
83 | OPT_r = (1 << 1), /* module removal instead of loading */ | 84 | OPT_r = (1 << 1), /* module removal instead of loading */ |
84 | }; | 85 | }; |
@@ -168,7 +169,7 @@ static char* find_keyword(char *ptr, size_t len, const char *word) | |||
168 | 169 | ||
169 | /* search for the first char in word */ | 170 | /* search for the first char in word */ |
170 | ptr = memchr(ptr, word[0], len); | 171 | ptr = memchr(ptr, word[0], len); |
171 | if (ptr == NULL) /* no occurance left, done */ | 172 | if (ptr == NULL) /* no occurrence left, done */ |
172 | break; | 173 | break; |
173 | after_word = is_prefixed_with(ptr, word); | 174 | after_word = is_prefixed_with(ptr, word); |
174 | if (after_word) | 175 | if (after_word) |
@@ -410,7 +411,7 @@ static FAST_FUNC int fileAction(const char *pathname, | |||
410 | if (load_module(pathname, module_load_options) == 0) { | 411 | if (load_module(pathname, module_load_options) == 0) { |
411 | /* Load was successful, there is nothing else to do. | 412 | /* Load was successful, there is nothing else to do. |
412 | * This can happen ONLY for "top-level" module load, | 413 | * This can happen ONLY for "top-level" module load, |
413 | * not a dep, because deps dont do dirscan. */ | 414 | * not a dep, because deps don't do dirscan. */ |
414 | exit(EXIT_SUCCESS); | 415 | exit(EXIT_SUCCESS); |
415 | } | 416 | } |
416 | } | 417 | } |
@@ -477,7 +478,7 @@ static int start_dep_bb_writeout(void) | |||
477 | int fd; | 478 | int fd; |
478 | 479 | ||
479 | /* depmod -n: write result to stdout */ | 480 | /* depmod -n: write result to stdout */ |
480 | if (applet_name[0] == 'd' && (option_mask32 & 1)) | 481 | if (is_depmod && (option_mask32 & DEPMOD_OPT_n)) |
481 | return STDOUT_FILENO; | 482 | return STDOUT_FILENO; |
482 | 483 | ||
483 | fd = open(DEPFILE_BB".new", O_WRONLY | O_CREAT | O_TRUNC | O_EXCL, 0644); | 484 | fd = open(DEPFILE_BB".new", O_WRONLY | O_CREAT | O_TRUNC | O_EXCL, 0644); |
@@ -764,9 +765,12 @@ static int process_module(char *name, const char *cmdline_options) | |||
764 | 765 | ||
765 | if (!infovec) { | 766 | if (!infovec) { |
766 | /* both dirscan and find_alias found nothing */ | 767 | /* both dirscan and find_alias found nothing */ |
767 | if (!is_remove && !is_depmod) /* it wasn't rmmod or depmod */ | 768 | if (!is_remove && !is_depmod) { /* it wasn't rmmod or depmod */ |
768 | bb_error_msg("module '%s' not found", name); | 769 | bb_error_msg("module '%s' not found", name); |
769 | //TODO: _and_die()? or should we continue (un)loading modules listed on cmdline? | 770 | //TODO: _and_die()? or should we continue (un)loading modules listed on cmdline? |
771 | /* "modprobe non-existing-module; echo $?" must print 1 */ | ||
772 | exitcode = EXIT_FAILURE; | ||
773 | } | ||
770 | goto ret; | 774 | goto ret; |
771 | } | 775 | } |
772 | 776 | ||
@@ -862,25 +866,28 @@ Usage: rmmod [-fhswvV] modulename ... | |||
862 | should eventually fall to zero). | 866 | should eventually fall to zero). |
863 | 867 | ||
864 | # modprobe | 868 | # modprobe |
865 | Usage: modprobe [-v] [-V] [-C config-file] [-n] [-i] [-q] [-b] | 869 | Usage: modprobe [-v] [-V] [-C config-file] [-d <dirname> ] [-n] [-i] [-q] |
866 | [-o <modname>] [ --dump-modversions ] <modname> [parameters...] | 870 | [-b] [-o <modname>] [ --dump-modversions ] <modname> [parameters...] |
867 | modprobe -r [-n] [-i] [-v] <modulename> ... | 871 | modprobe -r [-n] [-i] [-v] <modulename> ... |
868 | modprobe -l -t <dirname> [ -a <modulename> ...] | 872 | modprobe -l -t <dirname> [ -a <modulename> ...] |
869 | 873 | ||
870 | # depmod --help | 874 | # depmod --help |
871 | depmod 3.4 -- part of module-init-tools | 875 | depmod 3.13 -- part of module-init-tools |
872 | depmod -[aA] [-n -e -v -q -V -r -u] | 876 | depmod -[aA] [-n -e -v -q -V -r -u -w -m] |
873 | [-b basedirectory] [forced_version] | 877 | [-b basedirectory] [forced_version] |
874 | depmod [-n -e -v -q -r -u] [-F kernelsyms] module1.ko module2.ko ... | 878 | depmod [-n -e -v -q -r -u -w] [-F kernelsyms] module1.ko module2.ko ... |
875 | If no arguments (except options) are given, "depmod -a" is assumed. | 879 | If no arguments (except options) are given, "depmod -a" is assumed. |
876 | depmod will output a dependency list suitable for the modprobe utility. | 880 | depmod will output a dependency list suitable for the modprobe utility. |
877 | Options: | 881 | Options: |
878 | -a, --all Probe all modules | 882 | -a, --all Probe all modules |
879 | -A, --quick Only does the work if there's a new module | 883 | -A, --quick Only does the work if there's a new module |
880 | -n, --show Write the dependency file on stdout only | ||
881 | -e, --errsyms Report not supplied symbols | 884 | -e, --errsyms Report not supplied symbols |
885 | -m, --map Create the legacy map files | ||
886 | -n, --show Write the dependency file on stdout only | ||
887 | -P, --symbol-prefix Architecture symbol prefix | ||
882 | -V, --version Print the release version | 888 | -V, --version Print the release version |
883 | -v, --verbose Enable verbose mode | 889 | -v, --verbose Enable verbose mode |
890 | -w, --warn Warn on duplicates | ||
884 | -h, --help Print this usage message | 891 | -h, --help Print this usage message |
885 | The following options are useful for people managing distributions: | 892 | The following options are useful for people managing distributions: |
886 | -b basedirectory | 893 | -b basedirectory |
@@ -889,12 +896,18 @@ The following options are useful for people managing distributions: | |||
889 | -F kernelsyms | 896 | -F kernelsyms |
890 | --filesyms kernelsyms | 897 | --filesyms kernelsyms |
891 | Use the file instead of the current kernel symbols | 898 | Use the file instead of the current kernel symbols |
899 | -E Module.symvers | ||
900 | --symvers Module.symvers | ||
901 | Use Module.symvers file to check symbol versions | ||
892 | */ | 902 | */ |
893 | 903 | ||
894 | //usage:#if ENABLE_MODPROBE_SMALL | 904 | //usage:#if ENABLE_MODPROBE_SMALL |
895 | 905 | ||
896 | //usage:#define depmod_trivial_usage NOUSAGE_STR | 906 | //usage:#define depmod_trivial_usage "[-n]" |
897 | //usage:#define depmod_full_usage "" | 907 | //usage:#define depmod_full_usage "\n\n" |
908 | //usage: "Generate modules.dep.bb" | ||
909 | //usage: "\n" | ||
910 | //usage: "\n -n Dry run: print file to stdout" | ||
898 | 911 | ||
899 | //usage:#define insmod_trivial_usage | 912 | //usage:#define insmod_trivial_usage |
900 | //usage: "FILE" IF_FEATURE_CMDLINE_MODULE_OPTIONS(" [SYMBOL=VALUE]...") | 913 | //usage: "FILE" IF_FEATURE_CMDLINE_MODULE_OPTIONS(" [SYMBOL=VALUE]...") |
@@ -947,10 +960,12 @@ int modprobe_main(int argc UNUSED_PARAM, char **argv) | |||
947 | * -e: report any symbols which a module needs | 960 | * -e: report any symbols which a module needs |
948 | * which are not supplied by other modules or the kernel | 961 | * which are not supplied by other modules or the kernel |
949 | * -F FILE: System.map (symbols for -e) | 962 | * -F FILE: System.map (symbols for -e) |
950 | * -q, -r, -u: noop? | 963 | * -q, -r, -u: noop |
951 | * Not supported: | 964 | * Not supported: |
952 | * -b BASEDIR: (TODO!) modules are in | 965 | * -b BASEDIR: (TODO!) modules are in |
953 | * $BASEDIR/lib/modules/$VERSION | 966 | * $BASEDIR/lib/modules/$VERSION |
967 | * -m: create legacy "modules.*map" files (deprecated; in | ||
968 | * kmod's depmod, prints a warning message and continues) | ||
954 | * -v: human readable deps to stdout | 969 | * -v: human readable deps to stdout |
955 | * -V: version (don't want to support it - people may depend | 970 | * -V: version (don't want to support it - people may depend |
956 | * on it as an indicator of "standard" depmod) | 971 | * on it as an indicator of "standard" depmod) |