[PATCH] mark struct file_operations const 8
authorArjan van de Ven <arjan@linux.intel.com>
Mon, 12 Feb 2007 08:55:36 +0000 (00:55 -0800)
committerLinus Torvalds <torvalds@woody.linux-foundation.org>
Mon, 12 Feb 2007 17:48:46 +0000 (09:48 -0800)
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>
31 files changed:
net/irda/ircomm/ircomm_core.c
net/irda/iriap.c
net/irda/irlan/irlan_common.c
net/irda/irlap.c
net/irda/irlmp.c
net/irda/irttp.c
net/llc/llc_proc.c
net/netfilter/nf_conntrack_expect.c
net/netfilter/nf_conntrack_standalone.c
net/netfilter/nf_log.c
net/netfilter/nf_queue.c
net/netfilter/nfnetlink_log.c
net/netfilter/nfnetlink_queue.c
net/netfilter/x_tables.c
net/netfilter/xt_hashlimit.c
net/netlink/af_netlink.c
net/netrom/af_netrom.c
net/netrom/nr_route.c
net/packet/af_packet.c
net/rose/af_rose.c
net/rose/rose_route.c
net/rxrpc/proc.c
net/sched/sch_api.c
net/sctp/proc.c
net/socket.c
net/sunrpc/cache.c
net/sunrpc/rpc_pipe.c
net/sunrpc/stats.c
net/unix/af_unix.c
net/wanrouter/wanproc.c
net/x25/x25_proc.c

index c28ee7bce26add7fe60f6bad0c295050d0a2b11e..ec40715dcdda97cfced91730e3d4cb1e33d328f4 100644 (file)
@@ -56,7 +56,7 @@ static void ircomm_control_indication(struct ircomm_cb *self,
 extern struct proc_dir_entry *proc_irda;
 static int ircomm_seq_open(struct inode *, struct file *);
 
-static struct file_operations ircomm_proc_fops = {
+static const struct file_operations ircomm_proc_fops = {
        .owner          = THIS_MODULE,
        .open           = ircomm_seq_open,
        .read           = seq_read,
index 98b0fa9657908b7600faff555b2446b887e4d0b4..915d9384f36a1784fe84f476b4c48f099a82168c 100644 (file)
@@ -1080,7 +1080,7 @@ static int irias_seq_open(struct inode *inode, struct file *file)
        return seq_open(file, &irias_seq_ops);
 }
 
-struct file_operations irias_seq_fops = {
+const struct file_operations irias_seq_fops = {
        .owner          = THIS_MODULE,
        .open           = irias_seq_open,
        .read           = seq_read,
index 9c3dc57ff7464383641f4b64ec9ec73c0eb46185..fcf9d6599628cdba2d2e52b937d1f1e0f96ead0e 100644 (file)
@@ -93,7 +93,7 @@ extern struct proc_dir_entry *proc_irda;
 
 static int irlan_seq_open(struct inode *inode, struct file *file);
 
-static struct file_operations irlan_fops = {
+static const struct file_operations irlan_fops = {
        .owner   = THIS_MODULE,
        .open    = irlan_seq_open,
        .read    = seq_read,
index fd73e4af715a3dc82fcad5fcc771b136210a7afb..d93ebd11431e86b2c82f65fc220e7e1316abfc50 100644 (file)
@@ -1244,7 +1244,7 @@ out_kfree:
        goto out;
 }
 
-struct file_operations irlap_seq_fops = {
+const struct file_operations irlap_seq_fops = {
        .owner          = THIS_MODULE,
        .open           = irlap_seq_open,
        .read           = seq_read,
index b134c3cf2bdb9dd3a1fd0f42788bdf9c68f63f6a..9df0461b6d18fe8b6750b77c2d1bbc716236ca60 100644 (file)
@@ -2026,7 +2026,7 @@ out_kfree:
        goto out;
 }
 
-struct file_operations irlmp_seq_fops = {
+const struct file_operations irlmp_seq_fops = {
        .owner          = THIS_MODULE,
        .open           = irlmp_seq_open,
        .read           = seq_read,
index 68836358fdf2ff2fc2db2725745d26fe3d2544cc..a7486b3bddcb0150f7afadcab71ad40d85d6dec6 100644 (file)
@@ -1895,7 +1895,7 @@ out_kfree:
        goto out;
 }
 
-struct file_operations irttp_seq_fops = {
+const struct file_operations irttp_seq_fops = {
        .owner          = THIS_MODULE,
        .open           = irttp_seq_open,
        .read           = seq_read,
index dcfe6c739471b5040cf9dbe34dfbd9d968927bc3..3ab9d9f8b17fc8d4368dd03e32ff134c9e8776fa 100644 (file)
@@ -208,7 +208,7 @@ static int llc_seq_core_open(struct inode *inode, struct file *file)
        return seq_open(file, &llc_seq_core_ops);
 }
 
-static struct file_operations llc_seq_socket_fops = {
+static const struct file_operations llc_seq_socket_fops = {
        .owner          = THIS_MODULE,
        .open           = llc_seq_socket_open,
        .read           = seq_read,
@@ -216,7 +216,7 @@ static struct file_operations llc_seq_socket_fops = {
        .release        = seq_release,
 };
 
-static struct file_operations llc_seq_core_fops = {
+static const struct file_operations llc_seq_core_fops = {
        .owner          = THIS_MODULE,
        .open           = llc_seq_core_open,
        .read           = seq_read,
index 9cbf926cdd14fb0d6af92917339e1cd1d3f23b23..5cdcd7f4e81346f218ee5eb3f809732a54b3452e 100644 (file)
@@ -435,7 +435,7 @@ static int exp_open(struct inode *inode, struct file *file)
        return seq_open(file, &exp_seq_ops);
 }
 
-struct file_operations exp_file_ops = {
+const struct file_operations exp_file_ops = {
        .owner   = THIS_MODULE,
        .open    = exp_open,
        .read    = seq_read,
index f1cb60ff9319bf1a9651c984157a04d16c592ff2..04ac12431db7103f1653deaafe5e6e3b8fcab8b6 100644 (file)
@@ -229,7 +229,7 @@ out_free:
        return ret;
 }
 
-static struct file_operations ct_file_ops = {
+static const struct file_operations ct_file_ops = {
        .owner   = THIS_MODULE,
        .open    = ct_open,
        .read    = seq_read,
@@ -317,7 +317,7 @@ static int ct_cpu_seq_open(struct inode *inode, struct file *file)
        return seq_open(file, &ct_cpu_seq_ops);
 }
 
-static struct file_operations ct_cpu_seq_fops = {
+static const struct file_operations ct_cpu_seq_fops = {
        .owner   = THIS_MODULE,
        .open    = ct_cpu_seq_open,
        .read    = seq_read,
index 8901b3a07f7e26a41d23bb6389c6c6d7731e61ca..07e28e089616b751dd142a587c353fdb066eb598 100644 (file)
@@ -151,7 +151,7 @@ static int nflog_open(struct inode *inode, struct file *file)
        return seq_open(file, &nflog_seq_ops);
 }
 
-static struct file_operations nflog_file_ops = {
+static const struct file_operations nflog_file_ops = {
        .owner   = THIS_MODULE,
        .open    = nflog_open,
        .read    = seq_read,
index 4d8936ed581d2f9e524e6b1a59a844db1546676b..e136fea1db22b2411fd6f2928f4d5d2cd17a124b 100644 (file)
@@ -331,7 +331,7 @@ static int nfqueue_open(struct inode *inode, struct file *file)
        return seq_open(file, &nfqueue_seq_ops);
 }
 
-static struct file_operations nfqueue_file_ops = {
+static const struct file_operations nfqueue_file_ops = {
        .owner   = THIS_MODULE,
        .open    = nfqueue_open,
        .read    = seq_read,
index d1505dd25c6663b4cc8fddb56c9e92ad395e569a..c47e7e2ba642814327dcd4d32780d0923a8bf971 100644 (file)
@@ -1025,7 +1025,7 @@ out_free:
        return ret;
 }
 
-static struct file_operations nful_file_ops = {
+static const struct file_operations nful_file_ops = {
        .owner   = THIS_MODULE,
        .open    = nful_open,
        .read    = seq_read,
index a88a017da22c4146893952a6d0706fa9e44aebe3..99e516eca41a7e2d82e279716ef41a21d33d3b00 100644 (file)
@@ -1077,7 +1077,7 @@ out_free:
        return ret;
 }
 
-static struct file_operations nfqnl_file_ops = {
+static const struct file_operations nfqnl_file_ops = {
        .owner   = THIS_MODULE,
        .open    = nfqnl_open,
        .read    = seq_read,
index 8996584b84998708ccc0eabf94b4faa19b96ad11..134cc88f8c83d27b04328ec0e2feb6f8aade0f58 100644 (file)
@@ -772,7 +772,7 @@ static int xt_tgt_open(struct inode *inode, struct file *file)
        return ret;
 }
 
-static struct file_operations xt_file_ops = {
+static const struct file_operations xt_file_ops = {
        .owner   = THIS_MODULE,
        .open    = xt_tgt_open,
        .read    = seq_read,
index bd1f7a2048d6d8cca560e3cd714278530965b68f..269a1e7934784382247d4c923eda94caa8e7cad8 100644 (file)
@@ -37,7 +37,7 @@ MODULE_ALIAS("ip6t_hashlimit");
 /* need to declare this at the top */
 static struct proc_dir_entry *hashlimit_procdir4;
 static struct proc_dir_entry *hashlimit_procdir6;
-static struct file_operations dl_file_ops;
+static const struct file_operations dl_file_ops;
 
 /* hash table crap */
 struct dsthash_dst {
@@ -714,7 +714,7 @@ static int dl_proc_open(struct inode *inode, struct file *file)
        return ret;
 }
 
-static struct file_operations dl_file_ops = {
+static const struct file_operations dl_file_ops = {
        .owner   = THIS_MODULE,
        .open    = dl_proc_open,
        .read    = seq_read,
index f6ee9b47428bf3b1c987fd68e8100fcd735cdca7..e73d8f546c6bf075d4a4d7c591b1258e5c571408 100644 (file)
@@ -1713,7 +1713,7 @@ static int netlink_seq_open(struct inode *inode, struct file *file)
        return 0;
 }
 
-static struct file_operations netlink_seq_fops = {
+static const struct file_operations netlink_seq_fops = {
        .owner          = THIS_MODULE,
        .open           = netlink_seq_open,
        .read           = seq_read,
index 799b76806bc30c4b70541fadd1f8b608a1f398f9..bf9837dd95c4505642b99f93e9b96403d055685e 100644 (file)
@@ -1335,7 +1335,7 @@ static int nr_info_open(struct inode *inode, struct file *file)
        return seq_open(file, &nr_info_seqops);
 }
 
-static struct file_operations nr_info_fops = {
+static const struct file_operations nr_info_fops = {
        .owner = THIS_MODULE,
        .open = nr_info_open,
        .read = seq_read,
index e9909aeb43e9ed12346297e1e180fd1c36dbdf03..c2fbac9c69ceab2a6a5db77b1283dbe901662d0b 100644 (file)
@@ -934,7 +934,7 @@ static int nr_node_info_open(struct inode *inode, struct file *file)
        return seq_open(file, &nr_node_seqops);
 }
 
-struct file_operations nr_nodes_fops = {
+const struct file_operations nr_nodes_fops = {
        .owner = THIS_MODULE,
        .open = nr_node_info_open,
        .read = seq_read,
@@ -1018,7 +1018,7 @@ static int nr_neigh_info_open(struct inode *inode, struct file *file)
        return seq_open(file, &nr_neigh_seqops);
 }
 
-struct file_operations nr_neigh_fops = {
+const struct file_operations nr_neigh_fops = {
        .owner = THIS_MODULE,
        .open = nr_neigh_info_open,
        .read = seq_read,
index 444550917bc1f6f89a297cf20868f4b31de4933c..15ff7b15e2112c675e97b582376ce27c2c951af0 100644 (file)
@@ -1952,7 +1952,7 @@ static int packet_seq_open(struct inode *inode, struct file *file)
        return seq_open(file, &packet_seq_ops);
 }
 
-static struct file_operations packet_seq_fops = {
+static const struct file_operations packet_seq_fops = {
        .owner          = THIS_MODULE,
        .open           = packet_seq_open,
        .read           = seq_read,
index 7a81a8ee8544731a4600d00d8eb91852c06aa6fd..8c34f1ca6c8c8eb8486d084bbd1e17eb6eca224c 100644 (file)
@@ -1440,7 +1440,7 @@ static int rose_info_open(struct inode *inode, struct file *file)
        return seq_open(file, &rose_info_seqops);
 }
 
-static struct file_operations rose_info_fops = {
+static const struct file_operations rose_info_fops = {
        .owner = THIS_MODULE,
        .open = rose_info_open,
        .read = seq_read,
index 0dcca4289eeb9eed07b7fb6d39d76f72a67ff5b5..1ddf7f5fa6db8578534d5fe62faf1cb1bc5f99ad 100644 (file)
@@ -1129,7 +1129,7 @@ static int rose_nodes_open(struct inode *inode, struct file *file)
        return seq_open(file, &rose_node_seqops);
 }
 
-struct file_operations rose_nodes_fops = {
+const struct file_operations rose_nodes_fops = {
        .owner = THIS_MODULE,
        .open = rose_nodes_open,
        .read = seq_read,
@@ -1211,7 +1211,7 @@ static int rose_neigh_open(struct inode *inode, struct file *file)
        return seq_open(file, &rose_neigh_seqops);
 }
 
-struct file_operations rose_neigh_fops = {
+const struct file_operations rose_neigh_fops = {
        .owner = THIS_MODULE,
        .open = rose_neigh_open,
        .read = seq_read,
@@ -1295,7 +1295,7 @@ static int rose_route_open(struct inode *inode, struct file *file)
        return seq_open(file, &rose_route_seqops);
 }
 
-struct file_operations rose_routes_fops = {
+const struct file_operations rose_routes_fops = {
        .owner = THIS_MODULE,
        .open = rose_route_open,
        .read = seq_read,
index 29975d99d864de1a1d8ea5b2b4a91a719c8b0861..8551c879e45645428840a60d97a2b857cdca4b80 100644 (file)
@@ -37,7 +37,7 @@ static struct seq_operations rxrpc_proc_transports_ops = {
        .show   = rxrpc_proc_transports_show,
 };
 
-static struct file_operations rxrpc_proc_transports_fops = {
+static const struct file_operations rxrpc_proc_transports_fops = {
        .open           = rxrpc_proc_transports_open,
        .read           = seq_read,
        .llseek         = seq_lseek,
@@ -57,7 +57,7 @@ static struct seq_operations rxrpc_proc_peers_ops = {
        .show   = rxrpc_proc_peers_show,
 };
 
-static struct file_operations rxrpc_proc_peers_fops = {
+static const struct file_operations rxrpc_proc_peers_fops = {
        .open           = rxrpc_proc_peers_open,
        .read           = seq_read,
        .llseek         = seq_lseek,
@@ -77,7 +77,7 @@ static struct seq_operations rxrpc_proc_conns_ops = {
        .show   = rxrpc_proc_conns_show,
 };
 
-static struct file_operations rxrpc_proc_conns_fops = {
+static const struct file_operations rxrpc_proc_conns_fops = {
        .open           = rxrpc_proc_conns_open,
        .read           = seq_read,
        .llseek         = seq_lseek,
@@ -97,7 +97,7 @@ static struct seq_operations rxrpc_proc_calls_ops = {
        .show   = rxrpc_proc_calls_show,
 };
 
-static struct file_operations rxrpc_proc_calls_fops = {
+static const struct file_operations rxrpc_proc_calls_fops = {
        .open           = rxrpc_proc_calls_open,
        .read           = seq_read,
        .llseek         = seq_lseek,
index 60b92fcdc8bbd5df0782769049d3671670eb3052..4158127bc202f60636ec1432b1ca4e4f68728c30 100644 (file)
@@ -1194,7 +1194,7 @@ static int psched_open(struct inode *inode, struct file *file)
        return single_open(file, psched_show, PDE(inode)->data);
 }
 
-static struct file_operations psched_fops = {
+static const struct file_operations psched_fops = {
        .owner = THIS_MODULE,
        .open = psched_open,
        .read  = seq_read,
index e93fc1cc430ab4f3fc58dbc1108b1d57324eaad2..2f12bf2d8d3c622f5f134cf1fa3308d7fab015fd 100644 (file)
@@ -114,7 +114,7 @@ static int sctp_snmp_seq_open(struct inode *inode, struct file *file)
        return single_open(file, sctp_snmp_seq_show, NULL);
 }
 
-static struct file_operations sctp_snmp_seq_fops = {
+static const struct file_operations sctp_snmp_seq_fops = {
        .owner   = THIS_MODULE,
        .open    = sctp_snmp_seq_open,
        .read    = seq_read,
@@ -264,7 +264,7 @@ static int sctp_eps_seq_open(struct inode *inode, struct file *file)
        return seq_open(file, &sctp_eps_ops);
 }
 
-static struct file_operations sctp_eps_seq_fops = {
+static const struct file_operations sctp_eps_seq_fops = {
        .open    = sctp_eps_seq_open,
        .read    = seq_read,
        .llseek  = seq_lseek,
@@ -374,7 +374,7 @@ static int sctp_assocs_seq_open(struct inode *inode, struct file *file)
        return seq_open(file, &sctp_assoc_ops);
 }
 
-static struct file_operations sctp_assocs_seq_fops = {
+static const struct file_operations sctp_assocs_seq_fops = {
        .open    = sctp_assocs_seq_open,
        .read    = seq_read,
        .llseek  = seq_lseek,
index a92f595802345c64e627ac3b04d5e8dc4afeac19..0778c54424117ee48c6337714f3fe72403d4f7ae 100644 (file)
@@ -117,7 +117,7 @@ static ssize_t sock_sendpage(struct file *file, struct page *page,
  *     in the operation structures but are done directly via the socketcall() multiplexor.
  */
 
-static struct file_operations socket_file_ops = {
+static const struct file_operations socket_file_ops = {
        .owner =        THIS_MODULE,
        .llseek =       no_llseek,
        .aio_read =     sock_aio_read,
index c80df455802d55dfe15b119189106e34865d0ac8..8612044b918930d67a389e9c4cdb4cd26f03cc31 100644 (file)
@@ -282,9 +282,9 @@ static DEFINE_SPINLOCK(cache_list_lock);
 static struct cache_detail *current_detail;
 static int current_index;
 
-static struct file_operations cache_file_operations;
-static struct file_operations content_file_operations;
-static struct file_operations cache_flush_operations;
+static const struct file_operations cache_file_operations;
+static const struct file_operations content_file_operations;
+static const struct file_operations cache_flush_operations;
 
 static void do_cache_clean(struct work_struct *work);
 static DECLARE_DELAYED_WORK(cache_cleaner, do_cache_clean);
@@ -887,7 +887,7 @@ cache_release(struct inode *inode, struct file *filp)
 
 
 
-static struct file_operations cache_file_operations = {
+static const struct file_operations cache_file_operations = {
        .owner          = THIS_MODULE,
        .llseek         = no_llseek,
        .read           = cache_read,
@@ -1245,7 +1245,7 @@ static int content_release(struct inode *inode, struct file *file)
        return seq_release(inode, file);
 }
 
-static struct file_operations content_file_operations = {
+static const struct file_operations content_file_operations = {
        .open           = content_open,
        .read           = seq_read,
        .llseek         = seq_lseek,
@@ -1297,7 +1297,7 @@ static ssize_t write_flush(struct file * file, const char __user * buf,
        return count;
 }
 
-static struct file_operations cache_flush_operations = {
+static const struct file_operations cache_flush_operations = {
        .open           = nonseekable_open,
        .read           = read_flush,
        .write          = write_flush,
index 89273d35e0cc433d554d2abe1a91305cea51a5d7..e1fad77a2257bf47fc83e36ded07abd79737edf7 100644 (file)
@@ -309,7 +309,7 @@ rpc_pipe_ioctl(struct inode *ino, struct file *filp,
        }
 }
 
-static struct file_operations rpc_pipe_fops = {
+static const struct file_operations rpc_pipe_fops = {
        .owner          = THIS_MODULE,
        .llseek         = no_llseek,
        .read           = rpc_pipe_read,
@@ -366,7 +366,7 @@ rpc_info_release(struct inode *inode, struct file *file)
        return single_release(inode, file);
 }
 
-static struct file_operations rpc_info_operations = {
+static const struct file_operations rpc_info_operations = {
        .owner          = THIS_MODULE,
        .open           = rpc_info_open,
        .read           = seq_read,
index bd98124c3a649b97508685cd2f87b4813aeb83b7..044d9484bb8c639a90fb9a91d85335c4f520d9b9 100644 (file)
@@ -66,7 +66,7 @@ static int rpc_proc_open(struct inode *inode, struct file *file)
        return single_open(file, rpc_proc_show, PDE(inode)->data);
 }
 
-static struct file_operations rpc_proc_fops = {
+static const struct file_operations rpc_proc_fops = {
        .owner = THIS_MODULE,
        .open = rpc_proc_open,
        .read  = seq_read,
index ac9478d0ca8b45a69c295bb2b6ffa1fdafc34847..606971645b33e0c43e5f8e097144570fa317a80f 100644 (file)
@@ -2040,7 +2040,7 @@ out_kfree:
        goto out;
 }
 
-static struct file_operations unix_seq_fops = {
+static const struct file_operations unix_seq_fops = {
        .owner          = THIS_MODULE,
        .open           = unix_seq_open,
        .read           = seq_read,
index abce828736049252e2c454f81b9f30ec21b0e1cf..205106521ecba36c886f5dbf90064798e3da2d25 100644 (file)
@@ -188,7 +188,7 @@ static int status_open(struct inode *inode, struct file *file)
        return seq_open(file, &status_op);
 }
 
-static struct file_operations config_fops = {
+static const struct file_operations config_fops = {
        .owner   = THIS_MODULE,
        .open    = config_open,
        .read    = seq_read,
@@ -196,7 +196,7 @@ static struct file_operations config_fops = {
        .release = seq_release,
 };
 
-static struct file_operations status_fops = {
+static const struct file_operations status_fops = {
        .owner   = THIS_MODULE,
        .open    = status_open,
        .read    = seq_read,
@@ -271,7 +271,7 @@ static int wandev_open(struct inode *inode, struct file *file)
        return single_open(file, wandev_show, PDE(inode)->data);
 }
 
-static struct file_operations wandev_fops = {
+static const struct file_operations wandev_fops = {
        .owner   = THIS_MODULE,
        .open    = wandev_open,
        .read    = seq_read,
index 3c9f1ba56221c3e0067ea8d4105ca257a2af4ed3..96001f0c64fc16a8f4cd32512bb31adab912ec5f 100644 (file)
@@ -270,7 +270,7 @@ static int x25_seq_forward_open(struct inode *inode, struct file *file)
        return seq_open(file, &x25_seq_forward_ops);
 }
 
-static struct file_operations x25_seq_socket_fops = {
+static const struct file_operations x25_seq_socket_fops = {
        .owner          = THIS_MODULE,
        .open           = x25_seq_socket_open,
        .read           = seq_read,
@@ -278,7 +278,7 @@ static struct file_operations x25_seq_socket_fops = {
        .release        = seq_release,
 };
 
-static struct file_operations x25_seq_route_fops = {
+static const struct file_operations x25_seq_route_fops = {
        .owner          = THIS_MODULE,
        .open           = x25_seq_route_open,
        .read           = seq_read,