diff options
| author | Bernhard Reutner-Fischer <rep.dot.nop@gmail.com> | 2008-05-27 10:55:34 +0000 |
|---|---|---|
| committer | Bernhard Reutner-Fischer <rep.dot.nop@gmail.com> | 2008-05-27 10:55:34 +0000 |
| commit | b85fb693c149e6e574b4693c3abadfb554bb18dc (patch) | |
| tree | 5a02d581d4235ec8d86f8122bca0dd21f55026e9 /modutils | |
| parent | 4fec3469668faf0022d32fc195c9451523219cb2 (diff) | |
| download | busybox-w32-b85fb693c149e6e574b4693c3abadfb554bb18dc.tar.gz busybox-w32-b85fb693c149e6e574b4693c3abadfb554bb18dc.tar.bz2 busybox-w32-b85fb693c149e6e574b4693c3abadfb554bb18dc.zip | |
- Add config option for DEFAULT_DEPMOD_FILE and DEFAULT_DEPMOD_FILE.
No obj-code changes.
Diffstat (limited to 'modutils')
| -rw-r--r-- | modutils/Config.in | 19 | ||||
| -rw-r--r-- | modutils/depmod.c | 10 | ||||
| -rw-r--r-- | modutils/insmod.c | 8 | ||||
| -rw-r--r-- | modutils/modprobe.c | 16 |
4 files changed, 31 insertions, 22 deletions
diff --git a/modutils/Config.in b/modutils/Config.in index 44b1d9134..c69e1b376 100644 --- a/modutils/Config.in +++ b/modutils/Config.in | |||
| @@ -136,7 +136,7 @@ config FEATURE_MODPROBE_BLACKLIST | |||
| 136 | buffer drivers etc. | 136 | buffer drivers etc. |
| 137 | 137 | ||
| 138 | comment "Options common to multiple modutils" | 138 | comment "Options common to multiple modutils" |
| 139 | depends on INSMOD || RMMOD || MODPROBE || LSMOD | 139 | depends on INSMOD || RMMOD || MODPROBE || LSMOD || DEPMOD |
| 140 | 140 | ||
| 141 | config FEATURE_CHECK_TAINTED_MODULE | 141 | config FEATURE_CHECK_TAINTED_MODULE |
| 142 | # Simulate indentation | 142 | # Simulate indentation |
| @@ -168,6 +168,23 @@ config FEATURE_2_6_MODULES | |||
| 168 | help | 168 | help |
| 169 | Support module loading for newer 2.6.x Linux kernels. | 169 | Support module loading for newer 2.6.x Linux kernels. |
| 170 | 170 | ||
| 171 | config DEFAULT_MODULES_DIR | ||
| 172 | # Simulate indentation | ||
| 173 | string "default directory containing modules" | ||
| 174 | default "/lib/modules" | ||
| 175 | depends on INSMOD || RMMOD || MODPROBE || DEPMOD | ||
| 176 | help | ||
| 177 | Directory that contains kernel modules. | ||
| 178 | Defaults to "/lib/modules" | ||
| 179 | |||
| 180 | config DEFAULT_DEPMOD_FILE | ||
| 181 | # Simulate indentation | ||
| 182 | string "default name of modules.dep" | ||
| 183 | default "modules.dep" | ||
| 184 | depends on INSMOD || RMMOD || MODPROBE || DEPMOD | ||
| 185 | help | ||
| 186 | Filename that contains kernel modules dependencies. | ||
| 187 | Defaults to "modules.dep" | ||
| 171 | 188 | ||
| 172 | config FEATURE_QUERY_MODULE_INTERFACE | 189 | config FEATURE_QUERY_MODULE_INTERFACE |
| 173 | bool | 190 | bool |
diff --git a/modutils/depmod.c b/modutils/depmod.c index 34483dc07..9faf9c302 100644 --- a/modutils/depmod.c +++ b/modutils/depmod.c | |||
| @@ -11,12 +11,6 @@ | |||
| 11 | #include <libbb.h> | 11 | #include <libbb.h> |
| 12 | #include <sys/utsname.h> /* uname() */ | 12 | #include <sys/utsname.h> /* uname() */ |
| 13 | 13 | ||
| 14 | #ifndef DEFAULT_MODULES_DIR | ||
| 15 | #define DEFAULT_MODULES_DIR "/lib/modules" | ||
| 16 | #endif | ||
| 17 | #ifndef DEFAULT_DEPMOD_FILE | ||
| 18 | #define DEFAULT_DEPMOD_FILE "modules.dep" | ||
| 19 | #endif | ||
| 20 | /* | 14 | /* |
| 21 | * Theory of operation: | 15 | * Theory of operation: |
| 22 | * - iterate over all modules and record their full path | 16 | * - iterate over all modules and record their full path |
| @@ -138,7 +132,7 @@ int depmod_main(int ATTRIBUTE_UNUSED argc, char **argv) | |||
| 138 | /* if no modules are given on the command-line, -a is on per default */ | 132 | /* if no modules are given on the command-line, -a is on per default */ |
| 139 | option_mask32 |= *argv == NULL; | 133 | option_mask32 |= *argv == NULL; |
| 140 | 134 | ||
| 141 | moddir = concat_path_file(DEFAULT_MODULES_DIR, chp); | 135 | moddir = concat_path_file(CONFIG_DEFAULT_MODULES_DIR, chp); |
| 142 | // if (ENABLE_FEATURE_CLEAN_UP) | 136 | // if (ENABLE_FEATURE_CLEAN_UP) |
| 143 | // free(chp); | 137 | // free(chp); |
| 144 | if (option_mask32 & ARG_b) { | 138 | if (option_mask32 & ARG_b) { |
| @@ -149,7 +143,7 @@ int depmod_main(int ATTRIBUTE_UNUSED argc, char **argv) | |||
| 149 | } | 143 | } |
| 150 | 144 | ||
| 151 | if (!(option_mask32 & ARG_n)) { /* --dry-run */ | 145 | if (!(option_mask32 & ARG_n)) { /* --dry-run */ |
| 152 | chp = concat_path_file(moddir, DEFAULT_DEPMOD_FILE); | 146 | chp = concat_path_file(moddir, CONFIG_DEFAULT_DEPMOD_FILE); |
| 153 | filedes = xfopen(chp, "w"); | 147 | filedes = xfopen(chp, "w"); |
| 154 | if (ENABLE_FEATURE_CLEAN_UP) | 148 | if (ENABLE_FEATURE_CLEAN_UP) |
| 155 | free(chp); | 149 | free(chp); |
diff --git a/modutils/insmod.c b/modutils/insmod.c index 30d471b78..9242e08e4 100644 --- a/modutils/insmod.c +++ b/modutils/insmod.c | |||
| @@ -673,8 +673,6 @@ static int obj_gpl_license(struct obj_file *f, const char **license); | |||
| 673 | #define SPFX "" | 673 | #define SPFX "" |
| 674 | #endif | 674 | #endif |
| 675 | 675 | ||
| 676 | |||
| 677 | #define _PATH_MODULES "/lib/modules" | ||
| 678 | enum { STRVERSIONLEN = 64 }; | 676 | enum { STRVERSIONLEN = 64 }; |
| 679 | 677 | ||
| 680 | /*======================================================================*/ | 678 | /*======================================================================*/ |
| @@ -3999,7 +3997,7 @@ int insmod_main(int argc, char **argv) | |||
| 3999 | char *module_dir; | 3997 | char *module_dir; |
| 4000 | char *tmdn; | 3998 | char *tmdn; |
| 4001 | 3999 | ||
| 4002 | tmdn = concat_path_file(_PATH_MODULES, myuname.release); | 4000 | tmdn = concat_path_file(CONFIG_DEFAULT_MODULES_DIR, myuname.release); |
| 4003 | /* Jump through hoops in case /lib/modules/`uname -r` | 4001 | /* Jump through hoops in case /lib/modules/`uname -r` |
| 4004 | * is a symlink. We do not want recursive_action to | 4002 | * is a symlink. We do not want recursive_action to |
| 4005 | * follow symlinks, but we do want to follow the | 4003 | * follow symlinks, but we do want to follow the |
| @@ -4021,9 +4019,9 @@ int insmod_main(int argc, char **argv) | |||
| 4021 | 4019 | ||
| 4022 | free(m_filename); | 4020 | free(m_filename); |
| 4023 | m_filename = NULL; | 4021 | m_filename = NULL; |
| 4024 | module_dir = xmalloc_readlink(_PATH_MODULES); | 4022 | module_dir = xmalloc_readlink(CONFIG_DEFAULT_MODULES_DIR); |
| 4025 | if (!module_dir) | 4023 | if (!module_dir) |
| 4026 | module_dir = xstrdup(_PATH_MODULES); | 4024 | module_dir = xstrdup(CONFIG_DEFAULT_MODULES_DIR); |
| 4027 | /* No module found under /lib/modules/`uname -r`, this | 4025 | /* No module found under /lib/modules/`uname -r`, this |
| 4028 | * time cast the net a bit wider. Search /lib/modules/ */ | 4026 | * time cast the net a bit wider. Search /lib/modules/ */ |
| 4029 | r = recursive_action(module_dir, ACTION_RECURSE, | 4027 | r = recursive_action(module_dir, ACTION_RECURSE, |
diff --git a/modutils/modprobe.c b/modutils/modprobe.c index b7903469d..3a89d9814 100644 --- a/modutils/modprobe.c +++ b/modutils/modprobe.c | |||
| @@ -364,15 +364,15 @@ static struct dep_t *build_dep(void) | |||
| 364 | k_version = un.release[2] - '0'; | 364 | k_version = un.release[2] - '0'; |
| 365 | } | 365 | } |
| 366 | 366 | ||
| 367 | filename = xasprintf("/lib/modules/%s/modules.dep", un.release); | 367 | filename = xasprintf(CONFIG_DEFAULT_MODULES_DIR"/%s/"CONFIG_DEFAULT_DEPMOD_FILE, un.release); |
| 368 | fd = open(filename, O_RDONLY); | 368 | fd = open(filename, O_RDONLY); |
| 369 | if (ENABLE_FEATURE_CLEAN_UP) | 369 | if (ENABLE_FEATURE_CLEAN_UP) |
| 370 | free(filename); | 370 | free(filename); |
| 371 | if (fd < 0) { | 371 | if (fd < 0) { |
| 372 | /* Ok, that didn't work. Fall back to looking in /lib/modules */ | 372 | /* Ok, that didn't work. Fall back to looking in /lib/modules */ |
| 373 | fd = open("/lib/modules/modules.dep", O_RDONLY); | 373 | fd = open(CONFIG_DEFAULT_MODULES_DIR"/"CONFIG_DEFAULT_DEPMOD_FILE, O_RDONLY); |
| 374 | if (fd < 0) { | 374 | if (fd < 0) { |
| 375 | bb_error_msg_and_die("cannot parse modules.dep"); | 375 | bb_error_msg_and_die("cannot parse " CONFIG_DEFAULT_DEPMOD_FILE); |
| 376 | } | 376 | } |
| 377 | } | 377 | } |
| 378 | 378 | ||
| @@ -522,11 +522,11 @@ static struct dep_t *build_dep(void) | |||
| 522 | /* Only 2.6 has a modules.alias file */ | 522 | /* Only 2.6 has a modules.alias file */ |
| 523 | if (ENABLE_FEATURE_2_6_MODULES) { | 523 | if (ENABLE_FEATURE_2_6_MODULES) { |
| 524 | /* Parse kernel-declared module aliases */ | 524 | /* Parse kernel-declared module aliases */ |
| 525 | filename = xasprintf("/lib/modules/%s/modules.alias", un.release); | 525 | filename = xasprintf(CONFIG_DEFAULT_MODULES_DIR"/%s/modules.alias", un.release); |
| 526 | fd = open(filename, O_RDONLY); | 526 | fd = open(filename, O_RDONLY); |
| 527 | if (fd < 0) { | 527 | if (fd < 0) { |
| 528 | /* Ok, that didn't work. Fall back to looking in /lib/modules */ | 528 | /* Ok, that didn't work. Fall back to looking in /lib/modules */ |
| 529 | fd = open("/lib/modules/modules.alias", O_RDONLY); | 529 | fd = open(CONFIG_DEFAULT_MODULES_DIR"/modules.alias", O_RDONLY); |
| 530 | } | 530 | } |
| 531 | if (ENABLE_FEATURE_CLEAN_UP) | 531 | if (ENABLE_FEATURE_CLEAN_UP) |
| 532 | free(filename); | 532 | free(filename); |
| @@ -537,11 +537,11 @@ static struct dep_t *build_dep(void) | |||
| 537 | } | 537 | } |
| 538 | 538 | ||
| 539 | /* Parse kernel-declared symbol aliases */ | 539 | /* Parse kernel-declared symbol aliases */ |
| 540 | filename = xasprintf("/lib/modules/%s/modules.symbols", un.release); | 540 | filename = xasprintf(CONFIG_DEFAULT_MODULES_DIR"/%s/modules.symbols", un.release); |
| 541 | fd = open(filename, O_RDONLY); | 541 | fd = open(filename, O_RDONLY); |
| 542 | if (fd < 0) { | 542 | if (fd < 0) { |
| 543 | /* Ok, that didn't work. Fall back to looking in /lib/modules */ | 543 | /* Ok, that didn't work. Fall back to looking in /lib/modules */ |
| 544 | fd = open("/lib/modules/modules.symbols", O_RDONLY); | 544 | fd = open(CONFIG_DEFAULT_MODULES_DIR"/modules.symbols", O_RDONLY); |
| 545 | } | 545 | } |
| 546 | if (ENABLE_FEATURE_CLEAN_UP) | 546 | if (ENABLE_FEATURE_CLEAN_UP) |
| 547 | free(filename); | 547 | free(filename); |
| @@ -895,7 +895,7 @@ int modprobe_main(int argc, char **argv) | |||
| 895 | depend = build_dep(); | 895 | depend = build_dep(); |
| 896 | 896 | ||
| 897 | if (!depend) | 897 | if (!depend) |
| 898 | bb_error_msg_and_die("cannot parse modules.dep"); | 898 | bb_error_msg_and_die("cannot parse "CONFIG_DEFAULT_DEPMOD_FILE); |
| 899 | 899 | ||
| 900 | if (remove_opt) { | 900 | if (remove_opt) { |
| 901 | do { | 901 | do { |
