diff mbox series

[v5,4/8] tracing/probes: support '%pd/%pD' type for fprobe

Message ID 20240125073923.2252057-5-yebin10@huawei.com (mailing list archive)
State Superseded
Delegated to: Masami Hiramatsu
Headers show
Series support '%pd' and '%pD' for print file name | expand

Commit Message

yebin (H) Jan. 25, 2024, 7:39 a.m. UTC
Support print type '%pd/%pD' for print dentry's or file's name.

Signed-off-by: Ye Bin <yebin10@huawei.com>
---
 kernel/trace/trace_fprobe.c | 6 ++++++
 1 file changed, 6 insertions(+)

Comments

Masami Hiramatsu (Google) Feb. 7, 2024, 2:31 p.m. UTC | #1
On Thu, 25 Jan 2024 15:39:19 +0800
Ye Bin <yebin10@huawei.com> wrote:

> Support print type '%pd/%pD' for print dentry's or file's name.
> 

nit: Looks good to me. but the patch ordering seems a bit strange.
This should be next to [2/8].

Acked-by: Masami Hiramatsu (Google) <mhiramat@kernel.org>

Thank you,

> Signed-off-by: Ye Bin <yebin10@huawei.com>
> ---
>  kernel/trace/trace_fprobe.c | 6 ++++++
>  1 file changed, 6 insertions(+)
> 
> diff --git a/kernel/trace/trace_fprobe.c b/kernel/trace/trace_fprobe.c
> index 7d2ddbcfa377..988d68e906ad 100644
> --- a/kernel/trace/trace_fprobe.c
> +++ b/kernel/trace/trace_fprobe.c
> @@ -976,6 +976,7 @@ static int __trace_fprobe_create(int argc, const char *argv[])
>  	char gbuf[MAX_EVENT_NAME_LEN];
>  	char sbuf[KSYM_NAME_LEN];
>  	char abuf[MAX_BTF_ARGS_LEN];
> +	char *dbuf = NULL;
>  	bool is_tracepoint = false;
>  	struct tracepoint *tpoint = NULL;
>  	struct traceprobe_parse_context ctx = {
> @@ -1086,6 +1087,10 @@ static int __trace_fprobe_create(int argc, const char *argv[])
>  		argv = new_argv;
>  	}
>  
> +	ret = traceprobe_expand_dentry_args(argc, argv, &dbuf);
> +	if (ret)
> +		goto out;
> +
>  	/* setup a probe */
>  	tf = alloc_trace_fprobe(group, event, symbol, tpoint, maxactive,
>  				argc, is_return);
> @@ -1131,6 +1136,7 @@ static int __trace_fprobe_create(int argc, const char *argv[])
>  	trace_probe_log_clear();
>  	kfree(new_argv);
>  	kfree(symbol);
> +	kfree(dbuf);
>  	return ret;
>  
>  parse_error:
> -- 
> 2.31.1
>
diff mbox series

Patch

diff --git a/kernel/trace/trace_fprobe.c b/kernel/trace/trace_fprobe.c
index 7d2ddbcfa377..988d68e906ad 100644
--- a/kernel/trace/trace_fprobe.c
+++ b/kernel/trace/trace_fprobe.c
@@ -976,6 +976,7 @@  static int __trace_fprobe_create(int argc, const char *argv[])
 	char gbuf[MAX_EVENT_NAME_LEN];
 	char sbuf[KSYM_NAME_LEN];
 	char abuf[MAX_BTF_ARGS_LEN];
+	char *dbuf = NULL;
 	bool is_tracepoint = false;
 	struct tracepoint *tpoint = NULL;
 	struct traceprobe_parse_context ctx = {
@@ -1086,6 +1087,10 @@  static int __trace_fprobe_create(int argc, const char *argv[])
 		argv = new_argv;
 	}
 
+	ret = traceprobe_expand_dentry_args(argc, argv, &dbuf);
+	if (ret)
+		goto out;
+
 	/* setup a probe */
 	tf = alloc_trace_fprobe(group, event, symbol, tpoint, maxactive,
 				argc, is_return);
@@ -1131,6 +1136,7 @@  static int __trace_fprobe_create(int argc, const char *argv[])
 	trace_probe_log_clear();
 	kfree(new_argv);
 	kfree(symbol);
+	kfree(dbuf);
 	return ret;
 
 parse_error: