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 ocfs2_stack_operations

"struct ocfs2_stack_operations" are not modified in this driver.

Constifying this structure moves some data to a read-only section, so
increase overall security.

In order to do it, "struct ocfs2_stack_plugin" also needs to be adjusted
to this new const qualifier.

On a x86_64, with allmodconfig:
Before:
======
text data bss dec hex filename
6241 644 0 6885 1ae5 fs/ocfs2/stack_o2cb.o

After:
=====
text data bss dec hex filename
6337 548 0 6885 1ae5 fs/ocfs2/stack_o2cb.o

Link: https://lkml.kernel.org/r/f52dab89ee0049ec6271de29183a781efbb275ab.1718398605.git.christophe.jaillet@wanadoo.fr
Signed-off-by: Christophe JAILLET <christophe.jaillet@wanadoo.fr>
Cc: Mark Fasheh <mark@fasheh.com>
Cc: Joel Becker <jlbec@evilplan.org>
Cc: Junxiao Bi <junxiao.bi@oracle.com>
Cc: Joseph Qi <jiangqi903@gmail.com>
Cc: Changwei Ge <gechangwei@live.cn>
Cc: Gang He <ghe@suse.com>
Cc: Jun Piao <piaojun@huawei.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>

authored by

Christophe JAILLET and committed by
Andrew Morton
03bf0044 3ebe69c0

+3 -3
+1 -1
fs/ocfs2/stack_o2cb.c
··· 404 404 return 0; 405 405 } 406 406 407 - static struct ocfs2_stack_operations o2cb_stack_ops = { 407 + static const struct ocfs2_stack_operations o2cb_stack_ops = { 408 408 .connect = o2cb_cluster_connect, 409 409 .disconnect = o2cb_cluster_disconnect, 410 410 .this_node = o2cb_cluster_this_node,
+1 -1
fs/ocfs2/stack_user.c
··· 1065 1065 return 0; 1066 1066 } 1067 1067 1068 - static struct ocfs2_stack_operations ocfs2_user_plugin_ops = { 1068 + static const struct ocfs2_stack_operations ocfs2_user_plugin_ops = { 1069 1069 .connect = user_cluster_connect, 1070 1070 .disconnect = user_cluster_disconnect, 1071 1071 .this_node = user_cluster_this_node,
+1 -1
fs/ocfs2/stackglue.h
··· 223 223 */ 224 224 struct ocfs2_stack_plugin { 225 225 char *sp_name; 226 - struct ocfs2_stack_operations *sp_ops; 226 + const struct ocfs2_stack_operations *sp_ops; 227 227 struct module *sp_owner; 228 228 229 229 /* These are managed by the stackglue code. */