blob: 40cb04a9583d14b74f0623ed98a0a51d5be17a12 [file] [log] [blame]
Nicholas Flintham1e3d3112013-04-10 10:48:38 +01001#ifndef _LINUX_TRACE_SEQ_H
2#define _LINUX_TRACE_SEQ_H
3
4#include <linux/fs.h>
5
6#include <asm/page.h>
7
8
9struct trace_seq {
10 unsigned char buffer[PAGE_SIZE];
11 unsigned int len;
12 unsigned int readpos;
13 int full;
14};
15
16static inline void
17trace_seq_init(struct trace_seq *s)
18{
19 s->len = 0;
20 s->readpos = 0;
21 s->full = 0;
22}
23
24#ifdef CONFIG_TRACING
25extern __printf(2, 3)
26int trace_seq_printf(struct trace_seq *s, const char *fmt, ...);
27extern __printf(2, 0)
28int trace_seq_vprintf(struct trace_seq *s, const char *fmt, va_list args);
29extern int
30trace_seq_bprintf(struct trace_seq *s, const char *fmt, const u32 *binary);
31extern int trace_print_seq(struct seq_file *m, struct trace_seq *s);
32extern ssize_t trace_seq_to_user(struct trace_seq *s, char __user *ubuf,
33 size_t cnt);
34extern int trace_seq_puts(struct trace_seq *s, const char *str);
35extern int trace_seq_putc(struct trace_seq *s, unsigned char c);
36extern int trace_seq_putmem(struct trace_seq *s, const void *mem, size_t len);
37extern int trace_seq_putmem_hex(struct trace_seq *s, const void *mem,
38 size_t len);
39extern void *trace_seq_reserve(struct trace_seq *s, size_t len);
40extern int trace_seq_path(struct trace_seq *s, const struct path *path);
41
42#else
43static inline int trace_seq_printf(struct trace_seq *s, const char *fmt, ...)
44{
45 return 0;
46}
47static inline int
48trace_seq_bprintf(struct trace_seq *s, const char *fmt, const u32 *binary)
49{
50 return 0;
51}
52
53static inline int trace_print_seq(struct seq_file *m, struct trace_seq *s)
54{
55 return 0;
56}
57static inline ssize_t trace_seq_to_user(struct trace_seq *s, char __user *ubuf,
58 size_t cnt)
59{
60 return 0;
61}
62static inline int trace_seq_puts(struct trace_seq *s, const char *str)
63{
64 return 0;
65}
66static inline int trace_seq_putc(struct trace_seq *s, unsigned char c)
67{
68 return 0;
69}
70static inline int
71trace_seq_putmem(struct trace_seq *s, const void *mem, size_t len)
72{
73 return 0;
74}
75static inline int trace_seq_putmem_hex(struct trace_seq *s, const void *mem,
76 size_t len)
77{
78 return 0;
79}
80static inline void *trace_seq_reserve(struct trace_seq *s, size_t len)
81{
82 return NULL;
83}
84static inline int trace_seq_path(struct trace_seq *s, const struct path *path)
85{
86 return 0;
87}
88#endif
89
90#endif