Skip to contentSkip to conversation

bpf: Define bpf_token_show_fdinfo with CONFIG_PROC_FS

PATCH In review Tao Chen 2 participants 3 messages Mar 17, 2025 – Mar 18, 2025 BPF

lore
Share & tools
lore

Tao Chen

author
#0 lore raw

PATCH 1/1 bpf: Define bpf_token_show_fdinfo with CONFIG_PROC_FS

Protect bpf_token_show_fdinfo with CONFIG_PROC_FS check, otherwise it will compile error if CONFIG_PROC_FS is not set.

Fixes 35f96de04127 ("bpf: Introduce BPF token object")
---
 kernel/bpf/token.c | 2 ++
 1 file changed, 2 insertions(+)
kernel/bpf/token.c +2 -0
index 26057aa13..4396eefde 100644
@@ -105,7 +105,9 @@ static const struct inode_operations bpf_token_iops = { };
 
 static const struct file_operations bpf_token_fops = {
 	.release	= bpf_token_release,
+#ifdef CONFIG_PROC_FS
 	.show_fdinfo	= bpf_token_show_fdinfo,
+#endif
 };
 
 int bpf_token_create(union bpf_attr *attr)
Signature · 1 line
2.43.0
reviewer
#1 lore raw
Quoted 3 lines · Tao Chen

Protect bpf_token_show_fdinfo with CONFIG_PROC_FS check, otherwise it will compile error if CONFIG_PROC_FS is not set.

On bpt-next/master, I don't see compile error with

CONFIG_BPF_SYSCALL=y
...
# CONFIG_PROC_FS is not set

Are you testing with a different tree/branch?

Thanks,
Song

Quoted 25 lines
Fixes 35f96de04127 ("bpf: Introduce BPF token object")
---
 kernel/bpf/token.c | 2 ++
 1 file changed, 2 insertions(+)
kernel/bpf/token.c +2 -1
index 26057aa13..4396eefde 100644
@@ -105,7 +105,9 @@ static const struct inode_operations bpf_token_iops = { };
 
 static const struct file_operations bpf_token_fops = {
        .release        = bpf_token_release,
+#ifdef CONFIG_PROC_FS
        .show_fdinfo    = bpf_token_show_fdinfo,
+#endif
 };
 
 int bpf_token_create(union bpf_attr *attr)
--

2.43.0

author
#2 lore raw
Quoted 36 lines · Song Liu
Quoted 3 lines · Tao Chen

Protect bpf_token_show_fdinfo with CONFIG_PROC_FS check, otherwise it will compile error if CONFIG_PROC_FS is not set.

On bpt-next/master, I don't see compile error with

CONFIG_BPF_SYSCALL=y
...
# CONFIG_PROC_FS is not set

Are you testing with a different tree/branch?

Thanks,
Song

Quoted 20 lines
Fixes 35f96de04127 ("bpf: Introduce BPF token object")
---
  kernel/bpf/token.c | 2 ++
  1 file changed, 2 insertions(+)
kernel/bpf/token.c +2 -0
index 26057aa13..4396eefde 100644
@@ -105,7 +105,9 @@ static const struct inode_operations bpf_token_iops = { };
 
  static const struct file_operations bpf_token_fops = {
         .release        = bpf_token_release,
+#ifdef CONFIG_PROC_FS
         .show_fdinfo    = bpf_token_show_fdinfo,
+#endif
  };
 
Quoted 5 lines
Quoted 5 lines
kernel/bpf/token.c +0 -1
  int bpf_token_create(union bpf_attr *attr)
--

2.43.0

Hi Song,

I try it, it seems that i had some misunderstandings before about CONFIG_PROC_FS, and the description in the changelog is not quite correct. Please ignore this patch, and i will resend it. Just to follow the pattern used with other *_show_fdinfo functions and only define bpf_token_show_fdinfo when CONFIG_PROC_FS is set. Thank you for your reminder.

Signature · 2 lines
Best Regards
Tao Chen