Skip to content

sysfs: prepare the constification of struct attribute

Thomas Weißschuh lkml 6 versions – In review

Get series with b4
b4 am [email protected] change-id 20250114-sysfs-const-attr-prep-e9414982dc4f

Versions newest first

  1. v5 Latest7 patches 1 replyIn review
  2. v47 patches 0 repliesSuperseded
  3. v37 patches 10 repliesSuperseded
Earlier versions · 3
VersionPostedPatchesRepliesStatus
v2 posting 2/27 patches0 repliesSuperseded
v2 posting 1/27 patches0 repliesSuperseded
v16 patches3 repliesSuperseded

Changes in v5 from the cover letter

- Use the new CONFIG_CFI over the old CONFIG_CFI_CLANG
- Link to v4: https://lore.kernel.org/r/[email protected]

Patches in v5 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/7sysfs: attribute_group: allow registration of const attributeinclude/linux/sysfs.h+4 -10 replies
2/7sysfs: transparently handle const pointers in ATTRIBUTE_GROUPS()include/linux/sysfs.h+6 -10 replies
3/7sysfs: introduce __SYSFS_FUNCTION_ALTERNATIVE()include/linux/sysfs.h+6 -00 replies
4/7sysfs: attribute_group: enable const variants of is_visible()fs/sysfs/group.c include/linux/sysfs.h+14 -40 replies
5/7samples/kobject: add is_visible() callback to attribute groupsamples/kobject/kset-example.c+16 -10 replies
6/7samples/kobject: constify 'struct foo_attribute'samples/kobject/kset-example.c+17 -160 replies
7/7sysfs: simplify attribute definition macrosinclude/linux/sysfs.h+7 -150 replies

Reviews trailers per patch

No Reviewed-by, Acked-by or Tested-by trailers for v5 yet.

Read the v5 thread

Cover letter [PATCH v5 0/7] sysfs: prepare the constification of struct attribute

The migration of 'struct attribute' and its related structures and macros are more complicated than those for 'struct bin_attribute'. Mostly because they are all shared by various custom attribute types. Introduce some initial utilities to support the migration. These are enough to migrate some specialized attributes atomically or those which don't use 'struct attribute' in their callbacks stepwise.

The big outstanding problems are 'struct device_attribute' and 'struct kobj_attribute'. These are used everywhere and I'm not yet sure about a migration plan.

---
Changes in v5:
- Use the new CONFIG_CFI over the old CONFIG_CFI_CLANG
- Link to v4: https://lore.kernel.org/r/[email protected]

Changes in v4:
- Rebase onto v6.18-rc1
- Rename _new -> _const
- Link to v3: https://lore.kernel.org/r/[email protected]

Changes in v3:
- Rebase von v6.17-rc1
- Link to v2: https://lore.kernel.org/r/[email protected]

Changes in v2:
- Rebase onto driver-core-next
- Simplify attribute macro definitions
- +Cc Danilo
- Link to v1: https://lore.kernel.org/r/[email protected]

---
Thomas Weißschuh (7):
sysfs: attribute_group: allow registration of const attribute
sysfs: transparently handle const pointers in ATTRIBUTE_GROUPS()
sysfs: introduce __SYSFS_FUNCTION_ALTERNATIVE()
sysfs: attribute_group: enable const variants of is_visible() samples/kobject: add is_visible() callback to attribute group samples/kobject: constify 'struct foo_attribute'
sysfs: simplify attribute definition macros

 fs/sysfs/group.c               | 10 +++++++--
 include/linux/sysfs.h          | 48 +++++++++++++++++++++++++-----------------
 samples/kobject/kset-example.c | 44 ++++++++++++++++++++++++++------------
 3 files changed, 67 insertions(+), 35 deletions(-)

---
base-commit: 3a8660878839faadb4f1a6dd72c3179c1df56787
change-id: 20250114-sysfs-const-attr-prep-e9414982dc4f

Best regards,

Signature · 1 line
Thomas Weißschuh <[email protected]>