diff options
Diffstat (limited to 'fs/proc/base.c')
-rw-r--r-- | fs/proc/base.c | 56 |
1 files changed, 30 insertions, 26 deletions
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 | ||
355 | static struct inode_operations proc_def_inode_operations = { | 355 | static 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 | ||
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 | }; |
@@ -980,7 +980,7 @@ out: | |||
980 | return error; | 980 | return error; |
981 | } | 981 | } |
982 | 982 | ||
983 | static struct inode_operations proc_pid_link_inode_operations = { | 983 | static 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 | ||
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 | }; |
@@ -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 | */ |
1419 | static struct inode_operations proc_fd_inode_operations = { | 1419 | static 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 | ||
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 | }; |
@@ -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 | ||
1659 | static struct inode_operations proc_attr_dir_inode_operations = { | 1659 | static 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 | ||
1685 | static struct inode_operations proc_self_inode_operations = { | 1685 | static 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 | |||
1810 | static int proc_pid_io_accounting(struct task_struct *task, char *buffer) | 1810 | static 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 | */ |
1833 | static struct file_operations proc_task_operations; | 1837 | static const struct file_operations proc_task_operations; |
1834 | static struct inode_operations proc_task_inode_operations; | 1838 | static const struct inode_operations proc_task_inode_operations; |
1835 | 1839 | ||
1836 | static struct pid_entry tgid_base_stuff[] = { | 1840 | static 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 | ||
1893 | static struct file_operations proc_tgid_base_operations = { | 1897 | static 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 | ||
1903 | static struct inode_operations proc_tgid_base_inode_operations = { | 1907 | static 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 | ||
2176 | static struct file_operations proc_tid_base_operations = { | 2180 | static 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 | ||
2181 | static struct inode_operations proc_tid_base_inode_operations = { | 2185 | static 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 | ||
2407 | static struct inode_operations proc_task_inode_operations = { | 2411 | static 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 | ||
2413 | static struct file_operations proc_task_operations = { | 2417 | static 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 | }; |