aboutsummaryrefslogtreecommitdiffstats
path: root/fs/proc
diff options
context:
space:
mode:
Diffstat (limited to 'fs/proc')
-rw-r--r--fs/proc/array.c2
-rw-r--r--fs/proc/base.c56
-rw-r--r--fs/proc/generic.c10
-rw-r--r--fs/proc/inode.c2
-rw-r--r--fs/proc/internal.h12
-rw-r--r--fs/proc/nommu.c2
-rw-r--r--fs/proc/proc_misc.c54
-rw-r--r--fs/proc/proc_tty.c2
-rw-r--r--fs/proc/root.c4
-rw-r--r--fs/proc/task_mmu.c6
-rw-r--r--fs/proc/task_nommu.c2
11 files changed, 78 insertions, 74 deletions
diff --git a/fs/proc/array.c b/fs/proc/array.c
index 70e4fab117b1..07c9cdbcdcac 100644
--- a/fs/proc/array.c
+++ b/fs/proc/array.c
@@ -351,7 +351,7 @@ static int do_task_stat(struct task_struct *task, char * buffer, int whole)
351 struct signal_struct *sig = task->signal; 351 struct signal_struct *sig = task->signal;
352 352
353 if (sig->tty) { 353 if (sig->tty) {
354 tty_pgrp = sig->tty->pgrp; 354 tty_pgrp = pid_nr(sig->tty->pgrp);
355 tty_nr = new_encode_dev(tty_devnum(sig->tty)); 355 tty_nr = new_encode_dev(tty_devnum(sig->tty));
356 } 356 }
357 357
diff --git a/fs/proc/base.c b/fs/proc/base.c
index 1a979ea3b379..4f5745af8c19 100644
--- a/fs/proc/base.c
+++ b/fs/proc/base.c
@@ -93,8 +93,8 @@ struct pid_entry {
93 int len; 93 int len;
94 char *name; 94 char *name;
95 mode_t mode; 95 mode_t mode;
96 struct inode_operations *iop; 96 const 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
@@ -352,7 +352,7 @@ static int proc_setattr(struct dentry *dentry, struct iattr *attr)
352 return error; 352 return error;
353} 353}
354 354
355static struct inode_operations proc_def_inode_operations = { 355static const struct inode_operations proc_def_inode_operations = {
356 .setattr = proc_setattr, 356 .setattr = proc_setattr,
357}; 357};
358 358
@@ -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};
@@ -980,7 +980,7 @@ out:
980 return error; 980 return error;
981} 981}
982 982
983static struct inode_operations proc_pid_link_inode_operations = { 983static const struct inode_operations proc_pid_link_inode_operations = {
984 .readlink = proc_pid_readlink, 984 .readlink = proc_pid_readlink,
985 .follow_link = proc_pid_follow_link, 985 .follow_link = proc_pid_follow_link,
986 .setattr = proc_setattr, 986 .setattr = proc_setattr,
@@ -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};
@@ -1416,7 +1416,7 @@ static struct file_operations proc_fd_operations = {
1416/* 1416/*
1417 * proc directories can do almost nothing.. 1417 * proc directories can do almost nothing..
1418 */ 1418 */
1419static struct inode_operations proc_fd_inode_operations = { 1419static const struct inode_operations proc_fd_inode_operations = {
1420 .lookup = proc_lookupfd, 1420 .lookup = proc_lookupfd,
1421 .setattr = proc_setattr, 1421 .setattr = proc_setattr,
1422}; 1422};
@@ -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};
@@ -1656,7 +1656,7 @@ static struct dentry *proc_attr_dir_lookup(struct inode *dir,
1656 attr_dir_stuff, ARRAY_SIZE(attr_dir_stuff)); 1656 attr_dir_stuff, ARRAY_SIZE(attr_dir_stuff));
1657} 1657}
1658 1658
1659static struct inode_operations proc_attr_dir_inode_operations = { 1659static const struct inode_operations proc_attr_dir_inode_operations = {
1660 .lookup = proc_attr_dir_lookup, 1660 .lookup = proc_attr_dir_lookup,
1661 .getattr = pid_getattr, 1661 .getattr = pid_getattr,
1662 .setattr = proc_setattr, 1662 .setattr = proc_setattr,
@@ -1682,7 +1682,7 @@ static void *proc_self_follow_link(struct dentry *dentry, struct nameidata *nd)
1682 return ERR_PTR(vfs_follow_link(nd,tmp)); 1682 return ERR_PTR(vfs_follow_link(nd,tmp));
1683} 1683}
1684 1684
1685static struct inode_operations proc_self_inode_operations = { 1685static const struct inode_operations proc_self_inode_operations = {
1686 .readlink = proc_self_readlink, 1686 .readlink = proc_self_readlink,
1687 .follow_link = proc_self_follow_link, 1687 .follow_link = proc_self_follow_link,
1688}; 1688};
@@ -1810,17 +1810,21 @@ static int proc_base_fill_cache(struct file *filp, void *dirent, filldir_t filld
1810static int proc_pid_io_accounting(struct task_struct *task, char *buffer) 1810static int proc_pid_io_accounting(struct task_struct *task, char *buffer)
1811{ 1811{
1812 return sprintf(buffer, 1812 return sprintf(buffer,
1813#ifdef CONFIG_TASK_XACCT
1813 "rchar: %llu\n" 1814 "rchar: %llu\n"
1814 "wchar: %llu\n" 1815 "wchar: %llu\n"
1815 "syscr: %llu\n" 1816 "syscr: %llu\n"
1816 "syscw: %llu\n" 1817 "syscw: %llu\n"
1818#endif
1817 "read_bytes: %llu\n" 1819 "read_bytes: %llu\n"
1818 "write_bytes: %llu\n" 1820 "write_bytes: %llu\n"
1819 "cancelled_write_bytes: %llu\n", 1821 "cancelled_write_bytes: %llu\n",
1822#ifdef CONFIG_TASK_XACCT
1820 (unsigned long long)task->rchar, 1823 (unsigned long long)task->rchar,
1821 (unsigned long long)task->wchar, 1824 (unsigned long long)task->wchar,
1822 (unsigned long long)task->syscr, 1825 (unsigned long long)task->syscr,
1823 (unsigned long long)task->syscw, 1826 (unsigned long long)task->syscw,
1827#endif
1824 (unsigned long long)task->ioac.read_bytes, 1828 (unsigned long long)task->ioac.read_bytes,
1825 (unsigned long long)task->ioac.write_bytes, 1829 (unsigned long long)task->ioac.write_bytes,
1826 (unsigned long long)task->ioac.cancelled_write_bytes); 1830 (unsigned long long)task->ioac.cancelled_write_bytes);
@@ -1830,8 +1834,8 @@ static int proc_pid_io_accounting(struct task_struct *task, char *buffer)
1830/* 1834/*
1831 * Thread groups 1835 * Thread groups
1832 */ 1836 */
1833static struct file_operations proc_task_operations; 1837static const struct file_operations proc_task_operations;
1834static struct inode_operations proc_task_inode_operations; 1838static const struct inode_operations proc_task_inode_operations;
1835 1839
1836static struct pid_entry tgid_base_stuff[] = { 1840static struct pid_entry tgid_base_stuff[] = {
1837 DIR("task", S_IRUGO|S_IXUGO, task), 1841 DIR("task", S_IRUGO|S_IXUGO, task),
@@ -1890,7 +1894,7 @@ static int proc_tgid_base_readdir(struct file * filp,
1890 tgid_base_stuff,ARRAY_SIZE(tgid_base_stuff)); 1894 tgid_base_stuff,ARRAY_SIZE(tgid_base_stuff));
1891} 1895}
1892 1896
1893static struct file_operations proc_tgid_base_operations = { 1897static const struct file_operations proc_tgid_base_operations = {
1894 .read = generic_read_dir, 1898 .read = generic_read_dir,
1895 .readdir = proc_tgid_base_readdir, 1899 .readdir = proc_tgid_base_readdir,
1896}; 1900};
@@ -1900,7 +1904,7 @@ static struct dentry *proc_tgid_base_lookup(struct inode *dir, struct dentry *de
1900 tgid_base_stuff, ARRAY_SIZE(tgid_base_stuff)); 1904 tgid_base_stuff, ARRAY_SIZE(tgid_base_stuff));
1901} 1905}
1902 1906
1903static struct inode_operations proc_tgid_base_inode_operations = { 1907static const struct inode_operations proc_tgid_base_inode_operations = {
1904 .lookup = proc_tgid_base_lookup, 1908 .lookup = proc_tgid_base_lookup,
1905 .getattr = pid_getattr, 1909 .getattr = pid_getattr,
1906 .setattr = proc_setattr, 1910 .setattr = proc_setattr,
@@ -2173,12 +2177,12 @@ static struct dentry *proc_tid_base_lookup(struct inode *dir, struct dentry *den
2173 tid_base_stuff, ARRAY_SIZE(tid_base_stuff)); 2177 tid_base_stuff, ARRAY_SIZE(tid_base_stuff));
2174} 2178}
2175 2179
2176static struct file_operations proc_tid_base_operations = { 2180static const struct file_operations proc_tid_base_operations = {
2177 .read = generic_read_dir, 2181 .read = generic_read_dir,
2178 .readdir = proc_tid_base_readdir, 2182 .readdir = proc_tid_base_readdir,
2179}; 2183};
2180 2184
2181static struct inode_operations proc_tid_base_inode_operations = { 2185static const struct inode_operations proc_tid_base_inode_operations = {
2182 .lookup = proc_tid_base_lookup, 2186 .lookup = proc_tid_base_lookup,
2183 .getattr = pid_getattr, 2187 .getattr = pid_getattr,
2184 .setattr = proc_setattr, 2188 .setattr = proc_setattr,
@@ -2404,13 +2408,13 @@ static int proc_task_getattr(struct vfsmount *mnt, struct dentry *dentry, struct
2404 return 0; 2408 return 0;
2405} 2409}
2406 2410
2407static struct inode_operations proc_task_inode_operations = { 2411static const struct inode_operations proc_task_inode_operations = {
2408 .lookup = proc_task_lookup, 2412 .lookup = proc_task_lookup,
2409 .getattr = proc_task_getattr, 2413 .getattr = proc_task_getattr,
2410 .setattr = proc_setattr, 2414 .setattr = proc_setattr,
2411}; 2415};
2412 2416
2413static struct file_operations proc_task_operations = { 2417static const struct file_operations proc_task_operations = {
2414 .read = generic_read_dir, 2418 .read = generic_read_dir,
2415 .readdir = proc_task_readdir, 2419 .readdir = proc_task_readdir,
2416}; 2420};
diff --git a/fs/proc/generic.c b/fs/proc/generic.c
index 853cb877d5f3..0cdc00d9d97e 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,
@@ -265,7 +265,7 @@ static int proc_getattr(struct vfsmount *mnt, struct dentry *dentry,
265 return 0; 265 return 0;
266} 266}
267 267
268static struct inode_operations proc_file_inode_operations = { 268static const struct inode_operations proc_file_inode_operations = {
269 .setattr = proc_notify_change, 269 .setattr = proc_notify_change,
270}; 270};
271 271
@@ -357,7 +357,7 @@ static void *proc_follow_link(struct dentry *dentry, struct nameidata *nd)
357 return NULL; 357 return NULL;
358} 358}
359 359
360static struct inode_operations proc_link_inode_operations = { 360static const struct inode_operations proc_link_inode_operations = {
361 .readlink = generic_readlink, 361 .readlink = generic_readlink,
362 .follow_link = proc_follow_link, 362 .follow_link = proc_follow_link,
363}; 363};
@@ -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};
@@ -505,7 +505,7 @@ static struct file_operations proc_dir_operations = {
505/* 505/*
506 * proc directories can do almost nothing.. 506 * proc directories can do almost nothing..
507 */ 507 */
508static struct inode_operations proc_dir_inode_operations = { 508static const struct inode_operations proc_dir_inode_operations = {
509 .lookup = proc_lookup, 509 .lookup = proc_lookup,
510 .getattr = proc_getattr, 510 .getattr = proc_getattr,
511 .setattr = proc_notify_change, 511 .setattr = proc_notify_change,
diff --git a/fs/proc/inode.c b/fs/proc/inode.c
index e26945ba685b..f6722be37dde 100644
--- a/fs/proc/inode.c
+++ b/fs/proc/inode.c
@@ -132,7 +132,7 @@ static int proc_remount(struct super_block *sb, int *flags, char *data)
132 return 0; 132 return 0;
133} 133}
134 134
135static struct super_operations proc_sops = { 135static const struct super_operations proc_sops = {
136 .alloc_inode = proc_alloc_inode, 136 .alloc_inode = proc_alloc_inode,
137 .destroy_inode = proc_destroy_inode, 137 .destroy_inode = proc_destroy_inode,
138 .read_inode = proc_read_inode, 138 .read_inode = proc_read_inode,
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 b37ce33f67ea..e2c4c0a5c90d 100644
--- a/fs/proc/proc_misc.c
+++ b/fs/proc/proc_misc.c
@@ -121,16 +121,11 @@ static int meminfo_read_proc(char *page, char **start, off_t off,
121{ 121{
122 struct sysinfo i; 122 struct sysinfo i;
123 int len; 123 int len;
124 unsigned long inactive;
125 unsigned long active;
126 unsigned long free;
127 unsigned long committed; 124 unsigned long committed;
128 unsigned long allowed; 125 unsigned long allowed;
129 struct vmalloc_info vmi; 126 struct vmalloc_info vmi;
130 long cached; 127 long cached;
131 128
132 get_zone_counts(&active, &inactive, &free);
133
134/* 129/*
135 * display in kilobytes. 130 * display in kilobytes.
136 */ 131 */
@@ -187,8 +182,8 @@ static int meminfo_read_proc(char *page, char **start, off_t off,
187 K(i.bufferram), 182 K(i.bufferram),
188 K(cached), 183 K(cached),
189 K(total_swapcache_pages), 184 K(total_swapcache_pages),
190 K(active), 185 K(global_page_state(NR_ACTIVE)),
191 K(inactive), 186 K(global_page_state(NR_INACTIVE)),
192#ifdef CONFIG_HIGHMEM 187#ifdef CONFIG_HIGHMEM
193 K(i.totalhigh), 188 K(i.totalhigh),
194 K(i.freehigh), 189 K(i.freehigh),
@@ -228,7 +223,7 @@ static int fragmentation_open(struct inode *inode, struct file *file)
228 return seq_open(file, &fragmentation_op); 223 return seq_open(file, &fragmentation_op);
229} 224}
230 225
231static struct file_operations fragmentation_file_operations = { 226static const struct file_operations fragmentation_file_operations = {
232 .open = fragmentation_open, 227 .open = fragmentation_open,
233 .read = seq_read, 228 .read = seq_read,
234 .llseek = seq_lseek, 229 .llseek = seq_lseek,
@@ -241,7 +236,7 @@ static int zoneinfo_open(struct inode *inode, struct file *file)
241 return seq_open(file, &zoneinfo_op); 236 return seq_open(file, &zoneinfo_op);
242} 237}
243 238
244static struct file_operations proc_zoneinfo_file_operations = { 239static const struct file_operations proc_zoneinfo_file_operations = {
245 .open = zoneinfo_open, 240 .open = zoneinfo_open,
246 .read = seq_read, 241 .read = seq_read,
247 .llseek = seq_lseek, 242 .llseek = seq_lseek,
@@ -266,7 +261,7 @@ static int cpuinfo_open(struct inode *inode, struct file *file)
266 return seq_open(file, &cpuinfo_op); 261 return seq_open(file, &cpuinfo_op);
267} 262}
268 263
269static struct file_operations proc_cpuinfo_operations = { 264static const struct file_operations proc_cpuinfo_operations = {
270 .open = cpuinfo_open, 265 .open = cpuinfo_open,
271 .read = seq_read, 266 .read = seq_read,
272 .llseek = seq_lseek, 267 .llseek = seq_lseek,
@@ -325,7 +320,7 @@ static int devinfo_open(struct inode *inode, struct file *filp)
325 return seq_open(filp, &devinfo_ops); 320 return seq_open(filp, &devinfo_ops);
326} 321}
327 322
328static struct file_operations proc_devinfo_operations = { 323static const struct file_operations proc_devinfo_operations = {
329 .open = devinfo_open, 324 .open = devinfo_open,
330 .read = seq_read, 325 .read = seq_read,
331 .llseek = seq_lseek, 326 .llseek = seq_lseek,
@@ -337,7 +332,7 @@ static int vmstat_open(struct inode *inode, struct file *file)
337{ 332{
338 return seq_open(file, &vmstat_op); 333 return seq_open(file, &vmstat_op);
339} 334}
340static struct file_operations proc_vmstat_file_operations = { 335static const struct file_operations proc_vmstat_file_operations = {
341 .open = vmstat_open, 336 .open = vmstat_open,
342 .read = seq_read, 337 .read = seq_read,
343 .llseek = seq_lseek, 338 .llseek = seq_lseek,
@@ -368,7 +363,7 @@ static int partitions_open(struct inode *inode, struct file *file)
368{ 363{
369 return seq_open(file, &partitions_op); 364 return seq_open(file, &partitions_op);
370} 365}
371static struct file_operations proc_partitions_operations = { 366static const struct file_operations proc_partitions_operations = {
372 .open = partitions_open, 367 .open = partitions_open,
373 .read = seq_read, 368 .read = seq_read,
374 .llseek = seq_lseek, 369 .llseek = seq_lseek,
@@ -380,7 +375,7 @@ static int diskstats_open(struct inode *inode, struct file *file)
380{ 375{
381 return seq_open(file, &diskstats_op); 376 return seq_open(file, &diskstats_op);
382} 377}
383static struct file_operations proc_diskstats_operations = { 378static const struct file_operations proc_diskstats_operations = {
384 .open = diskstats_open, 379 .open = diskstats_open,
385 .read = seq_read, 380 .read = seq_read,
386 .llseek = seq_lseek, 381 .llseek = seq_lseek,
@@ -394,7 +389,7 @@ static int modules_open(struct inode *inode, struct file *file)
394{ 389{
395 return seq_open(file, &modules_op); 390 return seq_open(file, &modules_op);
396} 391}
397static struct file_operations proc_modules_operations = { 392static const struct file_operations proc_modules_operations = {
398 .open = modules_open, 393 .open = modules_open,
399 .read = seq_read, 394 .read = seq_read,
400 .llseek = seq_lseek, 395 .llseek = seq_lseek,
@@ -409,7 +404,7 @@ static int slabinfo_open(struct inode *inode, struct file *file)
409{ 404{
410 return seq_open(file, &slabinfo_op); 405 return seq_open(file, &slabinfo_op);
411} 406}
412static struct file_operations proc_slabinfo_operations = { 407static const struct file_operations proc_slabinfo_operations = {
413 .open = slabinfo_open, 408 .open = slabinfo_open,
414 .read = seq_read, 409 .read = seq_read,
415 .write = slabinfo_write, 410 .write = slabinfo_write,
@@ -443,7 +438,7 @@ static int slabstats_release(struct inode *inode, struct file *file)
443 return seq_release(inode, file); 438 return seq_release(inode, file);
444} 439}
445 440
446static struct file_operations proc_slabstats_operations = { 441static const struct file_operations proc_slabstats_operations = {
447 .open = slabstats_open, 442 .open = slabstats_open,
448 .read = seq_read, 443 .read = seq_read,
449 .llseek = seq_lseek, 444 .llseek = seq_lseek,
@@ -556,7 +551,7 @@ static int stat_open(struct inode *inode, struct file *file)
556 kfree(buf); 551 kfree(buf);
557 return res; 552 return res;
558} 553}
559static struct file_operations proc_stat_operations = { 554static const struct file_operations proc_stat_operations = {
560 .open = stat_open, 555 .open = stat_open,
561 .read = seq_read, 556 .read = seq_read,
562 .llseek = seq_lseek, 557 .llseek = seq_lseek,
@@ -598,7 +593,7 @@ static int interrupts_open(struct inode *inode, struct file *filp)
598 return seq_open(filp, &int_seq_ops); 593 return seq_open(filp, &int_seq_ops);
599} 594}
600 595
601static struct file_operations proc_interrupts_operations = { 596static const struct file_operations proc_interrupts_operations = {
602 .open = interrupts_open, 597 .open = interrupts_open,
603 .read = seq_read, 598 .read = seq_read,
604 .llseek = seq_lseek, 599 .llseek = seq_lseek,
@@ -655,7 +650,7 @@ static ssize_t write_sysrq_trigger(struct file *file, const char __user *buf,
655 return count; 650 return count;
656} 651}
657 652
658static struct file_operations proc_sysrq_trigger_operations = { 653static const struct file_operations proc_sysrq_trigger_operations = {
659 .write = write_sysrq_trigger, 654 .write = write_sysrq_trigger,
660}; 655};
661#endif 656#endif
@@ -672,7 +667,6 @@ void create_seq_entry(char *name, mode_t mode, const struct file_operations *f)
672 667
673void __init proc_misc_init(void) 668void __init proc_misc_init(void)
674{ 669{
675 struct proc_dir_entry *entry;
676 static struct { 670 static struct {
677 char *name; 671 char *name;
678 int (*read_proc)(char*,char**,off_t,int,int*,void*); 672 int (*read_proc)(char*,char**,off_t,int,int*,void*);
@@ -700,9 +694,12 @@ void __init proc_misc_init(void)
700 694
701 /* And now for trickier ones */ 695 /* And now for trickier ones */
702#ifdef CONFIG_PRINTK 696#ifdef CONFIG_PRINTK
703 entry = create_proc_entry("kmsg", S_IRUSR, &proc_root); 697 {
704 if (entry) 698 struct proc_dir_entry *entry;
705 entry->proc_fops = &proc_kmsg_operations; 699 entry = create_proc_entry("kmsg", S_IRUSR, &proc_root);
700 if (entry)
701 entry->proc_fops = &proc_kmsg_operations;
702 }
706#endif 703#endif
707 create_seq_entry("devices", 0, &proc_devinfo_operations); 704 create_seq_entry("devices", 0, &proc_devinfo_operations);
708 create_seq_entry("cpuinfo", 0, &proc_cpuinfo_operations); 705 create_seq_entry("cpuinfo", 0, &proc_cpuinfo_operations);
@@ -743,8 +740,11 @@ void __init proc_misc_init(void)
743 proc_vmcore->proc_fops = &proc_vmcore_operations; 740 proc_vmcore->proc_fops = &proc_vmcore_operations;
744#endif 741#endif
745#ifdef CONFIG_MAGIC_SYSRQ 742#ifdef CONFIG_MAGIC_SYSRQ
746 entry = create_proc_entry("sysrq-trigger", S_IWUSR, NULL); 743 {
747 if (entry) 744 struct proc_dir_entry *entry;
748 entry->proc_fops = &proc_sysrq_trigger_operations; 745 entry = create_proc_entry("sysrq-trigger", S_IWUSR, NULL);
746 if (entry)
747 entry->proc_fops = &proc_sysrq_trigger_operations;
748 }
749#endif 749#endif
750} 750}
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..af154458b540 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};
@@ -144,7 +144,7 @@ static struct file_operations proc_root_operations = {
144/* 144/*
145 * proc root can do almost nothing.. 145 * proc root can do almost nothing..
146 */ 146 */
147static struct inode_operations proc_root_inode_operations = { 147static const struct inode_operations proc_root_inode_operations = {
148 .lookup = proc_root_lookup, 148 .lookup = proc_root_lookup,
149 .getattr = proc_root_getattr, 149 .getattr = proc_root_getattr,
150}; 150};
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,