aboutsummaryrefslogtreecommitdiffstats
path: root/fs/proc
diff options
context:
space:
mode:
authorArjan van de Ven <arjan@linux.intel.com>2007-02-12 03:55:34 -0500
committerLinus Torvalds <torvalds@woody.linux-foundation.org>2007-02-12 12:48:45 -0500
commit00977a59b951207d38380c75f03a36829950265c (patch)
tree26933feafebffca95df02c19df03f5e56aada47e /fs/proc
parentd54b1fdb1d9f82e375a299e22bd366aad52d4c34 (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')
-rw-r--r--fs/proc/base.c32
-rw-r--r--fs/proc/generic.c4
-rw-r--r--fs/proc/internal.h12
-rw-r--r--fs/proc/nommu.c2
-rw-r--r--fs/proc/proc_misc.c26
-rw-r--r--fs/proc/proc_tty.c2
-rw-r--r--fs/proc/root.c2
-rw-r--r--fs/proc/task_mmu.c6
-rw-r--r--fs/proc/task_nommu.c2
9 files changed, 44 insertions, 44 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
427static struct file_operations proc_mounts_operations = { 427static 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
465static struct file_operations proc_mountstats_operations = { 465static 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
504static struct file_operations proc_info_file_operations = { 504static 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
649static struct file_operations proc_mem_operations = { 649static 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
713static struct file_operations proc_oom_adjust_operations = { 713static 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
780static struct file_operations proc_loginuid_operations = { 780static 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
852static struct file_operations proc_seccomp_operations = { 852static 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
911static struct file_operations proc_fault_inject_operations = { 911static 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
1411static struct file_operations proc_fd_operations = { 1411static 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
1626static struct file_operations proc_pid_attr_operations = { 1626static 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
1647static struct file_operations proc_attr_dir_operations = { 1647static 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 */
1837static struct file_operations proc_task_operations; 1837static const struct file_operations proc_task_operations;
1838static struct inode_operations proc_task_inode_operations; 1838static struct inode_operations proc_task_inode_operations;
1839 1839
1840static struct pid_entry tgid_base_stuff[] = { 1840static 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
1897static struct file_operations proc_tgid_base_operations = { 1897static 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
2180static struct file_operations proc_tid_base_operations = { 2180static 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
2417static struct file_operations proc_task_operations = { 2417static 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};
diff --git a/fs/proc/generic.c b/fs/proc/generic.c
index 853cb877d5f3..aa52f1080e62 100644
--- a/fs/proc/generic.c
+++ b/fs/proc/generic.c
@@ -39,7 +39,7 @@ int proc_match(int len, const char *name, struct proc_dir_entry *de)
39 return !memcmp(name, de->name, len); 39 return !memcmp(name, de->name, len);
40} 40}
41 41
42static struct file_operations proc_file_operations = { 42static const struct file_operations proc_file_operations = {
43 .llseek = proc_file_lseek, 43 .llseek = proc_file_lseek,
44 .read = proc_file_read, 44 .read = proc_file_read,
45 .write = proc_file_write, 45 .write = proc_file_write,
@@ -497,7 +497,7 @@ out: unlock_kernel();
497 * use the in-memory "struct proc_dir_entry" tree to parse 497 * use the in-memory "struct proc_dir_entry" tree to parse
498 * the /proc directory. 498 * the /proc directory.
499 */ 499 */
500static struct file_operations proc_dir_operations = { 500static const struct file_operations proc_dir_operations = {
501 .read = generic_read_dir, 501 .read = generic_read_dir,
502 .readdir = proc_readdir, 502 .readdir = proc_readdir,
503}; 503};
diff --git a/fs/proc/internal.h b/fs/proc/internal.h
index 987c773dbb20..277dcd66ebe2 100644
--- a/fs/proc/internal.h
+++ b/fs/proc/internal.h
@@ -38,13 +38,13 @@ extern int proc_tgid_stat(struct task_struct *, char *);
38extern int proc_pid_status(struct task_struct *, char *); 38extern int proc_pid_status(struct task_struct *, char *);
39extern int proc_pid_statm(struct task_struct *, char *); 39extern int proc_pid_statm(struct task_struct *, char *);
40 40
41extern struct file_operations proc_maps_operations; 41extern const struct file_operations proc_maps_operations;
42extern struct file_operations proc_numa_maps_operations; 42extern const struct file_operations proc_numa_maps_operations;
43extern struct file_operations proc_smaps_operations; 43extern const struct file_operations proc_smaps_operations;
44 44
45extern struct file_operations proc_maps_operations; 45extern const struct file_operations proc_maps_operations;
46extern struct file_operations proc_numa_maps_operations; 46extern const struct file_operations proc_numa_maps_operations;
47extern struct file_operations proc_smaps_operations; 47extern const struct file_operations proc_smaps_operations;
48 48
49 49
50void free_proc_entry(struct proc_dir_entry *de); 50void free_proc_entry(struct proc_dir_entry *de);
diff --git a/fs/proc/nommu.c b/fs/proc/nommu.c
index 5ec67257e5f9..22f789de3909 100644
--- a/fs/proc/nommu.c
+++ b/fs/proc/nommu.c
@@ -128,7 +128,7 @@ static int proc_nommu_vma_list_open(struct inode *inode, struct file *file)
128 return seq_open(file, &proc_nommu_vma_list_seqop); 128 return seq_open(file, &proc_nommu_vma_list_seqop);
129} 129}
130 130
131static struct file_operations proc_nommu_vma_list_operations = { 131static const struct file_operations proc_nommu_vma_list_operations = {
132 .open = proc_nommu_vma_list_open, 132 .open = proc_nommu_vma_list_open,
133 .read = seq_read, 133 .read = seq_read,
134 .llseek = seq_lseek, 134 .llseek = seq_lseek,
diff --git a/fs/proc/proc_misc.c b/fs/proc/proc_misc.c
index 5e2d4359c292..e2c4c0a5c90d 100644
--- a/fs/proc/proc_misc.c
+++ b/fs/proc/proc_misc.c
@@ -223,7 +223,7 @@ static int fragmentation_open(struct inode *inode, struct file *file)
223 return seq_open(file, &fragmentation_op); 223 return seq_open(file, &fragmentation_op);
224} 224}
225 225
226static struct file_operations fragmentation_file_operations = { 226static const struct file_operations fragmentation_file_operations = {
227 .open = fragmentation_open, 227 .open = fragmentation_open,
228 .read = seq_read, 228 .read = seq_read,
229 .llseek = seq_lseek, 229 .llseek = seq_lseek,
@@ -236,7 +236,7 @@ static int zoneinfo_open(struct inode *inode, struct file *file)
236 return seq_open(file, &zoneinfo_op); 236 return seq_open(file, &zoneinfo_op);
237} 237}
238 238
239static struct file_operations proc_zoneinfo_file_operations = { 239static const struct file_operations proc_zoneinfo_file_operations = {
240 .open = zoneinfo_open, 240 .open = zoneinfo_open,
241 .read = seq_read, 241 .read = seq_read,
242 .llseek = seq_lseek, 242 .llseek = seq_lseek,
@@ -261,7 +261,7 @@ static int cpuinfo_open(struct inode *inode, struct file *file)
261 return seq_open(file, &cpuinfo_op); 261 return seq_open(file, &cpuinfo_op);
262} 262}
263 263
264static struct file_operations proc_cpuinfo_operations = { 264static const struct file_operations proc_cpuinfo_operations = {
265 .open = cpuinfo_open, 265 .open = cpuinfo_open,
266 .read = seq_read, 266 .read = seq_read,
267 .llseek = seq_lseek, 267 .llseek = seq_lseek,
@@ -320,7 +320,7 @@ static int devinfo_open(struct inode *inode, struct file *filp)
320 return seq_open(filp, &devinfo_ops); 320 return seq_open(filp, &devinfo_ops);
321} 321}
322 322
323static struct file_operations proc_devinfo_operations = { 323static const struct file_operations proc_devinfo_operations = {
324 .open = devinfo_open, 324 .open = devinfo_open,
325 .read = seq_read, 325 .read = seq_read,
326 .llseek = seq_lseek, 326 .llseek = seq_lseek,
@@ -332,7 +332,7 @@ static int vmstat_open(struct inode *inode, struct file *file)
332{ 332{
333 return seq_open(file, &vmstat_op); 333 return seq_open(file, &vmstat_op);
334} 334}
335static struct file_operations proc_vmstat_file_operations = { 335static const struct file_operations proc_vmstat_file_operations = {
336 .open = vmstat_open, 336 .open = vmstat_open,
337 .read = seq_read, 337 .read = seq_read,
338 .llseek = seq_lseek, 338 .llseek = seq_lseek,
@@ -363,7 +363,7 @@ static int partitions_open(struct inode *inode, struct file *file)
363{ 363{
364 return seq_open(file, &partitions_op); 364 return seq_open(file, &partitions_op);
365} 365}
366static struct file_operations proc_partitions_operations = { 366static const struct file_operations proc_partitions_operations = {
367 .open = partitions_open, 367 .open = partitions_open,
368 .read = seq_read, 368 .read = seq_read,
369 .llseek = seq_lseek, 369 .llseek = seq_lseek,
@@ -375,7 +375,7 @@ static int diskstats_open(struct inode *inode, struct file *file)
375{ 375{
376 return seq_open(file, &diskstats_op); 376 return seq_open(file, &diskstats_op);
377} 377}
378static struct file_operations proc_diskstats_operations = { 378static const struct file_operations proc_diskstats_operations = {
379 .open = diskstats_open, 379 .open = diskstats_open,
380 .read = seq_read, 380 .read = seq_read,
381 .llseek = seq_lseek, 381 .llseek = seq_lseek,
@@ -389,7 +389,7 @@ static int modules_open(struct inode *inode, struct file *file)
389{ 389{
390 return seq_open(file, &modules_op); 390 return seq_open(file, &modules_op);
391} 391}
392static struct file_operations proc_modules_operations = { 392static const struct file_operations proc_modules_operations = {
393 .open = modules_open, 393 .open = modules_open,
394 .read = seq_read, 394 .read = seq_read,
395 .llseek = seq_lseek, 395 .llseek = seq_lseek,
@@ -404,7 +404,7 @@ static int slabinfo_open(struct inode *inode, struct file *file)
404{ 404{
405 return seq_open(file, &slabinfo_op); 405 return seq_open(file, &slabinfo_op);
406} 406}
407static struct file_operations proc_slabinfo_operations = { 407static const struct file_operations proc_slabinfo_operations = {
408 .open = slabinfo_open, 408 .open = slabinfo_open,
409 .read = seq_read, 409 .read = seq_read,
410 .write = slabinfo_write, 410 .write = slabinfo_write,
@@ -438,7 +438,7 @@ static int slabstats_release(struct inode *inode, struct file *file)
438 return seq_release(inode, file); 438 return seq_release(inode, file);
439} 439}
440 440
441static struct file_operations proc_slabstats_operations = { 441static const struct file_operations proc_slabstats_operations = {
442 .open = slabstats_open, 442 .open = slabstats_open,
443 .read = seq_read, 443 .read = seq_read,
444 .llseek = seq_lseek, 444 .llseek = seq_lseek,
@@ -551,7 +551,7 @@ static int stat_open(struct inode *inode, struct file *file)
551 kfree(buf); 551 kfree(buf);
552 return res; 552 return res;
553} 553}
554static struct file_operations proc_stat_operations = { 554static const struct file_operations proc_stat_operations = {
555 .open = stat_open, 555 .open = stat_open,
556 .read = seq_read, 556 .read = seq_read,
557 .llseek = seq_lseek, 557 .llseek = seq_lseek,
@@ -593,7 +593,7 @@ static int interrupts_open(struct inode *inode, struct file *filp)
593 return seq_open(filp, &int_seq_ops); 593 return seq_open(filp, &int_seq_ops);
594} 594}
595 595
596static struct file_operations proc_interrupts_operations = { 596static const struct file_operations proc_interrupts_operations = {
597 .open = interrupts_open, 597 .open = interrupts_open,
598 .read = seq_read, 598 .read = seq_read,
599 .llseek = seq_lseek, 599 .llseek = seq_lseek,
@@ -650,7 +650,7 @@ static ssize_t write_sysrq_trigger(struct file *file, const char __user *buf,
650 return count; 650 return count;
651} 651}
652 652
653static struct file_operations proc_sysrq_trigger_operations = { 653static const struct file_operations proc_sysrq_trigger_operations = {
654 .write = write_sysrq_trigger, 654 .write = write_sysrq_trigger,
655}; 655};
656#endif 656#endif
diff --git a/fs/proc/proc_tty.c b/fs/proc/proc_tty.c
index 15c4455b09eb..c1bbfbeb035e 100644
--- a/fs/proc/proc_tty.c
+++ b/fs/proc/proc_tty.c
@@ -138,7 +138,7 @@ static int tty_drivers_open(struct inode *inode, struct file *file)
138 return seq_open(file, &tty_drivers_op); 138 return seq_open(file, &tty_drivers_op);
139} 139}
140 140
141static struct file_operations proc_tty_drivers_operations = { 141static const struct file_operations proc_tty_drivers_operations = {
142 .open = tty_drivers_open, 142 .open = tty_drivers_open,
143 .read = seq_read, 143 .read = seq_read,
144 .llseek = seq_lseek, 144 .llseek = seq_lseek,
diff --git a/fs/proc/root.c b/fs/proc/root.c
index 64d242b6dcfa..81c92e967a98 100644
--- a/fs/proc/root.c
+++ b/fs/proc/root.c
@@ -136,7 +136,7 @@ static int proc_root_readdir(struct file * filp,
136 * <pid> directories. Thus we don't use the generic 136 * <pid> directories. Thus we don't use the generic
137 * directory handling functions for that.. 137 * directory handling functions for that..
138 */ 138 */
139static struct file_operations proc_root_operations = { 139static const struct file_operations proc_root_operations = {
140 .read = generic_read_dir, 140 .read = generic_read_dir,
141 .readdir = proc_root_readdir, 141 .readdir = proc_root_readdir,
142}; 142};
diff --git a/fs/proc/task_mmu.c b/fs/proc/task_mmu.c
index 55ade0d15621..7445980c8022 100644
--- a/fs/proc/task_mmu.c
+++ b/fs/proc/task_mmu.c
@@ -434,7 +434,7 @@ static int maps_open(struct inode *inode, struct file *file)
434 return do_maps_open(inode, file, &proc_pid_maps_op); 434 return do_maps_open(inode, file, &proc_pid_maps_op);
435} 435}
436 436
437struct file_operations proc_maps_operations = { 437const struct file_operations proc_maps_operations = {
438 .open = maps_open, 438 .open = maps_open,
439 .read = seq_read, 439 .read = seq_read,
440 .llseek = seq_lseek, 440 .llseek = seq_lseek,
@@ -456,7 +456,7 @@ static int numa_maps_open(struct inode *inode, struct file *file)
456 return do_maps_open(inode, file, &proc_pid_numa_maps_op); 456 return do_maps_open(inode, file, &proc_pid_numa_maps_op);
457} 457}
458 458
459struct file_operations proc_numa_maps_operations = { 459const struct file_operations proc_numa_maps_operations = {
460 .open = numa_maps_open, 460 .open = numa_maps_open,
461 .read = seq_read, 461 .read = seq_read,
462 .llseek = seq_lseek, 462 .llseek = seq_lseek,
@@ -469,7 +469,7 @@ static int smaps_open(struct inode *inode, struct file *file)
469 return do_maps_open(inode, file, &proc_pid_smaps_op); 469 return do_maps_open(inode, file, &proc_pid_smaps_op);
470} 470}
471 471
472struct file_operations proc_smaps_operations = { 472const struct file_operations proc_smaps_operations = {
473 .open = smaps_open, 473 .open = smaps_open,
474 .read = seq_read, 474 .read = seq_read,
475 .llseek = seq_lseek, 475 .llseek = seq_lseek,
diff --git a/fs/proc/task_nommu.c b/fs/proc/task_nommu.c
index fcc5caf93f55..7cddf6b8635a 100644
--- a/fs/proc/task_nommu.c
+++ b/fs/proc/task_nommu.c
@@ -220,7 +220,7 @@ static int maps_open(struct inode *inode, struct file *file)
220 return ret; 220 return ret;
221} 221}
222 222
223struct file_operations proc_maps_operations = { 223const struct file_operations proc_maps_operations = {
224 .open = maps_open, 224 .open = maps_open,
225 .read = seq_read, 225 .read = seq_read,
226 .llseek = seq_lseek, 226 .llseek = seq_lseek,