[<prev] [next>] [day] [month] [year] [list]
Message-Id: <20230210-kobj_type-nfs-v1-1-5078835dbb42@weissschuh.net>
Date: Fri, 10 Feb 2023 02:17:45 +0000
From: Thomas Weißschuh <linux@...ssschuh.net>
To: Trond Myklebust <trond.myklebust@...merspace.com>,
Anna Schumaker <anna@...nel.org>
Cc: linux-nfs@...r.kernel.org, linux-kernel@...r.kernel.org,
Thomas Weißschuh <linux@...ssschuh.net>
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 <linux@...ssschuh.net>
---
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 <linux@...ssschuh.net>
Powered by blists - more mailing lists