1#ifndef _LINUX_TRACE_SEQ_H
2#define _LINUX_TRACE_SEQ_H
3
4#include <linux/seq_buf.h>
5
6#include <asm/page.h>
7
8
9
10
11
12
13struct trace_seq {
14 unsigned char buffer[PAGE_SIZE];
15 struct seq_buf seq;
16 int full;
17};
18
19static inline void
20trace_seq_init(struct trace_seq *s)
21{
22 seq_buf_init(&s->seq, s->buffer, PAGE_SIZE);
23 s->full = 0;
24}
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39static inline int trace_seq_used(struct trace_seq *s)
40{
41 return seq_buf_used(&s->seq);
42}
43
44
45
46
47
48
49
50
51
52
53static inline unsigned char *
54trace_seq_buffer_ptr(struct trace_seq *s)
55{
56 return s->buffer + seq_buf_used(&s->seq);
57}
58
59
60
61
62
63
64
65
66static inline bool trace_seq_has_overflowed(struct trace_seq *s)
67{
68 return s->full || seq_buf_has_overflowed(&s->seq);
69}
70
71
72
73
74#ifdef CONFIG_TRACING
75extern __printf(2, 3)
76void trace_seq_printf(struct trace_seq *s, const char *fmt, ...);
77extern __printf(2, 0)
78void trace_seq_vprintf(struct trace_seq *s, const char *fmt, va_list args);
79extern void
80trace_seq_bprintf(struct trace_seq *s, const char *fmt, const u32 *binary);
81extern int trace_print_seq(struct seq_file *m, struct trace_seq *s);
82extern int trace_seq_to_user(struct trace_seq *s, char __user *ubuf,
83 int cnt);
84extern void trace_seq_puts(struct trace_seq *s, const char *str);
85extern void trace_seq_putc(struct trace_seq *s, unsigned char c);
86extern void trace_seq_putmem(struct trace_seq *s, const void *mem, unsigned int len);
87extern void trace_seq_putmem_hex(struct trace_seq *s, const void *mem,
88 unsigned int len);
89extern int trace_seq_path(struct trace_seq *s, const struct path *path);
90
91extern void trace_seq_bitmask(struct trace_seq *s, const unsigned long *maskp,
92 int nmaskbits);
93
94#else
95static inline void trace_seq_printf(struct trace_seq *s, const char *fmt, ...)
96{
97}
98static inline void
99trace_seq_bprintf(struct trace_seq *s, const char *fmt, const u32 *binary)
100{
101}
102
103static inline void
104trace_seq_bitmask(struct trace_seq *s, const unsigned long *maskp,
105 int nmaskbits)
106{
107}
108
109static inline int trace_print_seq(struct seq_file *m, struct trace_seq *s)
110{
111 return 0;
112}
113static inline int trace_seq_to_user(struct trace_seq *s, char __user *ubuf,
114 int cnt)
115{
116 return 0;
117}
118static inline void trace_seq_puts(struct trace_seq *s, const char *str)
119{
120}
121static inline void trace_seq_putc(struct trace_seq *s, unsigned char c)
122{
123}
124static inline void
125trace_seq_putmem(struct trace_seq *s, const void *mem, unsigned int len)
126{
127}
128static inline void trace_seq_putmem_hex(struct trace_seq *s, const void *mem,
129 unsigned int len)
130{
131}
132static inline int trace_seq_path(struct trace_seq *s, const struct path *path)
133{
134 return 0;
135}
136#endif
137
138#endif
139