]> git.ipfire.org Git - thirdparty/kmod.git/commitdiff
libkmod-module: probe: add flag to dry-run
authorLucas De Marchi <lucas.demarchi@profusion.mobi>
Mon, 30 Jan 2012 21:00:58 +0000 (19:00 -0200)
committerLucas De Marchi <lucas.demarchi@profusion.mobi>
Tue, 31 Jan 2012 16:08:57 +0000 (14:08 -0200)
libkmod/libkmod-module.c
libkmod/libkmod.h

index 1229a95b6f6d25c6d1f03b4af62682743d6ec946..d6d081092a62c3582f45abe7d75313b2d2155d38 100644 (file)
@@ -1167,10 +1167,13 @@ KMOD_EXPORT int kmod_module_probe_insert_module(struct kmod_module *mod,
                                free(options);
                                break;
                        }
+
                        if (print_action != NULL)
                                print_action(m, true, options ?: "");
 
-                       err = module_do_install_commands(m, options, &cb);
+                       if (!(flags & KMOD_PROBE_DRY_RUN))
+                               err = module_do_install_commands(m, options,
+                                                                       &cb);
                } else {
                        int state;
 
@@ -1194,7 +1197,9 @@ KMOD_EXPORT int kmod_module_probe_insert_module(struct kmod_module *mod,
                        if (print_action != NULL)
                                print_action(m, false, options ?: "");
 
-                       err = kmod_module_insert_module(m, flags, options);
+                       if (!(flags & KMOD_PROBE_DRY_RUN))
+                               err = kmod_module_insert_module(m, flags,
+                                                               options);
                }
 
                free(options);
index cf4a7b7b7fee7f52dc31a8bd7df5c5d754bb46e3..932279c0817730930cfc683a1a348e6c9adab3cf 100644 (file)
@@ -129,6 +129,7 @@ enum kmod_probe {
        KMOD_PROBE_FORCE_MODVERSION =           0x00002,
        KMOD_PROBE_IGNORE_COMMAND =             0x00004,
        KMOD_PROBE_IGNORE_LOADED =              0x00008,
+       KMOD_PROBE_DRY_RUN =                    0x00010,
 
        /* codes below can be used in return value, too */
        KMOD_PROBE_APPLY_BLACKLIST_ALL =        0x10000,