tracing: Move the trace_seq_* functions into its own trace_seq.c file
[linux-2.6-block.git] / include / linux / trace_seq.h
CommitLineData
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
13struct trace_seq {
14 unsigned char buffer[PAGE_SIZE];
15 unsigned int len;
16 unsigned int readpos;
d184b31c 17 int full;
9504504c
SR
18};
19
20static inline void
21trace_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
34extern __printf(2, 3)
35int trace_seq_printf(struct trace_seq *s, const char *fmt, ...);
36extern __printf(2, 0)
37int trace_seq_vprintf(struct trace_seq *s, const char *fmt, va_list args);
9504504c
SR
38extern int
39trace_seq_bprintf(struct trace_seq *s, const char *fmt, const u32 *binary);
a63ce5b3 40extern int trace_print_seq(struct seq_file *m, struct trace_seq *s);
9504504c
SR
41extern ssize_t trace_seq_to_user(struct trace_seq *s, char __user *ubuf,
42 size_t cnt);
43extern int trace_seq_puts(struct trace_seq *s, const char *str);
44extern int trace_seq_putc(struct trace_seq *s, unsigned char c);
45extern int trace_seq_putmem(struct trace_seq *s, const void *mem, size_t len);
46extern int trace_seq_putmem_hex(struct trace_seq *s, const void *mem,
47 size_t len);
48extern void *trace_seq_reserve(struct trace_seq *s, size_t len);
38eff289 49extern int trace_seq_path(struct trace_seq *s, const struct path *path);
9504504c 50
4449bf92
SRRH
51extern int trace_seq_bitmask(struct trace_seq *s, const unsigned long *maskp,
52 int nmaskbits);
53
9504504c
SR
54#else /* CONFIG_TRACING */
55static inline int trace_seq_printf(struct trace_seq *s, const char *fmt, ...)
9504504c
SR
56{
57 return 0;
58}
59static inline int
60trace_seq_bprintf(struct trace_seq *s, const char *fmt, const u32 *binary)
61{
62 return 0;
63}
64
4449bf92
SRRH
65static inline int
66trace_seq_bitmask(struct trace_seq *s, const unsigned long *maskp,
67 int nmaskbits)
68{
69 return 0;
70}
71
a63ce5b3 72static inline int trace_print_seq(struct seq_file *m, struct trace_seq *s)
9504504c 73{
a63ce5b3 74 return 0;
9504504c
SR
75}
76static inline ssize_t trace_seq_to_user(struct trace_seq *s, char __user *ubuf,
77 size_t cnt)
78{
79 return 0;
80}
81static inline int trace_seq_puts(struct trace_seq *s, const char *str)
82{
83 return 0;
84}
23de29de 85static inline int trace_seq_putc(struct trace_seq *s, unsigned char c)
9504504c
SR
86{
87 return 0;
88}
89static inline int
90trace_seq_putmem(struct trace_seq *s, const void *mem, size_t len)
91{
92 return 0;
93}
94static inline int trace_seq_putmem_hex(struct trace_seq *s, const void *mem,
95 size_t len)
96{
97 return 0;
98}
99static inline void *trace_seq_reserve(struct trace_seq *s, size_t len)
100{
101 return NULL;
102}
38eff289 103static 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 */