Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

ocfs2: constify struct configfs_item_operations and configfs_group_operations

'struct configfs_item_operations' and 'configfs_group_operations' are not
modified in this driver.

Constifying these structures moves some data to a read-only section, so
increases overall security, especially when the structure holds some
function pointers.

On a x86_64, with allmodconfig, as an example:
Before:
======
text data bss dec hex filename
74011 19312 5280 98603 1812b fs/ocfs2/cluster/heartbeat.o

After:
=====
text data bss dec hex filename
74171 19152 5280 98603 1812b fs/ocfs2/cluster/heartbeat.o

Link: https://lkml.kernel.org/r/7c7c00ba328e5e514d8debee698154039e9640dd.1765708880.git.christophe.jaillet@wanadoo.fr
Signed-off-by: Christophe JAILLET <christophe.jaillet@wanadoo.fr>
Acked-by: Joseph Qi <joseph.qi@linux.alibaba.com>
Cc: Mark Fasheh <mark@fasheh.com>
Cc: Joel Becker <jlbec@evilplan.org>
Cc: Junxiao Bi <junxiao.bi@oracle.com>
Cc: Changwei Ge <gechangwei@live.cn>
Cc: Jun Piao <piaojun@huawei.com>
Cc: Heming Zhao <heming.zhao@suse.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>

authored by

Christophe JAILLET and committed by
Andrew Morton
9677a51a fd4d53bd

+6 -6
+2 -2
fs/ocfs2/cluster/heartbeat.c
··· 1942 1942 NULL, 1943 1943 }; 1944 1944 1945 - static struct configfs_item_operations o2hb_region_item_ops = { 1945 + static const struct configfs_item_operations o2hb_region_item_ops = { 1946 1946 .release = o2hb_region_release, 1947 1947 }; 1948 1948 ··· 2193 2193 NULL, 2194 2194 }; 2195 2195 2196 - static struct configfs_group_operations o2hb_heartbeat_group_group_ops = { 2196 + static const struct configfs_group_operations o2hb_heartbeat_group_group_ops = { 2197 2197 .make_item = o2hb_heartbeat_group_make_item, 2198 2198 .drop_item = o2hb_heartbeat_group_drop_item, 2199 2199 };
+4 -4
fs/ocfs2/cluster/nodemanager.c
··· 396 396 NULL, 397 397 }; 398 398 399 - static struct configfs_item_operations o2nm_node_item_ops = { 399 + static const struct configfs_item_operations o2nm_node_item_ops = { 400 400 .release = o2nm_node_release, 401 401 }; 402 402 ··· 638 638 config_item_put(item); 639 639 } 640 640 641 - static struct configfs_group_operations o2nm_node_group_group_ops = { 641 + static const struct configfs_group_operations o2nm_node_group_group_ops = { 642 642 .make_item = o2nm_node_group_make_item, 643 643 .drop_item = o2nm_node_group_drop_item, 644 644 }; ··· 657 657 kfree(cluster); 658 658 } 659 659 660 - static struct configfs_item_operations o2nm_cluster_item_ops = { 660 + static const struct configfs_item_operations o2nm_cluster_item_ops = { 661 661 .release = o2nm_cluster_release, 662 662 }; 663 663 ··· 741 741 config_item_put(item); 742 742 } 743 743 744 - static struct configfs_group_operations o2nm_cluster_group_group_ops = { 744 + static const struct configfs_group_operations o2nm_cluster_group_group_ops = { 745 745 .make_group = o2nm_cluster_group_make_group, 746 746 .drop_item = o2nm_cluster_group_drop_item, 747 747 };