tracing: Clean up trace_seq.c
[deliverable/linux.git] / include / linux / trace_seq.h
1 #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 /*
9 * Trace sequences are used to allow a function to call several other functions
10 * to create a string of data to use (up to a max of PAGE_SIZE).
11 */
12
13 struct trace_seq {
14 unsigned char buffer[PAGE_SIZE];
15 unsigned int len;
16 unsigned int readpos;
17 int full;
18 };
19
20 static inline void
21 trace_seq_init(struct trace_seq *s)
22 {
23 s->len = 0;
24 s->readpos = 0;
25 s->full = 0;
26 }
27
28 #define MAX_MEMHEX_BYTES 8
29
30 /*
31 * Currently only defined when tracing is enabled.
32 */
33 #ifdef CONFIG_TRACING
34 extern __printf(2, 3)
35 int trace_seq_printf(struct trace_seq *s, const char *fmt, ...);
36 extern __printf(2, 0)
37 int trace_seq_vprintf(struct trace_seq *s, const char *fmt, va_list args);
38 extern int
39 trace_seq_bprintf(struct trace_seq *s, const char *fmt, const u32 *binary);
40 extern int trace_print_seq(struct seq_file *m, struct trace_seq *s);
41 extern int trace_seq_to_user(struct trace_seq *s, char __user *ubuf,
42 int cnt);
43 extern int trace_seq_puts(struct trace_seq *s, const char *str);
44 extern int trace_seq_putc(struct trace_seq *s, unsigned char c);
45 extern int trace_seq_putmem(struct trace_seq *s, const void *mem, unsigned int len);
46 extern int trace_seq_putmem_hex(struct trace_seq *s, const void *mem,
47 unsigned int len);
48 extern void *trace_seq_reserve(struct trace_seq *s, unsigned int len);
49 extern int trace_seq_path(struct trace_seq *s, const struct path *path);
50
51 extern int trace_seq_bitmask(struct trace_seq *s, const unsigned long *maskp,
52 int nmaskbits);
53
54 #else /* CONFIG_TRACING */
55 static inline int trace_seq_printf(struct trace_seq *s, const char *fmt, ...)
56 {
57 return 0;
58 }
59 static inline int
60 trace_seq_bprintf(struct trace_seq *s, const char *fmt, const u32 *binary)
61 {
62 return 0;
63 }
64
65 static inline int
66 trace_seq_bitmask(struct trace_seq *s, const unsigned long *maskp,
67 int nmaskbits)
68 {
69 return 0;
70 }
71
72 static inline int trace_print_seq(struct seq_file *m, struct trace_seq *s)
73 {
74 return 0;
75 }
76 static inline int trace_seq_to_user(struct trace_seq *s, char __user *ubuf,
77 int cnt)
78 {
79 return 0;
80 }
81 static inline int trace_seq_puts(struct trace_seq *s, const char *str)
82 {
83 return 0;
84 }
85 static inline int trace_seq_putc(struct trace_seq *s, unsigned char c)
86 {
87 return 0;
88 }
89 static inline int
90 trace_seq_putmem(struct trace_seq *s, const void *mem, unsigned int len)
91 {
92 return 0;
93 }
94 static inline int trace_seq_putmem_hex(struct trace_seq *s, const void *mem,
95 unsigned int len)
96 {
97 return 0;
98 }
99 static inline void *trace_seq_reserve(struct trace_seq *s, unsigned int len)
100 {
101 return NULL;
102 }
103 static inline int trace_seq_path(struct trace_seq *s, const struct path *path)
104 {
105 return 0;
106 }
107 #endif /* CONFIG_TRACING */
108
109 #endif /* _LINUX_TRACE_SEQ_H */
This page took 0.058844 seconds and 5 git commands to generate.