Skip to content

Comments

module: sysfs: Two cleanups and preparation for const struct bin_attribute#43

Closed
modules-kpd-app[bot] wants to merge 9 commits intomodules-next_basefrom
series/918334=>modules-next
Closed

module: sysfs: Two cleanups and preparation for const struct bin_attribute#43
modules-kpd-app[bot] wants to merge 9 commits intomodules-next_basefrom
series/918334=>modules-next

Conversation

@modules-kpd-app
Copy link

Pull request for series with
subject: module: sysfs: Two cleanups and preparation for const struct bin_attribute
version: 1
url: https://patchwork.kernel.org/project/linux-modules/list/?series=918334

@modules-kpd-app
Copy link
Author

Upstream branch: f3fda0d
series: https://patchwork.kernel.org/project/linux-modules/list/?series=918334
version: 1

Uwe Kleine-König and others added 5 commits December 31, 2024 14:27
Instead of repeating the add_taint_module() call for each offender, create
an array and loop over that one. This simplifies adding new entries
considerably.

Signed-off-by: Uwe Kleine-König <ukleinek@kernel.org>
Reviewed-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Reviewed-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Werner Sembach <wse@tuxedocomputers.com>
Link: https://lore.kernel.org/r/20241115185253.1299264-2-wse@tuxedocomputers.com
[ppavlu: make the array const]
Signed-off-by: Petr Pavlu <petr.pavlu@suse.com>
The 'struct module_attribute' sysfs callbacks are about to change to
receive a 'const struct module_attribute *' parameter.
Prepare for that by avoid casting away the constness through
container_of() and using const pointers to 'struct param_attribute'.

Signed-off-by: Thomas Weißschuh <linux@weissschuh.net>
Reviewed-by: Petr Pavlu <petr.pavlu@suse.com>
Link: https://lore.kernel.org/r/20241216-sysfs-const-attr-module-v1-1-3790b53e0abf@weissschuh.net
Signed-off-by: Petr Pavlu <petr.pavlu@suse.com>
The structure is always read-only due to its placement in the read-only
section __modver. Reflect this at its usage sites.
Also prepare for the const handling of 'struct module_attribute' itself.

Signed-off-by: Thomas Weißschuh <linux@weissschuh.net>
Reviewed-by: Petr Pavlu <petr.pavlu@suse.com>
Link: https://lore.kernel.org/r/20241216-sysfs-const-attr-module-v1-2-3790b53e0abf@weissschuh.net
Signed-off-by: Petr Pavlu <petr.pavlu@suse.com>
These structs are never modified, move them to read-only memory.
This makes the API clearer and also prepares for the constification of
'struct attribute' itself.

While at it, also constify 'modinfo_attrs_count'.

Signed-off-by: Thomas Weißschuh <linux@weissschuh.net>
Reviewed-by: Petr Pavlu <petr.pavlu@suse.com>
Link: https://lore.kernel.org/r/20241216-sysfs-const-attr-module-v1-3-3790b53e0abf@weissschuh.net
Signed-off-by: Petr Pavlu <petr.pavlu@suse.com>
@modules-kpd-app
Copy link
Author

Upstream branch: 8a231a1
series: https://patchwork.kernel.org/project/linux-modules/list/?series=918334
version: 1

t-8ch added 4 commits January 2, 2025 14:05
The member is only used to iterate over all attributes in
free_sect_attrs(). However the attribute group can already be used for
that. Use the group and drop 'nsections'.

Signed-off-by: Thomas Weißschuh <linux@weissschuh.net>
The existing allocation logic manually stuffs two allocations into one.
This is hard to understand and of limited value, given that all the
section names are allocated on their own anyways.
Une one allocation per datastructure.

Signed-off-by: Thomas Weißschuh <linux@weissschuh.net>
A kobject is meant to manage the lifecycle of some resource.
However the module sysfs code only creates a kobject to get a
"notes" subdirectory in sysfs.
This can be achieved easier and cheaper by using a sysfs group.
Switch the notes attribute code to such a group, similar to how the
section allocation in the same file already works.

Signed-off-by: Thomas Weißschuh <linux@weissschuh.net>
The sysfs core is switching to 'const struct bin_attribute's.
Prepare for that.

Signed-off-by: Thomas Weißschuh <linux@weissschuh.net>
@modules-kpd-app modules-kpd-app bot force-pushed the series/918334=>modules-next branch from 4f07e08 to e1df569 Compare January 2, 2025 14:05
@modules-kpd-app
Copy link
Author

At least one diff in series https://patchwork.kernel.org/project/linux-modules/list/?series=918334 irrelevant now. Closing PR.

@modules-kpd-app modules-kpd-app bot removed the new label Jan 15, 2025
@modules-kpd-app modules-kpd-app bot closed this Jan 15, 2025
@modules-kpd-app modules-kpd-app bot deleted the series/918334=>modules-next branch January 15, 2025 19:56
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants