mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: "Thomas Weißschuh" <linux@weissschuh.net>
To: Masahiro Yamada <masahiroy@kernel.org>
Cc: "Joel Fernandes (Google)" <joel@joelfernandes.org>,
	 Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
	Kees Cook <kees@kernel.org>,
	linux-kernel@vger.kernel.org
Subject: Re: [PATCH v2] kheaders: Simplify attribute through __BIN_ATTR_SIMPLE_RO()
Date: Sat, 28 Dec 2024 15:56:53 +0100	[thread overview]
Message-ID: <da38fbce-19e8-45e6-bbcf-3ae403e949f3@t-8ch.de> (raw)
In-Reply-To: <CAK7LNARwEsSLK_Pz62CiQ+A2bU5vbDdbA6O3yWEjEdiDmLxhTQ@mail.gmail.com>

Hi Masahiro,

On 2024-12-28 23:52:13+0900, Masahiro Yamada wrote:
> On Sat, Dec 21, 2024 at 11:09 PM Thomas Weißschuh <linux@weissschuh.net> wrote:
> >
> > The utility macro from the sysfs core is sufficient to implement this
> > attribute. Make use of it.
> >
> > Signed-off-by: Thomas Weißschuh <linux@weissschuh.net>
> 
> 
> Applied to linux-kbuild. Thanks.

Thanks, but FYI it is also already applied to the driver-core tree.
Unfortunately Greg's confirmation mails don't go to the list.

IMO having an explicit maintainer for this file could avoid this issue
in the future.

> > ---
> > Changes in v2:
> > - Use __BIN_ATTR_SIMPLE_RO() (Thanks Masahiro)
> > - Link to v1: https://lore.kernel.org/r/20241215-sysfs-const-bin_attr-kheaders-v1-1-319bbd50e224@weissschuh.net
> > ---
> > __BIN_ATTR() is used over the normal struct initializer because it is
> > shorter and can also handle the transition to const struct bin_attr
> > callbacks.
> > If you prefer, I can switch that back, but it will introduce a trivial
> > conflict with [0].
> >
> > Note: There is no formal maintainer for that source file.
> >
> > [0] https://lore.kernel.org/lkml/20241205-sysfs-const-bin_attr-simple-v1-0-4a4e4ced71e3@weissschuh.net/
> > ---
> >  kernel/kheaders.c | 19 +++----------------
> >  1 file changed, 3 insertions(+), 16 deletions(-)
> >
> > diff --git a/kernel/kheaders.c b/kernel/kheaders.c
> > index 42163c9e94e557c5043e2ac7987b567f23087ee2..378088b07f46d643736c04b9075f631e0dc2a53d 100644
> > --- a/kernel/kheaders.c
> > +++ b/kernel/kheaders.c
> > @@ -29,25 +29,12 @@ asm (
> >  extern char kernel_headers_data[];
> >  extern char kernel_headers_data_end[];
> >
> > -static ssize_t
> > -ikheaders_read(struct file *file,  struct kobject *kobj,
> > -              struct bin_attribute *bin_attr,
> > -              char *buf, loff_t off, size_t len)
> > -{
> > -       memcpy(buf, &kernel_headers_data[off], len);
> > -       return len;
> > -}
> > -
> > -static struct bin_attribute kheaders_attr __ro_after_init = {
> > -       .attr = {
> > -               .name = "kheaders.tar.xz",
> > -               .mode = 0444,
> > -       },
> > -       .read = &ikheaders_read,
> > -};
> > +static struct bin_attribute kheaders_attr __ro_after_init =
> > +       __BIN_ATTR_SIMPLE_RO(kheaders.tar.xz, 0444);
> >
> >  static int __init ikheaders_init(void)
> >  {
> > +       kheaders_attr.private = kernel_headers_data;
> >         kheaders_attr.size = (kernel_headers_data_end -
> >                               kernel_headers_data);
> >         return sysfs_create_bin_file(kernel_kobj, &kheaders_attr);
> >
> > ---
> > base-commit: 499551201b5f4fd3c0618a3e95e3d0d15ea18f31
> > change-id: 20241215-sysfs-const-bin_attr-kheaders-440887f23892
> >
> > Best regards,
> > --
> > Thomas Weißschuh <linux@weissschuh.net>
> >
> 
> 
> -- 
> Best Regards
> Masahiro Yamada

  reply	other threads:[~2024-12-28 14:57 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-12-21 14:09 Thomas Weißschuh
2024-12-28 14:52 ` Masahiro Yamada
2024-12-28 14:56   ` Thomas Weißschuh [this message]
2024-12-28 14:58     ` Masahiro Yamada

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=da38fbce-19e8-45e6-bbcf-3ae403e949f3@t-8ch.de \
    --to=linux@weissschuh.net \
    --cc=gregkh@linuxfoundation.org \
    --cc=joel@joelfernandes.org \
    --cc=kees@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=masahiroy@kernel.org \
    /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

all inboxes | Powered by JetHome®