@@ -20,23 +20,6 @@ static struct hlist_head event_hash[EVENT_HASHSIZE] __read_mostly;
2020
2121static int next_event_type = __TRACE_LAST_TYPE + 1 ;
2222
23- int trace_print_seq (struct seq_file * m , struct trace_seq * s )
24- {
25- int len = s -> len >= PAGE_SIZE ? PAGE_SIZE - 1 : s -> len ;
26- int ret ;
27-
28- ret = seq_write (m , s -> buffer , len );
29-
30- /*
31- * Only reset this buffer if we successfully wrote to the
32- * seq_file buffer.
33- */
34- if (!ret )
35- trace_seq_init (s );
36-
37- return ret ;
38- }
39-
4023enum print_line_t trace_print_bputs_msg_only (struct trace_iterator * iter )
4124{
4225 struct trace_seq * s = & iter -> seq ;
@@ -85,257 +68,6 @@ enum print_line_t trace_print_printk_msg_only(struct trace_iterator *iter)
8568 return TRACE_TYPE_HANDLED ;
8669}
8770
88- /**
89- * trace_seq_printf - sequence printing of trace information
90- * @s: trace sequence descriptor
91- * @fmt: printf format string
92- *
93- * It returns 0 if the trace oversizes the buffer's free
94- * space, 1 otherwise.
95- *
96- * The tracer may use either sequence operations or its own
97- * copy to user routines. To simplify formating of a trace
98- * trace_seq_printf is used to store strings into a special
99- * buffer (@s). Then the output may be either used by
100- * the sequencer or pulled into another buffer.
101- */
102- int
103- trace_seq_printf (struct trace_seq * s , const char * fmt , ...)
104- {
105- int len = (PAGE_SIZE - 1 ) - s -> len ;
106- va_list ap ;
107- int ret ;
108-
109- if (s -> full || !len )
110- return 0 ;
111-
112- va_start (ap , fmt );
113- ret = vsnprintf (s -> buffer + s -> len , len , fmt , ap );
114- va_end (ap );
115-
116- /* If we can't write it all, don't bother writing anything */
117- if (ret >= len ) {
118- s -> full = 1 ;
119- return 0 ;
120- }
121-
122- s -> len += ret ;
123-
124- return 1 ;
125- }
126- EXPORT_SYMBOL_GPL (trace_seq_printf );
127-
128- /**
129- * trace_seq_bitmask - put a list of longs as a bitmask print output
130- * @s: trace sequence descriptor
131- * @maskp: points to an array of unsigned longs that represent a bitmask
132- * @nmaskbits: The number of bits that are valid in @maskp
133- *
134- * It returns 0 if the trace oversizes the buffer's free
135- * space, 1 otherwise.
136- *
137- * Writes a ASCII representation of a bitmask string into @s.
138- */
139- int
140- trace_seq_bitmask (struct trace_seq * s , const unsigned long * maskp ,
141- int nmaskbits )
142- {
143- int len = (PAGE_SIZE - 1 ) - s -> len ;
144- int ret ;
145-
146- if (s -> full || !len )
147- return 0 ;
148-
149- ret = bitmap_scnprintf (s -> buffer , len , maskp , nmaskbits );
150- s -> len += ret ;
151-
152- return 1 ;
153- }
154- EXPORT_SYMBOL_GPL (trace_seq_bitmask );
155-
156- /**
157- * trace_seq_vprintf - sequence printing of trace information
158- * @s: trace sequence descriptor
159- * @fmt: printf format string
160- *
161- * The tracer may use either sequence operations or its own
162- * copy to user routines. To simplify formating of a trace
163- * trace_seq_printf is used to store strings into a special
164- * buffer (@s). Then the output may be either used by
165- * the sequencer or pulled into another buffer.
166- */
167- int
168- trace_seq_vprintf (struct trace_seq * s , const char * fmt , va_list args )
169- {
170- int len = (PAGE_SIZE - 1 ) - s -> len ;
171- int ret ;
172-
173- if (s -> full || !len )
174- return 0 ;
175-
176- ret = vsnprintf (s -> buffer + s -> len , len , fmt , args );
177-
178- /* If we can't write it all, don't bother writing anything */
179- if (ret >= len ) {
180- s -> full = 1 ;
181- return 0 ;
182- }
183-
184- s -> len += ret ;
185-
186- return len ;
187- }
188- EXPORT_SYMBOL_GPL (trace_seq_vprintf );
189-
190- int trace_seq_bprintf (struct trace_seq * s , const char * fmt , const u32 * binary )
191- {
192- int len = (PAGE_SIZE - 1 ) - s -> len ;
193- int ret ;
194-
195- if (s -> full || !len )
196- return 0 ;
197-
198- ret = bstr_printf (s -> buffer + s -> len , len , fmt , binary );
199-
200- /* If we can't write it all, don't bother writing anything */
201- if (ret >= len ) {
202- s -> full = 1 ;
203- return 0 ;
204- }
205-
206- s -> len += ret ;
207-
208- return len ;
209- }
210-
211- /**
212- * trace_seq_puts - trace sequence printing of simple string
213- * @s: trace sequence descriptor
214- * @str: simple string to record
215- *
216- * The tracer may use either the sequence operations or its own
217- * copy to user routines. This function records a simple string
218- * into a special buffer (@s) for later retrieval by a sequencer
219- * or other mechanism.
220- */
221- int trace_seq_puts (struct trace_seq * s , const char * str )
222- {
223- int len = strlen (str );
224-
225- if (s -> full )
226- return 0 ;
227-
228- if (len > ((PAGE_SIZE - 1 ) - s -> len )) {
229- s -> full = 1 ;
230- return 0 ;
231- }
232-
233- memcpy (s -> buffer + s -> len , str , len );
234- s -> len += len ;
235-
236- return len ;
237- }
238-
239- int trace_seq_putc (struct trace_seq * s , unsigned char c )
240- {
241- if (s -> full )
242- return 0 ;
243-
244- if (s -> len >= (PAGE_SIZE - 1 )) {
245- s -> full = 1 ;
246- return 0 ;
247- }
248-
249- s -> buffer [s -> len ++ ] = c ;
250-
251- return 1 ;
252- }
253- EXPORT_SYMBOL (trace_seq_putc );
254-
255- int trace_seq_putmem (struct trace_seq * s , const void * mem , size_t len )
256- {
257- if (s -> full )
258- return 0 ;
259-
260- if (len > ((PAGE_SIZE - 1 ) - s -> len )) {
261- s -> full = 1 ;
262- return 0 ;
263- }
264-
265- memcpy (s -> buffer + s -> len , mem , len );
266- s -> len += len ;
267-
268- return len ;
269- }
270-
271- int trace_seq_putmem_hex (struct trace_seq * s , const void * mem , size_t len )
272- {
273- unsigned char hex [HEX_CHARS ];
274- const unsigned char * data = mem ;
275- int i , j ;
276-
277- if (s -> full )
278- return 0 ;
279-
280- #ifdef __BIG_ENDIAN
281- for (i = 0 , j = 0 ; i < len ; i ++ ) {
282- #else
283- for (i = len - 1 , j = 0 ; i >= 0 ; i -- ) {
284- #endif
285- hex [j ++ ] = hex_asc_hi (data [i ]);
286- hex [j ++ ] = hex_asc_lo (data [i ]);
287- }
288- hex [j ++ ] = ' ' ;
289-
290- return trace_seq_putmem (s , hex , j );
291- }
292-
293- void * trace_seq_reserve (struct trace_seq * s , size_t len )
294- {
295- void * ret ;
296-
297- if (s -> full )
298- return NULL ;
299-
300- if (len > ((PAGE_SIZE - 1 ) - s -> len )) {
301- s -> full = 1 ;
302- return NULL ;
303- }
304-
305- ret = s -> buffer + s -> len ;
306- s -> len += len ;
307-
308- return ret ;
309- }
310-
311- int trace_seq_path (struct trace_seq * s , const struct path * path )
312- {
313- unsigned char * p ;
314-
315- if (s -> full )
316- return 0 ;
317-
318- if (s -> len >= (PAGE_SIZE - 1 )) {
319- s -> full = 1 ;
320- return 0 ;
321- }
322-
323- p = d_path (path , s -> buffer + s -> len , PAGE_SIZE - s -> len );
324- if (!IS_ERR (p )) {
325- p = mangle_path (s -> buffer + s -> len , p , "\n" );
326- if (p ) {
327- s -> len = p - s -> buffer ;
328- return 1 ;
329- }
330- } else {
331- s -> buffer [s -> len ++ ] = '?' ;
332- return 1 ;
333- }
334-
335- s -> full = 1 ;
336- return 0 ;
337- }
338-
33971const char *
34072ftrace_print_flags_seq (struct trace_seq * p , const char * delim ,
34173 unsigned long flags ,
0 commit comments