summaryrefslogtreecommitdiff
path: root/kernel
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@home.transmeta.com>2003-05-16 22:39:18 -0700
committerLinus Torvalds <torvalds@home.transmeta.com>2003-05-16 22:39:18 -0700
commitd847507434bbeda3e22b5f2c1cd5c486905ec1ab (patch)
tree85f325877503394edba7a77fd9cd40cc34d534c9 /kernel
parent3584199aaf995eea33b57fb1e933711c0fffe5cf (diff)
Make request_module() take a printf-like vararg argument instead of a string.
This is what a lot of the callers really wanted.
Diffstat (limited to 'kernel')
-rw-r--r--kernel/exec_domain.c6
-rw-r--r--kernel/intermodule.c2
-rw-r--r--kernel/kmod.c14
3 files changed, 13 insertions, 9 deletions
diff --git a/kernel/exec_domain.c b/kernel/exec_domain.c
index 5d53353d57b0..930968f15a1d 100644
--- a/kernel/exec_domain.c
+++ b/kernel/exec_domain.c
@@ -88,11 +88,7 @@ lookup_exec_domain(u_long personality)
#ifdef CONFIG_KMOD
read_unlock(&exec_domains_lock);
- {
- char buffer[30];
- sprintf(buffer, "personality-%ld", pers);
- request_module(buffer);
- }
+ request_module("personality-%ld", pers);
read_lock(&exec_domains_lock);
for (ep = exec_domains; ep; ep = ep->next) {
diff --git a/kernel/intermodule.c b/kernel/intermodule.c
index 5171df7d70fb..09f556507f57 100644
--- a/kernel/intermodule.c
+++ b/kernel/intermodule.c
@@ -143,7 +143,7 @@ const void *inter_module_get_request(const char *im_name, const char *modname)
{
const void *result = inter_module_get(im_name);
if (!result) {
- request_module(modname);
+ request_module("%s", modname);
result = inter_module_get(im_name);
}
return(result);
diff --git a/kernel/kmod.c b/kernel/kmod.c
index 971fc7438a6b..64a6d9ff86c3 100644
--- a/kernel/kmod.c
+++ b/kernel/kmod.c
@@ -58,11 +58,14 @@ char modprobe_path[256] = "/sbin/modprobe";
* If module auto-loading support is disabled then this function
* becomes a no-operation.
*/
-int request_module(const char *module_name)
+#define MODULENAME_SIZE 32
+int request_module(const char *fmt, ...)
{
+ va_list args;
+ char module_name[MODULENAME_SIZE];
unsigned int max_modprobes;
int ret;
- char *argv[] = { modprobe_path, "--", (char*)module_name, NULL };
+ char *argv[] = { modprobe_path, "--", module_name, NULL };
static char *envp[] = { "HOME=/",
"TERM=linux",
"PATH=/sbin:/usr/sbin:/bin:/usr/bin",
@@ -71,6 +74,12 @@ int request_module(const char *module_name)
#define MAX_KMOD_CONCURRENT 50 /* Completely arbitrary value - KAO */
static int kmod_loop_msg;
+ va_start(args, fmt);
+ ret = vsnprintf(module_name, MODULENAME_SIZE, fmt, args);
+ va_end(args);
+ if (ret >= MODULENAME_SIZE)
+ return -ENAMETOOLONG;
+
/* If modprobe needs a service that is in a module, we get a recursive
* loop. Limit the number of running kmod threads to max_threads/2 or
* MAX_KMOD_CONCURRENT, whichever is the smaller. A cleaner method
@@ -80,7 +89,6 @@ int request_module(const char *module_name)
* and it is not worth changing the proc code just to handle this case.
* KAO.
*
-
* "trace the ppid" is simple, but will fail if someone's
* parent exits. I think this is as good as it gets. --RR
*/