From 9a32144e9d7b4e21341174b1a83b82a82353be86 Mon Sep 17 00:00:00 2001 From: Arjan van de Ven Date: Mon, 12 Feb 2007 00:55:35 -0800 Subject: [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 Signed-off-by: Andrew Morton Signed-off-by: Linus Torvalds --- net/ipv4/arp.c | 2 +- net/ipv4/fib_hash.c | 2 +- net/ipv4/fib_trie.c | 6 +++--- net/ipv4/igmp.c | 4 ++-- net/ipv4/ipconfig.c | 2 +- net/ipv4/ipmr.c | 4 ++-- net/ipv4/ipvs/ip_vs_app.c | 2 +- net/ipv4/ipvs/ip_vs_conn.c | 2 +- net/ipv4/ipvs/ip_vs_ctl.c | 4 ++-- net/ipv4/netfilter/ip_conntrack_standalone.c | 6 +++--- net/ipv4/netfilter/ipt_CLUSTERIP.c | 4 ++-- net/ipv4/netfilter/ipt_recent.c | 4 ++-- net/ipv4/netfilter/nf_conntrack_l3proto_ipv4_compat.c | 6 +++--- net/ipv4/proc.c | 6 +++--- net/ipv4/raw.c | 2 +- net/ipv4/route.c | 4 ++-- net/ipv4/tcp_probe.c | 2 +- 17 files changed, 31 insertions(+), 31 deletions(-) (limited to 'net/ipv4') diff --git a/net/ipv4/arp.c b/net/ipv4/arp.c index a58afde4f72..0ffd2d2920c 100644 --- a/net/ipv4/arp.c +++ b/net/ipv4/arp.c @@ -1390,7 +1390,7 @@ out_kfree: goto out; } -static struct file_operations arp_seq_fops = { +static const struct file_operations arp_seq_fops = { .owner = THIS_MODULE, .open = arp_seq_open, .read = seq_read, diff --git a/net/ipv4/fib_hash.c b/net/ipv4/fib_hash.c index dea04d725b0..b21bb28d1fd 100644 --- a/net/ipv4/fib_hash.c +++ b/net/ipv4/fib_hash.c @@ -1057,7 +1057,7 @@ out_kfree: goto out; } -static struct file_operations fib_seq_fops = { +static const struct file_operations fib_seq_fops = { .owner = THIS_MODULE, .open = fib_seq_open, .read = seq_read, diff --git a/net/ipv4/fib_trie.c b/net/ipv4/fib_trie.c index 004a437bd7b..c33dca07380 100644 --- a/net/ipv4/fib_trie.c +++ b/net/ipv4/fib_trie.c @@ -2173,7 +2173,7 @@ static int fib_triestat_seq_open(struct inode *inode, struct file *file) return single_open(file, fib_triestat_seq_show, NULL); } -static struct file_operations fib_triestat_fops = { +static const struct file_operations fib_triestat_fops = { .owner = THIS_MODULE, .open = fib_triestat_seq_open, .read = seq_read, @@ -2364,7 +2364,7 @@ out_kfree: goto out; } -static struct file_operations fib_trie_fops = { +static const struct file_operations fib_trie_fops = { .owner = THIS_MODULE, .open = fib_trie_seq_open, .read = seq_read, @@ -2485,7 +2485,7 @@ out_kfree: goto out; } -static struct file_operations fib_route_fops = { +static const struct file_operations fib_route_fops = { .owner = THIS_MODULE, .open = fib_route_seq_open, .read = seq_read, diff --git a/net/ipv4/igmp.c b/net/ipv4/igmp.c index b8e1625d34c..063721302eb 100644 --- a/net/ipv4/igmp.c +++ b/net/ipv4/igmp.c @@ -2403,7 +2403,7 @@ out_kfree: goto out; } -static struct file_operations igmp_mc_seq_fops = { +static const struct file_operations igmp_mc_seq_fops = { .owner = THIS_MODULE, .open = igmp_mc_seq_open, .read = seq_read, @@ -2577,7 +2577,7 @@ out_kfree: goto out; } -static struct file_operations igmp_mcf_seq_fops = { +static const struct file_operations igmp_mcf_seq_fops = { .owner = THIS_MODULE, .open = igmp_mcf_seq_open, .read = seq_read, diff --git a/net/ipv4/ipconfig.c b/net/ipv4/ipconfig.c index ba882bec317..cf49de1a498 100644 --- a/net/ipv4/ipconfig.c +++ b/net/ipv4/ipconfig.c @@ -1200,7 +1200,7 @@ static int pnp_seq_open(struct inode *indoe, struct file *file) return single_open(file, pnp_seq_show, NULL); } -static struct file_operations pnp_seq_fops = { +static const struct file_operations pnp_seq_fops = { .owner = THIS_MODULE, .open = pnp_seq_open, .read = seq_read, diff --git a/net/ipv4/ipmr.c b/net/ipv4/ipmr.c index 604f5b58510..e6d11abd784 100644 --- a/net/ipv4/ipmr.c +++ b/net/ipv4/ipmr.c @@ -1712,7 +1712,7 @@ out_kfree: } -static struct file_operations ipmr_vif_fops = { +static const struct file_operations ipmr_vif_fops = { .owner = THIS_MODULE, .open = ipmr_vif_open, .read = seq_read, @@ -1874,7 +1874,7 @@ out_kfree: } -static struct file_operations ipmr_mfc_fops = { +static const struct file_operations ipmr_mfc_fops = { .owner = THIS_MODULE, .open = ipmr_mfc_open, .read = seq_read, diff --git a/net/ipv4/ipvs/ip_vs_app.c b/net/ipv4/ipvs/ip_vs_app.c index 6c40899aa16..22e104c6a49 100644 --- a/net/ipv4/ipvs/ip_vs_app.c +++ b/net/ipv4/ipvs/ip_vs_app.c @@ -561,7 +561,7 @@ static int ip_vs_app_open(struct inode *inode, struct file *file) return seq_open(file, &ip_vs_app_seq_ops); } -static struct file_operations ip_vs_app_fops = { +static const struct file_operations ip_vs_app_fops = { .owner = THIS_MODULE, .open = ip_vs_app_open, .read = seq_read, diff --git a/net/ipv4/ipvs/ip_vs_conn.c b/net/ipv4/ipvs/ip_vs_conn.c index 0b5e03476ce..7018f97c75d 100644 --- a/net/ipv4/ipvs/ip_vs_conn.c +++ b/net/ipv4/ipvs/ip_vs_conn.c @@ -757,7 +757,7 @@ static int ip_vs_conn_open(struct inode *inode, struct file *file) return seq_open(file, &ip_vs_conn_seq_ops); } -static struct file_operations ip_vs_conn_fops = { +static const struct file_operations ip_vs_conn_fops = { .owner = THIS_MODULE, .open = ip_vs_conn_open, .read = seq_read, diff --git a/net/ipv4/ipvs/ip_vs_ctl.c b/net/ipv4/ipvs/ip_vs_ctl.c index 9b933381ebb..8b08d9cdcbc 100644 --- a/net/ipv4/ipvs/ip_vs_ctl.c +++ b/net/ipv4/ipvs/ip_vs_ctl.c @@ -1812,7 +1812,7 @@ out_kfree: goto out; } -static struct file_operations ip_vs_info_fops = { +static const struct file_operations ip_vs_info_fops = { .owner = THIS_MODULE, .open = ip_vs_info_open, .read = seq_read, @@ -1859,7 +1859,7 @@ static int ip_vs_stats_seq_open(struct inode *inode, struct file *file) return single_open(file, ip_vs_stats_show, NULL); } -static struct file_operations ip_vs_stats_fops = { +static const struct file_operations ip_vs_stats_fops = { .owner = THIS_MODULE, .open = ip_vs_stats_seq_open, .read = seq_read, diff --git a/net/ipv4/netfilter/ip_conntrack_standalone.c b/net/ipv4/netfilter/ip_conntrack_standalone.c index 5903588fddc..300ccbbbdac 100644 --- a/net/ipv4/netfilter/ip_conntrack_standalone.c +++ b/net/ipv4/netfilter/ip_conntrack_standalone.c @@ -222,7 +222,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, @@ -298,7 +298,7 @@ static int exp_open(struct inode *inode, struct file *file) return seq_open(file, &exp_seq_ops); } -static struct file_operations exp_file_ops = { +static const struct file_operations exp_file_ops = { .owner = THIS_MODULE, .open = exp_open, .read = seq_read, @@ -386,7 +386,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, diff --git a/net/ipv4/netfilter/ipt_CLUSTERIP.c b/net/ipv4/netfilter/ipt_CLUSTERIP.c index 4fe28f26447..e965b333c99 100644 --- a/net/ipv4/netfilter/ipt_CLUSTERIP.c +++ b/net/ipv4/netfilter/ipt_CLUSTERIP.c @@ -70,7 +70,7 @@ static LIST_HEAD(clusterip_configs); static DEFINE_RWLOCK(clusterip_lock); #ifdef CONFIG_PROC_FS -static struct file_operations clusterip_proc_fops; +static const struct file_operations clusterip_proc_fops; static struct proc_dir_entry *clusterip_procdir; #endif @@ -715,7 +715,7 @@ static ssize_t clusterip_proc_write(struct file *file, const char __user *input, return size; } -static struct file_operations clusterip_proc_fops = { +static const struct file_operations clusterip_proc_fops = { .owner = THIS_MODULE, .open = clusterip_proc_open, .read = seq_read, diff --git a/net/ipv4/netfilter/ipt_recent.c b/net/ipv4/netfilter/ipt_recent.c index 6b97b679617..aecb9c48e15 100644 --- a/net/ipv4/netfilter/ipt_recent.c +++ b/net/ipv4/netfilter/ipt_recent.c @@ -79,7 +79,7 @@ static DEFINE_MUTEX(recent_mutex); #ifdef CONFIG_PROC_FS static struct proc_dir_entry *proc_dir; -static struct file_operations recent_fops; +static const struct file_operations recent_fops; #endif static u_int32_t hash_rnd; @@ -454,7 +454,7 @@ static ssize_t recent_proc_write(struct file *file, const char __user *input, return size; } -static struct file_operations recent_fops = { +static const struct file_operations recent_fops = { .open = recent_seq_open, .read = seq_read, .write = recent_proc_write, diff --git a/net/ipv4/netfilter/nf_conntrack_l3proto_ipv4_compat.c b/net/ipv4/netfilter/nf_conntrack_l3proto_ipv4_compat.c index 14a93a73841..89f933e8103 100644 --- a/net/ipv4/netfilter/nf_conntrack_l3proto_ipv4_compat.c +++ b/net/ipv4/netfilter/nf_conntrack_l3proto_ipv4_compat.c @@ -197,7 +197,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, @@ -278,7 +278,7 @@ static int exp_open(struct inode *inode, struct file *file) return seq_open(file, &exp_seq_ops); } -static struct file_operations ip_exp_file_ops = { +static const struct file_operations ip_exp_file_ops = { .owner = THIS_MODULE, .open = exp_open, .read = seq_read, @@ -366,7 +366,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, diff --git a/net/ipv4/proc.c b/net/ipv4/proc.c index ccb199e9dd8..ae68a691e8c 100644 --- a/net/ipv4/proc.c +++ b/net/ipv4/proc.c @@ -79,7 +79,7 @@ static int sockstat_seq_open(struct inode *inode, struct file *file) return single_open(file, sockstat_seq_show, NULL); } -static struct file_operations sockstat_seq_fops = { +static const struct file_operations sockstat_seq_fops = { .owner = THIS_MODULE, .open = sockstat_seq_open, .read = seq_read, @@ -326,7 +326,7 @@ static int snmp_seq_open(struct inode *inode, struct file *file) return single_open(file, snmp_seq_show, NULL); } -static struct file_operations snmp_seq_fops = { +static const struct file_operations snmp_seq_fops = { .owner = THIS_MODULE, .open = snmp_seq_open, .read = seq_read, @@ -360,7 +360,7 @@ static int netstat_seq_open(struct inode *inode, struct file *file) return single_open(file, netstat_seq_show, NULL); } -static struct file_operations netstat_seq_fops = { +static const struct file_operations netstat_seq_fops = { .owner = THIS_MODULE, .open = netstat_seq_open, .read = seq_read, diff --git a/net/ipv4/raw.c b/net/ipv4/raw.c index 931084bfb57..87e9c161810 100644 --- a/net/ipv4/raw.c +++ b/net/ipv4/raw.c @@ -916,7 +916,7 @@ out_kfree: goto out; } -static struct file_operations raw_seq_fops = { +static const struct file_operations raw_seq_fops = { .owner = THIS_MODULE, .open = raw_seq_open, .read = seq_read, diff --git a/net/ipv4/route.c b/net/ipv4/route.c index 5b3834b38a2..9b5e56481d5 100644 --- a/net/ipv4/route.c +++ b/net/ipv4/route.c @@ -393,7 +393,7 @@ out_kfree: goto out; } -static struct file_operations rt_cache_seq_fops = { +static const struct file_operations rt_cache_seq_fops = { .owner = THIS_MODULE, .open = rt_cache_seq_open, .read = seq_read, @@ -484,7 +484,7 @@ static int rt_cpu_seq_open(struct inode *inode, struct file *file) return seq_open(file, &rt_cpu_seq_ops); } -static struct file_operations rt_cpu_seq_fops = { +static const struct file_operations rt_cpu_seq_fops = { .owner = THIS_MODULE, .open = rt_cpu_seq_open, .read = seq_read, diff --git a/net/ipv4/tcp_probe.c b/net/ipv4/tcp_probe.c index 41c15784818..61f406f2729 100644 --- a/net/ipv4/tcp_probe.c +++ b/net/ipv4/tcp_probe.c @@ -143,7 +143,7 @@ out_free: return error ? error : cnt; } -static struct file_operations tcpprobe_fops = { +static const struct file_operations tcpprobe_fops = { .owner = THIS_MODULE, .open = tcpprobe_open, .read = tcpprobe_read, -- cgit v1.2.3-18-g5258