mirror of
https://github.com/torvalds/linux.git
synced 2026-11-23 23:11:40 +00:00
tracing: Add trace_seq_pop() and seq_buf_pop()
In order to allow an interface to remove an added character from the trace_seq and seq_buf descriptors, add helper functions trace_seq_pop() and seq_buf_pop(). Cc: Masami Hiramatsu <[email protected]> Cc: Mark Rutland <[email protected]> Cc: Mathieu Desnoyers <[email protected]> Cc: Andrew Morton <[email protected]> Cc: Peter Zijlstra <[email protected]> Cc: Namhyung Kim <[email protected]> Cc: Takaya Saeki <[email protected]> Cc: Tom Zanussi <[email protected]> Cc: Thomas Gleixner <[email protected]> Cc: Ian Rogers <[email protected]> Cc: Douglas Raillard <[email protected]> Cc: Arnaldo Carvalho de Melo <[email protected]> Cc: Jiri Olsa <[email protected]> Cc: Adrian Hunter <[email protected]> Cc: Ingo Molnar <[email protected]> Link: https://lore.kernel.org/[email protected] Signed-off-by: Steven Rostedt (Google) <[email protected]>
This commit is contained in:
committed by
Steven Rostedt (Google)
parent
e77ad6da90
commit
32e0f607ac
@@ -149,6 +149,23 @@ static inline void seq_buf_commit(struct seq_buf *s, int num)
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* seq_buf_pop - pop off the last written character
|
||||
* @s: the seq_buf handle
|
||||
*
|
||||
* Removes the last written character to the seq_buf @s.
|
||||
*
|
||||
* Returns the last character or -1 if it is empty.
|
||||
*/
|
||||
static inline int seq_buf_pop(struct seq_buf *s)
|
||||
{
|
||||
if (!s->len)
|
||||
return -1;
|
||||
|
||||
s->len--;
|
||||
return (unsigned int)s->buffer[s->len];
|
||||
}
|
||||
|
||||
extern __printf(2, 3)
|
||||
int seq_buf_printf(struct seq_buf *s, const char *fmt, ...);
|
||||
extern __printf(2, 0)
|
||||
|
||||
@@ -80,6 +80,19 @@ static inline bool trace_seq_has_overflowed(struct trace_seq *s)
|
||||
return s->full || seq_buf_has_overflowed(&s->seq);
|
||||
}
|
||||
|
||||
/**
|
||||
* trace_seq_pop - pop off the last written character
|
||||
* @s: trace sequence descriptor
|
||||
*
|
||||
* Removes the last written character to the trace_seq @s.
|
||||
*
|
||||
* Returns the last character or -1 if it is empty.
|
||||
*/
|
||||
static inline int trace_seq_pop(struct trace_seq *s)
|
||||
{
|
||||
return seq_buf_pop(&s->seq);
|
||||
}
|
||||
|
||||
/*
|
||||
* Currently only defined when tracing is enabled.
|
||||
*/
|
||||
|
||||
Reference in New Issue
Block a user