aboutsummaryrefslogtreecommitdiffstats
path: root/security
diff options
context:
space:
mode:
authorArjan van de Ven <arjan@linux.intel.com>2007-02-12 03:55:37 -0500
committerLinus Torvalds <torvalds@woody.linux-foundation.org>2007-02-12 12:48:46 -0500
commit9c2e08c592cd357a8330c34def1e8ecfdcf53275 (patch)
tree62e7449e43bb502f2e9630ab41832ceccd9a0f65 /security
parentda7071d7e32d15149cc513f096a3638097b66387 (diff)
[PATCH] mark struct file_operations const 9
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>
Diffstat (limited to 'security')
-rw-r--r--security/inode.c4
-rw-r--r--security/keys/proc.c4
-rw-r--r--security/selinux/selinuxfs.c26
3 files changed, 17 insertions, 17 deletions
diff --git a/security/inode.c b/security/inode.c
index 9b16e14f3a80..d7ecf89fbc74 100644
--- a/security/inode.c
+++ b/security/inode.c
@@ -50,7 +50,7 @@ static int default_open(struct inode *inode, struct file *file)
50 return 0; 50 return 0;
51} 51}
52 52
53static struct file_operations default_file_ops = { 53static const struct file_operations default_file_ops = {
54 .read = default_read_file, 54 .read = default_read_file,
55 .write = default_write_file, 55 .write = default_write_file,
56 .open = default_open, 56 .open = default_open,
@@ -215,7 +215,7 @@ static int create_by_name(const char *name, mode_t mode,
215 */ 215 */
216struct dentry *securityfs_create_file(const char *name, mode_t mode, 216struct dentry *securityfs_create_file(const char *name, mode_t mode,
217 struct dentry *parent, void *data, 217 struct dentry *parent, void *data,
218 struct file_operations *fops) 218 const struct file_operations *fops)
219{ 219{
220 struct dentry *dentry = NULL; 220 struct dentry *dentry = NULL;
221 int error; 221 int error;
diff --git a/security/keys/proc.c b/security/keys/proc.c
index 686a9ee0c5de..3e0d0a6e224f 100644
--- a/security/keys/proc.c
+++ b/security/keys/proc.c
@@ -33,7 +33,7 @@ static struct seq_operations proc_keys_ops = {
33 .show = proc_keys_show, 33 .show = proc_keys_show,
34}; 34};
35 35
36static struct file_operations proc_keys_fops = { 36static const struct file_operations proc_keys_fops = {
37 .open = proc_keys_open, 37 .open = proc_keys_open,
38 .read = seq_read, 38 .read = seq_read,
39 .llseek = seq_lseek, 39 .llseek = seq_lseek,
@@ -54,7 +54,7 @@ static struct seq_operations proc_key_users_ops = {
54 .show = proc_key_users_show, 54 .show = proc_key_users_show,
55}; 55};
56 56
57static struct file_operations proc_key_users_fops = { 57static const struct file_operations proc_key_users_fops = {
58 .open = proc_key_users_open, 58 .open = proc_key_users_open,
59 .read = seq_read, 59 .read = seq_read,
60 .llseek = seq_lseek, 60 .llseek = seq_lseek,
diff --git a/security/selinux/selinuxfs.c b/security/selinux/selinuxfs.c
index c8bf6e172f6e..93b3177c7585 100644
--- a/security/selinux/selinuxfs.c
+++ b/security/selinux/selinuxfs.c
@@ -161,7 +161,7 @@ out:
161#define sel_write_enforce NULL 161#define sel_write_enforce NULL
162#endif 162#endif
163 163
164static struct file_operations sel_enforce_ops = { 164static const struct file_operations sel_enforce_ops = {
165 .read = sel_read_enforce, 165 .read = sel_read_enforce,
166 .write = sel_write_enforce, 166 .write = sel_write_enforce,
167}; 167};
@@ -211,7 +211,7 @@ out:
211#define sel_write_disable NULL 211#define sel_write_disable NULL
212#endif 212#endif
213 213
214static struct file_operations sel_disable_ops = { 214static const struct file_operations sel_disable_ops = {
215 .write = sel_write_disable, 215 .write = sel_write_disable,
216}; 216};
217 217
@@ -225,7 +225,7 @@ static ssize_t sel_read_policyvers(struct file *filp, char __user *buf,
225 return simple_read_from_buffer(buf, count, ppos, tmpbuf, length); 225 return simple_read_from_buffer(buf, count, ppos, tmpbuf, length);
226} 226}
227 227
228static struct file_operations sel_policyvers_ops = { 228static const struct file_operations sel_policyvers_ops = {
229 .read = sel_read_policyvers, 229 .read = sel_read_policyvers,
230}; 230};
231 231
@@ -242,7 +242,7 @@ static ssize_t sel_read_mls(struct file *filp, char __user *buf,
242 return simple_read_from_buffer(buf, count, ppos, tmpbuf, length); 242 return simple_read_from_buffer(buf, count, ppos, tmpbuf, length);
243} 243}
244 244
245static struct file_operations sel_mls_ops = { 245static const struct file_operations sel_mls_ops = {
246 .read = sel_read_mls, 246 .read = sel_read_mls,
247}; 247};
248 248
@@ -294,7 +294,7 @@ out:
294 return length; 294 return length;
295} 295}
296 296
297static struct file_operations sel_load_ops = { 297static const struct file_operations sel_load_ops = {
298 .write = sel_write_load, 298 .write = sel_write_load,
299}; 299};
300 300
@@ -374,7 +374,7 @@ out:
374 free_page((unsigned long) page); 374 free_page((unsigned long) page);
375 return length; 375 return length;
376} 376}
377static struct file_operations sel_checkreqprot_ops = { 377static const struct file_operations sel_checkreqprot_ops = {
378 .read = sel_read_checkreqprot, 378 .read = sel_read_checkreqprot,
379 .write = sel_write_checkreqprot, 379 .write = sel_write_checkreqprot,
380}; 380};
@@ -423,7 +423,7 @@ out:
423 free_page((unsigned long) page); 423 free_page((unsigned long) page);
424 return length; 424 return length;
425} 425}
426static struct file_operations sel_compat_net_ops = { 426static const struct file_operations sel_compat_net_ops = {
427 .read = sel_read_compat_net, 427 .read = sel_read_compat_net,
428 .write = sel_write_compat_net, 428 .write = sel_write_compat_net,
429}; 429};
@@ -467,7 +467,7 @@ static ssize_t selinux_transaction_write(struct file *file, const char __user *b
467 return rv; 467 return rv;
468} 468}
469 469
470static struct file_operations transaction_ops = { 470static const struct file_operations transaction_ops = {
471 .write = selinux_transaction_write, 471 .write = selinux_transaction_write,
472 .read = simple_transaction_read, 472 .read = simple_transaction_read,
473 .release = simple_transaction_release, 473 .release = simple_transaction_release,
@@ -875,7 +875,7 @@ out:
875 return length; 875 return length;
876} 876}
877 877
878static struct file_operations sel_bool_ops = { 878static const struct file_operations sel_bool_ops = {
879 .read = sel_read_bool, 879 .read = sel_read_bool,
880 .write = sel_write_bool, 880 .write = sel_write_bool,
881}; 881};
@@ -932,7 +932,7 @@ out:
932 return length; 932 return length;
933} 933}
934 934
935static struct file_operations sel_commit_bools_ops = { 935static const struct file_operations sel_commit_bools_ops = {
936 .write = sel_commit_bools_write, 936 .write = sel_commit_bools_write,
937}; 937};
938 938
@@ -1131,12 +1131,12 @@ out:
1131 return ret; 1131 return ret;
1132} 1132}
1133 1133
1134static struct file_operations sel_avc_cache_threshold_ops = { 1134static const struct file_operations sel_avc_cache_threshold_ops = {
1135 .read = sel_read_avc_cache_threshold, 1135 .read = sel_read_avc_cache_threshold,
1136 .write = sel_write_avc_cache_threshold, 1136 .write = sel_write_avc_cache_threshold,
1137}; 1137};
1138 1138
1139static struct file_operations sel_avc_hash_stats_ops = { 1139static const struct file_operations sel_avc_hash_stats_ops = {
1140 .read = sel_read_avc_hash_stats, 1140 .read = sel_read_avc_hash_stats,
1141}; 1141};
1142 1142
@@ -1198,7 +1198,7 @@ static int sel_open_avc_cache_stats(struct inode *inode, struct file *file)
1198 return seq_open(file, &sel_avc_cache_stats_seq_ops); 1198 return seq_open(file, &sel_avc_cache_stats_seq_ops);
1199} 1199}
1200 1200
1201static struct file_operations sel_avc_cache_stats_ops = { 1201static const struct file_operations sel_avc_cache_stats_ops = {
1202 .open = sel_open_avc_cache_stats, 1202 .open = sel_open_avc_cache_stats,
1203 .read = seq_read, 1203 .read = seq_read,
1204 .llseek = seq_lseek, 1204 .llseek = seq_lseek,