2023-02-10 02:17:57

by Thomas Weißschuh

[permalink] [raw]
Subject: [PATCH] NFS: make kobj_type structures constant

Since commit ee6d3dd4ed48 ("driver core: make kobj_type constant.")
the driver core allows the usage of const struct kobj_type.

Take advantage of this to constify the structure definitions to prevent
modification at runtime.

Signed-off-by: Thomas Weißschuh <[email protected]>
---
fs/nfs/sysfs.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/fs/nfs/sysfs.c b/fs/nfs/sysfs.c
index 0cbcd2dfa732..791eaf42a8a1 100644
--- a/fs/nfs/sysfs.c
+++ b/fs/nfs/sysfs.c
@@ -31,7 +31,7 @@ static const struct kobj_ns_type_operations *nfs_netns_object_child_ns_type(
return &net_ns_type_operations;
}

-static struct kobj_type nfs_netns_object_type = {
+static const struct kobj_type nfs_netns_object_type = {
.release = nfs_netns_object_release,
.sysfs_ops = &kobj_sysfs_ops,
.child_ns_type = nfs_netns_object_child_ns_type,
@@ -144,7 +144,7 @@ static struct attribute *nfs_netns_client_attrs[] = {
};
ATTRIBUTE_GROUPS(nfs_netns_client);

-static struct kobj_type nfs_netns_client_type = {
+static const struct kobj_type nfs_netns_client_type = {
.release = nfs_netns_client_release,
.default_groups = nfs_netns_client_groups,
.sysfs_ops = &kobj_sysfs_ops,

---
base-commit: e544a07438522ab3688416e6e2e34bf0ee6d8755
change-id: 20230210-kobj_type-nfs-15c077fc25f2

Best regards,
--
Thomas Weißschuh <[email protected]>