diff options
| author | Denys Vlasenko <vda.linux@googlemail.com> | 2016-11-23 07:54:52 +0100 |
|---|---|---|
| committer | Denys Vlasenko <vda.linux@googlemail.com> | 2016-11-23 07:54:52 +0100 |
| commit | e32b64c4ec9272295df6852fb2a2888d7799d2f0 (patch) | |
| tree | fa64292eb0697f7963060ad6d41f1d76b4978dff /modutils | |
| parent | 5467d268f09ddddd200ab14fd402831708be5dfd (diff) | |
| download | busybox-w32-e32b64c4ec9272295df6852fb2a2888d7799d2f0.tar.gz busybox-w32-e32b64c4ec9272295df6852fb2a2888d7799d2f0.tar.bz2 busybox-w32-e32b64c4ec9272295df6852fb2a2888d7799d2f0.zip | |
Convert all modutils/* applets to "new style" applet definitions
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
Diffstat (limited to 'modutils')
| -rw-r--r-- | modutils/Config.src | 111 | ||||
| -rw-r--r-- | modutils/Kbuild.src | 7 | ||||
| -rw-r--r-- | modutils/depmod.c | 11 | ||||
| -rw-r--r-- | modutils/insmod.c | 9 | ||||
| -rw-r--r-- | modutils/lsmod.c | 19 | ||||
| -rw-r--r-- | modutils/modprobe-small.c | 47 | ||||
| -rw-r--r-- | modutils/modprobe.c | 22 | ||||
| -rw-r--r-- | modutils/modutils-24.c | 2 | ||||
| -rw-r--r-- | modutils/rmmod.c | 9 |
9 files changed, 119 insertions, 118 deletions
diff --git a/modutils/Config.src b/modutils/Config.src index 0b11832bc..4227f356a 100644 --- a/modutils/Config.src +++ b/modutils/Config.src | |||
| @@ -7,117 +7,6 @@ menu "Linux Module Utilities" | |||
| 7 | 7 | ||
| 8 | INSERT | 8 | INSERT |
| 9 | 9 | ||
| 10 | config MODPROBE_SMALL | ||
| 11 | bool "Simplified modutils" | ||
| 12 | default y | ||
| 13 | select PLATFORM_LINUX | ||
| 14 | help | ||
| 15 | Simplified modutils. | ||
| 16 | |||
| 17 | With this option modprobe does not require modules.dep file | ||
| 18 | and does not use /etc/modules.conf file. | ||
| 19 | It scans module files in /lib/modules/`uname -r` and | ||
| 20 | determines dependencies and module alias names on the fly. | ||
| 21 | This may make module loading slower, most notably | ||
| 22 | when one needs to load module by alias (this requires | ||
| 23 | scanning through module _bodies_). | ||
| 24 | |||
| 25 | At the first attempt to load a module by alias modprobe | ||
| 26 | will try to generate modules.dep.bb file in order to speed up | ||
| 27 | future loads by alias. Failure to do so (read-only /lib/modules, | ||
| 28 | etc) is not reported, and future modprobes will be slow too. | ||
| 29 | |||
| 30 | NB: modules.dep.bb file format is not compatible | ||
| 31 | with modules.dep file as created/used by standard module tools. | ||
| 32 | |||
| 33 | Additional module parameters can be stored in | ||
| 34 | /etc/modules/$module_name files. | ||
| 35 | |||
| 36 | Apart from modprobe, other utilities are also provided: | ||
| 37 | - insmod is an alias to modprobe | ||
| 38 | - rmmod is an alias to modprobe -r | ||
| 39 | - depmod generates modules.dep.bb | ||
| 40 | |||
| 41 | config FEATURE_MODPROBE_SMALL_OPTIONS_ON_CMDLINE | ||
| 42 | bool "Accept module options on modprobe command line" | ||
| 43 | default y | ||
| 44 | depends on MODPROBE_SMALL | ||
| 45 | select PLATFORM_LINUX | ||
| 46 | help | ||
| 47 | Allow insmod and modprobe take module options from command line. | ||
| 48 | |||
| 49 | config FEATURE_MODPROBE_SMALL_CHECK_ALREADY_LOADED | ||
| 50 | bool "Skip loading of already loaded modules" | ||
| 51 | default y | ||
| 52 | depends on MODPROBE_SMALL | ||
| 53 | help | ||
| 54 | Check if the module is already loaded. | ||
| 55 | |||
| 56 | config INSMOD | ||
| 57 | bool "insmod" | ||
| 58 | default n | ||
| 59 | depends on !MODPROBE_SMALL | ||
| 60 | select PLATFORM_LINUX | ||
| 61 | help | ||
| 62 | insmod is used to load specified modules in the running kernel. | ||
| 63 | |||
| 64 | config RMMOD | ||
| 65 | bool "rmmod" | ||
| 66 | default n | ||
| 67 | depends on !MODPROBE_SMALL | ||
| 68 | select PLATFORM_LINUX | ||
| 69 | help | ||
| 70 | rmmod is used to unload specified modules from the kernel. | ||
| 71 | |||
| 72 | config LSMOD | ||
| 73 | bool "lsmod" | ||
| 74 | default n | ||
| 75 | depends on !MODPROBE_SMALL | ||
| 76 | select PLATFORM_LINUX | ||
| 77 | help | ||
| 78 | lsmod is used to display a list of loaded modules. | ||
| 79 | |||
| 80 | config FEATURE_LSMOD_PRETTY_2_6_OUTPUT | ||
| 81 | bool "Pretty output" | ||
| 82 | default n | ||
| 83 | depends on LSMOD | ||
| 84 | select PLATFORM_LINUX | ||
| 85 | help | ||
| 86 | This option makes output format of lsmod adjusted to | ||
| 87 | the format of module-init-tools for Linux kernel 2.6. | ||
| 88 | Increases size somewhat. | ||
| 89 | |||
| 90 | config MODPROBE | ||
| 91 | bool "modprobe" | ||
| 92 | default n | ||
| 93 | depends on !MODPROBE_SMALL | ||
| 94 | select PLATFORM_LINUX | ||
| 95 | help | ||
| 96 | Handle the loading of modules, and their dependencies on a high | ||
| 97 | level. | ||
| 98 | |||
| 99 | config FEATURE_MODPROBE_BLACKLIST | ||
| 100 | bool "Blacklist support" | ||
| 101 | default n | ||
| 102 | depends on MODPROBE | ||
| 103 | select PLATFORM_LINUX | ||
| 104 | help | ||
| 105 | Say 'y' here to enable support for the 'blacklist' command in | ||
| 106 | modprobe.conf. This prevents the alias resolver to resolve | ||
| 107 | blacklisted modules. This is useful if you want to prevent your | ||
| 108 | hardware autodetection scripts to load modules like evdev, frame | ||
| 109 | buffer drivers etc. | ||
| 110 | |||
| 111 | config DEPMOD | ||
| 112 | bool "depmod" | ||
| 113 | default n | ||
| 114 | depends on !MODPROBE_SMALL | ||
| 115 | select PLATFORM_LINUX | ||
| 116 | help | ||
| 117 | depmod generates modules.dep (and potentially modules.alias | ||
| 118 | and modules.symbols) that contain dependency information | ||
| 119 | for modprobe. | ||
| 120 | |||
| 121 | comment "Options common to multiple modutils" | 10 | comment "Options common to multiple modutils" |
| 122 | 11 | ||
| 123 | config FEATURE_2_4_MODULES | 12 | config FEATURE_2_4_MODULES |
diff --git a/modutils/Kbuild.src b/modutils/Kbuild.src index 1a7ac8751..6b4fb7470 100644 --- a/modutils/Kbuild.src +++ b/modutils/Kbuild.src | |||
| @@ -7,10 +7,3 @@ | |||
| 7 | lib-y:= | 7 | lib-y:= |
| 8 | 8 | ||
| 9 | INSERT | 9 | INSERT |
| 10 | lib-$(CONFIG_MODPROBE_SMALL) += modprobe-small.o | ||
| 11 | lib-$(CONFIG_DEPMOD) += depmod.o modutils.o | ||
| 12 | lib-$(CONFIG_INSMOD) += insmod.o modutils.o | ||
| 13 | lib-$(CONFIG_LSMOD) += lsmod.o modutils.o | ||
| 14 | lib-$(CONFIG_MODPROBE) += modprobe.o modutils.o | ||
| 15 | lib-$(CONFIG_RMMOD) += rmmod.o modutils.o | ||
| 16 | lib-$(CONFIG_FEATURE_2_4_MODULES) += modutils-24.o | ||
diff --git a/modutils/depmod.c b/modutils/depmod.c index e5f0e3d2b..b9347027e 100644 --- a/modutils/depmod.c +++ b/modutils/depmod.c | |||
| @@ -7,9 +7,20 @@ | |||
| 7 | * | 7 | * |
| 8 | * Licensed under GPLv2 or later, see file LICENSE in this source tree. | 8 | * Licensed under GPLv2 or later, see file LICENSE in this source tree. |
| 9 | */ | 9 | */ |
| 10 | //config:config DEPMOD | ||
| 11 | //config: bool "depmod" | ||
| 12 | //config: default n | ||
| 13 | //config: depends on !MODPROBE_SMALL | ||
| 14 | //config: select PLATFORM_LINUX | ||
| 15 | //config: help | ||
| 16 | //config: depmod generates modules.dep (and potentially modules.alias | ||
| 17 | //config: and modules.symbols) that contain dependency information | ||
| 18 | //config: for modprobe. | ||
| 10 | 19 | ||
| 11 | //applet:IF_DEPMOD(APPLET(depmod, BB_DIR_SBIN, BB_SUID_DROP)) | 20 | //applet:IF_DEPMOD(APPLET(depmod, BB_DIR_SBIN, BB_SUID_DROP)) |
| 12 | 21 | ||
| 22 | //kbuild:lib-$(CONFIG_DEPMOD) += depmod.o modutils.o | ||
| 23 | |||
| 13 | #include "libbb.h" | 24 | #include "libbb.h" |
| 14 | #include "modutils.h" | 25 | #include "modutils.h" |
| 15 | #include <sys/utsname.h> /* uname() */ | 26 | #include <sys/utsname.h> /* uname() */ |
diff --git a/modutils/insmod.c b/modutils/insmod.c index 9c3c992a5..2ebf4beb9 100644 --- a/modutils/insmod.c +++ b/modutils/insmod.c | |||
| @@ -6,9 +6,18 @@ | |||
| 6 | * | 6 | * |
| 7 | * Licensed under GPLv2 or later, see file LICENSE in this source tree. | 7 | * Licensed under GPLv2 or later, see file LICENSE in this source tree. |
| 8 | */ | 8 | */ |
| 9 | //config:config INSMOD | ||
| 10 | //config: bool "insmod" | ||
| 11 | //config: default n | ||
| 12 | //config: depends on !MODPROBE_SMALL | ||
| 13 | //config: select PLATFORM_LINUX | ||
| 14 | //config: help | ||
| 15 | //config: insmod is used to load specified modules in the running kernel. | ||
| 9 | 16 | ||
| 10 | //applet:IF_INSMOD(APPLET(insmod, BB_DIR_SBIN, BB_SUID_DROP)) | 17 | //applet:IF_INSMOD(APPLET(insmod, BB_DIR_SBIN, BB_SUID_DROP)) |
| 11 | 18 | ||
| 19 | //kbuild:lib-$(CONFIG_INSMOD) += insmod.o modutils.o | ||
| 20 | |||
| 12 | #include "libbb.h" | 21 | #include "libbb.h" |
| 13 | #include "modutils.h" | 22 | #include "modutils.h" |
| 14 | 23 | ||
diff --git a/modutils/lsmod.c b/modutils/lsmod.c index 3b3c166b9..ee85fb0fb 100644 --- a/modutils/lsmod.c +++ b/modutils/lsmod.c | |||
| @@ -7,9 +7,28 @@ | |||
| 7 | * | 7 | * |
| 8 | * Licensed under GPLv2 or later, see file LICENSE in this source tree. | 8 | * Licensed under GPLv2 or later, see file LICENSE in this source tree. |
| 9 | */ | 9 | */ |
| 10 | //config:config LSMOD | ||
| 11 | //config: bool "lsmod" | ||
| 12 | //config: default n | ||
| 13 | //config: depends on !MODPROBE_SMALL | ||
| 14 | //config: select PLATFORM_LINUX | ||
| 15 | //config: help | ||
| 16 | //config: lsmod is used to display a list of loaded modules. | ||
| 17 | //config: | ||
| 18 | //config:config FEATURE_LSMOD_PRETTY_2_6_OUTPUT | ||
| 19 | //config: bool "Pretty output" | ||
| 20 | //config: default n | ||
| 21 | //config: depends on LSMOD | ||
| 22 | //config: select PLATFORM_LINUX | ||
| 23 | //config: help | ||
| 24 | //config: This option makes output format of lsmod adjusted to | ||
| 25 | //config: the format of module-init-tools for Linux kernel 2.6. | ||
| 26 | //config: Increases size somewhat. | ||
| 10 | 27 | ||
| 11 | //applet:IF_LSMOD(APPLET(lsmod, BB_DIR_SBIN, BB_SUID_DROP)) | 28 | //applet:IF_LSMOD(APPLET(lsmod, BB_DIR_SBIN, BB_SUID_DROP)) |
| 12 | 29 | ||
| 30 | //kbuild:lib-$(CONFIG_LSMOD) += lsmod.o modutils.o | ||
| 31 | |||
| 13 | //usage:#if !ENABLE_MODPROBE_SMALL | 32 | //usage:#if !ENABLE_MODPROBE_SMALL |
| 14 | //usage:#define lsmod_trivial_usage | 33 | //usage:#define lsmod_trivial_usage |
| 15 | //usage: "" | 34 | //usage: "" |
diff --git a/modutils/modprobe-small.c b/modutils/modprobe-small.c index a47e52234..51ba42f7a 100644 --- a/modutils/modprobe-small.c +++ b/modutils/modprobe-small.c | |||
| @@ -7,6 +7,51 @@ | |||
| 7 | * | 7 | * |
| 8 | * Licensed under GPLv2, see file LICENSE in this source tree. | 8 | * Licensed under GPLv2, see file LICENSE in this source tree. |
| 9 | */ | 9 | */ |
| 10 | //config:config MODPROBE_SMALL | ||
| 11 | //config: bool "Simplified modutils" | ||
| 12 | //config: default y | ||
| 13 | //config: select PLATFORM_LINUX | ||
| 14 | //config: help | ||
| 15 | //config: Simplified modutils. | ||
| 16 | //config: | ||
| 17 | //config: With this option modprobe does not require modules.dep file | ||
| 18 | //config: and does not use /etc/modules.conf file. | ||
| 19 | //config: It scans module files in /lib/modules/`uname -r` and | ||
| 20 | //config: determines dependencies and module alias names on the fly. | ||
| 21 | //config: This may make module loading slower, most notably | ||
| 22 | //config: when one needs to load module by alias (this requires | ||
| 23 | //config: scanning through module _bodies_). | ||
| 24 | //config: | ||
| 25 | //config: At the first attempt to load a module by alias modprobe | ||
| 26 | //config: will try to generate modules.dep.bb file in order to speed up | ||
| 27 | //config: future loads by alias. Failure to do so (read-only /lib/modules, | ||
| 28 | //config: etc) is not reported, and future modprobes will be slow too. | ||
| 29 | //config: | ||
| 30 | //config: NB: modules.dep.bb file format is not compatible | ||
| 31 | //config: with modules.dep file as created/used by standard module tools. | ||
| 32 | //config: | ||
| 33 | //config: Additional module parameters can be stored in | ||
| 34 | //config: /etc/modules/$module_name files. | ||
| 35 | //config: | ||
| 36 | //config: Apart from modprobe, other utilities are also provided: | ||
| 37 | //config: - insmod is an alias to modprobe | ||
| 38 | //config: - rmmod is an alias to modprobe -r | ||
| 39 | //config: - depmod generates modules.dep.bb | ||
| 40 | //config: | ||
| 41 | //config:config FEATURE_MODPROBE_SMALL_OPTIONS_ON_CMDLINE | ||
| 42 | //config: bool "Accept module options on modprobe command line" | ||
| 43 | //config: default y | ||
| 44 | //config: depends on MODPROBE_SMALL | ||
| 45 | //config: select PLATFORM_LINUX | ||
| 46 | //config: help | ||
| 47 | //config: Allow insmod and modprobe take module options from command line. | ||
| 48 | //config: | ||
| 49 | //config:config FEATURE_MODPROBE_SMALL_CHECK_ALREADY_LOADED | ||
| 50 | //config: bool "Skip loading of already loaded modules" | ||
| 51 | //config: default y | ||
| 52 | //config: depends on MODPROBE_SMALL | ||
| 53 | //config: help | ||
| 54 | //config: Check if the module is already loaded. | ||
| 10 | 55 | ||
| 11 | //applet:IF_MODPROBE_SMALL(APPLET(modprobe, BB_DIR_SBIN, BB_SUID_DROP)) | 56 | //applet:IF_MODPROBE_SMALL(APPLET(modprobe, BB_DIR_SBIN, BB_SUID_DROP)) |
| 12 | //applet:IF_MODPROBE_SMALL(APPLET_ODDNAME(depmod, modprobe, BB_DIR_SBIN, BB_SUID_DROP, depmod)) | 57 | //applet:IF_MODPROBE_SMALL(APPLET_ODDNAME(depmod, modprobe, BB_DIR_SBIN, BB_SUID_DROP, depmod)) |
| @@ -14,6 +59,8 @@ | |||
| 14 | //applet:IF_MODPROBE_SMALL(APPLET_ODDNAME(lsmod, modprobe, BB_DIR_SBIN, BB_SUID_DROP, lsmod)) | 59 | //applet:IF_MODPROBE_SMALL(APPLET_ODDNAME(lsmod, modprobe, BB_DIR_SBIN, BB_SUID_DROP, lsmod)) |
| 15 | //applet:IF_MODPROBE_SMALL(APPLET_ODDNAME(rmmod, modprobe, BB_DIR_SBIN, BB_SUID_DROP, rmmod)) | 60 | //applet:IF_MODPROBE_SMALL(APPLET_ODDNAME(rmmod, modprobe, BB_DIR_SBIN, BB_SUID_DROP, rmmod)) |
| 16 | 61 | ||
| 62 | //kbuild:lib-$(CONFIG_MODPROBE_SMALL) += modprobe-small.o | ||
| 63 | |||
| 17 | #include "libbb.h" | 64 | #include "libbb.h" |
| 18 | /* After libbb.h, since it needs sys/types.h on some systems */ | 65 | /* After libbb.h, since it needs sys/types.h on some systems */ |
| 19 | #include <sys/utsname.h> /* uname() */ | 66 | #include <sys/utsname.h> /* uname() */ |
diff --git a/modutils/modprobe.c b/modutils/modprobe.c index 8130c40b7..d404ef92f 100644 --- a/modutils/modprobe.c +++ b/modutils/modprobe.c | |||
| @@ -7,9 +7,31 @@ | |||
| 7 | * | 7 | * |
| 8 | * Licensed under GPLv2 or later, see file LICENSE in this source tree. | 8 | * Licensed under GPLv2 or later, see file LICENSE in this source tree. |
| 9 | */ | 9 | */ |
| 10 | //config:config MODPROBE | ||
| 11 | //config: bool "modprobe" | ||
| 12 | //config: default n | ||
| 13 | //config: depends on !MODPROBE_SMALL | ||
| 14 | //config: select PLATFORM_LINUX | ||
| 15 | //config: help | ||
| 16 | //config: Handle the loading of modules, and their dependencies on a high | ||
| 17 | //config: level. | ||
| 18 | //config: | ||
| 19 | //config:config FEATURE_MODPROBE_BLACKLIST | ||
| 20 | //config: bool "Blacklist support" | ||
| 21 | //config: default n | ||
| 22 | //config: depends on MODPROBE | ||
| 23 | //config: select PLATFORM_LINUX | ||
| 24 | //config: help | ||
| 25 | //config: Say 'y' here to enable support for the 'blacklist' command in | ||
| 26 | //config: modprobe.conf. This prevents the alias resolver to resolve | ||
| 27 | //config: blacklisted modules. This is useful if you want to prevent your | ||
| 28 | //config: hardware autodetection scripts to load modules like evdev, frame | ||
| 29 | //config: buffer drivers etc. | ||
| 10 | 30 | ||
| 11 | //applet:IF_MODPROBE(APPLET(modprobe, BB_DIR_SBIN, BB_SUID_DROP)) | 31 | //applet:IF_MODPROBE(APPLET(modprobe, BB_DIR_SBIN, BB_SUID_DROP)) |
| 12 | 32 | ||
| 33 | //kbuild:lib-$(CONFIG_MODPROBE) += modprobe.o modutils.o | ||
| 34 | |||
| 13 | #include "libbb.h" | 35 | #include "libbb.h" |
| 14 | #include "modutils.h" | 36 | #include "modutils.h" |
| 15 | #include <sys/utsname.h> | 37 | #include <sys/utsname.h> |
diff --git a/modutils/modutils-24.c b/modutils/modutils-24.c index fe46fc3fd..9ce91351d 100644 --- a/modutils/modutils-24.c +++ b/modutils/modutils-24.c | |||
| @@ -58,6 +58,8 @@ | |||
| 58 | * Licensed under GPLv2 or later, see file LICENSE in this source tree. | 58 | * Licensed under GPLv2 or later, see file LICENSE in this source tree. |
| 59 | */ | 59 | */ |
| 60 | 60 | ||
| 61 | //kbuild:lib-$(CONFIG_FEATURE_2_4_MODULES) += modutils-24.o | ||
| 62 | |||
| 61 | #include "libbb.h" | 63 | #include "libbb.h" |
| 62 | #include "modutils.h" | 64 | #include "modutils.h" |
| 63 | #include <sys/utsname.h> | 65 | #include <sys/utsname.h> |
diff --git a/modutils/rmmod.c b/modutils/rmmod.c index 5c353ef95..e0358838a 100644 --- a/modutils/rmmod.c +++ b/modutils/rmmod.c | |||
| @@ -7,9 +7,18 @@ | |||
| 7 | * | 7 | * |
| 8 | * Licensed under GPLv2 or later, see file LICENSE in this source tree. | 8 | * Licensed under GPLv2 or later, see file LICENSE in this source tree. |
| 9 | */ | 9 | */ |
| 10 | //config:config RMMOD | ||
| 11 | //config: bool "rmmod" | ||
| 12 | //config: default n | ||
| 13 | //config: depends on !MODPROBE_SMALL | ||
| 14 | //config: select PLATFORM_LINUX | ||
| 15 | //config: help | ||
| 16 | //config: rmmod is used to unload specified modules from the kernel. | ||
| 10 | 17 | ||
| 11 | //applet:IF_RMMOD(APPLET(rmmod, BB_DIR_SBIN, BB_SUID_DROP)) | 18 | //applet:IF_RMMOD(APPLET(rmmod, BB_DIR_SBIN, BB_SUID_DROP)) |
| 12 | 19 | ||
| 20 | //kbuild:lib-$(CONFIG_RMMOD) += rmmod.o modutils.o | ||
| 21 | |||
| 13 | //usage:#if !ENABLE_MODPROBE_SMALL | 22 | //usage:#if !ENABLE_MODPROBE_SMALL |
| 14 | //usage:#define rmmod_trivial_usage | 23 | //usage:#define rmmod_trivial_usage |
| 15 | //usage: "[-wfa] [MODULE]..." | 24 | //usage: "[-wfa] [MODULE]..." |
