diff options
author | jolsa@redhat.com <jolsa@redhat.com> | 2009-09-11 11:29:27 -0400 |
---|---|---|
committer | Steven Rostedt <rostedt@goodmis.org> | 2009-09-11 14:46:55 -0400 |
commit | b63f39ea50330f836e301ddda21c6a93dcf0d6a3 (patch) | |
tree | 3fb5a88ca19da6417a52b83eff585b9413bfb9c9 /kernel/trace/trace.h | |
parent | f81c972d27c36729e65d4a815e3d7b782a540bad (diff) |
tracing: create generic trace parser
Create a "trace_parser" that can parse the user space input for
separate words.
struct trace_parser is the descriptor.
Generic "trace_get_user" function that can be a helper to read multiple
words passed in by user space.
Signed-off-by: Jiri Olsa <jolsa@redhat.com>
LKML-Reference: <1252682969-3366-2-git-send-email-jolsa@redhat.com>
Signed-off-by: Steven Rostedt <rostedt@goodmis.org>
Diffstat (limited to 'kernel/trace/trace.h')
-rw-r--r-- | kernel/trace/trace.h | 35 |
1 files changed, 35 insertions, 0 deletions
diff --git a/kernel/trace/trace.h b/kernel/trace/trace.h index b69697b4b846..28247cecd955 100644 --- a/kernel/trace/trace.h +++ b/kernel/trace/trace.h | |||
@@ -616,6 +616,41 @@ static inline int ftrace_trace_task(struct task_struct *task) | |||
616 | #endif | 616 | #endif |
617 | 617 | ||
618 | /* | 618 | /* |
619 | * struct trace_parser - servers for reading the user input separated by spaces | ||
620 | * @cont: set if the input is not complete - no final space char was found | ||
621 | * @buffer: holds the parsed user input | ||
622 | * @idx: user input lenght | ||
623 | * @size: buffer size | ||
624 | */ | ||
625 | struct trace_parser { | ||
626 | bool cont; | ||
627 | char *buffer; | ||
628 | unsigned idx; | ||
629 | unsigned size; | ||
630 | }; | ||
631 | |||
632 | static inline bool trace_parser_loaded(struct trace_parser *parser) | ||
633 | { | ||
634 | return (parser->idx != 0); | ||
635 | } | ||
636 | |||
637 | static inline bool trace_parser_cont(struct trace_parser *parser) | ||
638 | { | ||
639 | return parser->cont; | ||
640 | } | ||
641 | |||
642 | static inline void trace_parser_clear(struct trace_parser *parser) | ||
643 | { | ||
644 | parser->cont = false; | ||
645 | parser->idx = 0; | ||
646 | } | ||
647 | |||
648 | extern int trace_parser_get_init(struct trace_parser *parser, int size); | ||
649 | extern void trace_parser_put(struct trace_parser *parser); | ||
650 | extern int trace_get_user(struct trace_parser *parser, const char __user *ubuf, | ||
651 | size_t cnt, loff_t *ppos); | ||
652 | |||
653 | /* | ||
619 | * trace_iterator_flags is an enumeration that defines bit | 654 | * trace_iterator_flags is an enumeration that defines bit |
620 | * positions into trace_flags that controls the output. | 655 | * positions into trace_flags that controls the output. |
621 | * | 656 | * |