@@ -109,25 +109,22 @@ struct pid_entry {
109
109
.op = OP, \
110
110
}
111
111
112
- #define DIR (NAME , MODE , OTYPE ) \
113
- NOD(NAME, (S_IFDIR|(MODE)), \
114
- &proc_##OTYPE##_inode_operations, &proc_##OTYPE##_operations, \
115
- {} )
116
- #define LNK (NAME , OTYPE ) \
112
+ #define DIR (NAME , MODE , iops , fops ) \
113
+ NOD(NAME, (S_IFDIR|(MODE)), &iops, &fops, {} )
114
+ #define LNK (NAME , get_link ) \
117
115
NOD(NAME, (S_IFLNK|S_IRWXUGO), \
118
116
&proc_pid_link_inode_operations, NULL, \
119
- { .proc_get_link = &proc_##OTYPE##_link } )
120
- #define REG (NAME , MODE , OTYPE ) \
121
- NOD(NAME, (S_IFREG|(MODE)), NULL, \
122
- &proc_##OTYPE##_operations, {})
123
- #define INF (NAME , MODE , OTYPE ) \
117
+ { .proc_get_link = get_link } )
118
+ #define REG (NAME , MODE , fops ) \
119
+ NOD(NAME, (S_IFREG|(MODE)), NULL, &fops, {})
120
+ #define INF (NAME , MODE , read ) \
124
121
NOD(NAME, (S_IFREG|(MODE)), \
125
122
NULL, &proc_info_file_operations, \
126
- { .proc_read = &proc_##OTYPE } )
127
- #define ONE (NAME , MODE , OTYPE ) \
123
+ { .proc_read = read } )
124
+ #define ONE (NAME , MODE , show ) \
128
125
NOD(NAME, (S_IFREG|(MODE)), \
129
126
NULL, &proc_single_file_operations, \
130
- { .proc_show = &proc_##OTYPE } )
127
+ { .proc_show = show } )
131
128
132
129
/*
133
130
* Count the number of hardlinks for the pid_entry table, excluding the .
@@ -2134,12 +2131,12 @@ static const struct file_operations proc_pid_attr_operations = {
2134
2131
};
2135
2132
2136
2133
static const struct pid_entry attr_dir_stuff [] = {
2137
- REG ("current" , S_IRUGO |S_IWUGO , pid_attr ),
2138
- REG ("prev" , S_IRUGO , pid_attr ),
2139
- REG ("exec" , S_IRUGO |S_IWUGO , pid_attr ),
2140
- REG ("fscreate" , S_IRUGO |S_IWUGO , pid_attr ),
2141
- REG ("keycreate" , S_IRUGO |S_IWUGO , pid_attr ),
2142
- REG ("sockcreate" , S_IRUGO |S_IWUGO , pid_attr ),
2134
+ REG ("current" , S_IRUGO |S_IWUGO , proc_pid_attr_operations ),
2135
+ REG ("prev" , S_IRUGO , proc_pid_attr_operations ),
2136
+ REG ("exec" , S_IRUGO |S_IWUGO , proc_pid_attr_operations ),
2137
+ REG ("fscreate" , S_IRUGO |S_IWUGO , proc_pid_attr_operations ),
2138
+ REG ("keycreate" , S_IRUGO |S_IWUGO , proc_pid_attr_operations ),
2139
+ REG ("sockcreate" , S_IRUGO |S_IWUGO , proc_pid_attr_operations ),
2143
2140
};
2144
2141
2145
2142
static int proc_attr_dir_readdir (struct file * filp ,
@@ -2461,74 +2458,74 @@ static const struct file_operations proc_task_operations;
2461
2458
static const struct inode_operations proc_task_inode_operations ;
2462
2459
2463
2460
static const struct pid_entry tgid_base_stuff [] = {
2464
- DIR ("task" , S_IRUGO |S_IXUGO , task ),
2465
- DIR ("fd" , S_IRUSR |S_IXUSR , fd ),
2466
- DIR ("fdinfo" , S_IRUSR |S_IXUSR , fdinfo ),
2461
+ DIR ("task" , S_IRUGO |S_IXUGO , proc_task_inode_operations , proc_task_operations ),
2462
+ DIR ("fd" , S_IRUSR |S_IXUSR , proc_fd_inode_operations , proc_fd_operations ),
2463
+ DIR ("fdinfo" , S_IRUSR |S_IXUSR , proc_fdinfo_inode_operations , proc_fdinfo_operations ),
2467
2464
#ifdef CONFIG_NET
2468
- DIR ("net" , S_IRUGO |S_IXUGO , net ),
2465
+ DIR ("net" , S_IRUGO |S_IXUGO , proc_net_inode_operations , proc_net_operations ),
2469
2466
#endif
2470
- REG ("environ" , S_IRUSR , environ ),
2471
- INF ("auxv" , S_IRUSR , pid_auxv ),
2472
- ONE ("status" , S_IRUGO , pid_status ),
2473
- ONE ("personality" , S_IRUSR , pid_personality ),
2474
- INF ("limits" , S_IRUSR , pid_limits ),
2467
+ REG ("environ" , S_IRUSR , proc_environ_operations ),
2468
+ INF ("auxv" , S_IRUSR , proc_pid_auxv ),
2469
+ ONE ("status" , S_IRUGO , proc_pid_status ),
2470
+ ONE ("personality" , S_IRUSR , proc_pid_personality ),
2471
+ INF ("limits" , S_IRUSR , proc_pid_limits ),
2475
2472
#ifdef CONFIG_SCHED_DEBUG
2476
- REG ("sched" , S_IRUGO |S_IWUSR , pid_sched ),
2473
+ REG ("sched" , S_IRUGO |S_IWUSR , proc_pid_sched_operations ),
2477
2474
#endif
2478
2475
#ifdef CONFIG_HAVE_ARCH_TRACEHOOK
2479
- INF ("syscall" , S_IRUSR , pid_syscall ),
2476
+ INF ("syscall" , S_IRUSR , proc_pid_syscall ),
2480
2477
#endif
2481
- INF ("cmdline" , S_IRUGO , pid_cmdline ),
2482
- ONE ("stat" , S_IRUGO , tgid_stat ),
2483
- ONE ("statm" , S_IRUGO , pid_statm ),
2484
- REG ("maps" , S_IRUGO , maps ),
2478
+ INF ("cmdline" , S_IRUGO , proc_pid_cmdline ),
2479
+ ONE ("stat" , S_IRUGO , proc_tgid_stat ),
2480
+ ONE ("statm" , S_IRUGO , proc_pid_statm ),
2481
+ REG ("maps" , S_IRUGO , proc_maps_operations ),
2485
2482
#ifdef CONFIG_NUMA
2486
- REG ("numa_maps" , S_IRUGO , numa_maps ),
2483
+ REG ("numa_maps" , S_IRUGO , proc_numa_maps_operations ),
2487
2484
#endif
2488
- REG ("mem" , S_IRUSR |S_IWUSR , mem ),
2489
- LNK ("cwd" , cwd ),
2490
- LNK ("root" , root ),
2491
- LNK ("exe" , exe ),
2492
- REG ("mounts" , S_IRUGO , mounts ),
2493
- REG ("mountinfo" , S_IRUGO , mountinfo ),
2494
- REG ("mountstats" , S_IRUSR , mountstats ),
2485
+ REG ("mem" , S_IRUSR |S_IWUSR , proc_mem_operations ),
2486
+ LNK ("cwd" , proc_cwd_link ),
2487
+ LNK ("root" , proc_root_link ),
2488
+ LNK ("exe" , proc_exe_link ),
2489
+ REG ("mounts" , S_IRUGO , proc_mounts_operations ),
2490
+ REG ("mountinfo" , S_IRUGO , proc_mountinfo_operations ),
2491
+ REG ("mountstats" , S_IRUSR , proc_mountstats_operations ),
2495
2492
#ifdef CONFIG_PROC_PAGE_MONITOR
2496
- REG ("clear_refs" , S_IWUSR , clear_refs ),
2497
- REG ("smaps" , S_IRUGO , smaps ),
2498
- REG ("pagemap" , S_IRUSR , pagemap ),
2493
+ REG ("clear_refs" , S_IWUSR , proc_clear_refs_operations ),
2494
+ REG ("smaps" , S_IRUGO , proc_smaps_operations ),
2495
+ REG ("pagemap" , S_IRUSR , proc_pagemap_operations ),
2499
2496
#endif
2500
2497
#ifdef CONFIG_SECURITY
2501
- DIR ("attr" , S_IRUGO |S_IXUGO , attr_dir ),
2498
+ DIR ("attr" , S_IRUGO |S_IXUGO , proc_attr_dir_inode_operations , proc_attr_dir_operations ),
2502
2499
#endif
2503
2500
#ifdef CONFIG_KALLSYMS
2504
- INF ("wchan" , S_IRUGO , pid_wchan ),
2501
+ INF ("wchan" , S_IRUGO , proc_pid_wchan ),
2505
2502
#endif
2506
2503
#ifdef CONFIG_SCHEDSTATS
2507
- INF ("schedstat" , S_IRUGO , pid_schedstat ),
2504
+ INF ("schedstat" , S_IRUGO , proc_pid_schedstat ),
2508
2505
#endif
2509
2506
#ifdef CONFIG_LATENCYTOP
2510
- REG ("latency" , S_IRUGO , lstats ),
2507
+ REG ("latency" , S_IRUGO , proc_lstats_operations ),
2511
2508
#endif
2512
2509
#ifdef CONFIG_PROC_PID_CPUSET
2513
- REG ("cpuset" , S_IRUGO , cpuset ),
2510
+ REG ("cpuset" , S_IRUGO , proc_cpuset_operations ),
2514
2511
#endif
2515
2512
#ifdef CONFIG_CGROUPS
2516
- REG ("cgroup" , S_IRUGO , cgroup ),
2513
+ REG ("cgroup" , S_IRUGO , proc_cgroup_operations ),
2517
2514
#endif
2518
- INF ("oom_score" , S_IRUGO , oom_score ),
2519
- REG ("oom_adj" , S_IRUGO |S_IWUSR , oom_adjust ),
2515
+ INF ("oom_score" , S_IRUGO , proc_oom_score ),
2516
+ REG ("oom_adj" , S_IRUGO |S_IWUSR , proc_oom_adjust_operations ),
2520
2517
#ifdef CONFIG_AUDITSYSCALL
2521
- REG ("loginuid" , S_IWUSR |S_IRUGO , loginuid ),
2522
- REG ("sessionid" , S_IRUGO , sessionid ),
2518
+ REG ("loginuid" , S_IWUSR |S_IRUGO , proc_loginuid_operations ),
2519
+ REG ("sessionid" , S_IRUGO , proc_sessionid_operations ),
2523
2520
#endif
2524
2521
#ifdef CONFIG_FAULT_INJECTION
2525
- REG ("make-it-fail" , S_IRUGO |S_IWUSR , fault_inject ),
2522
+ REG ("make-it-fail" , S_IRUGO |S_IWUSR , proc_fault_inject_operations ),
2526
2523
#endif
2527
2524
#if defined(USE_ELF_CORE_DUMP ) && defined (CONFIG_ELF_CORE )
2528
- REG ("coredump_filter" , S_IRUGO |S_IWUSR , coredump_filter ),
2525
+ REG ("coredump_filter" , S_IRUGO |S_IWUSR , proc_coredump_filter_operations ),
2529
2526
#endif
2530
2527
#ifdef CONFIG_TASK_IO_ACCOUNTING
2531
- INF ("io" , S_IRUGO , tgid_io_accounting ),
2528
+ INF ("io" , S_IRUGO , proc_tgid_io_accounting ),
2532
2529
#endif
2533
2530
};
2534
2531
@@ -2801,66 +2798,66 @@ int proc_pid_readdir(struct file * filp, void * dirent, filldir_t filldir)
2801
2798
* Tasks
2802
2799
*/
2803
2800
static const struct pid_entry tid_base_stuff [] = {
2804
- DIR ("fd" , S_IRUSR |S_IXUSR , fd ),
2805
- DIR ("fdinfo" , S_IRUSR |S_IXUSR , fdinfo ),
2806
- REG ("environ" , S_IRUSR , environ ),
2807
- INF ("auxv" , S_IRUSR , pid_auxv ),
2808
- ONE ("status" , S_IRUGO , pid_status ),
2809
- ONE ("personality" , S_IRUSR , pid_personality ),
2810
- INF ("limits" , S_IRUSR , pid_limits ),
2801
+ DIR ("fd" , S_IRUSR |S_IXUSR , proc_fd_inode_operations , proc_fd_operations ),
2802
+ DIR ("fdinfo" , S_IRUSR |S_IXUSR , proc_fdinfo_inode_operations , proc_fd_operations ),
2803
+ REG ("environ" , S_IRUSR , proc_environ_operations ),
2804
+ INF ("auxv" , S_IRUSR , proc_pid_auxv ),
2805
+ ONE ("status" , S_IRUGO , proc_pid_status ),
2806
+ ONE ("personality" , S_IRUSR , proc_pid_personality ),
2807
+ INF ("limits" , S_IRUSR , proc_pid_limits ),
2811
2808
#ifdef CONFIG_SCHED_DEBUG
2812
- REG ("sched" , S_IRUGO |S_IWUSR , pid_sched ),
2809
+ REG ("sched" , S_IRUGO |S_IWUSR , proc_pid_sched_operations ),
2813
2810
#endif
2814
2811
#ifdef CONFIG_HAVE_ARCH_TRACEHOOK
2815
- INF ("syscall" , S_IRUSR , pid_syscall ),
2812
+ INF ("syscall" , S_IRUSR , proc_pid_syscall ),
2816
2813
#endif
2817
- INF ("cmdline" , S_IRUGO , pid_cmdline ),
2818
- ONE ("stat" , S_IRUGO , tid_stat ),
2819
- ONE ("statm" , S_IRUGO , pid_statm ),
2820
- REG ("maps" , S_IRUGO , maps ),
2814
+ INF ("cmdline" , S_IRUGO , proc_pid_cmdline ),
2815
+ ONE ("stat" , S_IRUGO , proc_tid_stat ),
2816
+ ONE ("statm" , S_IRUGO , proc_pid_statm ),
2817
+ REG ("maps" , S_IRUGO , proc_maps_operations ),
2821
2818
#ifdef CONFIG_NUMA
2822
- REG ("numa_maps" , S_IRUGO , numa_maps ),
2819
+ REG ("numa_maps" , S_IRUGO , proc_numa_maps_operations ),
2823
2820
#endif
2824
- REG ("mem" , S_IRUSR |S_IWUSR , mem ),
2825
- LNK ("cwd" , cwd ),
2826
- LNK ("root" , root ),
2827
- LNK ("exe" , exe ),
2828
- REG ("mounts" , S_IRUGO , mounts ),
2829
- REG ("mountinfo" , S_IRUGO , mountinfo ),
2821
+ REG ("mem" , S_IRUSR |S_IWUSR , proc_mem_operations ),
2822
+ LNK ("cwd" , proc_cwd_link ),
2823
+ LNK ("root" , proc_root_link ),
2824
+ LNK ("exe" , proc_exe_link ),
2825
+ REG ("mounts" , S_IRUGO , proc_mounts_operations ),
2826
+ REG ("mountinfo" , S_IRUGO , proc_mountinfo_operations ),
2830
2827
#ifdef CONFIG_PROC_PAGE_MONITOR
2831
- REG ("clear_refs" , S_IWUSR , clear_refs ),
2832
- REG ("smaps" , S_IRUGO , smaps ),
2833
- REG ("pagemap" , S_IRUSR , pagemap ),
2828
+ REG ("clear_refs" , S_IWUSR , proc_clear_refs_operations ),
2829
+ REG ("smaps" , S_IRUGO , proc_smaps_operations ),
2830
+ REG ("pagemap" , S_IRUSR , proc_pagemap_operations ),
2834
2831
#endif
2835
2832
#ifdef CONFIG_SECURITY
2836
- DIR ("attr" , S_IRUGO |S_IXUGO , attr_dir ),
2833
+ DIR ("attr" , S_IRUGO |S_IXUGO , proc_attr_dir_inode_operations , proc_attr_dir_operations ),
2837
2834
#endif
2838
2835
#ifdef CONFIG_KALLSYMS
2839
- INF ("wchan" , S_IRUGO , pid_wchan ),
2836
+ INF ("wchan" , S_IRUGO , proc_pid_wchan ),
2840
2837
#endif
2841
2838
#ifdef CONFIG_SCHEDSTATS
2842
- INF ("schedstat" , S_IRUGO , pid_schedstat ),
2839
+ INF ("schedstat" , S_IRUGO , proc_pid_schedstat ),
2843
2840
#endif
2844
2841
#ifdef CONFIG_LATENCYTOP
2845
- REG ("latency" , S_IRUGO , lstats ),
2842
+ REG ("latency" , S_IRUGO , proc_lstats_operations ),
2846
2843
#endif
2847
2844
#ifdef CONFIG_PROC_PID_CPUSET
2848
- REG ("cpuset" , S_IRUGO , cpuset ),
2845
+ REG ("cpuset" , S_IRUGO , proc_cpuset_operations ),
2849
2846
#endif
2850
2847
#ifdef CONFIG_CGROUPS
2851
- REG ("cgroup" , S_IRUGO , cgroup ),
2848
+ REG ("cgroup" , S_IRUGO , proc_cgroup_operations ),
2852
2849
#endif
2853
- INF ("oom_score" , S_IRUGO , oom_score ),
2854
- REG ("oom_adj" , S_IRUGO |S_IWUSR , oom_adjust ),
2850
+ INF ("oom_score" , S_IRUGO , proc_oom_score ),
2851
+ REG ("oom_adj" , S_IRUGO |S_IWUSR , proc_oom_adjust_operations ),
2855
2852
#ifdef CONFIG_AUDITSYSCALL
2856
- REG ("loginuid" , S_IWUSR |S_IRUGO , loginuid ),
2857
- REG ("sessionid" , S_IRUSR , sessionid ),
2853
+ REG ("loginuid" , S_IWUSR |S_IRUGO , proc_loginuid_operations ),
2854
+ REG ("sessionid" , S_IRUSR , proc_sessionid_operations ),
2858
2855
#endif
2859
2856
#ifdef CONFIG_FAULT_INJECTION
2860
- REG ("make-it-fail" , S_IRUGO |S_IWUSR , fault_inject ),
2857
+ REG ("make-it-fail" , S_IRUGO |S_IWUSR , proc_fault_inject_operations ),
2861
2858
#endif
2862
2859
#ifdef CONFIG_TASK_IO_ACCOUNTING
2863
- INF ("io" , S_IRUGO , tid_io_accounting ),
2860
+ INF ("io" , S_IRUGO , proc_tid_io_accounting ),
2864
2861
#endif
2865
2862
};
2866
2863
0 commit comments