]> www.infradead.org Git - users/jedix/linux-maple.git/commitdiff
bpf: Finish constification of 1st parameter of bpf_d_path()
authorRong Tao <rongtao@cestc.cn>
Sat, 4 Oct 2025 14:23:29 +0000 (22:23 +0800)
committerAlexei Starovoitov <ast@kernel.org>
Sat, 4 Oct 2025 16:05:23 +0000 (09:05 -0700)
The commit 1b8abbb12128 ("bpf...d_path(): constify path argument")
constified the first parameter of the bpf_d_path(), but failed to
update it in all places. Finish constification.

Otherwise the selftest fail to build:
.../selftests/bpf/bpf_experimental.h:222:12: error: conflicting types for 'bpf_path_d_path'
  222 | extern int bpf_path_d_path(const struct path *path, char *buf, size_t buf__sz) __ksym;
      |            ^
.../selftests/bpf/tools/include/vmlinux.h:153922:12: note: previous declaration is here
 153922 | extern int bpf_path_d_path(struct path *path, char *buf, size_t buf__sz) __weak __ksym;

Fixes: 1b8abbb12128 ("bpf...d_path(): constify path argument")
Signed-off-by: Rong Tao <rongtao@cestc.cn>
Signed-off-by: Alexei Starovoitov <ast@kernel.org>
include/uapi/linux/bpf.h
scripts/bpf_doc.py
tools/include/uapi/linux/bpf.h
tools/testing/selftests/bpf/progs/verifier_vfs_accept.c

index ae83d8649ef1cd0dd85c84438fbdb7e2b65e64aa..6829936d33f58e0b6ef4d65b6f66e59210434d3e 100644 (file)
@@ -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
index c77dc40f7689eaf85987714a48ac67f159c54361..15d113a1bc1d1059ee057ba2350a4f5d46901aa7 100755 (executable)
@@ -788,6 +788,7 @@ class PrinterHelpersHeader(Printer):
             'struct task_struct',
             'struct cgroup',
             'struct path',
+            'const struct path',
             'struct btf_ptr',
             'struct inode',
             'struct socket',
index ae83d8649ef1cd0dd85c84438fbdb7e2b65e64aa..6829936d33f58e0b6ef4d65b6f66e59210434d3e 100644 (file)
@@ -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
index 3e2d76ee8050f7ce95758c71d429988e21b663fd..55398c04290a8c974f8a398ce9e81010f1653cdf 100644 (file)
@@ -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