lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <YBEbRDOQhczI5/yC@kroah.com>
Date:   Wed, 27 Jan 2021 08:50:28 +0100
From:   Greg Kroah-Hartman <gregkh@...uxfoundation.org>
To:     Orson Zhai <orsonzhai@...il.com>
Cc:     Jonathan Corbet <corbet@....net>,
        Mauro Carvalho Chehab <mchehab+huawei@...nel.org>,
        Joe Perches <joe@...ches.com>,
        Denis Efremov <efremov@...ux.com>,
        "David S. Miller" <davem@...emloft.net>,
        Christian Brauner <christian.brauner@...ntu.com>,
        Dan Williams <dan.j.williams@...el.com>,
        Sourabh Jain <sourabhjain@...ux.ibm.com>,
        Orson Zhai <orson.zhai@...soc.com>, linux-doc@...r.kernel.org,
        linux-kernel@...r.kernel.org
Subject: Re: [PATCH] include: sysfs: Add macro to assign show for RO
 attributes

On Wed, Jan 27, 2021 at 12:19:22PM +0800, Orson Zhai wrote:
> In some circumstances, multiple __ATTR_RO attributes need to be assigned
> with a single show function.
> 
> Add this macro to make life easier with simple code.
> 
> Signed-off-by: Orson Zhai <orsonzhai@...il.com>
> ---
>  Documentation/filesystems/sysfs.rst | 2 ++
>  include/linux/sysfs.h               | 5 +++++
>  2 files changed, 7 insertions(+)
> 
> diff --git a/Documentation/filesystems/sysfs.rst b/Documentation/filesystems/sysfs.rst
> index 004d490..0e2274a 100644
> --- a/Documentation/filesystems/sysfs.rst
> +++ b/Documentation/filesystems/sysfs.rst
> @@ -141,6 +141,8 @@ __ATTR_RO_MODE(name, mode):
>  	         fore more restrictive RO access currently
>                   only use case is the EFI System Resource Table
>                   (see drivers/firmware/efi/esrt.c)
> +__ATTR_RO_SHOW(name, show):
> +		 assumes default mode 0444 with specified show.
>  __ATTR_RW(name):
>  	         assumes default name_show, name_store and setting
>                   mode to 0644.
> diff --git a/include/linux/sysfs.h b/include/linux/sysfs.h
> index 2caa34c..c851592 100644
> --- a/include/linux/sysfs.h
> +++ b/include/linux/sysfs.h
> @@ -117,6 +117,11 @@ struct attribute_group {
>  	.show	= _name##_show,						\
>  }
>  
> +#define __ATTR_RO_SHOW(_name, _show) {					\
> +	.attr	= { .name = __stringify(_name), .mode = 0444 },		\
> +	.show	= _show,						\
> +}

Do you have a real user for this?  Using "raw" kobject attributes is
rare and should not be used often, so who needs this?

thanks,

greg k-h

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ