svn commit: trunk/busybox/modutils
aldot at busybox.net
aldot at busybox.net
Tue May 27 03:55:34 PDT 2008
Author: aldot
Date: 2008-05-27 03:55:34 -0700 (Tue, 27 May 2008)
New Revision: 22091
Log:
- Add config option for DEFAULT_DEPMOD_FILE and DEFAULT_DEPMOD_FILE.
No obj-code changes.
Modified:
trunk/busybox/modutils/Config.in
trunk/busybox/modutils/depmod.c
trunk/busybox/modutils/insmod.c
trunk/busybox/modutils/modprobe.c
Changeset:
Modified: trunk/busybox/modutils/Config.in
===================================================================
--- trunk/busybox/modutils/Config.in 2008-05-27 10:13:54 UTC (rev 22090)
+++ trunk/busybox/modutils/Config.in 2008-05-27 10:55:34 UTC (rev 22091)
@@ -136,7 +136,7 @@
buffer drivers etc.
comment "Options common to multiple modutils"
- depends on INSMOD || RMMOD || MODPROBE || LSMOD
+ depends on INSMOD || RMMOD || MODPROBE || LSMOD || DEPMOD
config FEATURE_CHECK_TAINTED_MODULE
# Simulate indentation
@@ -168,7 +168,24 @@
help
Support module loading for newer 2.6.x Linux kernels.
+config DEFAULT_MODULES_DIR
+ # Simulate indentation
+ string "default directory containing modules"
+ default "/lib/modules"
+ depends on INSMOD || RMMOD || MODPROBE || DEPMOD
+ help
+ Directory that contains kernel modules.
+ Defaults to "/lib/modules"
+config DEFAULT_DEPMOD_FILE
+ # Simulate indentation
+ string "default name of modules.dep"
+ default "modules.dep"
+ depends on INSMOD || RMMOD || MODPROBE || DEPMOD
+ help
+ Filename that contains kernel modules dependencies.
+ Defaults to "modules.dep"
+
config FEATURE_QUERY_MODULE_INTERFACE
bool
default y
Modified: trunk/busybox/modutils/depmod.c
===================================================================
--- trunk/busybox/modutils/depmod.c 2008-05-27 10:13:54 UTC (rev 22090)
+++ trunk/busybox/modutils/depmod.c 2008-05-27 10:55:34 UTC (rev 22091)
@@ -11,12 +11,6 @@
#include <libbb.h>
#include <sys/utsname.h> /* uname() */
-#ifndef DEFAULT_MODULES_DIR
-#define DEFAULT_MODULES_DIR "/lib/modules"
-#endif
-#ifndef DEFAULT_DEPMOD_FILE
-#define DEFAULT_DEPMOD_FILE "modules.dep"
-#endif
/*
* Theory of operation:
* - iterate over all modules and record their full path
@@ -138,7 +132,7 @@
/* if no modules are given on the command-line, -a is on per default */
option_mask32 |= *argv == NULL;
- moddir = concat_path_file(DEFAULT_MODULES_DIR, chp);
+ moddir = concat_path_file(CONFIG_DEFAULT_MODULES_DIR, chp);
// if (ENABLE_FEATURE_CLEAN_UP)
// free(chp);
if (option_mask32 & ARG_b) {
@@ -149,7 +143,7 @@
}
if (!(option_mask32 & ARG_n)) { /* --dry-run */
- chp = concat_path_file(moddir, DEFAULT_DEPMOD_FILE);
+ chp = concat_path_file(moddir, CONFIG_DEFAULT_DEPMOD_FILE);
filedes = xfopen(chp, "w");
if (ENABLE_FEATURE_CLEAN_UP)
free(chp);
Modified: trunk/busybox/modutils/insmod.c
===================================================================
--- trunk/busybox/modutils/insmod.c 2008-05-27 10:13:54 UTC (rev 22090)
+++ trunk/busybox/modutils/insmod.c 2008-05-27 10:55:34 UTC (rev 22091)
@@ -673,8 +673,6 @@
#define SPFX ""
#endif
-
-#define _PATH_MODULES "/lib/modules"
enum { STRVERSIONLEN = 64 };
/*======================================================================*/
@@ -3999,7 +3997,7 @@
char *module_dir;
char *tmdn;
- tmdn = concat_path_file(_PATH_MODULES, myuname.release);
+ tmdn = concat_path_file(CONFIG_DEFAULT_MODULES_DIR, myuname.release);
/* Jump through hoops in case /lib/modules/`uname -r`
* is a symlink. We do not want recursive_action to
* follow symlinks, but we do want to follow the
@@ -4021,9 +4019,9 @@
free(m_filename);
m_filename = NULL;
- module_dir = xmalloc_readlink(_PATH_MODULES);
+ module_dir = xmalloc_readlink(CONFIG_DEFAULT_MODULES_DIR);
if (!module_dir)
- module_dir = xstrdup(_PATH_MODULES);
+ module_dir = xstrdup(CONFIG_DEFAULT_MODULES_DIR);
/* No module found under /lib/modules/`uname -r`, this
* time cast the net a bit wider. Search /lib/modules/ */
r = recursive_action(module_dir, ACTION_RECURSE,
Modified: trunk/busybox/modutils/modprobe.c
===================================================================
--- trunk/busybox/modutils/modprobe.c 2008-05-27 10:13:54 UTC (rev 22090)
+++ trunk/busybox/modutils/modprobe.c 2008-05-27 10:55:34 UTC (rev 22091)
@@ -364,15 +364,15 @@
k_version = un.release[2] - '0';
}
- filename = xasprintf("/lib/modules/%s/modules.dep", un.release);
+ filename = xasprintf(CONFIG_DEFAULT_MODULES_DIR"/%s/"CONFIG_DEFAULT_DEPMOD_FILE, un.release);
fd = open(filename, O_RDONLY);
if (ENABLE_FEATURE_CLEAN_UP)
free(filename);
if (fd < 0) {
/* Ok, that didn't work. Fall back to looking in /lib/modules */
- fd = open("/lib/modules/modules.dep", O_RDONLY);
+ fd = open(CONFIG_DEFAULT_MODULES_DIR"/"CONFIG_DEFAULT_DEPMOD_FILE, O_RDONLY);
if (fd < 0) {
- bb_error_msg_and_die("cannot parse modules.dep");
+ bb_error_msg_and_die("cannot parse " CONFIG_DEFAULT_DEPMOD_FILE);
}
}
@@ -522,11 +522,11 @@
/* Only 2.6 has a modules.alias file */
if (ENABLE_FEATURE_2_6_MODULES) {
/* Parse kernel-declared module aliases */
- filename = xasprintf("/lib/modules/%s/modules.alias", un.release);
+ filename = xasprintf(CONFIG_DEFAULT_MODULES_DIR"/%s/modules.alias", un.release);
fd = open(filename, O_RDONLY);
if (fd < 0) {
/* Ok, that didn't work. Fall back to looking in /lib/modules */
- fd = open("/lib/modules/modules.alias", O_RDONLY);
+ fd = open(CONFIG_DEFAULT_MODULES_DIR"/modules.alias", O_RDONLY);
}
if (ENABLE_FEATURE_CLEAN_UP)
free(filename);
@@ -537,11 +537,11 @@
}
/* Parse kernel-declared symbol aliases */
- filename = xasprintf("/lib/modules/%s/modules.symbols", un.release);
+ filename = xasprintf(CONFIG_DEFAULT_MODULES_DIR"/%s/modules.symbols", un.release);
fd = open(filename, O_RDONLY);
if (fd < 0) {
/* Ok, that didn't work. Fall back to looking in /lib/modules */
- fd = open("/lib/modules/modules.symbols", O_RDONLY);
+ fd = open(CONFIG_DEFAULT_MODULES_DIR"/modules.symbols", O_RDONLY);
}
if (ENABLE_FEATURE_CLEAN_UP)
free(filename);
@@ -895,7 +895,7 @@
depend = build_dep();
if (!depend)
- bb_error_msg_and_die("cannot parse modules.dep");
+ bb_error_msg_and_die("cannot parse "CONFIG_DEFAULT_DEPMOD_FILE);
if (remove_opt) {
do {
More information about the busybox-cvs
mailing list