From: Steven Rostedt <rostedt@kernel.org>
To: linux-kernel@vger.kernel.org, linux-trace-kernel@vger.kernel.org,
linux-perf-users@vger.kernel.org
Cc: Masami Hiramatsu <mhiramat@kernel.org>,
Mark Rutland <mark.rutland@arm.com>,
Mathieu Desnoyers <mathieu.desnoyers@efficios.com>,
Andrew Morton <akpm@linux-foundation.org>,
Peter Zijlstra <peterz@infradead.org>,
Namhyung Kim <namhyung@kernel.org>,
Takaya Saeki <takayas@google.com>,
Tom Zanussi <zanussi@kernel.org>,
Thomas Gleixner <tglx@linutronix.de>,
Ian Rogers <irogers@google.com>,
Douglas Raillard <douglas.raillard@arm.com>,
Arnaldo Carvalho de Melo <acme@kernel.org>,
Jiri Olsa <jolsa@kernel.org>,
Adrian Hunter <adrian.hunter@intel.com>,
Ingo Molnar <mingo@redhat.com>
Subject: [PATCH v4 10/13] tracing: Add trace_seq_pop() and seq_buf_pop()
Date: Mon, 20 Oct 2025 20:52:05 -0400 [thread overview]
Message-ID: <20251021005233.915557358@kernel.org> (raw)
In-Reply-To: 20251021005155.705735078@kernel.org
From: Steven Rostedt <rostedt@goodmis.org>
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().
Signed-off-by: Steven Rostedt (Google) <rostedt@goodmis.org>
---
include/linux/seq_buf.h | 17 +++++++++++++++++
include/linux/trace_seq.h | 13 +++++++++++++
2 files changed, 30 insertions(+)
diff --git a/include/linux/seq_buf.h b/include/linux/seq_buf.h
index 52791e070506..9f2839e73f8a 100644
--- a/include/linux/seq_buf.h
+++ b/include/linux/seq_buf.h
@@ -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)
diff --git a/include/linux/trace_seq.h b/include/linux/trace_seq.h
index 557780fe1c77..4a0b8c172d27 100644
--- a/include/linux/trace_seq.h
+++ b/include/linux/trace_seq.h
@@ -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.
*/
--
2.51.0
next prev parent reply other threads:[~2025-10-21 0:52 UTC|newest]
Thread overview: 16+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-10-21 0:51 [PATCH v4 00/13] tracing: Show contents of syscall trace event user space fields Steven Rostedt
2025-10-21 0:51 ` [PATCH v4 01/13] tracing: Make trace_user_fault_read() exposed to rest of tracing Steven Rostedt
2025-10-21 0:51 ` [PATCH v4 02/13] tracing: Have syscall trace events read user space string Steven Rostedt
2025-10-21 0:51 ` [PATCH v4 03/13] perf: tracing: Simplify perf_sysenter_enable/disable() with guards Steven Rostedt
2025-10-21 0:51 ` [PATCH v4 04/13] perf: tracing: Have perf system calls read user space Steven Rostedt
2025-10-21 0:52 ` [PATCH v4 05/13] tracing: Have system call events record user array data Steven Rostedt
2025-10-21 0:52 ` [PATCH v4 06/13] tracing: Display some syscall arrays as strings Steven Rostedt
2025-10-21 0:52 ` [PATCH v4 07/13] tracing: Allow syscall trace events to read more than one user parameter Steven Rostedt
2025-10-24 4:36 ` kernel test robot
2025-10-24 20:16 ` Sebastian Andrzej Siewior
2025-10-21 0:52 ` [PATCH v4 08/13] tracing: Add a config and syscall_user_buf_size file to limit amount written Steven Rostedt
2025-10-21 0:52 ` [PATCH v4 09/13] tracing: Show printable characters in syscall arrays Steven Rostedt
2025-10-21 0:52 ` Steven Rostedt [this message]
2025-10-21 0:52 ` [PATCH v4 11/13] tracing: Add parsing of flags to the sys_enter_openat trace event Steven Rostedt
2025-10-21 0:52 ` [PATCH v4 12/13] tracing: Check for printable characters when printing field dyn strings Steven Rostedt
2025-10-21 0:52 ` [PATCH v4 13/13] tracing: Have persistent ring buffer print syscalls normally Steven Rostedt
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20251021005233.915557358@kernel.org \
--to=rostedt@kernel.org \
--cc=acme@kernel.org \
--cc=adrian.hunter@intel.com \
--cc=akpm@linux-foundation.org \
--cc=douglas.raillard@arm.com \
--cc=irogers@google.com \
--cc=jolsa@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-perf-users@vger.kernel.org \
--cc=linux-trace-kernel@vger.kernel.org \
--cc=mark.rutland@arm.com \
--cc=mathieu.desnoyers@efficios.com \
--cc=mhiramat@kernel.org \
--cc=mingo@redhat.com \
--cc=namhyung@kernel.org \
--cc=peterz@infradead.org \
--cc=takayas@google.com \
--cc=tglx@linutronix.de \
--cc=zanussi@kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.