[LEDE-DEV] [PATCH] ubox: kmodloader: support '-q' quiet option

Kevin Darbyshire-Bryant kevin at darbyshire-bryant.me.uk
Fri Jan 27 01:12:35 PST 2017


The kernel opportunistically attempts to load modules in advanced with
'predicted' module names.  Often these modules don't exist and hence
kmodloader produces lots of logfile noise.  The kernel commandline to
modprobe from kworker proceses is '-q -- modulename' where '-q' means
quiet.

Add very basic support for any option beginning 'q' as meaning quiet.

Signed-off-by: Kevin Darbyshire-Bryant <kevin at darbyshire-bryant.me.uk>
---
 kmodloader.c | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)

diff --git a/kmodloader.c b/kmodloader.c
index 729027a..54ae961 100644
--- a/kmodloader.c
+++ b/kmodloader.c
@@ -825,12 +825,15 @@ static int main_modprobe(int argc, char **argv)
 	char *name;
 	char *mod = NULL;
 	int i;
+	bool quiet = false;
 
 	for (i = 1; i < argc; i++)
 		if (argv[i][0] != '-') {
 			mod = argv[i];
 			break;
 		}
+		else if (argv[i][1] == 'q') quiet = true;
+
 	if (!mod)
 		return print_usage("modprobe");
 
@@ -843,10 +846,10 @@ static int main_modprobe(int argc, char **argv)
 	name = get_module_name(mod);
 	m = find_module(name);
 	if (m && m->state == LOADED) {
-		ULOG_ERR("%s is already loaded\n", name);
+		if (!quiet) ULOG_ERR("%s is already loaded\n", name);
 		return -1;
 	} else if (!m) {
-		ULOG_ERR("failed to find a module named %s\n", name);
+		if (!quiet) ULOG_ERR("failed to find a module named %s\n", name);
 	} else {
 		int fail;
 
-- 
2.7.4




More information about the Lede-dev mailing list