FAQ Search Today's Posts Mark Forums Read
» Video Reviews

» Linux Archive

Linux-archive is a website aiming to archive linux email lists and to make them easily accessible for linux users/developers.


» Sponsor

» Partners

» Sponsor

Go Back   Linux Archive > Redhat > Device-mapper Development

 
 
LinkBack Thread Tools
 
Old 03-08-2011, 05:55 AM
"Brian C. Lane"
 
Default Convert earlyModuleLoad to use cmdline_argv (#569883)

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.carseCmdline() 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] = '';
- 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@redhat.com
https://www.redhat.com/mailman/listinfo/anaconda-devel-list
 
Old 03-08-2011, 06:35 AM
Ales Kozumplik
 
Default Convert earlyModuleLoad to use cmdline_argv (#569883)

On 03/08/2011 07:55 AM, Brian C. Lane wrote:

+/* parsed /proc/cmdline */
+extern char **cmdline_argv;
+extern int cmdline_argc;
+


Should this live in loader.h or somewhere?


/* 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.carseCmdline() 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] = '';
- cmdLine = buf;
-
- if (poptParseArgvString(cmdLine,&argc, (const char ***)&argv))


Great, ack!

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

Thread Tools




All times are GMT. The time now is 08:51 PM.

VBulletin, Copyright ©2000 - 2014, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO ©2007, Crawlability, Inc.
Copyright 2007 - 2008, www.linux-archive.org