Skip to content

Commit d5cfbdf

Browse files
tzstoyanovrostedt
authored andcommitted
ring-buffer: Have ring_buffer_print_page_header() be able to access ring_buffer_iter
In order to introduce sub-buffer size per ring buffer, some internal refactoring is needed. As ring_buffer_print_page_header() will depend on the trace_buffer structure, it is moved after the structure definition. Link: https://lore.kernel.org/linux-trace-devel/[email protected] Link: https://lore.kernel.org/linux-trace-kernel/[email protected] Cc: Masami Hiramatsu <[email protected]> Cc: Mark Rutland <[email protected]> Cc: Mathieu Desnoyers <[email protected]> Cc: Andrew Morton <[email protected]> Cc: Vincent Donnefort <[email protected]> Cc: Kent Overstreet <[email protected]> Signed-off-by: Tzvetomir Stoyanov (VMware) <[email protected]> Signed-off-by: Steven Rostedt (Google) <[email protected]>
1 parent f50345b commit d5cfbdf

File tree

1 file changed

+30
-30
lines changed

1 file changed

+30
-30
lines changed

kernel/trace/ring_buffer.c

Lines changed: 30 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -379,36 +379,6 @@ static inline bool test_time_stamp(u64 delta)
379379
/* Max payload is BUF_PAGE_SIZE - header (8bytes) */
380380
#define BUF_MAX_DATA_SIZE (BUF_PAGE_SIZE - (sizeof(u32) * 2))
381381

382-
int ring_buffer_print_page_header(struct trace_seq *s)
383-
{
384-
struct buffer_data_page field;
385-
386-
trace_seq_printf(s, "\tfield: u64 timestamp;\t"
387-
"offset:0;\tsize:%u;\tsigned:%u;\n",
388-
(unsigned int)sizeof(field.time_stamp),
389-
(unsigned int)is_signed_type(u64));
390-
391-
trace_seq_printf(s, "\tfield: local_t commit;\t"
392-
"offset:%u;\tsize:%u;\tsigned:%u;\n",
393-
(unsigned int)offsetof(typeof(field), commit),
394-
(unsigned int)sizeof(field.commit),
395-
(unsigned int)is_signed_type(long));
396-
397-
trace_seq_printf(s, "\tfield: int overwrite;\t"
398-
"offset:%u;\tsize:%u;\tsigned:%u;\n",
399-
(unsigned int)offsetof(typeof(field), commit),
400-
1,
401-
(unsigned int)is_signed_type(long));
402-
403-
trace_seq_printf(s, "\tfield: char data;\t"
404-
"offset:%u;\tsize:%u;\tsigned:%u;\n",
405-
(unsigned int)offsetof(typeof(field), data),
406-
(unsigned int)BUF_PAGE_SIZE,
407-
(unsigned int)is_signed_type(char));
408-
409-
return !trace_seq_has_overflowed(s);
410-
}
411-
412382
struct rb_irq_work {
413383
struct irq_work work;
414384
wait_queue_head_t waiters;
@@ -556,6 +526,36 @@ struct ring_buffer_iter {
556526
int missed_events;
557527
};
558528

529+
int ring_buffer_print_page_header(struct trace_seq *s)
530+
{
531+
struct buffer_data_page field;
532+
533+
trace_seq_printf(s, "\tfield: u64 timestamp;\t"
534+
"offset:0;\tsize:%u;\tsigned:%u;\n",
535+
(unsigned int)sizeof(field.time_stamp),
536+
(unsigned int)is_signed_type(u64));
537+
538+
trace_seq_printf(s, "\tfield: local_t commit;\t"
539+
"offset:%u;\tsize:%u;\tsigned:%u;\n",
540+
(unsigned int)offsetof(typeof(field), commit),
541+
(unsigned int)sizeof(field.commit),
542+
(unsigned int)is_signed_type(long));
543+
544+
trace_seq_printf(s, "\tfield: int overwrite;\t"
545+
"offset:%u;\tsize:%u;\tsigned:%u;\n",
546+
(unsigned int)offsetof(typeof(field), commit),
547+
1,
548+
(unsigned int)is_signed_type(long));
549+
550+
trace_seq_printf(s, "\tfield: char data;\t"
551+
"offset:%u;\tsize:%u;\tsigned:%u;\n",
552+
(unsigned int)offsetof(typeof(field), data),
553+
(unsigned int)BUF_PAGE_SIZE,
554+
(unsigned int)is_signed_type(char));
555+
556+
return !trace_seq_has_overflowed(s);
557+
}
558+
559559
static inline void rb_time_read(rb_time_t *t, u64 *ret)
560560
{
561561
*ret = local64_read(&t->time);

0 commit comments

Comments
 (0)