Blame view

include/linux/trace_seq.h 2.41 KB
9504504cb   Steven Rostedt   tracing: make tra...
1
2
  #ifndef _LINUX_TRACE_SEQ_H
  #define _LINUX_TRACE_SEQ_H
6d723736e   Steven Rostedt   tracing/events: a...
3
  #include <linux/fs.h>
78be6914c   Wu Zhangjin   tracing: fix unde...
4
  #include <asm/page.h>
9504504cb   Steven Rostedt   tracing: make tra...
5
6
  /*
   * Trace sequences are used to allow a function to call several other functions
6d3f1e12f   Jiri Olsa   tracing: Remove c...
7
   * to create a string of data to use (up to a max of PAGE_SIZE).
9504504cb   Steven Rostedt   tracing: make tra...
8
9
10
11
12
13
   */
  
  struct trace_seq {
  	unsigned char		buffer[PAGE_SIZE];
  	unsigned int		len;
  	unsigned int		readpos;
d184b31c0   Johannes Berg   tracing: Add full...
14
  	int			full;
9504504cb   Steven Rostedt   tracing: make tra...
15
16
17
18
19
20
21
  };
  
  static inline void
  trace_seq_init(struct trace_seq *s)
  {
  	s->len = 0;
  	s->readpos = 0;
d184b31c0   Johannes Berg   tracing: Add full...
22
  	s->full = 0;
9504504cb   Steven Rostedt   tracing: make tra...
23
24
25
26
27
28
  }
  
  /*
   * Currently only defined when tracing is enabled.
   */
  #ifdef CONFIG_TRACING
b9075fa96   Joe Perches   treewide: use __p...
29
30
31
32
  extern __printf(2, 3)
  int trace_seq_printf(struct trace_seq *s, const char *fmt, ...);
  extern __printf(2, 0)
  int trace_seq_vprintf(struct trace_seq *s, const char *fmt, va_list args);
9504504cb   Steven Rostedt   tracing: make tra...
33
34
  extern int
  trace_seq_bprintf(struct trace_seq *s, const char *fmt, const u32 *binary);
a63ce5b30   Steven Rostedt   tracing: Buffer t...
35
  extern int trace_print_seq(struct seq_file *m, struct trace_seq *s);
9504504cb   Steven Rostedt   tracing: make tra...
36
37
38
39
40
41
42
43
44
45
46
47
  extern ssize_t trace_seq_to_user(struct trace_seq *s, char __user *ubuf,
  				 size_t cnt);
  extern int trace_seq_puts(struct trace_seq *s, const char *str);
  extern int trace_seq_putc(struct trace_seq *s, unsigned char c);
  extern int trace_seq_putmem(struct trace_seq *s, const void *mem, size_t len);
  extern int trace_seq_putmem_hex(struct trace_seq *s, const void *mem,
  				size_t len);
  extern void *trace_seq_reserve(struct trace_seq *s, size_t len);
  extern int trace_seq_path(struct trace_seq *s, struct path *path);
  
  #else /* CONFIG_TRACING */
  static inline int trace_seq_printf(struct trace_seq *s, const char *fmt, ...)
9504504cb   Steven Rostedt   tracing: make tra...
48
49
50
51
52
53
54
55
  {
  	return 0;
  }
  static inline int
  trace_seq_bprintf(struct trace_seq *s, const char *fmt, const u32 *binary)
  {
  	return 0;
  }
a63ce5b30   Steven Rostedt   tracing: Buffer t...
56
  static inline int trace_print_seq(struct seq_file *m, struct trace_seq *s)
9504504cb   Steven Rostedt   tracing: make tra...
57
  {
a63ce5b30   Steven Rostedt   tracing: Buffer t...
58
  	return 0;
9504504cb   Steven Rostedt   tracing: make tra...
59
60
61
62
63
64
65
66
67
68
  }
  static inline ssize_t trace_seq_to_user(struct trace_seq *s, char __user *ubuf,
  				 size_t cnt)
  {
  	return 0;
  }
  static inline int trace_seq_puts(struct trace_seq *s, const char *str)
  {
  	return 0;
  }
23de29de2   Steven Rostedt   tracing: remove d...
69
  static inline int trace_seq_putc(struct trace_seq *s, unsigned char c)
9504504cb   Steven Rostedt   tracing: make tra...
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
  {
  	return 0;
  }
  static inline int
  trace_seq_putmem(struct trace_seq *s, const void *mem, size_t len)
  {
  	return 0;
  }
  static inline int trace_seq_putmem_hex(struct trace_seq *s, const void *mem,
  				       size_t len)
  {
  	return 0;
  }
  static inline void *trace_seq_reserve(struct trace_seq *s, size_t len)
  {
  	return NULL;
  }
  static inline int trace_seq_path(struct trace_seq *s, struct path *path)
  {
  	return 0;
  }
  #endif /* CONFIG_TRACING */
  
  #endif /* _LINUX_TRACE_SEQ_H */