mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [patch 0/1] Dynamic Debug providing early boot debug messages via boot parameter
@ 2010-07-20 12:00 trenn
  2010-07-20 12:00 ` [patch 1/1] Dynamic Debug: Split out query string parsing/setup from proc_write trenn
  0 siblings, 1 reply; 2+ messages in thread
From: trenn @ 2010-07-20 12:00 UTC (permalink / raw)
  To: jbaron; +Cc: linux-kernel, yehuda

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #1: Type: text/plain, Size: 520 bytes --]

this patch is against 2.6.35-rc5. Not sure whether Jason's latest fix is
in there already and whether it conflicts with this series,
but it should patch.

Please tell me if I should (have to) re-diff and against which branch
I should do that.

The patches got boot tested via ddebug_query="file ec.c +p" which worked
out fine.

Would be great to see these in the next kernel cycle (2.6.36).

Thanks,

     Thomas

-- 
£\x01›ÀËÌÀ$ز|š³Iâ—\ÆÓbI\f\x0e'zæ¥–¥\x16Å'çç¦Æ'%&gsuØ3³‚%`*\x05™\x04…\x19æ§&(éÇí³}iÕ.•ùäIÒ*i>\x0e?†Ù,\vžµ¬0åm›ç¶øÃ×µ6«77Þ0\x03

^ permalink raw reply	[flat|nested] 2+ messages in thread

* [patch 1/1] Dynamic Debug: Split out query string parsing/setup from proc_write
  2010-07-20 12:00 [patch 0/1] Dynamic Debug providing early boot debug messages via boot parameter trenn
@ 2010-07-20 12:00 ` trenn
  0 siblings, 0 replies; 2+ messages in thread
From: trenn @ 2010-07-20 12:00 UTC (permalink / raw)
  To: jbaron; +Cc: linux-kernel, yehuda

[-- Attachment #1: patches.drivers/dynamic_debug_split_up_query_exec.patch --]
[-- Type: text/plain, Size: 2352 bytes --]

The parsing and applying of dynamic debug strings is not only useful for
/sys/../dynamic_debug/control write access, but can also be used for
boot parameter parsing.
The boot parameter is introduced in a follow up patch.

Signed-off-by: Thomas Renninger <trenn@suse.de>
CC: jbaron@redhat.com
CC: linux-kernel@vger.kernel.org
CC: yehuda@hq.newdream.net

---
 lib/dynamic_debug.c |   40 +++++++++++++++++++++++++---------------
 1 file changed, 25 insertions(+), 15 deletions(-)

Index: linux-2.6.34-master/lib/dynamic_debug.c
===================================================================
--- linux-2.6.34-master.orig/lib/dynamic_debug.c
+++ linux-2.6.34-master/lib/dynamic_debug.c
@@ -429,6 +429,27 @@ static int ddebug_parse_flags(const char
 	return 0;
 }
 
+static int ddebug_exec_query(char *query_string)
+{
+	unsigned int flags = 0, mask = 0;
+	struct ddebug_query query;
+#define MAXWORDS 9
+	int nwords;
+	char *words[MAXWORDS];
+
+	nwords = ddebug_tokenize(query_string, words, MAXWORDS);
+	if (nwords <= 0)
+		return -EINVAL;
+	if (ddebug_parse_query(words, nwords-1, &query))
+		return -EINVAL;
+	if (ddebug_parse_flags(words[nwords-1], &flags, &mask))
+		return -EINVAL;
+
+	/* actually go and implement the change */
+	ddebug_change(&query, flags, mask);
+	return 0;
+}
+
 /*
  * File_ops->write method for <debugfs>/dynamic_debug/conrol.  Gathers the
  * command text from userspace, parses and executes it.
@@ -436,12 +457,8 @@ static int ddebug_parse_flags(const char
 static ssize_t ddebug_proc_write(struct file *file, const char __user *ubuf,
 				  size_t len, loff_t *offp)
 {
-	unsigned int flags = 0, mask = 0;
-	struct ddebug_query query;
-#define MAXWORDS 9
-	int nwords;
-	char *words[MAXWORDS];
 	char tmpbuf[256];
+	int ret;
 
 	if (len == 0)
 		return 0;
@@ -455,16 +472,9 @@ static ssize_t ddebug_proc_write(struct
 		printk(KERN_INFO "%s: read %d bytes from userspace\n",
 			__func__, (int)len);
 
-	nwords = ddebug_tokenize(tmpbuf, words, MAXWORDS);
-	if (nwords <= 0)
-		return -EINVAL;
-	if (ddebug_parse_query(words, nwords-1, &query))
-		return -EINVAL;
-	if (ddebug_parse_flags(words[nwords-1], &flags, &mask))
-		return -EINVAL;
-
-	/* actually go and implement the change */
-	ddebug_change(&query, flags, mask);
+	ret = ddebug_exec_query(tmpbuf);
+	if (ret)
+		return ret;
 
 	*offp += len;
 	return len;


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2010-07-20 12:07 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2010-07-20 12:00 [patch 0/1] Dynamic Debug providing early boot debug messages via boot parameter trenn
2010-07-20 12:00 ` [patch 1/1] Dynamic Debug: Split out query string parsing/setup from proc_write trenn

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