bpf: Define bpf_token_show_fdinfo with CONFIG_PROC_FS
PATCH 1/1 bpf: Define bpf_token_show_fdinfo with CONFIG_PROC_FS
Protect bpf_token_show_fdinfo with CONFIG_PROC_FS check, follow the pattern used with other *_show_fdinfo functions.
--- kernel/bpf/token.c | 4 ++++ 1 file changed, 4 insertions(+)
kernel/bpf/token.c +4 -0
@@ -65,6 +65,7 @@ static int bpf_token_release(struct inode *inode, struct file *filp)return 0 ; } +#ifdef CONFIG_PROC_FS static void bpf_token_show_fdinfo (struct seq_file *m,struct file *filp) {struct bpf_token *token = filp->private_data;
@@ -98,6 +99,7 @@ static void bpf_token_show_fdinfo(struct seq_file *m, struct file *filp) else seq_printf(m, "allowed_attachs:\t0x%llx\n", token->allowed_attachs); } +#endif #define BPF_TOKEN_INODE_NAME "bpf-token"
@@ -105,7 +107,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
Quoted 30 lines · Tao Chen
Protect
bpf_token_show_fdinfowithCONFIG_PROC_FScheck, follow the pattern used with other*_show_fdinfofunctions.Fixes 35f96de04127 ("bpf: Introduce BPF token object")Signed-off-by Tao Chen <[email protected]>--- kernel/bpf/token.c | 4 ++++ 1 file changed, 4 insertions(+)kernel/bpf/token.c +2
-0@@ -65,6 +65,7 @@ static int bpf_token_release(struct inode *inode, struct file *filp)return 0 ; } +#ifdef CONFIG_PROC_FS static void bpf_token_show_fdinfo (struct seq_file *m,struct file *filp) {struct bpf_token *token = filp->private_data;@@ -98,6 +99,7 @@ static void bpf_token_show_fdinfo(struct seq_file *m, struct file *filp) else seq_printf(m, "allowed_attachs:\t0x%llx\n", token->allowed_attachs); } +#endif #define BPF_TOKEN_INODE_NAME "bpf-token"
kernel/bpf/token.c static const struct inode_operations bpf_token_iops = { }; · line 112
Quoted 6 lines
kernel/bpf/token.c +2
-0@@ -105,7 +107,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
there's many more of such cases.. I'm not sure if it makes sense to fix that, because it does not break the build and only save space for !CONFIG_PROC_FS kernels
jirka
Quoted 6 lines
kernel/bpf/token.c +0
-0};int bpf_token_create (union bpf_attr *attr)Signature · 1 line
2.43.0
Quoted 33 lines · Jiri Olsa
Quoted 31 lines · Tao Chen
Protect
bpf_token_show_fdinfowithCONFIG_PROC_FScheck, follow the pattern used with other*_show_fdinfofunctions.Fixes 35f96de04127 ("bpf: Introduce BPF token object")Signed-off-by Tao Chen <[email protected]>--- kernel/bpf/token.c | 4 ++++ 1 file changed, 4 insertions(+)kernel/bpf/token.c +2
-0@@ -65,6 +65,7 @@ static int bpf_token_release(struct inode *inode, struct file *filp)return 0 ; } +#ifdef CONFIG_PROC_FS static void bpf_token_show_fdinfo (struct seq_file *m,struct file *filp) {struct bpf_token *token = filp->private_data;@@ -98,6 +99,7 @@ static void bpf_token_show_fdinfo(struct seq_file *m, struct file *filp) else seq_printf(m, "allowed_attachs:\t0x%llx\n", token->allowed_attachs); } +#endif #define BPF_TOKEN_INODE_NAME "bpf-token"@@ -105,7 +107,9 @@ static const struct inode_operations bpf_token_iops = { };
Quoted 9 lines
kernel/bpf/token.c static const struct inode_operations bpf_token_iops = { }; · line 112
Quoted 5 lines
kernel/bpf/token.c +2
-0static const struct file_operations bpf_token_fops = { .release = bpf_token_release, +#ifdef CONFIG_PROC_FS .show_fdinfo = bpf_token_show_fdinfo, +#endifthere's many more of such cases.. I'm not sure if it makes sense to fix that, because it does not break the build and only save space for !CONFIG_PROC_FS kernels
+1.
let's keep the code as-is.
pw-bot: cr
Quoted 44 lines · Alexei Starovoitov
Quoted 33 lines · Jiri Olsa
Quoted 31 lines · Tao Chen
Protect
bpf_token_show_fdinfowithCONFIG_PROC_FScheck, follow the pattern used with other*_show_fdinfofunctions.Fixes 35f96de04127 ("bpf: Introduce BPF token object")Signed-off-by Tao Chen <[email protected]>--- kernel/bpf/token.c | 4 ++++ 1 file changed, 4 insertions(+)kernel/bpf/token.c +2
-0@@ -65,6 +65,7 @@ static int bpf_token_release(struct inode *inode, struct file *filp)return 0 ; } +#ifdef CONFIG_PROC_FS static void bpf_token_show_fdinfo (struct seq_file *m,struct file *filp) {struct bpf_token *token = filp->private_data;@@ -98,6 +99,7 @@ static void bpf_token_show_fdinfo(struct seq_file *m, struct file *filp) else seq_printf(m, "allowed_attachs:\t0x%llx\n", token->allowed_attachs); } +#endif #define BPF_TOKEN_INODE_NAME "bpf-token"@@ -105,7 +107,9 @@ static const struct inode_operations bpf_token_iops = { };Quoted 9 lines
kernel/bpf/token.c static const struct inode_operations bpf_token_iops = { }; · line 112
Quoted 5 lines
kernel/bpf/token.c +2
-0static const struct file_operations bpf_token_fops = { .release = bpf_token_release, +#ifdef CONFIG_PROC_FS .show_fdinfo = bpf_token_show_fdinfo, +#endifthere's many more of such cases.. I'm not sure if it makes sense to fix that, because it does not break the build and only save space for !CONFIG_PROC_FS kernels
Quoted 3 lines
+1.
let's keep the code as-is.
Got it, thanks anyway.
Quoted 1 line
pw-bot: cr
Signature · 2 lines
Best Regards Tao Chen