]> git.hungrycats.org Git - linux/commitdiff
[PATCH] modprobe -q: quieter when modules missing
authorRusty Russell <rusty@rustcorp.com.au>
Sun, 7 Sep 2003 13:46:30 +0000 (06:46 -0700)
committerLinus Torvalds <torvalds@home.osdl.org>
Sun, 7 Sep 2003 13:46:30 +0000 (06:46 -0700)
The kernel invokes "modprobe" on modules which might not exist:
rightfully, modprobe complains by default when this happens.  So the
correct response is to invoke "modprobe -q", which is silent on such
errors (but still reports other errors such as config errors).

Also, use MODULE_NAME_LEN from module.h instead of inventing our own.

kernel/kmod.c

index e011611afb7df0c29b5579a7f7229bdac42194be..98d8096890926bae6fbc3b7c7d0c6124fd3c9004 100644 (file)
@@ -60,12 +60,11 @@ char modprobe_path[256] = "/sbin/modprobe";
  */
 int request_module(const char *fmt, ...)
 {
-#define MODULENAME_SIZE 32
        va_list args;
-       char module_name[MODULENAME_SIZE];
+       char module_name[MODULE_NAME_LEN];
        unsigned int max_modprobes;
        int ret;
-       char *argv[] = { modprobe_path, "--", module_name, NULL };
+       char *argv[] = { modprobe_path, "-q", "--", module_name, NULL };
        static char *envp[] = { "HOME=/",
                                "TERM=linux",
                                "PATH=/sbin:/usr/sbin:/bin:/usr/bin",
@@ -75,9 +74,9 @@ int request_module(const char *fmt, ...)
        static int kmod_loop_msg;
 
        va_start(args, fmt);
-       ret = vsnprintf(module_name, MODULENAME_SIZE, fmt, args);
+       ret = vsnprintf(module_name, MODULE_NAME_LEN, fmt, args);
        va_end(args);
-       if (ret >= MODULENAME_SIZE)
+       if (ret >= MODULE_NAME_LEN)
                return -ENAMETOOLONG;
 
        /* If modprobe needs a service that is in a module, we get a recursive