From eddef4feb4369777e379668756cefa4bf2bcf43c Mon Sep 17 00:00:00 2001 From: Rusty Russell Date: Sun, 7 Sep 2003 06:46:30 -0700 Subject: [PATCH] modprobe -q: quieter when modules missing 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 | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) (limited to 'kernel') diff --git a/kernel/kmod.c b/kernel/kmod.c index e011611afb7d..98d809689092 100644 --- a/kernel/kmod.c +++ b/kernel/kmod.c @@ -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 -- cgit v1.2.3