diff options
author | Arjan van de Ven <arjan@linux.intel.com> | 2007-02-12 03:55:34 -0500 |
---|---|---|
committer | Linus Torvalds <torvalds@woody.linux-foundation.org> | 2007-02-12 12:48:45 -0500 |
commit | 00977a59b951207d38380c75f03a36829950265c (patch) | |
tree | 26933feafebffca95df02c19df03f5e56aada47e /fs/proc/base.c | |
parent | d54b1fdb1d9f82e375a299e22bd366aad52d4c34 (diff) |
[PATCH] mark struct file_operations const 6
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 'fs/proc/base.c')
-rw-r--r-- | fs/proc/base.c | 32 |
1 files changed, 16 insertions, 16 deletions
diff --git a/fs/proc/base.c b/fs/proc/base.c index 7fb37d6f2864..7b1ded63fa63 100644 --- a/fs/proc/base.c +++ b/fs/proc/base.c | |||
@@ -94,7 +94,7 @@ struct pid_entry { | |||
94 | char *name; | 94 | char *name; |
95 | mode_t mode; | 95 | mode_t mode; |
96 | struct inode_operations *iop; | 96 | struct inode_operations *iop; |
97 | struct file_operations *fop; | 97 | const struct file_operations *fop; |
98 | union proc_op op; | 98 | union proc_op op; |
99 | }; | 99 | }; |
100 | 100 | ||
@@ -424,7 +424,7 @@ static unsigned mounts_poll(struct file *file, poll_table *wait) | |||
424 | return res; | 424 | return res; |
425 | } | 425 | } |
426 | 426 | ||
427 | static struct file_operations proc_mounts_operations = { | 427 | static const struct file_operations proc_mounts_operations = { |
428 | .open = mounts_open, | 428 | .open = mounts_open, |
429 | .read = seq_read, | 429 | .read = seq_read, |
430 | .llseek = seq_lseek, | 430 | .llseek = seq_lseek, |
@@ -462,7 +462,7 @@ static int mountstats_open(struct inode *inode, struct file *file) | |||
462 | return ret; | 462 | return ret; |
463 | } | 463 | } |
464 | 464 | ||
465 | static struct file_operations proc_mountstats_operations = { | 465 | static const struct file_operations proc_mountstats_operations = { |
466 | .open = mountstats_open, | 466 | .open = mountstats_open, |
467 | .read = seq_read, | 467 | .read = seq_read, |
468 | .llseek = seq_lseek, | 468 | .llseek = seq_lseek, |
@@ -501,7 +501,7 @@ out_no_task: | |||
501 | return length; | 501 | return length; |
502 | } | 502 | } |
503 | 503 | ||
504 | static struct file_operations proc_info_file_operations = { | 504 | static const struct file_operations proc_info_file_operations = { |
505 | .read = proc_info_read, | 505 | .read = proc_info_read, |
506 | }; | 506 | }; |
507 | 507 | ||
@@ -646,7 +646,7 @@ static loff_t mem_lseek(struct file * file, loff_t offset, int orig) | |||
646 | return file->f_pos; | 646 | return file->f_pos; |
647 | } | 647 | } |
648 | 648 | ||
649 | static struct file_operations proc_mem_operations = { | 649 | static const struct file_operations proc_mem_operations = { |
650 | .llseek = mem_lseek, | 650 | .llseek = mem_lseek, |
651 | .read = mem_read, | 651 | .read = mem_read, |
652 | .write = mem_write, | 652 | .write = mem_write, |
@@ -710,7 +710,7 @@ static ssize_t oom_adjust_write(struct file *file, const char __user *buf, | |||
710 | return end - buffer; | 710 | return end - buffer; |
711 | } | 711 | } |
712 | 712 | ||
713 | static struct file_operations proc_oom_adjust_operations = { | 713 | static const struct file_operations proc_oom_adjust_operations = { |
714 | .read = oom_adjust_read, | 714 | .read = oom_adjust_read, |
715 | .write = oom_adjust_write, | 715 | .write = oom_adjust_write, |
716 | }; | 716 | }; |
@@ -777,7 +777,7 @@ out_free_page: | |||
777 | return length; | 777 | return length; |
778 | } | 778 | } |
779 | 779 | ||
780 | static struct file_operations proc_loginuid_operations = { | 780 | static const struct file_operations proc_loginuid_operations = { |
781 | .read = proc_loginuid_read, | 781 | .read = proc_loginuid_read, |
782 | .write = proc_loginuid_write, | 782 | .write = proc_loginuid_write, |
783 | }; | 783 | }; |
@@ -849,7 +849,7 @@ out_no_task: | |||
849 | return result; | 849 | return result; |
850 | } | 850 | } |
851 | 851 | ||
852 | static struct file_operations proc_seccomp_operations = { | 852 | static const struct file_operations proc_seccomp_operations = { |
853 | .read = seccomp_read, | 853 | .read = seccomp_read, |
854 | .write = seccomp_write, | 854 | .write = seccomp_write, |
855 | }; | 855 | }; |
@@ -908,7 +908,7 @@ static ssize_t proc_fault_inject_write(struct file * file, | |||
908 | return end - buffer; | 908 | return end - buffer; |
909 | } | 909 | } |
910 | 910 | ||
911 | static struct file_operations proc_fault_inject_operations = { | 911 | static const struct file_operations proc_fault_inject_operations = { |
912 | .read = proc_fault_inject_read, | 912 | .read = proc_fault_inject_read, |
913 | .write = proc_fault_inject_write, | 913 | .write = proc_fault_inject_write, |
914 | }; | 914 | }; |
@@ -1408,7 +1408,7 @@ out_no_task: | |||
1408 | return retval; | 1408 | return retval; |
1409 | } | 1409 | } |
1410 | 1410 | ||
1411 | static struct file_operations proc_fd_operations = { | 1411 | static const struct file_operations proc_fd_operations = { |
1412 | .read = generic_read_dir, | 1412 | .read = generic_read_dir, |
1413 | .readdir = proc_readfd, | 1413 | .readdir = proc_readfd, |
1414 | }; | 1414 | }; |
@@ -1623,7 +1623,7 @@ out_no_task: | |||
1623 | return length; | 1623 | return length; |
1624 | } | 1624 | } |
1625 | 1625 | ||
1626 | static struct file_operations proc_pid_attr_operations = { | 1626 | static const struct file_operations proc_pid_attr_operations = { |
1627 | .read = proc_pid_attr_read, | 1627 | .read = proc_pid_attr_read, |
1628 | .write = proc_pid_attr_write, | 1628 | .write = proc_pid_attr_write, |
1629 | }; | 1629 | }; |
@@ -1644,7 +1644,7 @@ static int proc_attr_dir_readdir(struct file * filp, | |||
1644 | attr_dir_stuff,ARRAY_SIZE(attr_dir_stuff)); | 1644 | attr_dir_stuff,ARRAY_SIZE(attr_dir_stuff)); |
1645 | } | 1645 | } |
1646 | 1646 | ||
1647 | static struct file_operations proc_attr_dir_operations = { | 1647 | static const struct file_operations proc_attr_dir_operations = { |
1648 | .read = generic_read_dir, | 1648 | .read = generic_read_dir, |
1649 | .readdir = proc_attr_dir_readdir, | 1649 | .readdir = proc_attr_dir_readdir, |
1650 | }; | 1650 | }; |
@@ -1834,7 +1834,7 @@ static int proc_pid_io_accounting(struct task_struct *task, char *buffer) | |||
1834 | /* | 1834 | /* |
1835 | * Thread groups | 1835 | * Thread groups |
1836 | */ | 1836 | */ |
1837 | static struct file_operations proc_task_operations; | 1837 | static const struct file_operations proc_task_operations; |
1838 | static struct inode_operations proc_task_inode_operations; | 1838 | static struct inode_operations proc_task_inode_operations; |
1839 | 1839 | ||
1840 | static struct pid_entry tgid_base_stuff[] = { | 1840 | static struct pid_entry tgid_base_stuff[] = { |
@@ -1894,7 +1894,7 @@ static int proc_tgid_base_readdir(struct file * filp, | |||
1894 | tgid_base_stuff,ARRAY_SIZE(tgid_base_stuff)); | 1894 | tgid_base_stuff,ARRAY_SIZE(tgid_base_stuff)); |
1895 | } | 1895 | } |
1896 | 1896 | ||
1897 | static struct file_operations proc_tgid_base_operations = { | 1897 | static const struct file_operations proc_tgid_base_operations = { |
1898 | .read = generic_read_dir, | 1898 | .read = generic_read_dir, |
1899 | .readdir = proc_tgid_base_readdir, | 1899 | .readdir = proc_tgid_base_readdir, |
1900 | }; | 1900 | }; |
@@ -2177,7 +2177,7 @@ static struct dentry *proc_tid_base_lookup(struct inode *dir, struct dentry *den | |||
2177 | tid_base_stuff, ARRAY_SIZE(tid_base_stuff)); | 2177 | tid_base_stuff, ARRAY_SIZE(tid_base_stuff)); |
2178 | } | 2178 | } |
2179 | 2179 | ||
2180 | static struct file_operations proc_tid_base_operations = { | 2180 | static const struct file_operations proc_tid_base_operations = { |
2181 | .read = generic_read_dir, | 2181 | .read = generic_read_dir, |
2182 | .readdir = proc_tid_base_readdir, | 2182 | .readdir = proc_tid_base_readdir, |
2183 | }; | 2183 | }; |
@@ -2414,7 +2414,7 @@ static struct inode_operations proc_task_inode_operations = { | |||
2414 | .setattr = proc_setattr, | 2414 | .setattr = proc_setattr, |
2415 | }; | 2415 | }; |
2416 | 2416 | ||
2417 | static struct file_operations proc_task_operations = { | 2417 | static const struct file_operations proc_task_operations = { |
2418 | .read = generic_read_dir, | 2418 | .read = generic_read_dir, |
2419 | .readdir = proc_task_readdir, | 2419 | .readdir = proc_task_readdir, |
2420 | }; | 2420 | }; |