mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: "Randy.Dunlap" <rddunlap@osdl.org>
To: "Randy.Dunlap" <rddunlap@osdl.org>
Cc: yiding_wang@agilent.com, arjan@infradead.org,
	linux-kernel@vger.kernel.org, rusty@rustcorp.com.au,
	akpm <akpm@osdl.org>
Subject: [PATCH] handle quoted module parameters
Date: Thu, 11 Nov 2004 20:16:49 -0800	[thread overview]
Message-ID: <41943931.4090008@osdl.org> (raw)
In-Reply-To: <41943754.6090806@osdl.org>

[-- Attachment #1: Type: text/plain, Size: 362 bytes --]

Here's a patch with better description.


Fix module parameter quote handling.
Module parameter strings (with spaces) are quoted like so:
"modprm=this test"
and not like this:
modprm="this test"

Signed-off-by: Randy Dunlap <rddunlap@osdl.org>

diffstat:=
  kernel/params.c |   15 ++++++++++++---
  1 files changed, 12 insertions(+), 3 deletions(-)


-- 
~Randy

[-- Attachment #2: modprm_quoted.patch --]
[-- Type: text/x-patch, Size: 991 bytes --]


diff -Naurp ./kernel/params.c~modprm_quoted ./kernel/params.c
--- ./kernel/params.c~modprm_quoted	2004-11-11 15:13:26.000000000 -0800
+++ ./kernel/params.c	2004-11-11 19:42:36.714124784 -0800
@@ -77,10 +77,16 @@ static int parse_one(char *param,
 static char *next_arg(char *args, char **param, char **val)
 {
 	unsigned int i, equals = 0;
-	int in_quote = 0;
+	int in_quote = 0, quoted = 0;
+	char *next;
 
 	/* Chew any extra spaces */
 	while (*args == ' ') args++;
+	if (*args == '"') {
+		args++;
+		in_quote = 1;
+		quoted = 1;
+	}
 
 	for (i = 0; args[i]; i++) {
 		if (args[i] == ' ' && !in_quote)
@@ -106,13 +112,16 @@ static char *next_arg(char *args, char *
 			if (args[i-1] == '"')
 				args[i-1] = '\0';
 		}
+		if (quoted && args[i-1] == '"')
+			args[i-1] = '\0';
 	}
 
 	if (args[i]) {
 		args[i] = '\0';
-		return args + i + 1;
+		next = args + i + 1;
 	} else
-		return args + i;
+		next = args + i;
+	return next;
 }
 
 /* Args looks like "foo=bar,bar2 baz=fuz wiz". */

  reply	other threads:[~2004-11-12  4:18 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2004-11-11 18:09 module tool with 2.6.9 limitation issue yiding_wang
2004-11-12  4:08 ` Randy.Dunlap
2004-11-12  4:16   ` Randy.Dunlap [this message]
2004-11-15  1:14     ` [PATCH] handle quoted module parameters Rusty Russell
2004-11-12 19:02 yiding_wang
2004-11-12 19:41 ` Adam Heath
2004-11-12 21:57 yiding_wang
     [not found] ` <41968935.30701@osdl.org>
2004-11-15  0:18   ` Rusty Russell
2004-11-18 19:52 yiding_wang

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=41943931.4090008@osdl.org \
    --to=rddunlap@osdl.org \
    --cc=akpm@osdl.org \
    --cc=arjan@infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=rusty@rustcorp.com.au \
    --cc=yiding_wang@agilent.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

Powered by JetHome