* [PATCH bpf-next] bpf_doc: Support 1st const parameter of bpf_d_path()
@ 2025-10-04 14:23 Rong Tao
2025-10-04 16:16 ` Alexei Starovoitov
2025-10-04 16:20 ` patchwork-bot+netdevbpf
0 siblings, 2 replies; 3+ messages in thread
From: Rong Tao @ 2025-10-04 14:23 UTC (permalink / raw)
To: ast, daniel, andrii, yonghong.song
Cc: rtoax, Rong Tao, Martin KaFai Lau, Eduard Zingerman, Song Liu,
John Fastabend, KP Singh, Stanislav Fomichev, Hao Luo, Jiri Olsa,
Shuah Khan, Jason Xing, Willem de Bruijn, Paul Chaignon, Tao Chen,
Kumar Kartikeya Dwivedi, Martin Kelly, Anton Protopopov,
Matt Bobrowski, Christian Brauner, Jan Kara, Al Viro,
open list:BPF [GENERAL] (Safe Dynamic Programs and Tools),
open list, open list:KERNEL SELFTEST FRAMEWORK
From: Rong Tao <rongtao@cestc.cn>
Since commit 1b8abbb12128 ("bpf...d_path(): constify path argument"),
the first parameter of the bpf_d_path() has been changed to a const
constant. We need to modify the header file and bpf_doc.py.
The two error messages are as follows:
linux/tools/testing/selftests/bpf$ make
CLNG-BPF [test_progs] bpf_iter_task_vmas.bpf.o
progs/bpf_iter_task_vmas.c:52:14: error: passing 'const struct path *'
to parameter of type 'struct path *' discards qualifiers
[-Werror,-Wincompatible-pointer-types-discards-qualifiers]
52 | bpf_d_path(&file->f_path, d_path_buf, D_PATH_BUF_SIZE);
| ^~~~~~~~~~~~~
1 error generated.
....
progs/verifier_vfs_accept.c:80:7: error: assigning to 'struct path *'
from 'const struct path *' discards qualifiers
[-Werror,-Wincompatible-pointer-types-discards-qualifiers]
80 | path = &file->f_path;
| ^ ~~~~~~~~~~~~~
1 error generated.
Fixes: 1b8abbb12128 ("bpf...d_path(): constify path argument")
Signed-off-by: Rong Tao <rongtao@cestc.cn>
---
include/uapi/linux/bpf.h | 2 +-
scripts/bpf_doc.py | 1 +
tools/include/uapi/linux/bpf.h | 2 +-
tools/testing/selftests/bpf/progs/verifier_vfs_accept.c | 2 +-
4 files changed, 4 insertions(+), 3 deletions(-)
diff --git a/include/uapi/linux/bpf.h b/include/uapi/linux/bpf.h
index ae83d8649ef1..6829936d33f5 100644
--- a/include/uapi/linux/bpf.h
+++ b/include/uapi/linux/bpf.h
@@ -4891,7 +4891,7 @@ union bpf_attr {
*
* **-ENOENT** if the bpf_local_storage cannot be found.
*
- * long bpf_d_path(struct path *path, char *buf, u32 sz)
+ * long bpf_d_path(const struct path *path, char *buf, u32 sz)
* Description
* Return full path for given **struct path** object, which
* needs to be the kernel BTF *path* object. The path is
diff --git a/scripts/bpf_doc.py b/scripts/bpf_doc.py
index c77dc40f7689..15d113a1bc1d 100755
--- a/scripts/bpf_doc.py
+++ b/scripts/bpf_doc.py
@@ -788,6 +788,7 @@ class PrinterHelpersHeader(Printer):
'struct task_struct',
'struct cgroup',
'struct path',
+ 'const struct path',
'struct btf_ptr',
'struct inode',
'struct socket',
diff --git a/tools/include/uapi/linux/bpf.h b/tools/include/uapi/linux/bpf.h
index ae83d8649ef1..6829936d33f5 100644
--- a/tools/include/uapi/linux/bpf.h
+++ b/tools/include/uapi/linux/bpf.h
@@ -4891,7 +4891,7 @@ union bpf_attr {
*
* **-ENOENT** if the bpf_local_storage cannot be found.
*
- * long bpf_d_path(struct path *path, char *buf, u32 sz)
+ * long bpf_d_path(const struct path *path, char *buf, u32 sz)
* Description
* Return full path for given **struct path** object, which
* needs to be the kernel BTF *path* object. The path is
diff --git a/tools/testing/selftests/bpf/progs/verifier_vfs_accept.c b/tools/testing/selftests/bpf/progs/verifier_vfs_accept.c
index 3e2d76ee8050..55398c04290a 100644
--- a/tools/testing/selftests/bpf/progs/verifier_vfs_accept.c
+++ b/tools/testing/selftests/bpf/progs/verifier_vfs_accept.c
@@ -70,7 +70,7 @@ __success
int BPF_PROG(path_d_path_from_file_argument, struct file *file)
{
int ret;
- struct path *path;
+ const struct path *path;
/* The f_path member is a path which is embedded directly within a
* file. Therefore, a pointer to such embedded members are still
--
2.51.0
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH bpf-next] bpf_doc: Support 1st const parameter of bpf_d_path()
2025-10-04 14:23 [PATCH bpf-next] bpf_doc: Support 1st const parameter of bpf_d_path() Rong Tao
@ 2025-10-04 16:16 ` Alexei Starovoitov
2025-10-04 16:20 ` patchwork-bot+netdevbpf
1 sibling, 0 replies; 3+ messages in thread
From: Alexei Starovoitov @ 2025-10-04 16:16 UTC (permalink / raw)
To: Rong Tao
Cc: Alexei Starovoitov, Daniel Borkmann, Andrii Nakryiko,
Yonghong Song, Rong Tao, Martin KaFai Lau, Eduard Zingerman,
Song Liu, John Fastabend, KP Singh, Stanislav Fomichev, Hao Luo,
Jiri Olsa, Shuah Khan, Jason Xing, Willem de Bruijn,
Paul Chaignon, Tao Chen, Kumar Kartikeya Dwivedi, Martin Kelly,
Anton Protopopov, Matt Bobrowski, Christian Brauner, Jan Kara,
Al Viro,
open list:BPF [GENERAL] (Safe Dynamic Programs and Tools),
open list, open list:KERNEL SELFTEST FRAMEWORK
On Sat, Oct 4, 2025 at 7:24 AM Rong Tao <rtoax@foxmail.com> wrote:
>
> From: Rong Tao <rongtao@cestc.cn>
>
> Since commit 1b8abbb12128 ("bpf...d_path(): constify path argument"),
> the first parameter of the bpf_d_path() has been changed to a const
> constant. We need to modify the header file and bpf_doc.py.
...
> Fixes: 1b8abbb12128 ("bpf...d_path(): constify path argument")
> Signed-off-by: Rong Tao <rongtao@cestc.cn>
Thanks. I reworded the commit message and applied it to the bpf tree.
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH bpf-next] bpf_doc: Support 1st const parameter of bpf_d_path()
2025-10-04 14:23 [PATCH bpf-next] bpf_doc: Support 1st const parameter of bpf_d_path() Rong Tao
2025-10-04 16:16 ` Alexei Starovoitov
@ 2025-10-04 16:20 ` patchwork-bot+netdevbpf
1 sibling, 0 replies; 3+ messages in thread
From: patchwork-bot+netdevbpf @ 2025-10-04 16:20 UTC (permalink / raw)
To: Rong Tao
Cc: ast, daniel, andrii, yonghong.song, rongtao, martin.lau, eddyz87,
song, john.fastabend, kpsingh, sdf, haoluo, jolsa, shuah,
kerneljasonxing, willemb, paul.chaignon, chen.dylane, memxor,
martin.kelly, a.s.protopopov, mattbobrowski, brauner, jack, viro,
bpf, linux-kernel, linux-kselftest
Hello:
This patch was applied to bpf/bpf.git (master)
by Alexei Starovoitov <ast@kernel.org>:
On Sat, 4 Oct 2025 22:23:29 +0800 you wrote:
> From: Rong Tao <rongtao@cestc.cn>
>
> Since commit 1b8abbb12128 ("bpf...d_path(): constify path argument"),
> the first parameter of the bpf_d_path() has been changed to a const
> constant. We need to modify the header file and bpf_doc.py.
>
> The two error messages are as follows:
>
> [...]
Here is the summary with links:
- [bpf-next] bpf_doc: Support 1st const parameter of bpf_d_path()
https://git.kernel.org/bpf/bpf/c/de7342228b73
You are awesome, thank you!
--
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2025-10-04 16:20 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-10-04 14:23 [PATCH bpf-next] bpf_doc: Support 1st const parameter of bpf_d_path() Rong Tao
2025-10-04 16:16 ` Alexei Starovoitov
2025-10-04 16:20 ` patchwork-bot+netdevbpf
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox