public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Tao Chen <chen.dylane@linux.dev>
To: Alexei Starovoitov <alexei.starovoitov@gmail.com>,
	Jiri Olsa <olsajiri@gmail.com>
Cc: Alexei Starovoitov <ast@kernel.org>,
	Daniel Borkmann <daniel@iogearbox.net>,
	Andrii Nakryiko <andrii@kernel.org>,
	Martin KaFai Lau <martin.lau@linux.dev>,
	Eddy Z <eddyz87@gmail.com>, Song Liu <song@kernel.org>,
	Yonghong Song <yonghong.song@linux.dev>,
	John Fastabend <john.fastabend@gmail.com>,
	KP Singh <kpsingh@kernel.org>,
	Stanislav Fomichev <sdf@fomichev.me>, Hao Luo <haoluo@google.com>,
	Christian Brauner <brauner@kernel.org>, bpf <bpf@vger.kernel.org>,
	LKML <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH bpf-next] bpf: Define bpf_token_show_fdinfo with CONFIG_PROC_FS
Date: Tue, 18 Mar 2025 23:20:06 +0800	[thread overview]
Message-ID: <0e3bd726-f0d8-4e50-832f-5a341486632f@linux.dev> (raw)
In-Reply-To: <CAADnVQLULbENAnJqOVn4m_xmS+T7FvYSFf70mxVSdusgL85m8Q@mail.gmail.com>

在 2025/3/18 22:59, Alexei Starovoitov 写道:
> On Tue, Mar 18, 2025 at 2:29 AM Jiri Olsa <olsajiri@gmail.com> wrote:
>>
>> On Tue, Mar 18, 2025 at 02:25:57PM +0800, Tao Chen wrote:
>>> Protect bpf_token_show_fdinfo with CONFIG_PROC_FS check, follow the
>>> pattern used with other *_show_fdinfo functions.
>>>
>>> Fixes: 35f96de04127 ("bpf: Introduce BPF token object")
>>> Signed-off-by: Tao Chen <chen.dylane@linux.dev>
>>> ---
>>>   kernel/bpf/token.c | 4 ++++
>>>   1 file changed, 4 insertions(+)
>>>
>>> diff --git a/kernel/bpf/token.c b/kernel/bpf/token.c
>>> index 26057aa13..104ca37e9 100644
>>> --- a/kernel/bpf/token.c
>>> +++ b/kernel/bpf/token.c
>>> @@ -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
>>
>> 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
> 
> +1.
> let's keep the code as-is.
> 

Got it, thanks anyway.

> pw-bot: cr


-- 
Best Regards
Tao Chen

  reply	other threads:[~2025-03-18 15:20 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-03-18  6:25 [PATCH bpf-next] bpf: Define bpf_token_show_fdinfo with CONFIG_PROC_FS Tao Chen
2025-03-18  9:28 ` Jiri Olsa
2025-03-18 14:59   ` Alexei Starovoitov
2025-03-18 15:20     ` Tao Chen [this message]
  -- strict thread matches above, loose matches on Subject: below --
2025-03-17 15:51 Tao Chen
2025-03-17 18:01 ` Song Liu
2025-03-18  5:00   ` Tao Chen

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=0e3bd726-f0d8-4e50-832f-5a341486632f@linux.dev \
    --to=chen.dylane@linux.dev \
    --cc=alexei.starovoitov@gmail.com \
    --cc=andrii@kernel.org \
    --cc=ast@kernel.org \
    --cc=bpf@vger.kernel.org \
    --cc=brauner@kernel.org \
    --cc=daniel@iogearbox.net \
    --cc=eddyz87@gmail.com \
    --cc=haoluo@google.com \
    --cc=john.fastabend@gmail.com \
    --cc=kpsingh@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=martin.lau@linux.dev \
    --cc=olsajiri@gmail.com \
    --cc=sdf@fomichev.me \
    --cc=song@kernel.org \
    --cc=yonghong.song@linux.dev \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox