Skip to contentSkip to conversation

modprobe -q: quieter when modules missing

PATCH New Rusty Russell 1 participant 1 message Sep 8, 2003

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 modprobe -q: quieter when modules missing

Linus, please apply. modprobe -q currently suppresses only "module already loaded" messages, but in next release it also suppresses "no such module" messages.

Name: Modprobe should be invoked with -q
Status: Tested on 2.6.0-test4-bk9

D: The kernel invokes "modprobe" on modules which might not exist:
D: rightfully, modprobe complains by default when this happens. So
D: the correct response is to invoke "modprobe -q", which is silent on
D: such errors (but still reports other errors such as config errors).
D: Also, use MODULE_NAME_LEN from module.h instead of inventing our own.

kernel/kmod.c +4 -5
diff -urpN --exclude TAGS -X /home/rusty/devel/kernel/kernel-patches/current-dontdiff --minimal .24247-linux-2.6.0-test4-bk9/kernel/kmod.c .24247-linux-2.6.0-test4-bk9.updated/kernel/kmod.c
@@ -60,12 +60,11 @@ char modprobe_path[256] = "/sbin/modprob
  */
 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

Rusty.
--
Anyone who quotes me in their sig is an idiot. -- Rusty Russell.