Commit | Line | Data |
---|---|---|
9504504c SR |
1 | #ifndef _LINUX_TRACE_SEQ_H |
2 | #define _LINUX_TRACE_SEQ_H | |
3 | ||
6d723736 SR |
4 | #include <linux/fs.h> |
5 | ||
78be6914 WZ |
6 | #include <asm/page.h> |
7 | ||
9504504c SR |
8 | /* |
9 | * Trace sequences are used to allow a function to call several other functions | |
6d3f1e12 | 10 | * to create a string of data to use (up to a max of PAGE_SIZE). |
9504504c SR |
11 | */ |
12 | ||
13 | struct trace_seq { | |
14 | unsigned char buffer[PAGE_SIZE]; | |
15 | unsigned int len; | |
16 | unsigned int readpos; | |
d184b31c | 17 | int full; |
9504504c SR |
18 | }; |
19 | ||
20 | static inline void | |
21 | trace_seq_init(struct trace_seq *s) | |
22 | { | |
23 | s->len = 0; | |
24 | s->readpos = 0; | |
d184b31c | 25 | s->full = 0; |
9504504c SR |
26 | } |
27 | ||
12306276 SRRH |
28 | #define MAX_MEMHEX_BYTES 8 |
29 | ||
9504504c SR |
30 | /* |
31 | * Currently only defined when tracing is enabled. | |
32 | */ | |
33 | #ifdef CONFIG_TRACING | |
b9075fa9 JP |
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); | |
9504504c SR |
38 | extern int |
39 | trace_seq_bprintf(struct trace_seq *s, const char *fmt, const u32 *binary); | |
a63ce5b3 | 40 | extern int trace_print_seq(struct seq_file *m, struct trace_seq *s); |
9504504c SR |
41 | extern ssize_t trace_seq_to_user(struct trace_seq *s, char __user *ubuf, |
42 | size_t 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, size_t len); | |
46 | extern int trace_seq_putmem_hex(struct trace_seq *s, const void *mem, | |
47 | size_t len); | |
48 | extern void *trace_seq_reserve(struct trace_seq *s, size_t len); | |
38eff289 | 49 | extern int trace_seq_path(struct trace_seq *s, const struct path *path); |
9504504c | 50 | |
4449bf92 SRRH |
51 | extern int trace_seq_bitmask(struct trace_seq *s, const unsigned long *maskp, |
52 | int nmaskbits); | |
53 | ||
9504504c SR |
54 | #else /* CONFIG_TRACING */ |
55 | static inline int trace_seq_printf(struct trace_seq *s, const char *fmt, ...) | |
9504504c SR |
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 | ||
4449bf92 SRRH |
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 | ||
a63ce5b3 | 72 | static inline int trace_print_seq(struct seq_file *m, struct trace_seq *s) |
9504504c | 73 | { |
a63ce5b3 | 74 | return 0; |
9504504c SR |
75 | } |
76 | static inline ssize_t trace_seq_to_user(struct trace_seq *s, char __user *ubuf, | |
77 | size_t 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 | } | |
23de29de | 85 | static inline int trace_seq_putc(struct trace_seq *s, unsigned char c) |
9504504c SR |
86 | { |
87 | return 0; | |
88 | } | |
89 | static inline int | |
90 | trace_seq_putmem(struct trace_seq *s, const void *mem, size_t len) | |
91 | { | |
92 | return 0; | |
93 | } | |
94 | static inline int trace_seq_putmem_hex(struct trace_seq *s, const void *mem, | |
95 | size_t len) | |
96 | { | |
97 | return 0; | |
98 | } | |
99 | static inline void *trace_seq_reserve(struct trace_seq *s, size_t len) | |
100 | { | |
101 | return NULL; | |
102 | } | |
38eff289 | 103 | static inline int trace_seq_path(struct trace_seq *s, const struct path *path) |
9504504c SR |
104 | { |
105 | return 0; | |
106 | } | |
107 | #endif /* CONFIG_TRACING */ | |
108 | ||
109 | #endif /* _LINUX_TRACE_SEQ_H */ |