From: Steven Rostedt <rostedt@goodmis.org>
To: linux-kernel@vger.kernel.org,
Frederic Weisbecker <fweisbec@gmail.com>,
Jason Baron <jbaron@redhat.com>
Subject: [PATCH 1/6] tracing: Convert trace_printk() formats for module to const char *
Date: Mon, 04 Apr 2011 15:16:55 -0400 [thread overview]
Message-ID: <20110404191831.917976310@goodmis.org> (raw)
In-Reply-To: 20110404191654.006849945@goodmis.org
[-- Attachment #1: 0001-tracing-Convert-trace_printk-formats-for-module-to-c.patch --]
[-- Type: text/plain, Size: 1851 bytes --]
From: Steven Rostedt <srostedt@redhat.com>
The trace_printk() formats for modules do not show up in the
debugfs/tracing/printk_formats file. Only the formats that are
for trace_printk()s that are in the kernel core.
To facilitate the change to add trace_printk() formats from modules
into that file as well, we need to convert the structure that
holds the formats from char fmt[], into const char *fmt,
and allocate them separately.
Signed-off-by: Steven Rostedt <rostedt@goodmis.org>
---
kernel/trace/trace_printk.c | 17 +++++++++++------
1 files changed, 11 insertions(+), 6 deletions(-)
diff --git a/kernel/trace/trace_printk.c b/kernel/trace/trace_printk.c
index 2547d88..b8b2681 100644
--- a/kernel/trace/trace_printk.c
+++ b/kernel/trace/trace_printk.c
@@ -32,7 +32,7 @@ static DEFINE_MUTEX(btrace_mutex);
struct trace_bprintk_fmt {
struct list_head list;
- char fmt[0];
+ const char *fmt;
};
static inline struct trace_bprintk_fmt *lookup_format(const char *fmt)
@@ -49,6 +49,7 @@ static
void hold_module_trace_bprintk_format(const char **start, const char **end)
{
const char **iter;
+ char *fmt;
mutex_lock(&btrace_mutex);
for (iter = start; iter < end; iter++) {
@@ -58,14 +59,18 @@ void hold_module_trace_bprintk_format(const char **start, const char **end)
continue;
}
- tb_fmt = kmalloc(offsetof(struct trace_bprintk_fmt, fmt)
- + strlen(*iter) + 1, GFP_KERNEL);
- if (tb_fmt) {
+ tb_fmt = kmalloc(sizeof(*tb_fmt), GFP_KERNEL);
+ if (tb_fmt)
+ fmt = kmalloc(strlen(*iter) + 1, GFP_KERNEL);
+ if (tb_fmt && fmt) {
list_add_tail(&tb_fmt->list, &trace_bprintk_fmt_list);
- strcpy(tb_fmt->fmt, *iter);
+ strcpy(fmt, *iter);
+ tb_fmt->fmt = fmt;
*iter = tb_fmt->fmt;
- } else
+ } else {
+ kfree(tb_fmt);
*iter = NULL;
+ }
}
mutex_unlock(&btrace_mutex);
}
--
1.7.2.3
next prev parent reply other threads:[~2011-04-04 19:18 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-04-04 19:16 [PATCH 0/6] [GIT PULL][v2.6.40] tracing: updates and jump label rebase Steven Rostedt
2011-04-04 19:16 ` Steven Rostedt [this message]
2011-04-04 19:16 ` [PATCH 2/6] tracing: Print trace_bprintk() formats for modules too Steven Rostedt
2011-04-04 19:16 ` [PATCH 3/6] tracing: Avoid soft lockup in trace_pipe Steven Rostedt
2011-04-04 19:16 ` [PATCH 4/6] jump label: Introduce static_branch() interface Steven Rostedt
2011-04-04 19:16 ` [PATCH 5/6] jump label: Add _ASM_ALIGN for x86 and x86_64 Steven Rostedt
2011-04-04 19:17 ` [PATCH 6/6] jump label: Add s390 support Steven Rostedt
-- strict thread matches above, loose matches on Subject: below --
2011-04-20 15:58 [PATCH 0/6] [GIT PULL][v2.6.40] tracing: updates and jump label rebase Steven Rostedt
2011-04-20 15:58 ` [PATCH 1/6] tracing: Convert trace_printk() formats for module to const char * Steven Rostedt
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=20110404191831.917976310@goodmis.org \
--to=rostedt@goodmis.org \
--cc=fweisbec@gmail.com \
--cc=jbaron@redhat.com \
--cc=linux-kernel@vger.kernel.org \
/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