[PATCH 2/5] Convert earlyModuleLoad to use cmdline_argv (#569883)

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

 



Don't re-parse /proc/cmdline

Related: rhbz#569883
---
 loader2/hardware.c |   35 ++++++++++++-----------------------
 1 files changed, 12 insertions(+), 23 deletions(-)

diff --git a/loader2/hardware.c b/loader2/hardware.c
index 348ceb7..393bfc8 100644
--- a/loader2/hardware.c
+++ b/loader2/hardware.c
@@ -39,6 +39,10 @@
 /* boot flags */
 extern uint64_t flags;
 
+/* parsed /proc/cmdline */
+extern char **cmdline_argv;
+extern int cmdline_argc;
+
 /* returns whether or not we can probe devices automatically or have to 
  * ask for them manually. */
 int canProbeDevices(void) {
@@ -216,30 +220,15 @@ int probeiSeries(moduleInfoSet modInfo, moduleList modLoaded,
  */
 int earlyModuleLoad(moduleInfoSet modInfo, moduleList modLoaded, 
                     moduleDeps modDeps, int justProbe) {
-    int fd, len, i;
-    char buf[1024], *cmdLine;
-    int argc;
-    char ** argv;
-
-    /* FIXME: reparsing /proc/cmdline to avoid major loader changes.  
-     * should probably be done in loader.c:parseCmdline() like everything 
-     * else
-     */
-    if ((fd = open("/proc/cmdline", O_RDONLY)) < 0) return 1;
-    len = read(fd, buf, sizeof(buf) - 1);
-    close(fd);
-    if (len <= 0) return 1;
-        
-    buf[len] = '\0';
-    cmdLine = buf;
-    
-    if (poptParseArgvString(cmdLine, &argc, (const char ***) &argv))
+    int i;
+
+    if (cmdline_argc < 1)
         return 1;
-    
-    for (i=0; i < argc; i++) {
-        if (!strncasecmp(argv[i], "driverload=", 11)) {
-            logMessage(INFO, "loading %s early", argv[i] + 11);
-            mlLoadModuleSet(argv[i] + 11, modLoaded, modDeps, modInfo);
+
+    for (i=0; i < cmdline_argc; i++) {
+        if (!strncasecmp(cmdline_argv[i], "driverload=", 11)) {
+            logMessage(INFO, "loading %s early", cmdline_argv[i] + 11);
+            mlLoadModuleSet(cmdline_argv[i] + 11, modLoaded, modDeps, modInfo);
         }
     }
     return 0;
-- 
1.7.4

_______________________________________________
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