Commit 0d5c9f5f59a61cf8e98e2925cb5d81cbe7694305
Committed by
Linus Torvalds
1 parent
925d1c401f
Exists in
master
and in
7 other branches
proc: switch to proc_create()
Signed-off-by: Alexey Dobriyan <adobriyan@sw.ru> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Showing 4 changed files with 24 additions and 51 deletions Side-by-side Diff
fs/proc/internal.h
... | ... | @@ -46,8 +46,6 @@ |
46 | 46 | |
47 | 47 | extern int maps_protect; |
48 | 48 | |
49 | -extern void create_seq_entry(char *name, mode_t mode, | |
50 | - const struct file_operations *f); | |
51 | 49 | extern int proc_tid_stat(struct seq_file *m, struct pid_namespace *ns, |
52 | 50 | struct pid *pid, struct task_struct *task); |
53 | 51 | extern int proc_tgid_stat(struct seq_file *m, struct pid_namespace *ns, |
fs/proc/nommu.c
fs/proc/proc_misc.c
... | ... | @@ -826,14 +826,6 @@ |
826 | 826 | |
827 | 827 | struct proc_dir_entry *proc_root_kcore; |
828 | 828 | |
829 | -void create_seq_entry(char *name, mode_t mode, const struct file_operations *f) | |
830 | -{ | |
831 | - struct proc_dir_entry *entry; | |
832 | - entry = create_proc_entry(name, mode, NULL); | |
833 | - if (entry) | |
834 | - entry->proc_fops = f; | |
835 | -} | |
836 | - | |
837 | 829 | void __init proc_misc_init(void) |
838 | 830 | { |
839 | 831 | static struct { |
840 | 832 | |
841 | 833 | |
842 | 834 | |
843 | 835 | |
844 | 836 | |
845 | 837 | |
846 | 838 | |
847 | 839 | |
848 | 840 | |
849 | 841 | |
850 | 842 | |
851 | 843 | |
852 | 844 | |
853 | 845 | |
... | ... | @@ -862,67 +854,53 @@ |
862 | 854 | |
863 | 855 | /* And now for trickier ones */ |
864 | 856 | #ifdef CONFIG_PRINTK |
865 | - { | |
866 | - struct proc_dir_entry *entry; | |
867 | - entry = create_proc_entry("kmsg", S_IRUSR, &proc_root); | |
868 | - if (entry) | |
869 | - entry->proc_fops = &proc_kmsg_operations; | |
870 | - } | |
857 | + proc_create("kmsg", S_IRUSR, &proc_root, &proc_kmsg_operations); | |
871 | 858 | #endif |
872 | - create_seq_entry("locks", 0, &proc_locks_operations); | |
873 | - create_seq_entry("devices", 0, &proc_devinfo_operations); | |
874 | - create_seq_entry("cpuinfo", 0, &proc_cpuinfo_operations); | |
859 | + proc_create("locks", 0, NULL, &proc_locks_operations); | |
860 | + proc_create("devices", 0, NULL, &proc_devinfo_operations); | |
861 | + proc_create("cpuinfo", 0, NULL, &proc_cpuinfo_operations); | |
875 | 862 | #ifdef CONFIG_BLOCK |
876 | - create_seq_entry("partitions", 0, &proc_partitions_operations); | |
863 | + proc_create("partitions", 0, NULL, &proc_partitions_operations); | |
877 | 864 | #endif |
878 | - create_seq_entry("stat", 0, &proc_stat_operations); | |
879 | - create_seq_entry("interrupts", 0, &proc_interrupts_operations); | |
865 | + proc_create("stat", 0, NULL, &proc_stat_operations); | |
866 | + proc_create("interrupts", 0, NULL, &proc_interrupts_operations); | |
880 | 867 | #ifdef CONFIG_SLABINFO |
881 | - create_seq_entry("slabinfo",S_IWUSR|S_IRUGO,&proc_slabinfo_operations); | |
868 | + proc_create("slabinfo",S_IWUSR|S_IRUGO,NULL,&proc_slabinfo_operations); | |
882 | 869 | #ifdef CONFIG_DEBUG_SLAB_LEAK |
883 | - create_seq_entry("slab_allocators", 0 ,&proc_slabstats_operations); | |
870 | + proc_create("slab_allocators", 0, NULL, &proc_slabstats_operations); | |
884 | 871 | #endif |
885 | 872 | #endif |
886 | 873 | #ifdef CONFIG_MMU |
887 | 874 | proc_create("vmallocinfo", S_IRUSR, NULL, &proc_vmalloc_operations); |
888 | 875 | #endif |
889 | - create_seq_entry("buddyinfo",S_IRUGO, &fragmentation_file_operations); | |
890 | - create_seq_entry("pagetypeinfo", S_IRUGO, &pagetypeinfo_file_ops); | |
891 | - create_seq_entry("vmstat",S_IRUGO, &proc_vmstat_file_operations); | |
892 | - create_seq_entry("zoneinfo",S_IRUGO, &proc_zoneinfo_file_operations); | |
876 | + proc_create("buddyinfo", S_IRUGO, NULL, &fragmentation_file_operations); | |
877 | + proc_create("pagetypeinfo", S_IRUGO, NULL, &pagetypeinfo_file_ops); | |
878 | + proc_create("vmstat", S_IRUGO, NULL, &proc_vmstat_file_operations); | |
879 | + proc_create("zoneinfo", S_IRUGO, NULL, &proc_zoneinfo_file_operations); | |
893 | 880 | #ifdef CONFIG_BLOCK |
894 | - create_seq_entry("diskstats", 0, &proc_diskstats_operations); | |
881 | + proc_create("diskstats", 0, NULL, &proc_diskstats_operations); | |
895 | 882 | #endif |
896 | 883 | #ifdef CONFIG_MODULES |
897 | - create_seq_entry("modules", 0, &proc_modules_operations); | |
884 | + proc_create("modules", 0, NULL, &proc_modules_operations); | |
898 | 885 | #endif |
899 | 886 | #ifdef CONFIG_SCHEDSTATS |
900 | - create_seq_entry("schedstat", 0, &proc_schedstat_operations); | |
887 | + proc_create("schedstat", 0, NULL, &proc_schedstat_operations); | |
901 | 888 | #endif |
902 | 889 | #ifdef CONFIG_PROC_KCORE |
903 | - proc_root_kcore = create_proc_entry("kcore", S_IRUSR, NULL); | |
904 | - if (proc_root_kcore) { | |
905 | - proc_root_kcore->proc_fops = &proc_kcore_operations; | |
890 | + proc_root_kcore = proc_create("kcore", S_IRUSR, NULL, &proc_kcore_operations); | |
891 | + if (proc_root_kcore) | |
906 | 892 | proc_root_kcore->size = |
907 | 893 | (size_t)high_memory - PAGE_OFFSET + PAGE_SIZE; |
908 | - } | |
909 | 894 | #endif |
910 | 895 | #ifdef CONFIG_PROC_PAGE_MONITOR |
911 | - create_seq_entry("kpagecount", S_IRUSR, &proc_kpagecount_operations); | |
912 | - create_seq_entry("kpageflags", S_IRUSR, &proc_kpageflags_operations); | |
896 | + proc_create("kpagecount", S_IRUSR, NULL, &proc_kpagecount_operations); | |
897 | + proc_create("kpageflags", S_IRUSR, NULL, &proc_kpageflags_operations); | |
913 | 898 | #endif |
914 | 899 | #ifdef CONFIG_PROC_VMCORE |
915 | - proc_vmcore = create_proc_entry("vmcore", S_IRUSR, NULL); | |
916 | - if (proc_vmcore) | |
917 | - proc_vmcore->proc_fops = &proc_vmcore_operations; | |
900 | + proc_vmcore = proc_create("vmcore", S_IRUSR, NULL, &proc_vmcore_operations); | |
918 | 901 | #endif |
919 | 902 | #ifdef CONFIG_MAGIC_SYSRQ |
920 | - { | |
921 | - struct proc_dir_entry *entry; | |
922 | - entry = create_proc_entry("sysrq-trigger", S_IWUSR, NULL); | |
923 | - if (entry) | |
924 | - entry->proc_fops = &proc_sysrq_trigger_operations; | |
925 | - } | |
903 | + proc_create("sysrq-trigger", S_IWUSR, NULL, &proc_sysrq_trigger_operations); | |
926 | 904 | #endif |
927 | 905 | } |
fs/proc/proc_tty.c
... | ... | @@ -214,7 +214,6 @@ |
214 | 214 | */ |
215 | 215 | void __init proc_tty_init(void) |
216 | 216 | { |
217 | - struct proc_dir_entry *entry; | |
218 | 217 | if (!proc_mkdir("tty", NULL)) |
219 | 218 | return; |
220 | 219 | proc_tty_ldisc = proc_mkdir("tty/ldisc", NULL); |
... | ... | @@ -227,8 +226,6 @@ |
227 | 226 | proc_tty_driver = proc_mkdir_mode("tty/driver", S_IRUSR | S_IXUSR, NULL); |
228 | 227 | |
229 | 228 | create_proc_read_entry("tty/ldiscs", 0, NULL, tty_ldiscs_read_proc, NULL); |
230 | - entry = create_proc_entry("tty/drivers", 0, NULL); | |
231 | - if (entry) | |
232 | - entry->proc_fops = &proc_tty_drivers_operations; | |
229 | + proc_create("tty/drivers", 0, NULL, &proc_tty_drivers_operations); | |
233 | 230 | } |