kmodloader: added -v arg to modeprobe
authorGerard Ryan <g.m0n3y.2503@gmail.com>
Sun, 20 Oct 2019 06:01:11 +0000 (16:01 +1000)
committerJohn Crispin <john@phrozen.org>
Mon, 21 Oct 2019 11:18:17 +0000 (13:18 +0200)
This is primarily to satiate the usage by docker/libnetwork.

Signed-off-by: Gerard Ryan <G.M0N3Y.2503@gmail.com>
kmodloader.c

index 422c895f1f40daf19d8e9aacfc44db5964496ae6..07b67009aaf50f4ddd14db0b0a650234a11689ee 100644 (file)
@@ -678,7 +678,10 @@ static int print_insmod_usage(void)
 
 static int print_modprobe_usage(void)
 {
-       ULOG_INFO("Usage:\n\tmodprobe [-q] filename\n");
+       ULOG_INFO(
+               "Usage:\n"
+               "\tmodprobe [-q] [-v] filename\n"
+       );
 
        return -1;
 }
@@ -855,14 +858,18 @@ static int main_modprobe(int argc, char **argv)
        struct module *m;
        char *name;
        char *mod = NULL;
+       int log_level = LOG_WARNING;
        int opt;
        bool quiet = false;
 
-       while ((opt = getopt(argc, argv, "q")) != -1 ) {
+       while ((opt = getopt(argc, argv, "qv")) != -1 ) {
                switch (opt) {
                        case 'q': /* shhhh! */
                                quiet = true;
                                break;
+                       case 'v':
+                               log_level = LOG_DEBUG;
+                               break;
                        default: /* '?' */
                                return print_modprobe_usage();
                                break;
@@ -872,6 +879,9 @@ static int main_modprobe(int argc, char **argv)
        if (optind >= argc)
                return print_modprobe_usage(); /* expected module after options */
 
+       /* after print_modprobe_usage() so it won't be filtered out */
+       ulog_threshold(log_level);
+
        mod = argv[optind];
 
        if (scan_module_folders())