[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]

[PATCH 1/3] Support rdblacklist= boot parameter in addition to blacklist=



Support rdblacklist= as a synonym for the blacklist= boot parameter.
Support comma separated module lists on these options as well as single
module names.  The following are valid:

    blacklist=module
    blacklist=module,module
    rdblacklist=module
    rdblacklist=module,module

Also, "blacklist" and "rdblacklist" are case-insensitive.

Related: rhbz#689029
---
 loader/modules.c |   23 ++++++++++++++++++-----
 1 files changed, 18 insertions(+), 5 deletions(-)

diff --git a/loader/modules.c b/loader/modules.c
index c9f0a94..504a968 100644
--- a/loader/modules.c
+++ b/loader/modules.c
@@ -241,7 +241,7 @@ static gboolean _doLoadModule(const gchar *module, gchar **args) {
 }
 
 gboolean mlInitModuleConfig(void) {
-    gint i = 0;
+    gint i = 0, j = 0;
     gchar *cmdline = NULL;
     gchar **options = NULL;
     GError *readErr = NULL;
@@ -264,17 +264,30 @@ gboolean mlInitModuleConfig(void) {
     while (options[i] != NULL) {
         gchar *tmpmod = NULL;
         gchar **fields = NULL;
+        gchar **blmods = NULL;
 
         if (g_strstr_len(options[i], -1, "=") == NULL) {
             i++;
             continue;
         }
 
-        if (!strncmp(options[i], "blacklist=", 10)) {
+        if (!strncmp(options[i], "blacklist=", 10) ||
+            !strncmp(options[i], "rdblacklist=", 12)) {
             if ((fields = g_strsplit(options[i], "=", 0)) != NULL) {
-                if (g_strv_length(fields) == 2) {
-                    tmpmod = g_strdup(fields[1]);
-                    blacklist = g_slist_append(blacklist, tmpmod);
+                if (g_strv_length(fields) <= 1) {
+                    g_strfreev(fields);
+                    continue;
+                }
+
+                if ((blmods = g_strsplit(fields[1], ",", 0)) != NULL) {
+                    for (j=0; j < g_strv_length(blmods); j++) {
+                        if (blmods[j] != NULL && g_strcmp0(blmods[j], "")) {
+                            tmpmod = g_strdup(blmods[j]);
+                            blacklist = g_slist_append(blacklist, tmpmod);
+                        }
+                    }
+
+                    g_strfreev(blmods);
                 }
             }
         } else if ((fields = g_strsplit(options[i], ".", 0)) != NULL) {
-- 
1.7.1


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]