[PATCH bpf-next] bpf: Define bpf_token_show_fdinfo with CONFIG_PROC_FS

Tao Chen
2025-03-17T15:52:24Z

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")
Signed-off-by: Tao Chen <chen.dylane@linux.dev>
---
kernel/bpf/token.c | 2 ++
1 file changed, 2 insertions(+)

diff --git a/kernel/bpf/token.c b/kernel/bpf/token.c
index 26057aa13..4396eefde 100644
--- a/kernel/bpf/token.c
+++ b/kernel/bpf/token.c
@@ -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