mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Borislav Petkov <bp@amd64.org>
To: <acme@infradead.org>, <fweisbec@gmail.com>, <mingo@elte.hu>,
	<peterz@infradead.org>, <rostedt@goodmis.org>
Cc: <linux-kernel@vger.kernel.org>,
	Borislav Petkov <borislav.petkov@amd.com>
Subject: [PATCH 19/20] perf, trace: Export event parsing helpers
Date: Thu,  4 Nov 2010 16:36:55 +0100	[thread overview]
Message-ID: <1288885016-18295-20-git-send-email-bp@amd64.org> (raw)
In-Reply-To: <1288885016-18295-1-git-send-email-bp@amd64.org>

From: Borislav Petkov <borislav.petkov@amd.com>

Those are needed for the RAS daemon.

Signed-off-by: Borislav Petkov <borislav.petkov@amd.com>
---
 tools/lib/trace/parse-events.c     |   12 ++++++------
 tools/lib/trace/parse-events.h     |    5 +++++
 tools/lib/trace/trace-event-info.c |   10 +++++-----
 tools/lib/trace/trace-event.h      |    2 ++
 4 files changed, 18 insertions(+), 11 deletions(-)

diff --git a/tools/lib/trace/parse-events.c b/tools/lib/trace/parse-events.c
index 1f95f87..02fc69b 100644
--- a/tools/lib/trace/parse-events.c
+++ b/tools/lib/trace/parse-events.c
@@ -45,7 +45,7 @@ static int show_warning = 1;
 			warning(fmt, ##__VA_ARGS__);	\
 	} while (0)
 
-static void init_input_buf(const char *buf, unsigned long long size)
+void init_input_buf(const char *buf, unsigned long long size)
 {
 	input_buf = buf;
 	input_buf_siz = size;
@@ -585,7 +585,7 @@ void pevent_print_printk(struct pevent *pevent)
 	}
 }
 
-static struct event_format *alloc_event(void)
+struct event_format *alloc_event(void)
 {
 	struct event_format *event;
 
@@ -1079,7 +1079,7 @@ static int read_expected_item(enum event_type expect, const char *str)
 	return __read_expected(expect, str, 0);
 }
 
-static char *event_read_name(void)
+char *event_read_name(void)
 {
 	char *token;
 
@@ -1099,7 +1099,7 @@ static char *event_read_name(void)
 	return NULL;
 }
 
-static int event_read_id(void)
+int event_read_id(void)
 {
 	char *token;
 	int id;
@@ -1394,7 +1394,7 @@ fail_expect:
 	return -1;
 }
 
-static int event_read_format(struct event_format *event)
+int event_read_format(struct event_format *event)
 {
 	char *token;
 	int ret;
@@ -4287,7 +4287,7 @@ int pevent_parse_event(struct pevent *pevent,
 		if (strcmp(event->name, "bprint") == 0)
 			event->flags |= EVENT_FL_ISBPRINT;
 	}
-		
+
 	event->id = event_read_id();
 	if (event->id < 0)
 		die("failed to read event id");
diff --git a/tools/lib/trace/parse-events.h b/tools/lib/trace/parse-events.h
index f967885..4d9400a 100644
--- a/tools/lib/trace/parse-events.h
+++ b/tools/lib/trace/parse-events.h
@@ -728,4 +728,9 @@ int pevent_update_trivial(struct event_filter *dest, struct event_filter *source
 
 int pevent_filter_compare(struct event_filter *filter1, struct event_filter *filter2);
 
+extern struct event_format *alloc_event(void);
+extern void init_input_buf(const char *buf, unsigned long long size);
+extern char *event_read_name(void);
+extern int event_read_id(void);
+extern int event_read_format(struct event_format *event);
 #endif /* _PARSE_EVENTS_H */
diff --git a/tools/lib/trace/trace-event-info.c b/tools/lib/trace/trace-event-info.c
index 98faa44..8188c59 100644
--- a/tools/lib/trace/trace-event-info.c
+++ b/tools/lib/trace/trace-event-info.c
@@ -136,7 +136,7 @@ static const char *find_tracing_dir(void)
 	return tracing;
 }
 
-static char *get_tracing_file(const char *name)
+char *get_tracing_file(const char *name)
 {
 	const char *tracing;
 	char *file;
@@ -231,7 +231,7 @@ static unsigned long get_size_fd(int fd)
 	return size;
 }
 
-static unsigned long get_size(const char *file)
+unsigned long get_filesize(const char *file)
 {
 	unsigned long long size = 0;
 	int fd;
@@ -340,7 +340,7 @@ static void copy_event_system(const char *sys, struct tracepoint_path *tps)
 
 		if (ret >= 0) {
 			/* unfortunately, you can not stat debugfs files for size */
-			size = get_size(format);
+			size = get_filesize(format);
 			write_or_die(&size, 8);
 			check_size = copy_file(format);
 			if (size != check_size)
@@ -438,7 +438,7 @@ static void read_proc_kallsyms(void)
 		write_or_die(&size, 4);
 		return;
 	}
-	size = get_size(path);
+	size = get_filesize(path);
 	write_or_die(&size, 4);
 	check_size = copy_file(path);
 	if (size != check_size)
@@ -461,7 +461,7 @@ static void read_ftrace_printk(void)
 		write_or_die(&size, 4);
 		goto out;
 	}
-	size = get_size(path);
+	size = get_filesize(path);
 	write_or_die(&size, 4);
 	check_size = copy_file(path);
 	if (size != check_size)
diff --git a/tools/lib/trace/trace-event.h b/tools/lib/trace/trace-event.h
index 9c9d342..c7e8e0b 100644
--- a/tools/lib/trace/trace-event.h
+++ b/tools/lib/trace/trace-event.h
@@ -76,6 +76,8 @@ struct event_format *trace_find_event(int id);
 #endif
 struct event_format *trace_find_next_event(struct event_format *event);
 unsigned long long read_size(void *ptr, int size);
+unsigned long get_filesize(const char *file);
+char *get_tracing_file(const char *name);
 #if 0
 unsigned long long
 raw_field_value(struct event_format *event, const char *name, void *data);
-- 
1.7.3.1


  parent reply	other threads:[~2010-11-04 15:40 UTC|newest]

Thread overview: 31+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-11-04 15:36 [RFC PATCH 00/20] RAS daemon v3 Borislav Petkov
2010-11-04 15:36 ` [PATCH 01/20] perf: Start the massive restructuring Borislav Petkov
2010-11-04 15:36 ` [PATCH 02/20] perf: Add persistent event facilities Borislav Petkov
2010-11-04 15:36 ` [PATCH 03/20] x86, mce: Add persistent MCE event Borislav Petkov
2010-11-10 21:15   ` Ben Gamari
2010-11-10 22:21     ` Ingo Molnar
2010-11-11  6:17       ` Borislav Petkov
2010-11-11  8:58         ` Ingo Molnar
2010-11-11 13:34           ` Borislav Petkov
2010-11-11 15:38             ` Peter Zijlstra
2010-11-11 15:55               ` Borislav Petkov
2010-11-11 17:30                 ` Ingo Molnar
2010-11-04 15:36 ` [PATCH 04/20] perf: Move trace-event-parse out of perf/util directory Borislav Petkov
2010-11-04 15:36 ` [PATCH 05/20] perf: Update the lib parse-events to the latest code Borislav Petkov
2010-11-04 15:36 ` [PATCH 06/20] perf: Move trace stuff into tools/lib/trace Borislav Petkov
2010-11-04 15:36 ` [PATCH 07/20] perf: Export debugfs utilities Borislav Petkov
2010-11-04 15:36 ` [PATCH 08/20] perf: Export cpumap Borislav Petkov
2010-11-04 15:36 ` [PATCH 09/20] perf: Carve out mmap helpers for general use Borislav Petkov
2010-11-04 15:36 ` [PATCH 10/20] perf: Export util.ch into library Borislav Petkov
2010-11-04 15:36 ` [PATCH 11/20] perf: Move rbtree to library Borislav Petkov
2010-11-04 15:36 ` [PATCH 12/20] perf: Export generic kernel utils " Borislav Petkov
2010-11-04 15:36 ` [PATCH 13/20] perf: Export compiler.h to the generic library Borislav Petkov
2010-11-04 15:36 ` [PATCH 14/20] perf: Export color.ch and config.ch Borislav Petkov
2010-11-04 15:36 ` [PATCH 15/20] perf: Export strlist.ch Borislav Petkov
2010-11-04 15:36 ` [PATCH 16/20] perf: Export map.ch and symbol.ch Borislav Petkov
2010-11-04 15:36 ` [PATCH 17/20] perf: Export trace parsing utils Borislav Petkov
2010-11-04 15:36 ` [PATCH 18/20] Move string.c to the library Borislav Petkov
2010-11-04 15:36 ` Borislav Petkov [this message]
2010-11-04 15:36 ` [PATCH 20/20] ras: Add RAS daemon Borislav Petkov
2010-11-05 12:02 ` [RFC PATCH 00/20] RAS daemon v3 Mauro Carvalho Chehab
2010-11-05 13:46   ` Borislav Petkov

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=1288885016-18295-20-git-send-email-bp@amd64.org \
    --to=bp@amd64.org \
    --cc=acme@infradead.org \
    --cc=borislav.petkov@amd.com \
    --cc=fweisbec@gmail.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@elte.hu \
    --cc=peterz@infradead.org \
    --cc=rostedt@goodmis.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

all inboxes | Powered by JetHome®