[PATCH] mark struct file_operations const 7
Many struct file_operations in the kernel can be "const". Marking them const
moves these to the .rodata section, which avoids false sharing with potential
dirty data. In addition it'll catch accidental writes at compile time to
these shared resources.
Signed-off-by: Arjan van de Ven <arjan@linux.intel.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
diff --git a/net/core/dev.c b/net/core/dev.c
index 85d58d7..cf71614 100644
--- a/net/core/dev.c
+++ b/net/core/dev.c
@@ -2200,7 +2200,7 @@
return seq_open(file, &dev_seq_ops);
}
-static struct file_operations dev_seq_fops = {
+static const struct file_operations dev_seq_fops = {
.owner = THIS_MODULE,
.open = dev_seq_open,
.read = seq_read,
@@ -2220,7 +2220,7 @@
return seq_open(file, &softnet_seq_ops);
}
-static struct file_operations softnet_seq_fops = {
+static const struct file_operations softnet_seq_fops = {
.owner = THIS_MODULE,
.open = softnet_seq_open,
.read = seq_read,
diff --git a/net/core/dev_mcast.c b/net/core/dev_mcast.c
index bfcbdf73a..c4e754e 100644
--- a/net/core/dev_mcast.c
+++ b/net/core/dev_mcast.c
@@ -277,7 +277,7 @@
return seq_open(file, &dev_mc_seq_ops);
}
-static struct file_operations dev_mc_seq_fops = {
+static const struct file_operations dev_mc_seq_fops = {
.owner = THIS_MODULE,
.open = dev_mc_seq_open,
.read = seq_read,
diff --git a/net/core/neighbour.c b/net/core/neighbour.c
index c08d696..512eed9 100644
--- a/net/core/neighbour.c
+++ b/net/core/neighbour.c
@@ -63,7 +63,7 @@
static struct neigh_table *neigh_tables;
#ifdef CONFIG_PROC_FS
-static struct file_operations neigh_stat_seq_fops;
+static const struct file_operations neigh_stat_seq_fops;
#endif
/*
@@ -2403,7 +2403,7 @@
return ret;
};
-static struct file_operations neigh_stat_seq_fops = {
+static const struct file_operations neigh_stat_seq_fops = {
.owner = THIS_MODULE,
.open = neigh_stat_seq_open,
.read = seq_read,
diff --git a/net/core/pktgen.c b/net/core/pktgen.c
index c2818e0..74a9a32 100644
--- a/net/core/pktgen.c
+++ b/net/core/pktgen.c
@@ -579,7 +579,7 @@
return single_open(file, pgctrl_show, PDE(inode)->data);
}
-static struct file_operations pktgen_fops = {
+static const struct file_operations pktgen_fops = {
.owner = THIS_MODULE,
.open = pgctrl_open,
.read = seq_read,
@@ -1672,7 +1672,7 @@
return single_open(file, pktgen_if_show, PDE(inode)->data);
}
-static struct file_operations pktgen_if_fops = {
+static const struct file_operations pktgen_if_fops = {
.owner = THIS_MODULE,
.open = pktgen_if_open,
.read = seq_read,
@@ -1815,7 +1815,7 @@
return single_open(file, pktgen_thread_show, PDE(inode)->data);
}
-static struct file_operations pktgen_thread_fops = {
+static const struct file_operations pktgen_thread_fops = {
.owner = THIS_MODULE,
.open = pktgen_thread_open,
.read = seq_read,
diff --git a/net/core/sock.c b/net/core/sock.c
index 1e35d99..e9986ac 100644
--- a/net/core/sock.c
+++ b/net/core/sock.c
@@ -1911,7 +1911,7 @@
return seq_open(file, &proto_seq_ops);
}
-static struct file_operations proto_seq_fops = {
+static const struct file_operations proto_seq_fops = {
.owner = THIS_MODULE,
.open = proto_seq_open,
.read = seq_read,
diff --git a/net/core/wireless.c b/net/core/wireless.c
index 64017d4..9936ab1 100644
--- a/net/core/wireless.c
+++ b/net/core/wireless.c
@@ -674,7 +674,7 @@
return seq_open(file, &wireless_seq_ops);
}
-static struct file_operations wireless_seq_fops = {
+static const struct file_operations wireless_seq_fops = {
.owner = THIS_MODULE,
.open = wireless_seq_open,
.read = seq_read,