[master 1/3] break the dependency of modules.c on loader.h

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

 



---
 loader/kickstart.c |   51 ++++++++++++++++++++++++++++++++++++++++++++++++
 loader/kickstart.h |    1 +
 loader/modules.c   |   55 +---------------------------------------------------
 loader/modules.h   |    2 -
 4 files changed, 53 insertions(+), 56 deletions(-)

diff --git a/loader/kickstart.c b/loader/kickstart.c
index 4c3dc26..9c25ab0 100644
--- a/loader/kickstart.c
+++ b/loader/kickstart.c
@@ -316,6 +316,57 @@ int getKickstartFromBlockDevice(char *device, char *path) {
     return getFileFromBlockDevice(device, path, "/tmp/ks.cfg");
 }
 
+void loadKickstartModule(struct loaderData_s * loaderData,
+                         int argc, char **argv) {
+    gchar *opts = NULL;
+    gchar *module = NULL;
+    gchar **args = NULL, **remaining = NULL;
+    gboolean rc;
+    GOptionContext *optCon = g_option_context_new(NULL);
+    GError *optErr = NULL;
+    GOptionEntry ksDeviceOptions[] = {
+        { "opts", 0, 0, G_OPTION_ARG_STRING, &opts, NULL, NULL },
+        { G_OPTION_REMAINING, 0, 0, G_OPTION_ARG_STRING_ARRAY, &remaining,
+          NULL, NULL },
+        { NULL },
+    };
+
+    g_option_context_set_help_enabled(optCon, FALSE);
+    g_option_context_add_main_entries(optCon, ksDeviceOptions, NULL);
+
+    if (!g_option_context_parse(optCon, &argc, &argv, &optErr)) {
+        startNewt();
+        newtWinMessage(_("Kickstart Error"), _("OK"),
+                       _("Bad argument to device kickstart method "
+                         "command: %s"), optErr->message);
+        g_error_free(optErr);
+        g_option_context_free(optCon);
+        return;
+    }
+
+    g_option_context_free(optCon);
+
+    if ((remaining != NULL) && (g_strv_length(remaining) == 1)) {
+        module = remaining[0];
+    }
+
+    if (!module) {
+        startNewt();
+        newtWinMessage(_("Kickstart Error"), _("OK"),
+                       _("A module name must be specified for "
+                         "the kickstart device command."));
+        return;
+    }
+
+    if (opts) {
+        args = g_strsplit(opts, " ", 0);
+    }
+
+    rc = mlLoadModule(module, args);
+    g_strfreev(args);
+    return;
+}
+
 static char *newKickstartLocation(const char *origLocation) {
     const char *location;
     char *retval = NULL;
diff --git a/loader/kickstart.h b/loader/kickstart.h
index 574026b..eb1ffb2 100644
--- a/loader/kickstart.h
+++ b/loader/kickstart.h
@@ -50,5 +50,6 @@ int isKickstartFileRemote(char *ksFile);
 void getKickstartFile(struct loaderData_s * loaderData);
 void runKickstart(struct loaderData_s * loaderData);
 int getKickstartFromBlockDevice(char *device, char *path);
+void loadKickstartModule(struct loaderData_s *, int, char **);
 
 #endif
diff --git a/loader/modules.c b/loader/modules.c
index 9635be6..fd1b2a0 100644
--- a/loader/modules.c
+++ b/loader/modules.c
@@ -27,7 +27,6 @@
 #include <ctype.h>
 #include <errno.h>
 #include <fcntl.h>
-#include <newt.h>
 #include <stdlib.h>
 #include <stdio.h>
 #include <string.h>
@@ -40,12 +39,11 @@
 #include <glib.h>
 #include <glib/gprintf.h>
 #include <assert.h>
+#include <stdint.h>
 
 #include "../pyanaconda/isys/log.h"
 
-#include "loader.h"
 #include "modules.h"
-#include "windows.h"
 
 /* boot flags */
 extern uint64_t flags;
@@ -360,57 +358,6 @@ gboolean mlRemoveBlacklist(gchar *module) {
     return TRUE;
 }
 
-void loadKickstartModule(struct loaderData_s * loaderData,
-                         int argc, char **argv) {
-    gchar *opts = NULL;
-    gchar *module = NULL;
-    gchar **args = NULL, **remaining = NULL;
-    gboolean rc;
-    GOptionContext *optCon = g_option_context_new(NULL);
-    GError *optErr = NULL;
-    GOptionEntry ksDeviceOptions[] = {
-        { "opts", 0, 0, G_OPTION_ARG_STRING, &opts, NULL, NULL },
-        { G_OPTION_REMAINING, 0, 0, G_OPTION_ARG_STRING_ARRAY, &remaining,
-          NULL, NULL },
-        { NULL },
-    };
-
-    g_option_context_set_help_enabled(optCon, FALSE);
-    g_option_context_add_main_entries(optCon, ksDeviceOptions, NULL);
-
-    if (!g_option_context_parse(optCon, &argc, &argv, &optErr)) {
-        startNewt();
-        newtWinMessage(_("Kickstart Error"), _("OK"),
-                       _("Bad argument to device kickstart method "
-                         "command: %s"), optErr->message);
-        g_error_free(optErr);
-        g_option_context_free(optCon);
-        return;
-    }
-
-    g_option_context_free(optCon);
-
-    if ((remaining != NULL) && (g_strv_length(remaining) == 1)) {
-        module = remaining[0];
-    }
-
-    if (!module) {
-        startNewt();
-        newtWinMessage(_("Kickstart Error"), _("OK"),
-                       _("A module name must be specified for "
-                         "the kickstart device command."));
-        return;
-    }
-
-    if (opts) {
-        args = g_strsplit(opts, " ", 0);
-    }
-
-    rc = mlLoadModule(module, args);
-    g_strfreev(args);
-    return;
-}
-
 inline gint gcmp(gconstpointer a, gconstpointer b, gpointer userptr)
 {
     return g_strcmp0(a, b);
diff --git a/loader/modules.h b/loader/modules.h
index 605d01e..90ba4d9 100644
--- a/loader/modules.h
+++ b/loader/modules.h
@@ -23,7 +23,6 @@
 #define H_MODULES
 
 #include <glib.h>
-#include "loader.h"
 #include "moduleinfo.h"
 
 #define MODULES_CONF "/etc/modprobe.d/anaconda.conf"
@@ -38,7 +37,6 @@ gboolean mlLoadModule(const gchar *, gchar **);
 gboolean mlLoadModuleSet(const gchar *);
 gboolean mlAddBlacklist(gchar *);
 gboolean mlRemoveBlacklist(gchar *);
-void loadKickstartModule(struct loaderData_s *, int, char **);
 
 GTree* mlSaveModuleState();
 void mlRestoreModuleState(GTree *state);
-- 
1.7.1.1

_______________________________________________
Anaconda-devel-list mailing list
Anaconda-devel-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/anaconda-devel-list


[Index of Archives]     [Kickstart]     [Fedora Users]     [Fedora Legacy List]     [Fedora Maintainers]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [Yosemite Photos]     [KDE Users]     [Fedora Tools]
  Powered by Linux