From: Ye Bin <yebin10@huawei.com>
To: <rostedt@goodmis.org>, <mhiramat@kernel.org>,
<mathieu.desnoyers@efficios.com>,
<linux-trace-kernel@vger.kernel.org>
Cc: <linux-kernel@vger.kernel.org>, <yebin10@huawei.com>
Subject: [PATCH v2 3/7] tracing/probes: support '%pd' type for print struct dentry's name
Date: Mon, 22 Jan 2024 15:40:11 +0800 [thread overview]
Message-ID: <20240122074015.4042575-4-yebin10@huawei.com> (raw)
In-Reply-To: <20240122074015.4042575-1-yebin10@huawei.com>
Similar to '%pd' for printk, use '%pd' for print struct dentry's name.
Signed-off-by: Ye Bin <yebin10@huawei.com>
---
kernel/trace/trace_kprobe.c | 6 ++++++
kernel/trace/trace_probe.h | 1 +
2 files changed, 7 insertions(+)
diff --git a/kernel/trace/trace_kprobe.c b/kernel/trace/trace_kprobe.c
index c4c6e0e0068b..00b74530fbad 100644
--- a/kernel/trace/trace_kprobe.c
+++ b/kernel/trace/trace_kprobe.c
@@ -779,6 +779,7 @@ static int __trace_kprobe_create(int argc, const char *argv[])
char buf[MAX_EVENT_NAME_LEN];
char gbuf[MAX_EVENT_NAME_LEN];
char abuf[MAX_BTF_ARGS_LEN];
+ char dbuf[MAX_DENTRY_ARGS_LEN];
struct traceprobe_parse_context ctx = { .flags = TPARG_FL_KERNEL };
switch (argv[0][0]) {
@@ -930,6 +931,11 @@ static int __trace_kprobe_create(int argc, const char *argv[])
argv = new_argv;
}
+ ret = traceprobe_expand_dentry_args(argc, argv, dbuf,
+ MAX_DENTRY_ARGS_LEN);
+ if (ret)
+ goto out;
+
/* setup a probe */
tk = alloc_trace_kprobe(group, event, addr, symbol, offset, maxactive,
argc, is_return);
diff --git a/kernel/trace/trace_probe.h b/kernel/trace/trace_probe.h
index 553371a4e0b1..d9c053824975 100644
--- a/kernel/trace/trace_probe.h
+++ b/kernel/trace/trace_probe.h
@@ -34,6 +34,7 @@
#define MAX_ARRAY_LEN 64
#define MAX_ARG_NAME_LEN 32
#define MAX_BTF_ARGS_LEN 128
+#define MAX_DENTRY_ARGS_LEN 256
#define MAX_STRING_SIZE PATH_MAX
#define MAX_ARG_BUF_LEN (MAX_TRACE_ARGS * MAX_ARG_NAME_LEN)
--
2.31.1
next prev parent reply other threads:[~2024-01-22 7:38 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-01-22 7:40 [PATCH v2 0/7] support '%pd' and '%pD' for print file name Ye Bin
2024-01-22 7:40 ` [PATCH v2 1/7] string.h: add str_has_suffix() helper for test string ends with specify string Ye Bin
2024-01-22 16:07 ` Steven Rostedt
2024-01-23 2:36 ` yebin (H)
2024-01-22 7:40 ` [PATCH v2 2/7] tracing/probes: add traceprobe_expand_dentry_args() helper Ye Bin
2024-01-22 16:08 ` Steven Rostedt
2024-01-22 7:40 ` Ye Bin [this message]
2024-01-22 7:40 ` [PATCH v2 4/7] tracing/probes: support '%pD' type for print struct file's name Ye Bin
2024-01-22 16:13 ` Steven Rostedt
2024-01-22 7:40 ` [PATCH v2 5/7] tracing: add new type "%pd/%pD" in readme_msg[] Ye Bin
2024-01-22 7:40 ` [PATCH v2 6/7] Documentation: tracing: add new type '%pd' and '%pD' for kprobe Ye Bin
2024-01-22 7:40 ` [PATCH v2 7/7] selftests/ftrace: add test cases for VFS type "%pd" and "%pD" Ye Bin
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=20240122074015.4042575-4-yebin10@huawei.com \
--to=yebin10@huawei.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-trace-kernel@vger.kernel.org \
--cc=mathieu.desnoyers@efficios.com \
--cc=mhiramat@kernel.org \
--cc=rostedt@goodmis.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.