Message ID | 20241202-sysfs-const-bin_attr-admin_wo-v1-1-f489116210bf@weissschuh.net (mailing list archive) |
---|---|
State | New |
Headers | show |
Series | sysfs: introduce and use macro BIN_ATTR_ADMIN_WO() | expand |
On Mon, Dec 02, 2024 at 08:00:36PM +0100, Thomas Weißschuh wrote: > The macros BIN_ATTR_RO/BIN_ATTR_WO/BIN_ATTR_WR and > BIN_ATTR_ADMIN_RO/BIN_ATTR_ADMIN_RW already exist. > To complete the collection also add BIN_ATTR_ADMIN_WO. > > Signed-off-by: Thomas Weißschuh <linux@weissschuh.net> Reviewed-by: Tzung-Bi Shih <tzungbi@kernel.org>
diff --git a/include/linux/sysfs.h b/include/linux/sysfs.h index 0f2fcd244523f050c5286f19d4fe1846506f9214..bcae49105e54a79b7d8a610f17212cb5920c205a 100644 --- a/include/linux/sysfs.h +++ b/include/linux/sysfs.h @@ -385,12 +385,18 @@ struct bin_attribute bin_attr_##_name = __BIN_ATTR_RW(_name, _size) #define __BIN_ATTR_ADMIN_RO(_name, _size) \ __BIN_ATTR(_name, 0400, _name##_read, NULL, _size) +#define __BIN_ATTR_ADMIN_WO(_name, _size) \ + __BIN_ATTR(_name, 0200, NULL, _name##_write, _size) + #define __BIN_ATTR_ADMIN_RW(_name, _size) \ __BIN_ATTR(_name, 0600, _name##_read, _name##_write, _size) #define BIN_ATTR_ADMIN_RO(_name, _size) \ struct bin_attribute bin_attr_##_name = __BIN_ATTR_ADMIN_RO(_name, _size) +#define BIN_ATTR_ADMIN_WO(_name, _size) \ +struct bin_attribute bin_attr_##_name = __BIN_ATTR_ADMIN_WO(_name, _size) + #define BIN_ATTR_ADMIN_RW(_name, _size) \ struct bin_attribute bin_attr_##_name = __BIN_ATTR_ADMIN_RW(_name, _size)
The macros BIN_ATTR_RO/BIN_ATTR_WO/BIN_ATTR_WR and BIN_ATTR_ADMIN_RO/BIN_ATTR_ADMIN_RW already exist. To complete the collection also add BIN_ATTR_ADMIN_WO. Signed-off-by: Thomas Weißschuh <linux@weissschuh.net> --- include/linux/sysfs.h | 6 ++++++ 1 file changed, 6 insertions(+)