Skip to content

Commit 631f9c1

Browse files
author
Alexey Dobriyan
committed
proc: remove '##' usage
Inability to jump to /proc/*/foo handlers with ctags is annoying. Signed-off-by: Alexey Dobriyan <adobriyan@gmail.com>
1 parent ecae934 commit 631f9c1

File tree

1 file changed

+90
-93
lines changed

1 file changed

+90
-93
lines changed

fs/proc/base.c

Lines changed: 90 additions & 93 deletions
Original file line numberDiff line numberDiff line change
@@ -109,25 +109,22 @@ struct pid_entry {
109109
.op = OP, \
110110
}
111111

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) \
117115
NOD(NAME, (S_IFLNK|S_IRWXUGO), \
118116
&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) \
124121
NOD(NAME, (S_IFREG|(MODE)), \
125122
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) \
128125
NOD(NAME, (S_IFREG|(MODE)), \
129126
NULL, &proc_single_file_operations, \
130-
{ .proc_show = &proc_##OTYPE } )
127+
{ .proc_show = show } )
131128

132129
/*
133130
* 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 = {
21342131
};
21352132

21362133
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),
21432140
};
21442141

21452142
static int proc_attr_dir_readdir(struct file * filp,
@@ -2461,74 +2458,74 @@ static const struct file_operations proc_task_operations;
24612458
static const struct inode_operations proc_task_inode_operations;
24622459

24632460
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),
24672464
#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),
24692466
#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),
24752472
#ifdef CONFIG_SCHED_DEBUG
2476-
REG("sched", S_IRUGO|S_IWUSR, pid_sched),
2473+
REG("sched", S_IRUGO|S_IWUSR, proc_pid_sched_operations),
24772474
#endif
24782475
#ifdef CONFIG_HAVE_ARCH_TRACEHOOK
2479-
INF("syscall", S_IRUSR, pid_syscall),
2476+
INF("syscall", S_IRUSR, proc_pid_syscall),
24802477
#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),
24852482
#ifdef CONFIG_NUMA
2486-
REG("numa_maps", S_IRUGO, numa_maps),
2483+
REG("numa_maps", S_IRUGO, proc_numa_maps_operations),
24872484
#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),
24952492
#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),
24992496
#endif
25002497
#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),
25022499
#endif
25032500
#ifdef CONFIG_KALLSYMS
2504-
INF("wchan", S_IRUGO, pid_wchan),
2501+
INF("wchan", S_IRUGO, proc_pid_wchan),
25052502
#endif
25062503
#ifdef CONFIG_SCHEDSTATS
2507-
INF("schedstat", S_IRUGO, pid_schedstat),
2504+
INF("schedstat", S_IRUGO, proc_pid_schedstat),
25082505
#endif
25092506
#ifdef CONFIG_LATENCYTOP
2510-
REG("latency", S_IRUGO, lstats),
2507+
REG("latency", S_IRUGO, proc_lstats_operations),
25112508
#endif
25122509
#ifdef CONFIG_PROC_PID_CPUSET
2513-
REG("cpuset", S_IRUGO, cpuset),
2510+
REG("cpuset", S_IRUGO, proc_cpuset_operations),
25142511
#endif
25152512
#ifdef CONFIG_CGROUPS
2516-
REG("cgroup", S_IRUGO, cgroup),
2513+
REG("cgroup", S_IRUGO, proc_cgroup_operations),
25172514
#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),
25202517
#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),
25232520
#endif
25242521
#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),
25262523
#endif
25272524
#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),
25292526
#endif
25302527
#ifdef CONFIG_TASK_IO_ACCOUNTING
2531-
INF("io", S_IRUGO, tgid_io_accounting),
2528+
INF("io", S_IRUGO, proc_tgid_io_accounting),
25322529
#endif
25332530
};
25342531

@@ -2801,66 +2798,66 @@ int proc_pid_readdir(struct file * filp, void * dirent, filldir_t filldir)
28012798
* Tasks
28022799
*/
28032800
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),
28112808
#ifdef CONFIG_SCHED_DEBUG
2812-
REG("sched", S_IRUGO|S_IWUSR, pid_sched),
2809+
REG("sched", S_IRUGO|S_IWUSR, proc_pid_sched_operations),
28132810
#endif
28142811
#ifdef CONFIG_HAVE_ARCH_TRACEHOOK
2815-
INF("syscall", S_IRUSR, pid_syscall),
2812+
INF("syscall", S_IRUSR, proc_pid_syscall),
28162813
#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),
28212818
#ifdef CONFIG_NUMA
2822-
REG("numa_maps", S_IRUGO, numa_maps),
2819+
REG("numa_maps", S_IRUGO, proc_numa_maps_operations),
28232820
#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),
28302827
#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),
28342831
#endif
28352832
#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),
28372834
#endif
28382835
#ifdef CONFIG_KALLSYMS
2839-
INF("wchan", S_IRUGO, pid_wchan),
2836+
INF("wchan", S_IRUGO, proc_pid_wchan),
28402837
#endif
28412838
#ifdef CONFIG_SCHEDSTATS
2842-
INF("schedstat", S_IRUGO, pid_schedstat),
2839+
INF("schedstat", S_IRUGO, proc_pid_schedstat),
28432840
#endif
28442841
#ifdef CONFIG_LATENCYTOP
2845-
REG("latency", S_IRUGO, lstats),
2842+
REG("latency", S_IRUGO, proc_lstats_operations),
28462843
#endif
28472844
#ifdef CONFIG_PROC_PID_CPUSET
2848-
REG("cpuset", S_IRUGO, cpuset),
2845+
REG("cpuset", S_IRUGO, proc_cpuset_operations),
28492846
#endif
28502847
#ifdef CONFIG_CGROUPS
2851-
REG("cgroup", S_IRUGO, cgroup),
2848+
REG("cgroup", S_IRUGO, proc_cgroup_operations),
28522849
#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),
28552852
#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),
28582855
#endif
28592856
#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),
28612858
#endif
28622859
#ifdef CONFIG_TASK_IO_ACCOUNTING
2863-
INF("io", S_IRUGO, tid_io_accounting),
2860+
INF("io", S_IRUGO, proc_tid_io_accounting),
28642861
#endif
28652862
};
28662863

0 commit comments

Comments
 (0)