* [PATCH 0/3] net: make kobj_type structures constant
@ 2023-02-11 3:32 Thomas Weißschuh
2023-02-11 3:32 ` [PATCH 1/3] net: bridge: make kobj_type structure constant Thomas Weißschuh
` (3 more replies)
0 siblings, 4 replies; 5+ messages in thread
From: Thomas Weißschuh @ 2023-02-11 3:32 UTC (permalink / raw)
To: Roopa Prabhu, Nikolay Aleksandrov, David S. Miller, Eric Dumazet,
Jakub Kicinski, Paolo Abeni, Trond Myklebust, Anna Schumaker,
Chuck Lever, Jeff Layton
Cc: bridge, netdev, linux-kernel, linux-nfs, Thomas Weißschuh
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@weissschuh.net>
Signed-off-by: Thomas Weißschuh <linux@weissschuh.net>
---
Thomas Weißschuh (3):
net: bridge: make kobj_type structure constant
net-sysfs: make kobj_type structures constant
SUNRPC: make kobj_type structures constant
net/bridge/br_if.c | 2 +-
net/core/net-sysfs.c | 4 ++--
net/sunrpc/sysfs.c | 8 ++++----
3 files changed, 7 insertions(+), 7 deletions(-)
---
base-commit: 420b2d431d18a2572c8e86579e78105cb5ed45b0
change-id: 20230211-kobj_type-net-99f71346aed2
Best regards,
--
Thomas Weißschuh <linux@weissschuh.net>
^ permalink raw reply [flat|nested] 5+ messages in thread
* [PATCH 1/3] net: bridge: make kobj_type structure constant
2023-02-11 3:32 [PATCH 0/3] net: make kobj_type structures constant Thomas Weißschuh
@ 2023-02-11 3:32 ` Thomas Weißschuh
2023-02-11 3:32 ` [PATCH 2/3] net-sysfs: make kobj_type structures constant Thomas Weißschuh
` (2 subsequent siblings)
3 siblings, 0 replies; 5+ messages in thread
From: Thomas Weißschuh @ 2023-02-11 3:32 UTC (permalink / raw)
To: Roopa Prabhu, Nikolay Aleksandrov, David S. Miller, Eric Dumazet,
Jakub Kicinski, Paolo Abeni, Trond Myklebust, Anna Schumaker,
Chuck Lever, Jeff Layton
Cc: bridge, netdev, linux-kernel, linux-nfs, Thomas Weißschuh
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 definition to prevent
modification at runtime.
Signed-off-by: Thomas Weißschuh <linux@weissschuh.net>
---
net/bridge/br_if.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/net/bridge/br_if.c b/net/bridge/br_if.c
index ad13b48e3e08..24f01ff113f0 100644
--- a/net/bridge/br_if.c
+++ b/net/bridge/br_if.c
@@ -269,7 +269,7 @@ static void brport_get_ownership(const struct kobject *kobj, kuid_t *uid, kgid_t
net_ns_get_ownership(dev_net(p->dev), uid, gid);
}
-static struct kobj_type brport_ktype = {
+static const struct kobj_type brport_ktype = {
#ifdef CONFIG_SYSFS
.sysfs_ops = &brport_sysfs_ops,
#endif
--
2.39.1
^ permalink raw reply related [flat|nested] 5+ messages in thread
* [PATCH 2/3] net-sysfs: make kobj_type structures constant
2023-02-11 3:32 [PATCH 0/3] net: make kobj_type structures constant Thomas Weißschuh
2023-02-11 3:32 ` [PATCH 1/3] net: bridge: make kobj_type structure constant Thomas Weißschuh
@ 2023-02-11 3:32 ` Thomas Weißschuh
2023-02-11 3:32 ` [PATCH 3/3] SUNRPC: " Thomas Weißschuh
2023-02-14 4:11 ` [PATCH 0/3] net: " Jakub Kicinski
3 siblings, 0 replies; 5+ messages in thread
From: Thomas Weißschuh @ 2023-02-11 3:32 UTC (permalink / raw)
To: Roopa Prabhu, Nikolay Aleksandrov, David S. Miller, Eric Dumazet,
Jakub Kicinski, Paolo Abeni, Trond Myklebust, Anna Schumaker,
Chuck Lever, Jeff Layton
Cc: bridge, netdev, linux-kernel, linux-nfs, Thomas Weißschuh
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@weissschuh.net>
---
net/core/net-sysfs.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/net/core/net-sysfs.c b/net/core/net-sysfs.c
index ca55dd747d6c..a3771bba841a 100644
--- a/net/core/net-sysfs.c
+++ b/net/core/net-sysfs.c
@@ -1040,7 +1040,7 @@ static void rx_queue_get_ownership(const struct kobject *kobj,
net_ns_get_ownership(net, uid, gid);
}
-static struct kobj_type rx_queue_ktype __ro_after_init = {
+static const struct kobj_type rx_queue_ktype = {
.sysfs_ops = &rx_queue_sysfs_ops,
.release = rx_queue_release,
.default_groups = rx_queue_default_groups,
@@ -1643,7 +1643,7 @@ static void netdev_queue_get_ownership(const struct kobject *kobj,
net_ns_get_ownership(net, uid, gid);
}
-static struct kobj_type netdev_queue_ktype __ro_after_init = {
+static const struct kobj_type netdev_queue_ktype = {
.sysfs_ops = &netdev_queue_sysfs_ops,
.release = netdev_queue_release,
.default_groups = netdev_queue_default_groups,
--
2.39.1
^ permalink raw reply related [flat|nested] 5+ messages in thread
* [PATCH 3/3] SUNRPC: make kobj_type structures constant
2023-02-11 3:32 [PATCH 0/3] net: make kobj_type structures constant Thomas Weißschuh
2023-02-11 3:32 ` [PATCH 1/3] net: bridge: make kobj_type structure constant Thomas Weißschuh
2023-02-11 3:32 ` [PATCH 2/3] net-sysfs: make kobj_type structures constant Thomas Weißschuh
@ 2023-02-11 3:32 ` Thomas Weißschuh
2023-02-14 4:11 ` [PATCH 0/3] net: " Jakub Kicinski
3 siblings, 0 replies; 5+ messages in thread
From: Thomas Weißschuh @ 2023-02-11 3:32 UTC (permalink / raw)
To: Roopa Prabhu, Nikolay Aleksandrov, David S. Miller, Eric Dumazet,
Jakub Kicinski, Paolo Abeni, Trond Myklebust, Anna Schumaker,
Chuck Lever, Jeff Layton
Cc: bridge, netdev, linux-kernel, linux-nfs, Thomas Weißschuh
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@weissschuh.net>
---
net/sunrpc/sysfs.c | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)
diff --git a/net/sunrpc/sysfs.c b/net/sunrpc/sysfs.c
index 1e05a2d723f4..0d0db4e1064e 100644
--- a/net/sunrpc/sysfs.c
+++ b/net/sunrpc/sysfs.c
@@ -36,7 +36,7 @@ rpc_sysfs_object_child_ns_type(const struct kobject *kobj)
return &net_ns_type_operations;
}
-static struct kobj_type rpc_sysfs_object_type = {
+static const struct kobj_type rpc_sysfs_object_type = {
.release = rpc_sysfs_object_release,
.sysfs_ops = &kobj_sysfs_ops,
.child_ns_type = rpc_sysfs_object_child_ns_type,
@@ -427,20 +427,20 @@ static struct attribute *rpc_sysfs_xprt_switch_attrs[] = {
};
ATTRIBUTE_GROUPS(rpc_sysfs_xprt_switch);
-static struct kobj_type rpc_sysfs_client_type = {
+static const struct kobj_type rpc_sysfs_client_type = {
.release = rpc_sysfs_client_release,
.sysfs_ops = &kobj_sysfs_ops,
.namespace = rpc_sysfs_client_namespace,
};
-static struct kobj_type rpc_sysfs_xprt_switch_type = {
+static const struct kobj_type rpc_sysfs_xprt_switch_type = {
.release = rpc_sysfs_xprt_switch_release,
.default_groups = rpc_sysfs_xprt_switch_groups,
.sysfs_ops = &kobj_sysfs_ops,
.namespace = rpc_sysfs_xprt_switch_namespace,
};
-static struct kobj_type rpc_sysfs_xprt_type = {
+static const struct kobj_type rpc_sysfs_xprt_type = {
.release = rpc_sysfs_xprt_release,
.default_groups = rpc_sysfs_xprt_groups,
.sysfs_ops = &kobj_sysfs_ops,
--
2.39.1
^ permalink raw reply related [flat|nested] 5+ messages in thread
* Re: [PATCH 0/3] net: make kobj_type structures constant
2023-02-11 3:32 [PATCH 0/3] net: make kobj_type structures constant Thomas Weißschuh
` (2 preceding siblings ...)
2023-02-11 3:32 ` [PATCH 3/3] SUNRPC: " Thomas Weißschuh
@ 2023-02-14 4:11 ` Jakub Kicinski
3 siblings, 0 replies; 5+ messages in thread
From: Jakub Kicinski @ 2023-02-14 4:11 UTC (permalink / raw)
To: Thomas Weißschuh
Cc: Roopa Prabhu, Nikolay Aleksandrov, David S. Miller, Eric Dumazet,
Paolo Abeni, Trond Myklebust, Anna Schumaker, Chuck Lever,
Jeff Layton, bridge, netdev, linux-kernel, linux-nfs
On Sat, 11 Feb 2023 03:32:28 +0000 Thomas Weißschuh wrote:
> 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.
Could you resend just the first two with [PATCH net-next] in the
subject? Patch 3 needs to go to a different tree.
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2023-02-14 4:11 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-02-11 3:32 [PATCH 0/3] net: make kobj_type structures constant Thomas Weißschuh
2023-02-11 3:32 ` [PATCH 1/3] net: bridge: make kobj_type structure constant Thomas Weißschuh
2023-02-11 3:32 ` [PATCH 2/3] net-sysfs: make kobj_type structures constant Thomas Weißschuh
2023-02-11 3:32 ` [PATCH 3/3] SUNRPC: " Thomas Weißschuh
2023-02-14 4:11 ` [PATCH 0/3] net: " Jakub Kicinski
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).