diff options
author | Christoph Hellwig <hch@lst.de> | 2018-04-13 13:44:18 -0400 |
---|---|---|
committer | Christoph Hellwig <hch@lst.de> | 2018-05-16 01:23:35 -0400 |
commit | fddda2b7b521185f3aa018f9559eb33b0aee53a9 (patch) | |
tree | ece18b3d82822f8eaefd8b0afa2f93307e83b253 | |
parent | 7aed53d1dfd14d468e065212ce45068e2b50c1fa (diff) |
proc: introduce proc_create_seq{,_data}
Variants of proc_create{,_data} that directly take a struct seq_operations
argument and drastically reduces the boilerplate code in the callers.
All trivial callers converted over.
Signed-off-by: Christoph Hellwig <hch@lst.de>
53 files changed, 151 insertions, 925 deletions
diff --git a/arch/ia64/hp/common/sba_iommu.c b/arch/ia64/hp/common/sba_iommu.c index aec4a3354abe..cb5cd86a5530 100644 --- a/arch/ia64/hp/common/sba_iommu.c +++ b/arch/ia64/hp/common/sba_iommu.c | |||
@@ -1942,19 +1942,6 @@ static const struct seq_operations ioc_seq_ops = { | |||
1942 | .show = ioc_show | 1942 | .show = ioc_show |
1943 | }; | 1943 | }; |
1944 | 1944 | ||
1945 | static int | ||
1946 | ioc_open(struct inode *inode, struct file *file) | ||
1947 | { | ||
1948 | return seq_open(file, &ioc_seq_ops); | ||
1949 | } | ||
1950 | |||
1951 | static const struct file_operations ioc_fops = { | ||
1952 | .open = ioc_open, | ||
1953 | .read = seq_read, | ||
1954 | .llseek = seq_lseek, | ||
1955 | .release = seq_release | ||
1956 | }; | ||
1957 | |||
1958 | static void __init | 1945 | static void __init |
1959 | ioc_proc_init(void) | 1946 | ioc_proc_init(void) |
1960 | { | 1947 | { |
@@ -1964,7 +1951,7 @@ ioc_proc_init(void) | |||
1964 | if (!dir) | 1951 | if (!dir) |
1965 | return; | 1952 | return; |
1966 | 1953 | ||
1967 | proc_create(ioc_list->name, 0, dir, &ioc_fops); | 1954 | proc_create_seq(ioc_list->name, 0, dir, &ioc_seq_ops); |
1968 | } | 1955 | } |
1969 | #endif | 1956 | #endif |
1970 | 1957 | ||
diff --git a/arch/ia64/kernel/perfmon.c b/arch/ia64/kernel/perfmon.c index 8fb280e33114..3b38c717008a 100644 --- a/arch/ia64/kernel/perfmon.c +++ b/arch/ia64/kernel/perfmon.c | |||
@@ -5708,13 +5708,6 @@ const struct seq_operations pfm_seq_ops = { | |||
5708 | .show = pfm_proc_show | 5708 | .show = pfm_proc_show |
5709 | }; | 5709 | }; |
5710 | 5710 | ||
5711 | static int | ||
5712 | pfm_proc_open(struct inode *inode, struct file *file) | ||
5713 | { | ||
5714 | return seq_open(file, &pfm_seq_ops); | ||
5715 | } | ||
5716 | |||
5717 | |||
5718 | /* | 5711 | /* |
5719 | * we come here as soon as local_cpu_data->pfm_syst_wide is set. this happens | 5712 | * we come here as soon as local_cpu_data->pfm_syst_wide is set. this happens |
5720 | * during pfm_enable() hence before pfm_start(). We cannot assume monitoring | 5713 | * during pfm_enable() hence before pfm_start(). We cannot assume monitoring |
@@ -6537,13 +6530,6 @@ found: | |||
6537 | return 0; | 6530 | return 0; |
6538 | } | 6531 | } |
6539 | 6532 | ||
6540 | static const struct file_operations pfm_proc_fops = { | ||
6541 | .open = pfm_proc_open, | ||
6542 | .read = seq_read, | ||
6543 | .llseek = seq_lseek, | ||
6544 | .release = seq_release, | ||
6545 | }; | ||
6546 | |||
6547 | int __init | 6533 | int __init |
6548 | pfm_init(void) | 6534 | pfm_init(void) |
6549 | { | 6535 | { |
@@ -6615,7 +6601,7 @@ pfm_init(void) | |||
6615 | /* | 6601 | /* |
6616 | * create /proc/perfmon (mostly for debugging purposes) | 6602 | * create /proc/perfmon (mostly for debugging purposes) |
6617 | */ | 6603 | */ |
6618 | perfmon_dir = proc_create("perfmon", S_IRUGO, NULL, &pfm_proc_fops); | 6604 | perfmon_dir = proc_create_seq("perfmon", S_IRUGO, NULL, &pfm_seq_ops); |
6619 | if (perfmon_dir == NULL) { | 6605 | if (perfmon_dir == NULL) { |
6620 | printk(KERN_ERR "perfmon: cannot create /proc entry, perfmon disabled\n"); | 6606 | printk(KERN_ERR "perfmon: cannot create /proc entry, perfmon disabled\n"); |
6621 | pmu_conf = NULL; | 6607 | pmu_conf = NULL; |
diff --git a/arch/s390/kernel/sysinfo.c b/arch/s390/kernel/sysinfo.c index fc7e04c2195b..fed49601f06d 100644 --- a/arch/s390/kernel/sysinfo.c +++ b/arch/s390/kernel/sysinfo.c | |||
@@ -386,18 +386,6 @@ static const struct seq_operations service_level_seq_ops = { | |||
386 | .show = service_level_show | 386 | .show = service_level_show |
387 | }; | 387 | }; |
388 | 388 | ||
389 | static int service_level_open(struct inode *inode, struct file *file) | ||
390 | { | ||
391 | return seq_open(file, &service_level_seq_ops); | ||
392 | } | ||
393 | |||
394 | static const struct file_operations service_level_ops = { | ||
395 | .open = service_level_open, | ||
396 | .read = seq_read, | ||
397 | .llseek = seq_lseek, | ||
398 | .release = seq_release | ||
399 | }; | ||
400 | |||
401 | static void service_level_vm_print(struct seq_file *m, | 389 | static void service_level_vm_print(struct seq_file *m, |
402 | struct service_level *slr) | 390 | struct service_level *slr) |
403 | { | 391 | { |
@@ -420,7 +408,7 @@ static struct service_level service_level_vm = { | |||
420 | 408 | ||
421 | static __init int create_proc_service_level(void) | 409 | static __init int create_proc_service_level(void) |
422 | { | 410 | { |
423 | proc_create("service_levels", 0, NULL, &service_level_ops); | 411 | proc_create_seq("service_levels", 0, NULL, &service_level_seq_ops); |
424 | if (MACHINE_IS_VM) | 412 | if (MACHINE_IS_VM) |
425 | register_service_level(&service_level_vm); | 413 | register_service_level(&service_level_vm); |
426 | return 0; | 414 | return 0; |
diff --git a/block/genhd.c b/block/genhd.c index c4513fe1adda..6d7bc8958fda 100644 --- a/block/genhd.c +++ b/block/genhd.c | |||
@@ -1027,18 +1027,6 @@ static const struct seq_operations partitions_op = { | |||
1027 | .stop = disk_seqf_stop, | 1027 | .stop = disk_seqf_stop, |
1028 | .show = show_partition | 1028 | .show = show_partition |
1029 | }; | 1029 | }; |
1030 | |||
1031 | static int partitions_open(struct inode *inode, struct file *file) | ||
1032 | { | ||
1033 | return seq_open(file, &partitions_op); | ||
1034 | } | ||
1035 | |||
1036 | static const struct file_operations proc_partitions_operations = { | ||
1037 | .open = partitions_open, | ||
1038 | .read = seq_read, | ||
1039 | .llseek = seq_lseek, | ||
1040 | .release = seq_release, | ||
1041 | }; | ||
1042 | #endif | 1030 | #endif |
1043 | 1031 | ||
1044 | 1032 | ||
@@ -1377,22 +1365,10 @@ static const struct seq_operations diskstats_op = { | |||
1377 | .show = diskstats_show | 1365 | .show = diskstats_show |
1378 | }; | 1366 | }; |
1379 | 1367 | ||
1380 | static int diskstats_open(struct inode *inode, struct file *file) | ||
1381 | { | ||
1382 | return seq_open(file, &diskstats_op); | ||
1383 | } | ||
1384 | |||
1385 | static const struct file_operations proc_diskstats_operations = { | ||
1386 | .open = diskstats_open, | ||
1387 | .read = seq_read, | ||
1388 | .llseek = seq_lseek, | ||
1389 | .release = seq_release, | ||
1390 | }; | ||
1391 | |||
1392 | static int __init proc_genhd_init(void) | 1368 | static int __init proc_genhd_init(void) |
1393 | { | 1369 | { |
1394 | proc_create("diskstats", 0, NULL, &proc_diskstats_operations); | 1370 | proc_create_seq("diskstats", 0, NULL, &diskstats_op); |
1395 | proc_create("partitions", 0, NULL, &proc_partitions_operations); | 1371 | proc_create_seq("partitions", 0, NULL, &partitions_op); |
1396 | return 0; | 1372 | return 0; |
1397 | } | 1373 | } |
1398 | module_init(proc_genhd_init); | 1374 | module_init(proc_genhd_init); |
diff --git a/crypto/proc.c b/crypto/proc.c index 822fcef6d91c..f4eb6139973e 100644 --- a/crypto/proc.c +++ b/crypto/proc.c | |||
@@ -94,21 +94,9 @@ static const struct seq_operations crypto_seq_ops = { | |||
94 | .show = c_show | 94 | .show = c_show |
95 | }; | 95 | }; |
96 | 96 | ||
97 | static int crypto_info_open(struct inode *inode, struct file *file) | ||
98 | { | ||
99 | return seq_open(file, &crypto_seq_ops); | ||
100 | } | ||
101 | |||
102 | static const struct file_operations proc_crypto_ops = { | ||
103 | .open = crypto_info_open, | ||
104 | .read = seq_read, | ||
105 | .llseek = seq_lseek, | ||
106 | .release = seq_release | ||
107 | }; | ||
108 | |||
109 | void __init crypto_init_proc(void) | 97 | void __init crypto_init_proc(void) |
110 | { | 98 | { |
111 | proc_create("crypto", 0, NULL, &proc_crypto_ops); | 99 | proc_create_seq("crypto", 0, NULL, &crypto_seq_ops); |
112 | } | 100 | } |
113 | 101 | ||
114 | void __exit crypto_exit_proc(void) | 102 | void __exit crypto_exit_proc(void) |
diff --git a/drivers/char/misc.c b/drivers/char/misc.c index 1bb9e7cc82e3..53cfe574d8d4 100644 --- a/drivers/char/misc.c +++ b/drivers/char/misc.c | |||
@@ -95,19 +95,6 @@ static const struct seq_operations misc_seq_ops = { | |||
95 | .stop = misc_seq_stop, | 95 | .stop = misc_seq_stop, |
96 | .show = misc_seq_show, | 96 | .show = misc_seq_show, |
97 | }; | 97 | }; |
98 | |||
99 | static int misc_seq_open(struct inode *inode, struct file *file) | ||
100 | { | ||
101 | return seq_open(file, &misc_seq_ops); | ||
102 | } | ||
103 | |||
104 | static const struct file_operations misc_proc_fops = { | ||
105 | .owner = THIS_MODULE, | ||
106 | .open = misc_seq_open, | ||
107 | .read = seq_read, | ||
108 | .llseek = seq_lseek, | ||
109 | .release = seq_release, | ||
110 | }; | ||
111 | #endif | 98 | #endif |
112 | 99 | ||
113 | static int misc_open(struct inode *inode, struct file *file) | 100 | static int misc_open(struct inode *inode, struct file *file) |
@@ -282,7 +269,7 @@ static int __init misc_init(void) | |||
282 | int err; | 269 | int err; |
283 | struct proc_dir_entry *ret; | 270 | struct proc_dir_entry *ret; |
284 | 271 | ||
285 | ret = proc_create("misc", 0, NULL, &misc_proc_fops); | 272 | ret = proc_create_seq("misc", 0, NULL, &misc_seq_ops); |
286 | misc_class = class_create(THIS_MODULE, "misc"); | 273 | misc_class = class_create(THIS_MODULE, "misc"); |
287 | err = PTR_ERR(misc_class); | 274 | err = PTR_ERR(misc_class); |
288 | if (IS_ERR(misc_class)) | 275 | if (IS_ERR(misc_class)) |
diff --git a/drivers/isdn/capi/kcapi_proc.c b/drivers/isdn/capi/kcapi_proc.c index 68db3c5a1063..c94bd12c0f7c 100644 --- a/drivers/isdn/capi/kcapi_proc.c +++ b/drivers/isdn/capi/kcapi_proc.c | |||
@@ -108,32 +108,6 @@ static const struct seq_operations seq_contrstats_ops = { | |||
108 | .show = contrstats_show, | 108 | .show = contrstats_show, |
109 | }; | 109 | }; |
110 | 110 | ||
111 | static int seq_controller_open(struct inode *inode, struct file *file) | ||
112 | { | ||
113 | return seq_open(file, &seq_controller_ops); | ||
114 | } | ||
115 | |||
116 | static int seq_contrstats_open(struct inode *inode, struct file *file) | ||
117 | { | ||
118 | return seq_open(file, &seq_contrstats_ops); | ||
119 | } | ||
120 | |||
121 | static const struct file_operations proc_controller_ops = { | ||
122 | .owner = THIS_MODULE, | ||
123 | .open = seq_controller_open, | ||
124 | .read = seq_read, | ||
125 | .llseek = seq_lseek, | ||
126 | .release = seq_release, | ||
127 | }; | ||
128 | |||
129 | static const struct file_operations proc_contrstats_ops = { | ||
130 | .owner = THIS_MODULE, | ||
131 | .open = seq_contrstats_open, | ||
132 | .read = seq_read, | ||
133 | .llseek = seq_lseek, | ||
134 | .release = seq_release, | ||
135 | }; | ||
136 | |||
137 | // /proc/capi/applications: | 111 | // /proc/capi/applications: |
138 | // applid l3cnt dblkcnt dblklen #ncci recvqueuelen | 112 | // applid l3cnt dblkcnt dblklen #ncci recvqueuelen |
139 | // /proc/capi/applstats: | 113 | // /proc/capi/applstats: |
@@ -216,34 +190,6 @@ static const struct seq_operations seq_applstats_ops = { | |||
216 | .show = applstats_show, | 190 | .show = applstats_show, |
217 | }; | 191 | }; |
218 | 192 | ||
219 | static int | ||
220 | seq_applications_open(struct inode *inode, struct file *file) | ||
221 | { | ||
222 | return seq_open(file, &seq_applications_ops); | ||
223 | } | ||
224 | |||
225 | static int | ||
226 | seq_applstats_open(struct inode *inode, struct file *file) | ||
227 | { | ||
228 | return seq_open(file, &seq_applstats_ops); | ||
229 | } | ||
230 | |||
231 | static const struct file_operations proc_applications_ops = { | ||
232 | .owner = THIS_MODULE, | ||
233 | .open = seq_applications_open, | ||
234 | .read = seq_read, | ||
235 | .llseek = seq_lseek, | ||
236 | .release = seq_release, | ||
237 | }; | ||
238 | |||
239 | static const struct file_operations proc_applstats_ops = { | ||
240 | .owner = THIS_MODULE, | ||
241 | .open = seq_applstats_open, | ||
242 | .read = seq_read, | ||
243 | .llseek = seq_lseek, | ||
244 | .release = seq_release, | ||
245 | }; | ||
246 | |||
247 | // --------------------------------------------------------------------------- | 193 | // --------------------------------------------------------------------------- |
248 | 194 | ||
249 | static void *capi_driver_start(struct seq_file *seq, loff_t *pos) | 195 | static void *capi_driver_start(struct seq_file *seq, loff_t *pos) |
@@ -279,22 +225,6 @@ static const struct seq_operations seq_capi_driver_ops = { | |||
279 | .show = capi_driver_show, | 225 | .show = capi_driver_show, |
280 | }; | 226 | }; |
281 | 227 | ||
282 | static int | ||
283 | seq_capi_driver_open(struct inode *inode, struct file *file) | ||
284 | { | ||
285 | int err; | ||
286 | err = seq_open(file, &seq_capi_driver_ops); | ||
287 | return err; | ||
288 | } | ||
289 | |||
290 | static const struct file_operations proc_driver_ops = { | ||
291 | .owner = THIS_MODULE, | ||
292 | .open = seq_capi_driver_open, | ||
293 | .read = seq_read, | ||
294 | .llseek = seq_lseek, | ||
295 | .release = seq_release, | ||
296 | }; | ||
297 | |||
298 | // --------------------------------------------------------------------------- | 228 | // --------------------------------------------------------------------------- |
299 | 229 | ||
300 | void __init | 230 | void __init |
@@ -302,11 +232,11 @@ kcapi_proc_init(void) | |||
302 | { | 232 | { |
303 | proc_mkdir("capi", NULL); | 233 | proc_mkdir("capi", NULL); |
304 | proc_mkdir("capi/controllers", NULL); | 234 | proc_mkdir("capi/controllers", NULL); |
305 | proc_create("capi/controller", 0, NULL, &proc_controller_ops); | 235 | proc_create_seq("capi/controller", 0, NULL, &seq_controller_ops); |
306 | proc_create("capi/contrstats", 0, NULL, &proc_contrstats_ops); | 236 | proc_create_seq("capi/contrstats", 0, NULL, &seq_contrstats_ops); |
307 | proc_create("capi/applications", 0, NULL, &proc_applications_ops); | 237 | proc_create_seq("capi/applications", 0, NULL, &seq_applications_ops); |
308 | proc_create("capi/applstats", 0, NULL, &proc_applstats_ops); | 238 | proc_create_seq("capi/applstats", 0, NULL, &seq_applstats_ops); |
309 | proc_create("capi/driver", 0, NULL, &proc_driver_ops); | 239 | proc_create_seq("capi/driver", 0, NULL, &seq_capi_driver_ops); |
310 | } | 240 | } |
311 | 241 | ||
312 | void __exit | 242 | void __exit |
diff --git a/drivers/net/hamradio/bpqether.c b/drivers/net/hamradio/bpqether.c index dfabbae72efd..f347fd9c5b28 100644 --- a/drivers/net/hamradio/bpqether.c +++ b/drivers/net/hamradio/bpqether.c | |||
@@ -449,20 +449,6 @@ static const struct seq_operations bpq_seqops = { | |||
449 | .show = bpq_seq_show, | 449 | .show = bpq_seq_show, |
450 | }; | 450 | }; |
451 | 451 | ||
452 | static int bpq_info_open(struct inode *inode, struct file *file) | ||
453 | { | ||
454 | return seq_open(file, &bpq_seqops); | ||
455 | } | ||
456 | |||
457 | static const struct file_operations bpq_info_fops = { | ||
458 | .owner = THIS_MODULE, | ||
459 | .open = bpq_info_open, | ||
460 | .read = seq_read, | ||
461 | .llseek = seq_lseek, | ||
462 | .release = seq_release, | ||
463 | }; | ||
464 | |||
465 | |||
466 | /* ------------------------------------------------------------------------ */ | 452 | /* ------------------------------------------------------------------------ */ |
467 | 453 | ||
468 | static const struct net_device_ops bpq_netdev_ops = { | 454 | static const struct net_device_ops bpq_netdev_ops = { |
@@ -590,7 +576,7 @@ static int bpq_device_event(struct notifier_block *this, | |||
590 | static int __init bpq_init_driver(void) | 576 | static int __init bpq_init_driver(void) |
591 | { | 577 | { |
592 | #ifdef CONFIG_PROC_FS | 578 | #ifdef CONFIG_PROC_FS |
593 | if (!proc_create("bpqether", 0444, init_net.proc_net, &bpq_info_fops)) { | 579 | if (!proc_create_seq("bpqether", 0444, init_net.proc_net, &bpq_seqops)) { |
594 | printk(KERN_ERR | 580 | printk(KERN_ERR |
595 | "bpq: cannot create /proc/net/bpqether entry.\n"); | 581 | "bpq: cannot create /proc/net/bpqether entry.\n"); |
596 | return -ENOENT; | 582 | return -ENOENT; |
diff --git a/drivers/net/hamradio/scc.c b/drivers/net/hamradio/scc.c index 3de272959090..6c03932d8a6b 100644 --- a/drivers/net/hamradio/scc.c +++ b/drivers/net/hamradio/scc.c | |||
@@ -2084,21 +2084,6 @@ static const struct seq_operations scc_net_seq_ops = { | |||
2084 | .stop = scc_net_seq_stop, | 2084 | .stop = scc_net_seq_stop, |
2085 | .show = scc_net_seq_show, | 2085 | .show = scc_net_seq_show, |
2086 | }; | 2086 | }; |
2087 | |||
2088 | |||
2089 | static int scc_net_seq_open(struct inode *inode, struct file *file) | ||
2090 | { | ||
2091 | return seq_open(file, &scc_net_seq_ops); | ||
2092 | } | ||
2093 | |||
2094 | static const struct file_operations scc_net_seq_fops = { | ||
2095 | .owner = THIS_MODULE, | ||
2096 | .open = scc_net_seq_open, | ||
2097 | .read = seq_read, | ||
2098 | .llseek = seq_lseek, | ||
2099 | .release = seq_release_private, | ||
2100 | }; | ||
2101 | |||
2102 | #endif /* CONFIG_PROC_FS */ | 2087 | #endif /* CONFIG_PROC_FS */ |
2103 | 2088 | ||
2104 | 2089 | ||
@@ -2122,7 +2107,7 @@ static int __init scc_init_driver (void) | |||
2122 | } | 2107 | } |
2123 | rtnl_unlock(); | 2108 | rtnl_unlock(); |
2124 | 2109 | ||
2125 | proc_create("z8530drv", 0, init_net.proc_net, &scc_net_seq_fops); | 2110 | proc_create_seq("z8530drv", 0, init_net.proc_net, &scc_net_seq_ops); |
2126 | 2111 | ||
2127 | return 0; | 2112 | return 0; |
2128 | } | 2113 | } |
diff --git a/drivers/net/hamradio/yam.c b/drivers/net/hamradio/yam.c index 83034eb7ed4f..16ec7af6ab7b 100644 --- a/drivers/net/hamradio/yam.c +++ b/drivers/net/hamradio/yam.c | |||
@@ -841,20 +841,6 @@ static const struct seq_operations yam_seqops = { | |||
841 | .stop = yam_seq_stop, | 841 | .stop = yam_seq_stop, |
842 | .show = yam_seq_show, | 842 | .show = yam_seq_show, |
843 | }; | 843 | }; |
844 | |||
845 | static int yam_info_open(struct inode *inode, struct file *file) | ||
846 | { | ||
847 | return seq_open(file, &yam_seqops); | ||
848 | } | ||
849 | |||
850 | static const struct file_operations yam_info_fops = { | ||
851 | .owner = THIS_MODULE, | ||
852 | .open = yam_info_open, | ||
853 | .read = seq_read, | ||
854 | .llseek = seq_lseek, | ||
855 | .release = seq_release, | ||
856 | }; | ||
857 | |||
858 | #endif | 844 | #endif |
859 | 845 | ||
860 | 846 | ||
@@ -1168,7 +1154,7 @@ static int __init yam_init_driver(void) | |||
1168 | yam_timer.expires = jiffies + HZ / 100; | 1154 | yam_timer.expires = jiffies + HZ / 100; |
1169 | add_timer(&yam_timer); | 1155 | add_timer(&yam_timer); |
1170 | 1156 | ||
1171 | proc_create("yam", 0444, init_net.proc_net, &yam_info_fops); | 1157 | proc_create_seq("yam", 0444, init_net.proc_net, &yam_seqops); |
1172 | return 0; | 1158 | return 0; |
1173 | error: | 1159 | error: |
1174 | while (--i >= 0) { | 1160 | while (--i >= 0) { |
diff --git a/drivers/pci/proc.c b/drivers/pci/proc.c index 1ee8927a0635..7ac035af39f0 100644 --- a/drivers/pci/proc.c +++ b/drivers/pci/proc.c | |||
@@ -435,25 +435,12 @@ int pci_proc_detach_bus(struct pci_bus *bus) | |||
435 | return 0; | 435 | return 0; |
436 | } | 436 | } |
437 | 437 | ||
438 | static int proc_bus_pci_dev_open(struct inode *inode, struct file *file) | ||
439 | { | ||
440 | return seq_open(file, &proc_bus_pci_devices_op); | ||
441 | } | ||
442 | |||
443 | static const struct file_operations proc_bus_pci_dev_operations = { | ||
444 | .owner = THIS_MODULE, | ||
445 | .open = proc_bus_pci_dev_open, | ||
446 | .read = seq_read, | ||
447 | .llseek = seq_lseek, | ||
448 | .release = seq_release, | ||
449 | }; | ||
450 | |||
451 | static int __init pci_proc_init(void) | 438 | static int __init pci_proc_init(void) |
452 | { | 439 | { |
453 | struct pci_dev *dev = NULL; | 440 | struct pci_dev *dev = NULL; |
454 | proc_bus_pci_dir = proc_mkdir("bus/pci", NULL); | 441 | proc_bus_pci_dir = proc_mkdir("bus/pci", NULL); |
455 | proc_create("devices", 0, proc_bus_pci_dir, | 442 | proc_create_seq("devices", 0, proc_bus_pci_dir, |
456 | &proc_bus_pci_dev_operations); | 443 | &proc_bus_pci_devices_op); |
457 | proc_initialized = 1; | 444 | proc_initialized = 1; |
458 | for_each_pci_dev(dev) | 445 | for_each_pci_dev(dev) |
459 | pci_proc_attach_device(dev); | 446 | pci_proc_attach_device(dev); |
diff --git a/drivers/s390/block/dasd_proc.c b/drivers/s390/block/dasd_proc.c index c33788a829c3..5cb80c645489 100644 --- a/drivers/s390/block/dasd_proc.c +++ b/drivers/s390/block/dasd_proc.c | |||
@@ -131,19 +131,6 @@ static const struct seq_operations dasd_devices_seq_ops = { | |||
131 | .show = dasd_devices_show, | 131 | .show = dasd_devices_show, |
132 | }; | 132 | }; |
133 | 133 | ||
134 | static int dasd_devices_open(struct inode *inode, struct file *file) | ||
135 | { | ||
136 | return seq_open(file, &dasd_devices_seq_ops); | ||
137 | } | ||
138 | |||
139 | static const struct file_operations dasd_devices_file_ops = { | ||
140 | .owner = THIS_MODULE, | ||
141 | .open = dasd_devices_open, | ||
142 | .read = seq_read, | ||
143 | .llseek = seq_lseek, | ||
144 | .release = seq_release, | ||
145 | }; | ||
146 | |||
147 | #ifdef CONFIG_DASD_PROFILE | 134 | #ifdef CONFIG_DASD_PROFILE |
148 | static int dasd_stats_all_block_on(void) | 135 | static int dasd_stats_all_block_on(void) |
149 | { | 136 | { |
@@ -352,10 +339,10 @@ dasd_proc_init(void) | |||
352 | dasd_proc_root_entry = proc_mkdir("dasd", NULL); | 339 | dasd_proc_root_entry = proc_mkdir("dasd", NULL); |
353 | if (!dasd_proc_root_entry) | 340 | if (!dasd_proc_root_entry) |
354 | goto out_nodasd; | 341 | goto out_nodasd; |
355 | dasd_devices_entry = proc_create("devices", | 342 | dasd_devices_entry = proc_create_seq("devices", |
356 | S_IFREG | S_IRUGO | S_IWUSR, | 343 | S_IFREG | S_IRUGO | S_IWUSR, |
357 | dasd_proc_root_entry, | 344 | dasd_proc_root_entry, |
358 | &dasd_devices_file_ops); | 345 | &dasd_devices_seq_ops); |
359 | if (!dasd_devices_entry) | 346 | if (!dasd_devices_entry) |
360 | goto out_nodevices; | 347 | goto out_nodevices; |
361 | dasd_statistics_entry = proc_create("statistics", | 348 | dasd_statistics_entry = proc_create("statistics", |
diff --git a/drivers/s390/char/tape_proc.c b/drivers/s390/char/tape_proc.c index faae30476f4b..32a14ee31c6b 100644 --- a/drivers/s390/char/tape_proc.c +++ b/drivers/s390/char/tape_proc.c | |||
@@ -105,29 +105,14 @@ static const struct seq_operations tape_proc_seq = { | |||
105 | .show = tape_proc_show, | 105 | .show = tape_proc_show, |
106 | }; | 106 | }; |
107 | 107 | ||
108 | static int tape_proc_open(struct inode *inode, struct file *file) | ||
109 | { | ||
110 | return seq_open(file, &tape_proc_seq); | ||
111 | } | ||
112 | |||
113 | static const struct file_operations tape_proc_ops = | ||
114 | { | ||
115 | .owner = THIS_MODULE, | ||
116 | .open = tape_proc_open, | ||
117 | .read = seq_read, | ||
118 | .llseek = seq_lseek, | ||
119 | .release = seq_release, | ||
120 | }; | ||
121 | |||
122 | /* | 108 | /* |
123 | * Initialize procfs stuff on startup | 109 | * Initialize procfs stuff on startup |
124 | */ | 110 | */ |
125 | void | 111 | void |
126 | tape_proc_init(void) | 112 | tape_proc_init(void) |
127 | { | 113 | { |
128 | tape_proc_devices = | 114 | tape_proc_devices = proc_create_seq("tapedevices", |
129 | proc_create("tapedevices", S_IFREG | S_IRUGO | S_IWUSR, NULL, | 115 | S_IFREG | S_IRUGO | S_IWUSR, NULL, &tape_proc_seq); |
130 | &tape_proc_ops); | ||
131 | if (tape_proc_devices == NULL) { | 116 | if (tape_proc_devices == NULL) { |
132 | return; | 117 | return; |
133 | } | 118 | } |
diff --git a/drivers/staging/ipx/ipx_proc.c b/drivers/staging/ipx/ipx_proc.c index b9232e4e2ed4..360f0ad970de 100644 --- a/drivers/staging/ipx/ipx_proc.c +++ b/drivers/staging/ipx/ipx_proc.c | |||
@@ -244,42 +244,6 @@ static const struct seq_operations ipx_seq_socket_ops = { | |||
244 | .show = ipx_seq_socket_show, | 244 | .show = ipx_seq_socket_show, |
245 | }; | 245 | }; |
246 | 246 | ||
247 | static int ipx_seq_route_open(struct inode *inode, struct file *file) | ||
248 | { | ||
249 | return seq_open(file, &ipx_seq_route_ops); | ||
250 | } | ||
251 | |||
252 | static int ipx_seq_interface_open(struct inode *inode, struct file *file) | ||
253 | { | ||
254 | return seq_open(file, &ipx_seq_interface_ops); | ||
255 | } | ||
256 | |||
257 | static int ipx_seq_socket_open(struct inode *inode, struct file *file) | ||
258 | { | ||
259 | return seq_open(file, &ipx_seq_socket_ops); | ||
260 | } | ||
261 | |||
262 | static const struct file_operations ipx_seq_interface_fops = { | ||
263 | .open = ipx_seq_interface_open, | ||
264 | .read = seq_read, | ||
265 | .llseek = seq_lseek, | ||
266 | .release = seq_release, | ||
267 | }; | ||
268 | |||
269 | static const struct file_operations ipx_seq_route_fops = { | ||
270 | .open = ipx_seq_route_open, | ||
271 | .read = seq_read, | ||
272 | .llseek = seq_lseek, | ||
273 | .release = seq_release, | ||
274 | }; | ||
275 | |||
276 | static const struct file_operations ipx_seq_socket_fops = { | ||
277 | .open = ipx_seq_socket_open, | ||
278 | .read = seq_read, | ||
279 | .llseek = seq_lseek, | ||
280 | .release = seq_release, | ||
281 | }; | ||
282 | |||
283 | static struct proc_dir_entry *ipx_proc_dir; | 247 | static struct proc_dir_entry *ipx_proc_dir; |
284 | 248 | ||
285 | int __init ipx_proc_init(void) | 249 | int __init ipx_proc_init(void) |
@@ -291,16 +255,17 @@ int __init ipx_proc_init(void) | |||
291 | 255 | ||
292 | if (!ipx_proc_dir) | 256 | if (!ipx_proc_dir) |
293 | goto out; | 257 | goto out; |
294 | p = proc_create("interface", S_IRUGO, | 258 | p = proc_create_seq("interface", S_IRUGO, ipx_proc_dir, |
295 | ipx_proc_dir, &ipx_seq_interface_fops); | 259 | &ipx_seq_interface_ops); |
296 | if (!p) | 260 | if (!p) |
297 | goto out_interface; | 261 | goto out_interface; |
298 | 262 | ||
299 | p = proc_create("route", S_IRUGO, ipx_proc_dir, &ipx_seq_route_fops); | 263 | p = proc_create_seq("route", S_IRUGO, ipx_proc_dir, &ipx_seq_route_ops); |
300 | if (!p) | 264 | if (!p) |
301 | goto out_route; | 265 | goto out_route; |
302 | 266 | ||
303 | p = proc_create("socket", S_IRUGO, ipx_proc_dir, &ipx_seq_socket_fops); | 267 | p = proc_create_seq("socket", S_IRUGO, ipx_proc_dir, |
268 | &ipx_seq_socket_ops); | ||
304 | if (!p) | 269 | if (!p) |
305 | goto out_socket; | 270 | goto out_socket; |
306 | 271 | ||
diff --git a/drivers/tty/tty_ldisc.c b/drivers/tty/tty_ldisc.c index fb7329ab2b37..fc4c97cae01e 100644 --- a/drivers/tty/tty_ldisc.c +++ b/drivers/tty/tty_ldisc.c | |||
@@ -229,26 +229,13 @@ static int tty_ldiscs_seq_show(struct seq_file *m, void *v) | |||
229 | return 0; | 229 | return 0; |
230 | } | 230 | } |
231 | 231 | ||
232 | static const struct seq_operations tty_ldiscs_seq_ops = { | 232 | const struct seq_operations tty_ldiscs_seq_ops = { |
233 | .start = tty_ldiscs_seq_start, | 233 | .start = tty_ldiscs_seq_start, |
234 | .next = tty_ldiscs_seq_next, | 234 | .next = tty_ldiscs_seq_next, |
235 | .stop = tty_ldiscs_seq_stop, | 235 | .stop = tty_ldiscs_seq_stop, |
236 | .show = tty_ldiscs_seq_show, | 236 | .show = tty_ldiscs_seq_show, |
237 | }; | 237 | }; |
238 | 238 | ||
239 | static int proc_tty_ldiscs_open(struct inode *inode, struct file *file) | ||
240 | { | ||
241 | return seq_open(file, &tty_ldiscs_seq_ops); | ||
242 | } | ||
243 | |||
244 | const struct file_operations tty_ldiscs_proc_fops = { | ||
245 | .owner = THIS_MODULE, | ||
246 | .open = proc_tty_ldiscs_open, | ||
247 | .read = seq_read, | ||
248 | .llseek = seq_lseek, | ||
249 | .release = seq_release, | ||
250 | }; | ||
251 | |||
252 | /** | 239 | /** |
253 | * tty_ldisc_ref_wait - wait for the tty ldisc | 240 | * tty_ldisc_ref_wait - wait for the tty ldisc |
254 | * @tty: tty device | 241 | * @tty: tty device |
diff --git a/drivers/video/fbdev/core/fbmem.c b/drivers/video/fbdev/core/fbmem.c index f741ba8df01b..924d0730ffe2 100644 --- a/drivers/video/fbdev/core/fbmem.c +++ b/drivers/video/fbdev/core/fbmem.c | |||
@@ -713,19 +713,6 @@ static const struct seq_operations proc_fb_seq_ops = { | |||
713 | .show = fb_seq_show, | 713 | .show = fb_seq_show, |
714 | }; | 714 | }; |
715 | 715 | ||
716 | static int proc_fb_open(struct inode *inode, struct file *file) | ||
717 | { | ||
718 | return seq_open(file, &proc_fb_seq_ops); | ||
719 | } | ||
720 | |||
721 | static const struct file_operations fb_proc_fops = { | ||
722 | .owner = THIS_MODULE, | ||
723 | .open = proc_fb_open, | ||
724 | .read = seq_read, | ||
725 | .llseek = seq_lseek, | ||
726 | .release = seq_release, | ||
727 | }; | ||
728 | |||
729 | /* | 716 | /* |
730 | * We hold a reference to the fb_info in file->private_data, | 717 | * We hold a reference to the fb_info in file->private_data, |
731 | * but if the current registered fb has changed, we don't | 718 | * but if the current registered fb has changed, we don't |
@@ -1877,7 +1864,7 @@ fbmem_init(void) | |||
1877 | { | 1864 | { |
1878 | int ret; | 1865 | int ret; |
1879 | 1866 | ||
1880 | if (!proc_create("fb", 0, NULL, &fb_proc_fops)) | 1867 | if (!proc_create_seq("fb", 0, NULL, &proc_fb_seq_ops)) |
1881 | return -ENOMEM; | 1868 | return -ENOMEM; |
1882 | 1869 | ||
1883 | ret = register_chrdev(FB_MAJOR, "fb", &fb_fops); | 1870 | ret = register_chrdev(FB_MAJOR, "fb", &fb_fops); |
diff --git a/drivers/zorro/proc.c b/drivers/zorro/proc.c index df05a26ab8d8..2e4ca4dc0960 100644 --- a/drivers/zorro/proc.c +++ b/drivers/zorro/proc.c | |||
@@ -96,19 +96,6 @@ static const struct seq_operations zorro_devices_seq_ops = { | |||
96 | .show = zorro_seq_show, | 96 | .show = zorro_seq_show, |
97 | }; | 97 | }; |
98 | 98 | ||
99 | static int zorro_devices_proc_open(struct inode *inode, struct file *file) | ||
100 | { | ||
101 | return seq_open(file, &zorro_devices_seq_ops); | ||
102 | } | ||
103 | |||
104 | static const struct file_operations zorro_devices_proc_fops = { | ||
105 | .owner = THIS_MODULE, | ||
106 | .open = zorro_devices_proc_open, | ||
107 | .read = seq_read, | ||
108 | .llseek = seq_lseek, | ||
109 | .release = seq_release, | ||
110 | }; | ||
111 | |||
112 | static struct proc_dir_entry *proc_bus_zorro_dir; | 99 | static struct proc_dir_entry *proc_bus_zorro_dir; |
113 | 100 | ||
114 | static int __init zorro_proc_attach_device(unsigned int slot) | 101 | static int __init zorro_proc_attach_device(unsigned int slot) |
@@ -132,8 +119,8 @@ static int __init zorro_proc_init(void) | |||
132 | 119 | ||
133 | if (MACH_IS_AMIGA && AMIGAHW_PRESENT(ZORRO)) { | 120 | if (MACH_IS_AMIGA && AMIGAHW_PRESENT(ZORRO)) { |
134 | proc_bus_zorro_dir = proc_mkdir("bus/zorro", NULL); | 121 | proc_bus_zorro_dir = proc_mkdir("bus/zorro", NULL); |
135 | proc_create("devices", 0, proc_bus_zorro_dir, | 122 | proc_create_seq("devices", 0, proc_bus_zorro_dir, |
136 | &zorro_devices_proc_fops); | 123 | &zorro_devices_seq_ops); |
137 | for (slot = 0; slot < zorro_num_autocon; slot++) | 124 | for (slot = 0; slot < zorro_num_autocon; slot++) |
138 | zorro_proc_attach_device(slot); | 125 | zorro_proc_attach_device(slot); |
139 | } | 126 | } |
diff --git a/fs/cachefiles/proc.c b/fs/cachefiles/proc.c index 125b90f6c796..0ce1aa56b67f 100644 --- a/fs/cachefiles/proc.c +++ b/fs/cachefiles/proc.c | |||
@@ -85,21 +85,6 @@ static const struct seq_operations cachefiles_histogram_ops = { | |||
85 | }; | 85 | }; |
86 | 86 | ||
87 | /* | 87 | /* |
88 | * open "/proc/fs/cachefiles/XXX" which provide statistics summaries | ||
89 | */ | ||
90 | static int cachefiles_histogram_open(struct inode *inode, struct file *file) | ||
91 | { | ||
92 | return seq_open(file, &cachefiles_histogram_ops); | ||
93 | } | ||
94 | |||
95 | static const struct file_operations cachefiles_histogram_fops = { | ||
96 | .open = cachefiles_histogram_open, | ||
97 | .read = seq_read, | ||
98 | .llseek = seq_lseek, | ||
99 | .release = seq_release, | ||
100 | }; | ||
101 | |||
102 | /* | ||
103 | * initialise the /proc/fs/cachefiles/ directory | 88 | * initialise the /proc/fs/cachefiles/ directory |
104 | */ | 89 | */ |
105 | int __init cachefiles_proc_init(void) | 90 | int __init cachefiles_proc_init(void) |
@@ -109,8 +94,8 @@ int __init cachefiles_proc_init(void) | |||
109 | if (!proc_mkdir("fs/cachefiles", NULL)) | 94 | if (!proc_mkdir("fs/cachefiles", NULL)) |
110 | goto error_dir; | 95 | goto error_dir; |
111 | 96 | ||
112 | if (!proc_create("fs/cachefiles/histogram", S_IFREG | 0444, NULL, | 97 | if (!proc_create_seq("fs/cachefiles/histogram", S_IFREG | 0444, NULL, |
113 | &cachefiles_histogram_fops)) | 98 | &cachefiles_histogram_ops)) |
114 | goto error_histogram; | 99 | goto error_histogram; |
115 | 100 | ||
116 | _leave(" = 0"); | 101 | _leave(" = 0"); |
diff --git a/fs/fscache/histogram.c b/fs/fscache/histogram.c index 15a3d042247e..9a13e9e15b69 100644 --- a/fs/fscache/histogram.c +++ b/fs/fscache/histogram.c | |||
@@ -83,24 +83,9 @@ static void fscache_histogram_stop(struct seq_file *m, void *v) | |||
83 | { | 83 | { |
84 | } | 84 | } |
85 | 85 | ||
86 | static const struct seq_operations fscache_histogram_ops = { | 86 | const struct seq_operations fscache_histogram_ops = { |
87 | .start = fscache_histogram_start, | 87 | .start = fscache_histogram_start, |
88 | .stop = fscache_histogram_stop, | 88 | .stop = fscache_histogram_stop, |
89 | .next = fscache_histogram_next, | 89 | .next = fscache_histogram_next, |
90 | .show = fscache_histogram_show, | 90 | .show = fscache_histogram_show, |
91 | }; | 91 | }; |
92 | |||
93 | /* | ||
94 | * open "/proc/fs/fscache/histogram" to provide latency data | ||
95 | */ | ||
96 | static int fscache_histogram_open(struct inode *inode, struct file *file) | ||
97 | { | ||
98 | return seq_open(file, &fscache_histogram_ops); | ||
99 | } | ||
100 | |||
101 | const struct file_operations fscache_histogram_fops = { | ||
102 | .open = fscache_histogram_open, | ||
103 | .read = seq_read, | ||
104 | .llseek = seq_lseek, | ||
105 | .release = seq_release, | ||
106 | }; | ||
diff --git a/fs/fscache/internal.h b/fs/fscache/internal.h index 500650f938fe..53cfd0b34c38 100644 --- a/fs/fscache/internal.h +++ b/fs/fscache/internal.h | |||
@@ -31,6 +31,7 @@ | |||
31 | #include <linux/fscache-cache.h> | 31 | #include <linux/fscache-cache.h> |
32 | #include <trace/events/fscache.h> | 32 | #include <trace/events/fscache.h> |
33 | #include <linux/sched.h> | 33 | #include <linux/sched.h> |
34 | #include <linux/seq_file.h> | ||
34 | 35 | ||
35 | #define FSCACHE_MIN_THREADS 4 | 36 | #define FSCACHE_MIN_THREADS 4 |
36 | #define FSCACHE_MAX_THREADS 32 | 37 | #define FSCACHE_MAX_THREADS 32 |
@@ -84,7 +85,7 @@ static inline void fscache_hist(atomic_t histogram[], unsigned long start_jif) | |||
84 | atomic_inc(&histogram[jif]); | 85 | atomic_inc(&histogram[jif]); |
85 | } | 86 | } |
86 | 87 | ||
87 | extern const struct file_operations fscache_histogram_fops; | 88 | extern const struct seq_operations fscache_histogram_ops; |
88 | 89 | ||
89 | #else | 90 | #else |
90 | #define fscache_hist(hist, start_jif) do {} while (0) | 91 | #define fscache_hist(hist, start_jif) do {} while (0) |
diff --git a/fs/fscache/proc.c b/fs/fscache/proc.c index 1d9e4951a597..459df553ea09 100644 --- a/fs/fscache/proc.c +++ b/fs/fscache/proc.c | |||
@@ -32,8 +32,8 @@ int __init fscache_proc_init(void) | |||
32 | #endif | 32 | #endif |
33 | 33 | ||
34 | #ifdef CONFIG_FSCACHE_HISTOGRAM | 34 | #ifdef CONFIG_FSCACHE_HISTOGRAM |
35 | if (!proc_create("fs/fscache/histogram", S_IFREG | 0444, NULL, | 35 | if (!proc_create_seq("fs/fscache/histogram", S_IFREG | 0444, NULL, |
36 | &fscache_histogram_fops)) | 36 | &fscache_histogram_ops)) |
37 | goto error_histogram; | 37 | goto error_histogram; |
38 | #endif | 38 | #endif |
39 | 39 | ||
diff --git a/fs/proc/consoles.c b/fs/proc/consoles.c index a8ac48aebd59..954caf0b7fee 100644 --- a/fs/proc/consoles.c +++ b/fs/proc/consoles.c | |||
@@ -91,21 +91,9 @@ static const struct seq_operations consoles_op = { | |||
91 | .show = show_console_dev | 91 | .show = show_console_dev |
92 | }; | 92 | }; |
93 | 93 | ||
94 | static int consoles_open(struct inode *inode, struct file *file) | ||
95 | { | ||
96 | return seq_open(file, &consoles_op); | ||
97 | } | ||
98 | |||
99 | static const struct file_operations proc_consoles_operations = { | ||
100 | .open = consoles_open, | ||
101 | .read = seq_read, | ||
102 | .llseek = seq_lseek, | ||
103 | .release = seq_release, | ||
104 | }; | ||
105 | |||
106 | static int __init proc_consoles_init(void) | 94 | static int __init proc_consoles_init(void) |
107 | { | 95 | { |
108 | proc_create("consoles", 0, NULL, &proc_consoles_operations); | 96 | proc_create_seq("consoles", 0, NULL, &consoles_op); |
109 | return 0; | 97 | return 0; |
110 | } | 98 | } |
111 | fs_initcall(proc_consoles_init); | 99 | fs_initcall(proc_consoles_init); |
diff --git a/fs/proc/devices.c b/fs/proc/devices.c index 2c7f22b14489..37d38697eaf8 100644 --- a/fs/proc/devices.c +++ b/fs/proc/devices.c | |||
@@ -51,21 +51,9 @@ static const struct seq_operations devinfo_ops = { | |||
51 | .show = devinfo_show | 51 | .show = devinfo_show |
52 | }; | 52 | }; |
53 | 53 | ||
54 | static int devinfo_open(struct inode *inode, struct file *filp) | ||
55 | { | ||
56 | return seq_open(filp, &devinfo_ops); | ||
57 | } | ||
58 | |||
59 | static const struct file_operations proc_devinfo_operations = { | ||
60 | .open = devinfo_open, | ||
61 | .read = seq_read, | ||
62 | .llseek = seq_lseek, | ||
63 | .release = seq_release, | ||
64 | }; | ||
65 | |||
66 | static int __init proc_devices_init(void) | 54 | static int __init proc_devices_init(void) |
67 | { | 55 | { |
68 | proc_create("devices", 0, NULL, &proc_devinfo_operations); | 56 | proc_create_seq("devices", 0, NULL, &devinfo_ops); |
69 | return 0; | 57 | return 0; |
70 | } | 58 | } |
71 | fs_initcall(proc_devices_init); | 59 | fs_initcall(proc_devices_init); |
diff --git a/fs/proc/generic.c b/fs/proc/generic.c index ab6a321076b8..af644caaaf85 100644 --- a/fs/proc/generic.c +++ b/fs/proc/generic.c | |||
@@ -25,6 +25,7 @@ | |||
25 | #include <linux/spinlock.h> | 25 | #include <linux/spinlock.h> |
26 | #include <linux/completion.h> | 26 | #include <linux/completion.h> |
27 | #include <linux/uaccess.h> | 27 | #include <linux/uaccess.h> |
28 | #include <linux/seq_file.h> | ||
28 | 29 | ||
29 | #include "internal.h" | 30 | #include "internal.h" |
30 | 31 | ||
@@ -555,6 +556,35 @@ struct proc_dir_entry *proc_create(const char *name, umode_t mode, | |||
555 | } | 556 | } |
556 | EXPORT_SYMBOL(proc_create); | 557 | EXPORT_SYMBOL(proc_create); |
557 | 558 | ||
559 | static int proc_seq_open(struct inode *inode, struct file *file) | ||
560 | { | ||
561 | struct proc_dir_entry *de = PDE(inode); | ||
562 | |||
563 | return seq_open(file, de->seq_ops); | ||
564 | } | ||
565 | |||
566 | static const struct file_operations proc_seq_fops = { | ||
567 | .open = proc_seq_open, | ||
568 | .read = seq_read, | ||
569 | .llseek = seq_lseek, | ||
570 | .release = seq_release, | ||
571 | }; | ||
572 | |||
573 | struct proc_dir_entry *proc_create_seq_data(const char *name, umode_t mode, | ||
574 | struct proc_dir_entry *parent, const struct seq_operations *ops, | ||
575 | void *data) | ||
576 | { | ||
577 | struct proc_dir_entry *p; | ||
578 | |||
579 | p = proc_create_reg(name, mode, &parent, data); | ||
580 | if (!p) | ||
581 | return NULL; | ||
582 | p->proc_fops = &proc_seq_fops; | ||
583 | p->seq_ops = ops; | ||
584 | return proc_register(parent, p); | ||
585 | } | ||
586 | EXPORT_SYMBOL(proc_create_seq_data); | ||
587 | |||
558 | void proc_set_size(struct proc_dir_entry *de, loff_t size) | 588 | void proc_set_size(struct proc_dir_entry *de, loff_t size) |
559 | { | 589 | { |
560 | de->size = size; | 590 | de->size = size; |
diff --git a/fs/proc/internal.h b/fs/proc/internal.h index dd1e11400b97..4fb01c5f9c1a 100644 --- a/fs/proc/internal.h +++ b/fs/proc/internal.h | |||
@@ -44,6 +44,7 @@ struct proc_dir_entry { | |||
44 | struct completion *pde_unload_completion; | 44 | struct completion *pde_unload_completion; |
45 | const struct inode_operations *proc_iops; | 45 | const struct inode_operations *proc_iops; |
46 | const struct file_operations *proc_fops; | 46 | const struct file_operations *proc_fops; |
47 | const struct seq_operations *seq_ops; | ||
47 | void *data; | 48 | void *data; |
48 | unsigned int low_ino; | 49 | unsigned int low_ino; |
49 | nlink_t nlink; | 50 | nlink_t nlink; |
diff --git a/fs/proc/interrupts.c b/fs/proc/interrupts.c index 6a6bee9c603c..cb0edc7cbf09 100644 --- a/fs/proc/interrupts.c +++ b/fs/proc/interrupts.c | |||
@@ -34,21 +34,9 @@ static const struct seq_operations int_seq_ops = { | |||
34 | .show = show_interrupts | 34 | .show = show_interrupts |
35 | }; | 35 | }; |
36 | 36 | ||
37 | static int interrupts_open(struct inode *inode, struct file *filp) | ||
38 | { | ||
39 | return seq_open(filp, &int_seq_ops); | ||
40 | } | ||
41 | |||
42 | static const struct file_operations proc_interrupts_operations = { | ||
43 | .open = interrupts_open, | ||
44 | .read = seq_read, | ||
45 | .llseek = seq_lseek, | ||
46 | .release = seq_release, | ||
47 | }; | ||
48 | |||
49 | static int __init proc_interrupts_init(void) | 37 | static int __init proc_interrupts_init(void) |
50 | { | 38 | { |
51 | proc_create("interrupts", 0, NULL, &proc_interrupts_operations); | 39 | proc_create_seq("interrupts", 0, NULL, &int_seq_ops); |
52 | return 0; | 40 | return 0; |
53 | } | 41 | } |
54 | fs_initcall(proc_interrupts_init); | 42 | fs_initcall(proc_interrupts_init); |
diff --git a/fs/proc/nommu.c b/fs/proc/nommu.c index 75634379f82e..3b63be64e436 100644 --- a/fs/proc/nommu.c +++ b/fs/proc/nommu.c | |||
@@ -113,21 +113,9 @@ static const struct seq_operations proc_nommu_region_list_seqop = { | |||
113 | .show = nommu_region_list_show | 113 | .show = nommu_region_list_show |
114 | }; | 114 | }; |
115 | 115 | ||
116 | static int proc_nommu_region_list_open(struct inode *inode, struct file *file) | ||
117 | { | ||
118 | return seq_open(file, &proc_nommu_region_list_seqop); | ||
119 | } | ||
120 | |||
121 | static const struct file_operations proc_nommu_region_list_operations = { | ||
122 | .open = proc_nommu_region_list_open, | ||
123 | .read = seq_read, | ||
124 | .llseek = seq_lseek, | ||
125 | .release = seq_release, | ||
126 | }; | ||
127 | |||
128 | static int __init proc_nommu_init(void) | 116 | static int __init proc_nommu_init(void) |
129 | { | 117 | { |
130 | proc_create("maps", S_IRUGO, NULL, &proc_nommu_region_list_operations); | 118 | proc_create_seq("maps", S_IRUGO, NULL, &proc_nommu_region_list_seqop); |
131 | return 0; | 119 | return 0; |
132 | } | 120 | } |
133 | 121 | ||
diff --git a/fs/proc/proc_tty.c b/fs/proc/proc_tty.c index d0cf1c50bb6c..b1a4a8ddd246 100644 --- a/fs/proc/proc_tty.c +++ b/fs/proc/proc_tty.c | |||
@@ -126,18 +126,6 @@ static const struct seq_operations tty_drivers_op = { | |||
126 | .show = show_tty_driver | 126 | .show = show_tty_driver |
127 | }; | 127 | }; |
128 | 128 | ||
129 | static int tty_drivers_open(struct inode *inode, struct file *file) | ||
130 | { | ||
131 | return seq_open(file, &tty_drivers_op); | ||
132 | } | ||
133 | |||
134 | static const struct file_operations proc_tty_drivers_operations = { | ||
135 | .open = tty_drivers_open, | ||
136 | .read = seq_read, | ||
137 | .llseek = seq_lseek, | ||
138 | .release = seq_release, | ||
139 | }; | ||
140 | |||
141 | /* | 129 | /* |
142 | * This function is called by tty_register_driver() to handle | 130 | * This function is called by tty_register_driver() to handle |
143 | * registering the driver's /proc handler into /proc/tty/driver/<foo> | 131 | * registering the driver's /proc handler into /proc/tty/driver/<foo> |
@@ -186,6 +174,6 @@ void __init proc_tty_init(void) | |||
186 | * entry. | 174 | * entry. |
187 | */ | 175 | */ |
188 | proc_tty_driver = proc_mkdir_mode("tty/driver", S_IRUSR|S_IXUSR, NULL); | 176 | proc_tty_driver = proc_mkdir_mode("tty/driver", S_IRUSR|S_IXUSR, NULL); |
189 | proc_create("tty/ldiscs", 0, NULL, &tty_ldiscs_proc_fops); | 177 | proc_create_seq("tty/ldiscs", 0, NULL, &tty_ldiscs_seq_ops); |
190 | proc_create("tty/drivers", 0, NULL, &proc_tty_drivers_operations); | 178 | proc_create_seq("tty/drivers", 0, NULL, &tty_drivers_op); |
191 | } | 179 | } |
diff --git a/include/linux/proc_fs.h b/include/linux/proc_fs.h index 4edcde510631..f368a896a8cb 100644 --- a/include/linux/proc_fs.h +++ b/include/linux/proc_fs.h | |||
@@ -9,6 +9,7 @@ | |||
9 | #include <linux/fs.h> | 9 | #include <linux/fs.h> |
10 | 10 | ||
11 | struct proc_dir_entry; | 11 | struct proc_dir_entry; |
12 | struct seq_operations; | ||
12 | 13 | ||
13 | #ifdef CONFIG_PROC_FS | 14 | #ifdef CONFIG_PROC_FS |
14 | 15 | ||
@@ -23,6 +24,12 @@ extern struct proc_dir_entry *proc_mkdir_data(const char *, umode_t, | |||
23 | extern struct proc_dir_entry *proc_mkdir_mode(const char *, umode_t, | 24 | extern struct proc_dir_entry *proc_mkdir_mode(const char *, umode_t, |
24 | struct proc_dir_entry *); | 25 | struct proc_dir_entry *); |
25 | struct proc_dir_entry *proc_create_mount_point(const char *name); | 26 | struct proc_dir_entry *proc_create_mount_point(const char *name); |
27 | |||
28 | struct proc_dir_entry *proc_create_seq_data(const char *name, umode_t mode, | ||
29 | struct proc_dir_entry *parent, const struct seq_operations *ops, | ||
30 | void *data); | ||
31 | #define proc_create_seq(name, mode, parent, ops) \ | ||
32 | proc_create_seq_data(name, mode, parent, ops, NULL) | ||
26 | 33 | ||
27 | extern struct proc_dir_entry *proc_create_data(const char *, umode_t, | 34 | extern struct proc_dir_entry *proc_create_data(const char *, umode_t, |
28 | struct proc_dir_entry *, | 35 | struct proc_dir_entry *, |
@@ -57,6 +64,8 @@ static inline struct proc_dir_entry *proc_mkdir_data(const char *name, | |||
57 | umode_t mode, struct proc_dir_entry *parent, void *data) { return NULL; } | 64 | umode_t mode, struct proc_dir_entry *parent, void *data) { return NULL; } |
58 | static inline struct proc_dir_entry *proc_mkdir_mode(const char *name, | 65 | static inline struct proc_dir_entry *proc_mkdir_mode(const char *name, |
59 | umode_t mode, struct proc_dir_entry *parent) { return NULL; } | 66 | umode_t mode, struct proc_dir_entry *parent) { return NULL; } |
67 | #define proc_create_seq_data(name, mode, parent, ops, data) ({NULL;}) | ||
68 | #define proc_create_seq(name, mode, parent, ops) ({NULL;}) | ||
60 | #define proc_create(name, mode, parent, proc_fops) ({NULL;}) | 69 | #define proc_create(name, mode, parent, proc_fops) ({NULL;}) |
61 | #define proc_create_data(name, mode, parent, proc_fops, data) ({NULL;}) | 70 | #define proc_create_data(name, mode, parent, proc_fops, data) ({NULL;}) |
62 | 71 | ||
diff --git a/include/linux/tty.h b/include/linux/tty.h index 1dd587ba6d88..9bd7d37adbfa 100644 --- a/include/linux/tty.h +++ b/include/linux/tty.h | |||
@@ -10,6 +10,7 @@ | |||
10 | #include <linux/tty_ldisc.h> | 10 | #include <linux/tty_ldisc.h> |
11 | #include <linux/mutex.h> | 11 | #include <linux/mutex.h> |
12 | #include <linux/tty_flags.h> | 12 | #include <linux/tty_flags.h> |
13 | #include <linux/seq_file.h> | ||
13 | #include <uapi/linux/tty.h> | 14 | #include <uapi/linux/tty.h> |
14 | #include <linux/rwsem.h> | 15 | #include <linux/rwsem.h> |
15 | #include <linux/llist.h> | 16 | #include <linux/llist.h> |
@@ -535,7 +536,7 @@ extern void tty_ldisc_deref(struct tty_ldisc *); | |||
535 | extern struct tty_ldisc *tty_ldisc_ref_wait(struct tty_struct *); | 536 | extern struct tty_ldisc *tty_ldisc_ref_wait(struct tty_struct *); |
536 | extern void tty_ldisc_hangup(struct tty_struct *tty, bool reset); | 537 | extern void tty_ldisc_hangup(struct tty_struct *tty, bool reset); |
537 | extern int tty_ldisc_reinit(struct tty_struct *tty, int disc); | 538 | extern int tty_ldisc_reinit(struct tty_struct *tty, int disc); |
538 | extern const struct file_operations tty_ldiscs_proc_fops; | 539 | extern const struct seq_operations tty_ldiscs_seq_ops; |
539 | 540 | ||
540 | extern void tty_wakeup(struct tty_struct *tty); | 541 | extern void tty_wakeup(struct tty_struct *tty); |
541 | extern void tty_ldisc_flush(struct tty_struct *tty); | 542 | extern void tty_ldisc_flush(struct tty_struct *tty); |
diff --git a/include/net/ax25.h b/include/net/ax25.h index c91bc87931c7..3f9aea8087e3 100644 --- a/include/net/ax25.h +++ b/include/net/ax25.h | |||
@@ -15,6 +15,7 @@ | |||
15 | #include <linux/refcount.h> | 15 | #include <linux/refcount.h> |
16 | #include <net/neighbour.h> | 16 | #include <net/neighbour.h> |
17 | #include <net/sock.h> | 17 | #include <net/sock.h> |
18 | #include <linux/seq_file.h> | ||
18 | 19 | ||
19 | #define AX25_T1CLAMPLO 1 | 20 | #define AX25_T1CLAMPLO 1 |
20 | #define AX25_T1CLAMPHI (30 * HZ) | 21 | #define AX25_T1CLAMPHI (30 * HZ) |
@@ -399,7 +400,7 @@ int ax25_check_iframes_acked(ax25_cb *, unsigned short); | |||
399 | /* ax25_route.c */ | 400 | /* ax25_route.c */ |
400 | void ax25_rt_device_down(struct net_device *); | 401 | void ax25_rt_device_down(struct net_device *); |
401 | int ax25_rt_ioctl(unsigned int, void __user *); | 402 | int ax25_rt_ioctl(unsigned int, void __user *); |
402 | extern const struct file_operations ax25_route_fops; | 403 | extern const struct seq_operations ax25_rt_seqops; |
403 | ax25_route *ax25_get_route(ax25_address *addr, struct net_device *dev); | 404 | ax25_route *ax25_get_route(ax25_address *addr, struct net_device *dev); |
404 | int ax25_rt_autobind(ax25_cb *, ax25_address *); | 405 | int ax25_rt_autobind(ax25_cb *, ax25_address *); |
405 | struct sk_buff *ax25_rt_build_path(struct sk_buff *, ax25_address *, | 406 | struct sk_buff *ax25_rt_build_path(struct sk_buff *, ax25_address *, |
@@ -455,7 +456,7 @@ unsigned long ax25_display_timer(struct timer_list *); | |||
455 | extern int ax25_uid_policy; | 456 | extern int ax25_uid_policy; |
456 | ax25_uid_assoc *ax25_findbyuid(kuid_t); | 457 | ax25_uid_assoc *ax25_findbyuid(kuid_t); |
457 | int __must_check ax25_uid_ioctl(int, struct sockaddr_ax25 *); | 458 | int __must_check ax25_uid_ioctl(int, struct sockaddr_ax25 *); |
458 | extern const struct file_operations ax25_uid_fops; | 459 | extern const struct seq_operations ax25_uid_seqops; |
459 | void ax25_uid_free(void); | 460 | void ax25_uid_free(void); |
460 | 461 | ||
461 | /* sysctl_net_ax25.c */ | 462 | /* sysctl_net_ax25.c */ |
diff --git a/include/net/netrom.h b/include/net/netrom.h index 0dad2dd5f9d7..5a0714ff500f 100644 --- a/include/net/netrom.h +++ b/include/net/netrom.h | |||
@@ -13,6 +13,7 @@ | |||
13 | #include <linux/slab.h> | 13 | #include <linux/slab.h> |
14 | #include <net/sock.h> | 14 | #include <net/sock.h> |
15 | #include <linux/refcount.h> | 15 | #include <linux/refcount.h> |
16 | #include <linux/seq_file.h> | ||
16 | 17 | ||
17 | #define NR_NETWORK_LEN 15 | 18 | #define NR_NETWORK_LEN 15 |
18 | #define NR_TRANSPORT_LEN 5 | 19 | #define NR_TRANSPORT_LEN 5 |
@@ -216,8 +217,8 @@ struct net_device *nr_dev_get(ax25_address *); | |||
216 | int nr_rt_ioctl(unsigned int, void __user *); | 217 | int nr_rt_ioctl(unsigned int, void __user *); |
217 | void nr_link_failed(ax25_cb *, int); | 218 | void nr_link_failed(ax25_cb *, int); |
218 | int nr_route_frame(struct sk_buff *, ax25_cb *); | 219 | int nr_route_frame(struct sk_buff *, ax25_cb *); |
219 | extern const struct file_operations nr_nodes_fops; | 220 | extern const struct seq_operations nr_node_seqops; |
220 | extern const struct file_operations nr_neigh_fops; | 221 | extern const struct seq_operations nr_neigh_seqops; |
221 | void nr_rt_free(void); | 222 | void nr_rt_free(void); |
222 | 223 | ||
223 | /* nr_subr.c */ | 224 | /* nr_subr.c */ |
diff --git a/include/net/rose.h b/include/net/rose.h index 04b72681f2ab..cf517d306a28 100644 --- a/include/net/rose.h +++ b/include/net/rose.h | |||
@@ -200,9 +200,9 @@ void rose_enquiry_response(struct sock *); | |||
200 | 200 | ||
201 | /* rose_route.c */ | 201 | /* rose_route.c */ |
202 | extern struct rose_neigh *rose_loopback_neigh; | 202 | extern struct rose_neigh *rose_loopback_neigh; |
203 | extern const struct file_operations rose_neigh_fops; | 203 | extern const struct seq_operations rose_neigh_seqops; |
204 | extern const struct file_operations rose_nodes_fops; | 204 | extern const struct seq_operations rose_node_seqops; |
205 | extern const struct file_operations rose_routes_fops; | 205 | extern struct seq_operations rose_route_seqops; |
206 | 206 | ||
207 | void rose_add_loopback_neigh(void); | 207 | void rose_add_loopback_neigh(void); |
208 | int __must_check rose_add_loopback_node(rose_address *); | 208 | int __must_check rose_add_loopback_node(rose_address *); |
diff --git a/kernel/locking/lockdep_proc.c b/kernel/locking/lockdep_proc.c index ad69bbc9bd28..3629049648a1 100644 --- a/kernel/locking/lockdep_proc.c +++ b/kernel/locking/lockdep_proc.c | |||
@@ -101,18 +101,6 @@ static const struct seq_operations lockdep_ops = { | |||
101 | .show = l_show, | 101 | .show = l_show, |
102 | }; | 102 | }; |
103 | 103 | ||
104 | static int lockdep_open(struct inode *inode, struct file *file) | ||
105 | { | ||
106 | return seq_open(file, &lockdep_ops); | ||
107 | } | ||
108 | |||
109 | static const struct file_operations proc_lockdep_operations = { | ||
110 | .open = lockdep_open, | ||
111 | .read = seq_read, | ||
112 | .llseek = seq_lseek, | ||
113 | .release = seq_release, | ||
114 | }; | ||
115 | |||
116 | #ifdef CONFIG_PROVE_LOCKING | 104 | #ifdef CONFIG_PROVE_LOCKING |
117 | static void *lc_start(struct seq_file *m, loff_t *pos) | 105 | static void *lc_start(struct seq_file *m, loff_t *pos) |
118 | { | 106 | { |
@@ -170,18 +158,6 @@ static const struct seq_operations lockdep_chains_ops = { | |||
170 | .stop = lc_stop, | 158 | .stop = lc_stop, |
171 | .show = lc_show, | 159 | .show = lc_show, |
172 | }; | 160 | }; |
173 | |||
174 | static int lockdep_chains_open(struct inode *inode, struct file *file) | ||
175 | { | ||
176 | return seq_open(file, &lockdep_chains_ops); | ||
177 | } | ||
178 | |||
179 | static const struct file_operations proc_lockdep_chains_operations = { | ||
180 | .open = lockdep_chains_open, | ||
181 | .read = seq_read, | ||
182 | .llseek = seq_lseek, | ||
183 | .release = seq_release, | ||
184 | }; | ||
185 | #endif /* CONFIG_PROVE_LOCKING */ | 161 | #endif /* CONFIG_PROVE_LOCKING */ |
186 | 162 | ||
187 | static void lockdep_stats_debug_show(struct seq_file *m) | 163 | static void lockdep_stats_debug_show(struct seq_file *m) |
@@ -682,10 +658,9 @@ static const struct file_operations proc_lock_stat_operations = { | |||
682 | 658 | ||
683 | static int __init lockdep_proc_init(void) | 659 | static int __init lockdep_proc_init(void) |
684 | { | 660 | { |
685 | proc_create("lockdep", S_IRUSR, NULL, &proc_lockdep_operations); | 661 | proc_create_seq("lockdep", S_IRUSR, NULL, &lockdep_ops); |
686 | #ifdef CONFIG_PROVE_LOCKING | 662 | #ifdef CONFIG_PROVE_LOCKING |
687 | proc_create("lockdep_chains", S_IRUSR, NULL, | 663 | proc_create_seq("lockdep_chains", S_IRUSR, NULL, &lockdep_chains_ops); |
688 | &proc_lockdep_chains_operations); | ||
689 | #endif | 664 | #endif |
690 | proc_create("lockdep_stats", S_IRUSR, NULL, | 665 | proc_create("lockdep_stats", S_IRUSR, NULL, |
691 | &proc_lockdep_stats_operations); | 666 | &proc_lockdep_stats_operations); |
diff --git a/kernel/sched/debug.c b/kernel/sched/debug.c index 15b10e210a6b..e593b4118578 100644 --- a/kernel/sched/debug.c +++ b/kernel/sched/debug.c | |||
@@ -823,35 +823,9 @@ static const struct seq_operations sched_debug_sops = { | |||
823 | .show = sched_debug_show, | 823 | .show = sched_debug_show, |
824 | }; | 824 | }; |
825 | 825 | ||
826 | static int sched_debug_release(struct inode *inode, struct file *file) | ||
827 | { | ||
828 | seq_release(inode, file); | ||
829 | |||
830 | return 0; | ||
831 | } | ||
832 | |||
833 | static int sched_debug_open(struct inode *inode, struct file *filp) | ||
834 | { | ||
835 | int ret = 0; | ||
836 | |||
837 | ret = seq_open(filp, &sched_debug_sops); | ||
838 | |||
839 | return ret; | ||
840 | } | ||
841 | |||
842 | static const struct file_operations sched_debug_fops = { | ||
843 | .open = sched_debug_open, | ||
844 | .read = seq_read, | ||
845 | .llseek = seq_lseek, | ||
846 | .release = sched_debug_release, | ||
847 | }; | ||
848 | |||
849 | static int __init init_sched_debug_procfs(void) | 826 | static int __init init_sched_debug_procfs(void) |
850 | { | 827 | { |
851 | struct proc_dir_entry *pe; | 828 | if (!proc_create_seq("sched_debug", 0444, NULL, &sched_debug_sops)) |
852 | |||
853 | pe = proc_create("sched_debug", 0444, NULL, &sched_debug_fops); | ||
854 | if (!pe) | ||
855 | return -ENOMEM; | 829 | return -ENOMEM; |
856 | return 0; | 830 | return 0; |
857 | } | 831 | } |
diff --git a/kernel/sched/stats.c b/kernel/sched/stats.c index ab112cbfd7c8..750fb3c67eed 100644 --- a/kernel/sched/stats.c +++ b/kernel/sched/stats.c | |||
@@ -120,22 +120,9 @@ static const struct seq_operations schedstat_sops = { | |||
120 | .show = show_schedstat, | 120 | .show = show_schedstat, |
121 | }; | 121 | }; |
122 | 122 | ||
123 | static int schedstat_open(struct inode *inode, struct file *file) | ||
124 | { | ||
125 | return seq_open(file, &schedstat_sops); | ||
126 | } | ||
127 | |||
128 | static const struct file_operations proc_schedstat_operations = { | ||
129 | .open = schedstat_open, | ||
130 | .read = seq_read, | ||
131 | .llseek = seq_lseek, | ||
132 | .release = seq_release, | ||
133 | }; | ||
134 | |||
135 | static int __init proc_schedstat_init(void) | 123 | static int __init proc_schedstat_init(void) |
136 | { | 124 | { |
137 | proc_create("schedstat", 0, NULL, &proc_schedstat_operations); | 125 | proc_create_seq("schedstat", 0, NULL, &schedstat_sops); |
138 | |||
139 | return 0; | 126 | return 0; |
140 | } | 127 | } |
141 | subsys_initcall(proc_schedstat_init); | 128 | subsys_initcall(proc_schedstat_init); |
diff --git a/mm/vmalloc.c b/mm/vmalloc.c index ebff729cc956..bc43c7838778 100644 --- a/mm/vmalloc.c +++ b/mm/vmalloc.c | |||
@@ -2753,11 +2753,8 @@ static const struct seq_operations vmalloc_op = { | |||
2753 | 2753 | ||
2754 | static int vmalloc_open(struct inode *inode, struct file *file) | 2754 | static int vmalloc_open(struct inode *inode, struct file *file) |
2755 | { | 2755 | { |
2756 | if (IS_ENABLED(CONFIG_NUMA)) | 2756 | return seq_open_private(file, &vmalloc_op, |
2757 | return seq_open_private(file, &vmalloc_op, | ||
2758 | nr_node_ids * sizeof(unsigned int)); | 2757 | nr_node_ids * sizeof(unsigned int)); |
2759 | else | ||
2760 | return seq_open(file, &vmalloc_op); | ||
2761 | } | 2758 | } |
2762 | 2759 | ||
2763 | static const struct file_operations proc_vmalloc_operations = { | 2760 | static const struct file_operations proc_vmalloc_operations = { |
@@ -2769,7 +2766,11 @@ static const struct file_operations proc_vmalloc_operations = { | |||
2769 | 2766 | ||
2770 | static int __init proc_vmalloc_init(void) | 2767 | static int __init proc_vmalloc_init(void) |
2771 | { | 2768 | { |
2772 | proc_create("vmallocinfo", S_IRUSR, NULL, &proc_vmalloc_operations); | 2769 | if (IS_ENABLED(CONFIG_NUMA)) |
2770 | proc_create("vmallocinfo", S_IRUSR, NULL, | ||
2771 | &proc_vmalloc_operations); | ||
2772 | else | ||
2773 | proc_create_seq("vmallocinfo", S_IRUSR, NULL, &vmalloc_op); | ||
2773 | return 0; | 2774 | return 0; |
2774 | } | 2775 | } |
2775 | module_init(proc_vmalloc_init); | 2776 | module_init(proc_vmalloc_init); |
diff --git a/mm/vmstat.c b/mm/vmstat.c index a2b9518980ce..75eda9c2b260 100644 --- a/mm/vmstat.c +++ b/mm/vmstat.c | |||
@@ -1516,18 +1516,6 @@ static const struct seq_operations fragmentation_op = { | |||
1516 | .show = frag_show, | 1516 | .show = frag_show, |
1517 | }; | 1517 | }; |
1518 | 1518 | ||
1519 | static int fragmentation_open(struct inode *inode, struct file *file) | ||
1520 | { | ||
1521 | return seq_open(file, &fragmentation_op); | ||
1522 | } | ||
1523 | |||
1524 | static const struct file_operations buddyinfo_file_operations = { | ||
1525 | .open = fragmentation_open, | ||
1526 | .read = seq_read, | ||
1527 | .llseek = seq_lseek, | ||
1528 | .release = seq_release, | ||
1529 | }; | ||
1530 | |||
1531 | static const struct seq_operations pagetypeinfo_op = { | 1519 | static const struct seq_operations pagetypeinfo_op = { |
1532 | .start = frag_start, | 1520 | .start = frag_start, |
1533 | .next = frag_next, | 1521 | .next = frag_next, |
@@ -1535,18 +1523,6 @@ static const struct seq_operations pagetypeinfo_op = { | |||
1535 | .show = pagetypeinfo_show, | 1523 | .show = pagetypeinfo_show, |
1536 | }; | 1524 | }; |
1537 | 1525 | ||
1538 | static int pagetypeinfo_open(struct inode *inode, struct file *file) | ||
1539 | { | ||
1540 | return seq_open(file, &pagetypeinfo_op); | ||
1541 | } | ||
1542 | |||
1543 | static const struct file_operations pagetypeinfo_file_operations = { | ||
1544 | .open = pagetypeinfo_open, | ||
1545 | .read = seq_read, | ||
1546 | .llseek = seq_lseek, | ||
1547 | .release = seq_release, | ||
1548 | }; | ||
1549 | |||
1550 | static bool is_zone_first_populated(pg_data_t *pgdat, struct zone *zone) | 1526 | static bool is_zone_first_populated(pg_data_t *pgdat, struct zone *zone) |
1551 | { | 1527 | { |
1552 | int zid; | 1528 | int zid; |
@@ -1663,18 +1639,6 @@ static const struct seq_operations zoneinfo_op = { | |||
1663 | .show = zoneinfo_show, | 1639 | .show = zoneinfo_show, |
1664 | }; | 1640 | }; |
1665 | 1641 | ||
1666 | static int zoneinfo_open(struct inode *inode, struct file *file) | ||
1667 | { | ||
1668 | return seq_open(file, &zoneinfo_op); | ||
1669 | } | ||
1670 | |||
1671 | static const struct file_operations zoneinfo_file_operations = { | ||
1672 | .open = zoneinfo_open, | ||
1673 | .read = seq_read, | ||
1674 | .llseek = seq_lseek, | ||
1675 | .release = seq_release, | ||
1676 | }; | ||
1677 | |||
1678 | enum writeback_stat_item { | 1642 | enum writeback_stat_item { |
1679 | NR_DIRTY_THRESHOLD, | 1643 | NR_DIRTY_THRESHOLD, |
1680 | NR_DIRTY_BG_THRESHOLD, | 1644 | NR_DIRTY_BG_THRESHOLD, |
@@ -1762,18 +1726,6 @@ static const struct seq_operations vmstat_op = { | |||
1762 | .stop = vmstat_stop, | 1726 | .stop = vmstat_stop, |
1763 | .show = vmstat_show, | 1727 | .show = vmstat_show, |
1764 | }; | 1728 | }; |
1765 | |||
1766 | static int vmstat_open(struct inode *inode, struct file *file) | ||
1767 | { | ||
1768 | return seq_open(file, &vmstat_op); | ||
1769 | } | ||
1770 | |||
1771 | static const struct file_operations vmstat_file_operations = { | ||
1772 | .open = vmstat_open, | ||
1773 | .read = seq_read, | ||
1774 | .llseek = seq_lseek, | ||
1775 | .release = seq_release, | ||
1776 | }; | ||
1777 | #endif /* CONFIG_PROC_FS */ | 1729 | #endif /* CONFIG_PROC_FS */ |
1778 | 1730 | ||
1779 | #ifdef CONFIG_SMP | 1731 | #ifdef CONFIG_SMP |
@@ -2020,10 +1972,10 @@ void __init init_mm_internals(void) | |||
2020 | start_shepherd_timer(); | 1972 | start_shepherd_timer(); |
2021 | #endif | 1973 | #endif |
2022 | #ifdef CONFIG_PROC_FS | 1974 | #ifdef CONFIG_PROC_FS |
2023 | proc_create("buddyinfo", 0444, NULL, &buddyinfo_file_operations); | 1975 | proc_create_seq("buddyinfo", 0444, NULL, &fragmentation_op); |
2024 | proc_create("pagetypeinfo", 0444, NULL, &pagetypeinfo_file_operations); | 1976 | proc_create_seq("pagetypeinfo", 0444, NULL, &pagetypeinfo_op); |
2025 | proc_create("vmstat", 0444, NULL, &vmstat_file_operations); | 1977 | proc_create_seq("vmstat", 0444, NULL, &vmstat_op); |
2026 | proc_create("zoneinfo", 0444, NULL, &zoneinfo_file_operations); | 1978 | proc_create_seq("zoneinfo", 0444, NULL, &zoneinfo_op); |
2027 | #endif | 1979 | #endif |
2028 | } | 1980 | } |
2029 | 1981 | ||
diff --git a/net/appletalk/atalk_proc.c b/net/appletalk/atalk_proc.c index 7214aea14cb3..d456c702e725 100644 --- a/net/appletalk/atalk_proc.c +++ b/net/appletalk/atalk_proc.c | |||
@@ -210,42 +210,6 @@ static const struct seq_operations atalk_seq_socket_ops = { | |||
210 | .show = atalk_seq_socket_show, | 210 | .show = atalk_seq_socket_show, |
211 | }; | 211 | }; |
212 | 212 | ||
213 | static int atalk_seq_interface_open(struct inode *inode, struct file *file) | ||
214 | { | ||
215 | return seq_open(file, &atalk_seq_interface_ops); | ||
216 | } | ||
217 | |||
218 | static int atalk_seq_route_open(struct inode *inode, struct file *file) | ||
219 | { | ||
220 | return seq_open(file, &atalk_seq_route_ops); | ||
221 | } | ||
222 | |||
223 | static int atalk_seq_socket_open(struct inode *inode, struct file *file) | ||
224 | { | ||
225 | return seq_open(file, &atalk_seq_socket_ops); | ||
226 | } | ||
227 | |||
228 | static const struct file_operations atalk_seq_interface_fops = { | ||
229 | .open = atalk_seq_interface_open, | ||
230 | .read = seq_read, | ||
231 | .llseek = seq_lseek, | ||
232 | .release = seq_release, | ||
233 | }; | ||
234 | |||
235 | static const struct file_operations atalk_seq_route_fops = { | ||
236 | .open = atalk_seq_route_open, | ||
237 | .read = seq_read, | ||
238 | .llseek = seq_lseek, | ||
239 | .release = seq_release, | ||
240 | }; | ||
241 | |||
242 | static const struct file_operations atalk_seq_socket_fops = { | ||
243 | .open = atalk_seq_socket_open, | ||
244 | .read = seq_read, | ||
245 | .llseek = seq_lseek, | ||
246 | .release = seq_release, | ||
247 | }; | ||
248 | |||
249 | static struct proc_dir_entry *atalk_proc_dir; | 213 | static struct proc_dir_entry *atalk_proc_dir; |
250 | 214 | ||
251 | int __init atalk_proc_init(void) | 215 | int __init atalk_proc_init(void) |
@@ -257,18 +221,18 @@ int __init atalk_proc_init(void) | |||
257 | if (!atalk_proc_dir) | 221 | if (!atalk_proc_dir) |
258 | goto out; | 222 | goto out; |
259 | 223 | ||
260 | p = proc_create("interface", 0444, atalk_proc_dir, | 224 | p = proc_create_seq("interface", 0444, atalk_proc_dir, |
261 | &atalk_seq_interface_fops); | 225 | &atalk_seq_interface_ops); |
262 | if (!p) | 226 | if (!p) |
263 | goto out_interface; | 227 | goto out_interface; |
264 | 228 | ||
265 | p = proc_create("route", 0444, atalk_proc_dir, | 229 | p = proc_create_seq("route", 0444, atalk_proc_dir, |
266 | &atalk_seq_route_fops); | 230 | &atalk_seq_route_ops); |
267 | if (!p) | 231 | if (!p) |
268 | goto out_route; | 232 | goto out_route; |
269 | 233 | ||
270 | p = proc_create("socket", 0444, atalk_proc_dir, | 234 | p = proc_create_seq("socket", 0444, atalk_proc_dir, |
271 | &atalk_seq_socket_fops); | 235 | &atalk_seq_socket_ops); |
272 | if (!p) | 236 | if (!p) |
273 | goto out_socket; | 237 | goto out_socket; |
274 | 238 | ||
diff --git a/net/atm/br2684.c b/net/atm/br2684.c index fd94bea36ee8..36b3adacc0dd 100644 --- a/net/atm/br2684.c +++ b/net/atm/br2684.c | |||
@@ -818,18 +818,6 @@ static const struct seq_operations br2684_seq_ops = { | |||
818 | .show = br2684_seq_show, | 818 | .show = br2684_seq_show, |
819 | }; | 819 | }; |
820 | 820 | ||
821 | static int br2684_proc_open(struct inode *inode, struct file *file) | ||
822 | { | ||
823 | return seq_open(file, &br2684_seq_ops); | ||
824 | } | ||
825 | |||
826 | static const struct file_operations br2684_proc_ops = { | ||
827 | .open = br2684_proc_open, | ||
828 | .read = seq_read, | ||
829 | .llseek = seq_lseek, | ||
830 | .release = seq_release, | ||
831 | }; | ||
832 | |||
833 | extern struct proc_dir_entry *atm_proc_root; /* from proc.c */ | 821 | extern struct proc_dir_entry *atm_proc_root; /* from proc.c */ |
834 | #endif /* CONFIG_PROC_FS */ | 822 | #endif /* CONFIG_PROC_FS */ |
835 | 823 | ||
@@ -837,7 +825,7 @@ static int __init br2684_init(void) | |||
837 | { | 825 | { |
838 | #ifdef CONFIG_PROC_FS | 826 | #ifdef CONFIG_PROC_FS |
839 | struct proc_dir_entry *p; | 827 | struct proc_dir_entry *p; |
840 | p = proc_create("br2684", 0, atm_proc_root, &br2684_proc_ops); | 828 | p = proc_create_seq("br2684", 0, atm_proc_root, &br2684_seq_ops); |
841 | if (p == NULL) | 829 | if (p == NULL) |
842 | return -ENOMEM; | 830 | return -ENOMEM; |
843 | #endif | 831 | #endif |
diff --git a/net/ax25/af_ax25.c b/net/ax25/af_ax25.c index 2b41366fcad2..c603d33d5410 100644 --- a/net/ax25/af_ax25.c +++ b/net/ax25/af_ax25.c | |||
@@ -1924,19 +1924,6 @@ static const struct seq_operations ax25_info_seqops = { | |||
1924 | .stop = ax25_info_stop, | 1924 | .stop = ax25_info_stop, |
1925 | .show = ax25_info_show, | 1925 | .show = ax25_info_show, |
1926 | }; | 1926 | }; |
1927 | |||
1928 | static int ax25_info_open(struct inode *inode, struct file *file) | ||
1929 | { | ||
1930 | return seq_open(file, &ax25_info_seqops); | ||
1931 | } | ||
1932 | |||
1933 | static const struct file_operations ax25_info_fops = { | ||
1934 | .open = ax25_info_open, | ||
1935 | .read = seq_read, | ||
1936 | .llseek = seq_lseek, | ||
1937 | .release = seq_release, | ||
1938 | }; | ||
1939 | |||
1940 | #endif | 1927 | #endif |
1941 | 1928 | ||
1942 | static const struct net_proto_family ax25_family_ops = { | 1929 | static const struct net_proto_family ax25_family_ops = { |
@@ -1989,10 +1976,10 @@ static int __init ax25_init(void) | |||
1989 | dev_add_pack(&ax25_packet_type); | 1976 | dev_add_pack(&ax25_packet_type); |
1990 | register_netdevice_notifier(&ax25_dev_notifier); | 1977 | register_netdevice_notifier(&ax25_dev_notifier); |
1991 | 1978 | ||
1992 | proc_create("ax25_route", 0444, init_net.proc_net, | 1979 | proc_create_seq("ax25_route", 0444, init_net.proc_net, &ax25_rt_seqops); |
1993 | &ax25_route_fops); | 1980 | proc_create_seq("ax25", 0444, init_net.proc_net, &ax25_info_seqops); |
1994 | proc_create("ax25", 0444, init_net.proc_net, &ax25_info_fops); | 1981 | proc_create_seq("ax25_calls", 0444, init_net.proc_net, |
1995 | proc_create("ax25_calls", 0444, init_net.proc_net, &ax25_uid_fops); | 1982 | &ax25_uid_seqops); |
1996 | out: | 1983 | out: |
1997 | return rc; | 1984 | return rc; |
1998 | } | 1985 | } |
diff --git a/net/ax25/ax25_route.c b/net/ax25/ax25_route.c index 525558972fd9..a0eff323af12 100644 --- a/net/ax25/ax25_route.c +++ b/net/ax25/ax25_route.c | |||
@@ -323,25 +323,12 @@ static int ax25_rt_seq_show(struct seq_file *seq, void *v) | |||
323 | return 0; | 323 | return 0; |
324 | } | 324 | } |
325 | 325 | ||
326 | static const struct seq_operations ax25_rt_seqops = { | 326 | const struct seq_operations ax25_rt_seqops = { |
327 | .start = ax25_rt_seq_start, | 327 | .start = ax25_rt_seq_start, |
328 | .next = ax25_rt_seq_next, | 328 | .next = ax25_rt_seq_next, |
329 | .stop = ax25_rt_seq_stop, | 329 | .stop = ax25_rt_seq_stop, |
330 | .show = ax25_rt_seq_show, | 330 | .show = ax25_rt_seq_show, |
331 | }; | 331 | }; |
332 | |||
333 | static int ax25_rt_info_open(struct inode *inode, struct file *file) | ||
334 | { | ||
335 | return seq_open(file, &ax25_rt_seqops); | ||
336 | } | ||
337 | |||
338 | const struct file_operations ax25_route_fops = { | ||
339 | .open = ax25_rt_info_open, | ||
340 | .read = seq_read, | ||
341 | .llseek = seq_lseek, | ||
342 | .release = seq_release, | ||
343 | }; | ||
344 | |||
345 | #endif | 332 | #endif |
346 | 333 | ||
347 | /* | 334 | /* |
diff --git a/net/ax25/ax25_uid.c b/net/ax25/ax25_uid.c index 4ebe91ba317a..99d02e390e43 100644 --- a/net/ax25/ax25_uid.c +++ b/net/ax25/ax25_uid.c | |||
@@ -181,25 +181,12 @@ static int ax25_uid_seq_show(struct seq_file *seq, void *v) | |||
181 | return 0; | 181 | return 0; |
182 | } | 182 | } |
183 | 183 | ||
184 | static const struct seq_operations ax25_uid_seqops = { | 184 | const struct seq_operations ax25_uid_seqops = { |
185 | .start = ax25_uid_seq_start, | 185 | .start = ax25_uid_seq_start, |
186 | .next = ax25_uid_seq_next, | 186 | .next = ax25_uid_seq_next, |
187 | .stop = ax25_uid_seq_stop, | 187 | .stop = ax25_uid_seq_stop, |
188 | .show = ax25_uid_seq_show, | 188 | .show = ax25_uid_seq_show, |
189 | }; | 189 | }; |
190 | |||
191 | static int ax25_uid_info_open(struct inode *inode, struct file *file) | ||
192 | { | ||
193 | return seq_open(file, &ax25_uid_seqops); | ||
194 | } | ||
195 | |||
196 | const struct file_operations ax25_uid_fops = { | ||
197 | .open = ax25_uid_info_open, | ||
198 | .read = seq_read, | ||
199 | .llseek = seq_lseek, | ||
200 | .release = seq_release, | ||
201 | }; | ||
202 | |||
203 | #endif | 190 | #endif |
204 | 191 | ||
205 | /* | 192 | /* |
diff --git a/net/core/net-procfs.c b/net/core/net-procfs.c index 9737302907b1..c4e8ebe55e26 100644 --- a/net/core/net-procfs.c +++ b/net/core/net-procfs.c | |||
@@ -195,18 +195,6 @@ static const struct seq_operations softnet_seq_ops = { | |||
195 | .show = softnet_seq_show, | 195 | .show = softnet_seq_show, |
196 | }; | 196 | }; |
197 | 197 | ||
198 | static int softnet_seq_open(struct inode *inode, struct file *file) | ||
199 | { | ||
200 | return seq_open(file, &softnet_seq_ops); | ||
201 | } | ||
202 | |||
203 | static const struct file_operations softnet_seq_fops = { | ||
204 | .open = softnet_seq_open, | ||
205 | .read = seq_read, | ||
206 | .llseek = seq_lseek, | ||
207 | .release = seq_release, | ||
208 | }; | ||
209 | |||
210 | static void *ptype_get_idx(loff_t pos) | 198 | static void *ptype_get_idx(loff_t pos) |
211 | { | 199 | { |
212 | struct packet_type *pt = NULL; | 200 | struct packet_type *pt = NULL; |
@@ -317,8 +305,8 @@ static int __net_init dev_proc_net_init(struct net *net) | |||
317 | 305 | ||
318 | if (!proc_create("dev", 0444, net->proc_net, &dev_seq_fops)) | 306 | if (!proc_create("dev", 0444, net->proc_net, &dev_seq_fops)) |
319 | goto out; | 307 | goto out; |
320 | if (!proc_create("softnet_stat", 0444, net->proc_net, | 308 | if (!proc_create_seq("softnet_stat", 0444, net->proc_net, |
321 | &softnet_seq_fops)) | 309 | &softnet_seq_ops)) |
322 | goto out_dev; | 310 | goto out_dev; |
323 | if (!proc_create("ptype", 0444, net->proc_net, &ptype_seq_fops)) | 311 | if (!proc_create("ptype", 0444, net->proc_net, &ptype_seq_fops)) |
324 | goto out_softnet; | 312 | goto out_softnet; |
diff --git a/net/decnet/dn_dev.c b/net/decnet/dn_dev.c index c03b046478c3..bfd43e8f2c06 100644 --- a/net/decnet/dn_dev.c +++ b/net/decnet/dn_dev.c | |||
@@ -1382,19 +1382,6 @@ static const struct seq_operations dn_dev_seq_ops = { | |||
1382 | .stop = dn_dev_seq_stop, | 1382 | .stop = dn_dev_seq_stop, |
1383 | .show = dn_dev_seq_show, | 1383 | .show = dn_dev_seq_show, |
1384 | }; | 1384 | }; |
1385 | |||
1386 | static int dn_dev_seq_open(struct inode *inode, struct file *file) | ||
1387 | { | ||
1388 | return seq_open(file, &dn_dev_seq_ops); | ||
1389 | } | ||
1390 | |||
1391 | static const struct file_operations dn_dev_seq_fops = { | ||
1392 | .open = dn_dev_seq_open, | ||
1393 | .read = seq_read, | ||
1394 | .llseek = seq_lseek, | ||
1395 | .release = seq_release, | ||
1396 | }; | ||
1397 | |||
1398 | #endif /* CONFIG_PROC_FS */ | 1385 | #endif /* CONFIG_PROC_FS */ |
1399 | 1386 | ||
1400 | static int addr[2]; | 1387 | static int addr[2]; |
@@ -1424,7 +1411,7 @@ void __init dn_dev_init(void) | |||
1424 | rtnl_register_module(THIS_MODULE, PF_DECnet, RTM_GETADDR, | 1411 | rtnl_register_module(THIS_MODULE, PF_DECnet, RTM_GETADDR, |
1425 | NULL, dn_nl_dump_ifaddr, 0); | 1412 | NULL, dn_nl_dump_ifaddr, 0); |
1426 | 1413 | ||
1427 | proc_create("decnet_dev", 0444, init_net.proc_net, &dn_dev_seq_fops); | 1414 | proc_create_seq("decnet_dev", 0444, init_net.proc_net, &dn_dev_seq_ops); |
1428 | 1415 | ||
1429 | #ifdef CONFIG_SYSCTL | 1416 | #ifdef CONFIG_SYSCTL |
1430 | { | 1417 | { |
diff --git a/net/llc/llc_proc.c b/net/llc/llc_proc.c index 62ea0aed94b4..f3a36c16a5e7 100644 --- a/net/llc/llc_proc.c +++ b/net/llc/llc_proc.c | |||
@@ -214,30 +214,6 @@ static const struct seq_operations llc_seq_core_ops = { | |||
214 | .show = llc_seq_core_show, | 214 | .show = llc_seq_core_show, |
215 | }; | 215 | }; |
216 | 216 | ||
217 | static int llc_seq_socket_open(struct inode *inode, struct file *file) | ||
218 | { | ||
219 | return seq_open(file, &llc_seq_socket_ops); | ||
220 | } | ||
221 | |||
222 | static int llc_seq_core_open(struct inode *inode, struct file *file) | ||
223 | { | ||
224 | return seq_open(file, &llc_seq_core_ops); | ||
225 | } | ||
226 | |||
227 | static const struct file_operations llc_seq_socket_fops = { | ||
228 | .open = llc_seq_socket_open, | ||
229 | .read = seq_read, | ||
230 | .llseek = seq_lseek, | ||
231 | .release = seq_release, | ||
232 | }; | ||
233 | |||
234 | static const struct file_operations llc_seq_core_fops = { | ||
235 | .open = llc_seq_core_open, | ||
236 | .read = seq_read, | ||
237 | .llseek = seq_lseek, | ||
238 | .release = seq_release, | ||
239 | }; | ||
240 | |||
241 | static struct proc_dir_entry *llc_proc_dir; | 217 | static struct proc_dir_entry *llc_proc_dir; |
242 | 218 | ||
243 | int __init llc_proc_init(void) | 219 | int __init llc_proc_init(void) |
@@ -249,11 +225,11 @@ int __init llc_proc_init(void) | |||
249 | if (!llc_proc_dir) | 225 | if (!llc_proc_dir) |
250 | goto out; | 226 | goto out; |
251 | 227 | ||
252 | p = proc_create("socket", 0444, llc_proc_dir, &llc_seq_socket_fops); | 228 | p = proc_create_seq("socket", 0444, llc_proc_dir, &llc_seq_socket_ops); |
253 | if (!p) | 229 | if (!p) |
254 | goto out_socket; | 230 | goto out_socket; |
255 | 231 | ||
256 | p = proc_create("core", 0444, llc_proc_dir, &llc_seq_core_fops); | 232 | p = proc_create_seq("core", 0444, llc_proc_dir, &llc_seq_core_ops); |
257 | if (!p) | 233 | if (!p) |
258 | goto out_core; | 234 | goto out_core; |
259 | 235 | ||
diff --git a/net/netrom/af_netrom.c b/net/netrom/af_netrom.c index 4221d98a314b..c2888c78d4c1 100644 --- a/net/netrom/af_netrom.c +++ b/net/netrom/af_netrom.c | |||
@@ -1338,18 +1338,6 @@ static const struct seq_operations nr_info_seqops = { | |||
1338 | .stop = nr_info_stop, | 1338 | .stop = nr_info_stop, |
1339 | .show = nr_info_show, | 1339 | .show = nr_info_show, |
1340 | }; | 1340 | }; |
1341 | |||
1342 | static int nr_info_open(struct inode *inode, struct file *file) | ||
1343 | { | ||
1344 | return seq_open(file, &nr_info_seqops); | ||
1345 | } | ||
1346 | |||
1347 | static const struct file_operations nr_info_fops = { | ||
1348 | .open = nr_info_open, | ||
1349 | .read = seq_read, | ||
1350 | .llseek = seq_lseek, | ||
1351 | .release = seq_release, | ||
1352 | }; | ||
1353 | #endif /* CONFIG_PROC_FS */ | 1341 | #endif /* CONFIG_PROC_FS */ |
1354 | 1342 | ||
1355 | static const struct net_proto_family nr_family_ops = { | 1343 | static const struct net_proto_family nr_family_ops = { |
@@ -1450,9 +1438,9 @@ static int __init nr_proto_init(void) | |||
1450 | 1438 | ||
1451 | nr_loopback_init(); | 1439 | nr_loopback_init(); |
1452 | 1440 | ||
1453 | proc_create("nr", 0444, init_net.proc_net, &nr_info_fops); | 1441 | proc_create_seq("nr", 0444, init_net.proc_net, &nr_info_seqops); |
1454 | proc_create("nr_neigh", 0444, init_net.proc_net, &nr_neigh_fops); | 1442 | proc_create_seq("nr_neigh", 0444, init_net.proc_net, &nr_neigh_seqops); |
1455 | proc_create("nr_nodes", 0444, init_net.proc_net, &nr_nodes_fops); | 1443 | proc_create_seq("nr_nodes", 0444, init_net.proc_net, &nr_node_seqops); |
1456 | out: | 1444 | out: |
1457 | return rc; | 1445 | return rc; |
1458 | fail: | 1446 | fail: |
diff --git a/net/netrom/nr_route.c b/net/netrom/nr_route.c index b5a7dcb30991..6485f593e2f0 100644 --- a/net/netrom/nr_route.c +++ b/net/netrom/nr_route.c | |||
@@ -888,25 +888,13 @@ static int nr_node_show(struct seq_file *seq, void *v) | |||
888 | return 0; | 888 | return 0; |
889 | } | 889 | } |
890 | 890 | ||
891 | static const struct seq_operations nr_node_seqops = { | 891 | const struct seq_operations nr_node_seqops = { |
892 | .start = nr_node_start, | 892 | .start = nr_node_start, |
893 | .next = nr_node_next, | 893 | .next = nr_node_next, |
894 | .stop = nr_node_stop, | 894 | .stop = nr_node_stop, |
895 | .show = nr_node_show, | 895 | .show = nr_node_show, |
896 | }; | 896 | }; |
897 | 897 | ||
898 | static int nr_node_info_open(struct inode *inode, struct file *file) | ||
899 | { | ||
900 | return seq_open(file, &nr_node_seqops); | ||
901 | } | ||
902 | |||
903 | const struct file_operations nr_nodes_fops = { | ||
904 | .open = nr_node_info_open, | ||
905 | .read = seq_read, | ||
906 | .llseek = seq_lseek, | ||
907 | .release = seq_release, | ||
908 | }; | ||
909 | |||
910 | static void *nr_neigh_start(struct seq_file *seq, loff_t *pos) | 898 | static void *nr_neigh_start(struct seq_file *seq, loff_t *pos) |
911 | { | 899 | { |
912 | spin_lock_bh(&nr_neigh_list_lock); | 900 | spin_lock_bh(&nr_neigh_list_lock); |
@@ -954,25 +942,12 @@ static int nr_neigh_show(struct seq_file *seq, void *v) | |||
954 | return 0; | 942 | return 0; |
955 | } | 943 | } |
956 | 944 | ||
957 | static const struct seq_operations nr_neigh_seqops = { | 945 | const struct seq_operations nr_neigh_seqops = { |
958 | .start = nr_neigh_start, | 946 | .start = nr_neigh_start, |
959 | .next = nr_neigh_next, | 947 | .next = nr_neigh_next, |
960 | .stop = nr_neigh_stop, | 948 | .stop = nr_neigh_stop, |
961 | .show = nr_neigh_show, | 949 | .show = nr_neigh_show, |
962 | }; | 950 | }; |
963 | |||
964 | static int nr_neigh_info_open(struct inode *inode, struct file *file) | ||
965 | { | ||
966 | return seq_open(file, &nr_neigh_seqops); | ||
967 | } | ||
968 | |||
969 | const struct file_operations nr_neigh_fops = { | ||
970 | .open = nr_neigh_info_open, | ||
971 | .read = seq_read, | ||
972 | .llseek = seq_lseek, | ||
973 | .release = seq_release, | ||
974 | }; | ||
975 | |||
976 | #endif | 951 | #endif |
977 | 952 | ||
978 | /* | 953 | /* |
diff --git a/net/rose/af_rose.c b/net/rose/af_rose.c index 9ff5e0a76593..22a7f2b413ac 100644 --- a/net/rose/af_rose.c +++ b/net/rose/af_rose.c | |||
@@ -1453,18 +1453,6 @@ static const struct seq_operations rose_info_seqops = { | |||
1453 | .stop = rose_info_stop, | 1453 | .stop = rose_info_stop, |
1454 | .show = rose_info_show, | 1454 | .show = rose_info_show, |
1455 | }; | 1455 | }; |
1456 | |||
1457 | static int rose_info_open(struct inode *inode, struct file *file) | ||
1458 | { | ||
1459 | return seq_open(file, &rose_info_seqops); | ||
1460 | } | ||
1461 | |||
1462 | static const struct file_operations rose_info_fops = { | ||
1463 | .open = rose_info_open, | ||
1464 | .read = seq_read, | ||
1465 | .llseek = seq_lseek, | ||
1466 | .release = seq_release, | ||
1467 | }; | ||
1468 | #endif /* CONFIG_PROC_FS */ | 1456 | #endif /* CONFIG_PROC_FS */ |
1469 | 1457 | ||
1470 | static const struct net_proto_family rose_family_ops = { | 1458 | static const struct net_proto_family rose_family_ops = { |
@@ -1567,13 +1555,13 @@ static int __init rose_proto_init(void) | |||
1567 | 1555 | ||
1568 | rose_add_loopback_neigh(); | 1556 | rose_add_loopback_neigh(); |
1569 | 1557 | ||
1570 | proc_create("rose", 0444, init_net.proc_net, &rose_info_fops); | 1558 | proc_create_seq("rose", 0444, init_net.proc_net, &rose_info_seqops); |
1571 | proc_create("rose_neigh", 0444, init_net.proc_net, | 1559 | proc_create_seq("rose_neigh", 0444, init_net.proc_net, |
1572 | &rose_neigh_fops); | 1560 | &rose_neigh_seqops); |
1573 | proc_create("rose_nodes", 0444, init_net.proc_net, | 1561 | proc_create_seq("rose_nodes", 0444, init_net.proc_net, |
1574 | &rose_nodes_fops); | 1562 | &rose_node_seqops); |
1575 | proc_create("rose_routes", 0444, init_net.proc_net, | 1563 | proc_create_seq("rose_routes", 0444, init_net.proc_net, |
1576 | &rose_routes_fops); | 1564 | &rose_route_seqops); |
1577 | out: | 1565 | out: |
1578 | return rc; | 1566 | return rc; |
1579 | fail: | 1567 | fail: |
diff --git a/net/rose/rose_route.c b/net/rose/rose_route.c index 178619ddab68..77e9f85a2c92 100644 --- a/net/rose/rose_route.c +++ b/net/rose/rose_route.c | |||
@@ -1143,25 +1143,13 @@ static int rose_node_show(struct seq_file *seq, void *v) | |||
1143 | return 0; | 1143 | return 0; |
1144 | } | 1144 | } |
1145 | 1145 | ||
1146 | static const struct seq_operations rose_node_seqops = { | 1146 | const struct seq_operations rose_node_seqops = { |
1147 | .start = rose_node_start, | 1147 | .start = rose_node_start, |
1148 | .next = rose_node_next, | 1148 | .next = rose_node_next, |
1149 | .stop = rose_node_stop, | 1149 | .stop = rose_node_stop, |
1150 | .show = rose_node_show, | 1150 | .show = rose_node_show, |
1151 | }; | 1151 | }; |
1152 | 1152 | ||
1153 | static int rose_nodes_open(struct inode *inode, struct file *file) | ||
1154 | { | ||
1155 | return seq_open(file, &rose_node_seqops); | ||
1156 | } | ||
1157 | |||
1158 | const struct file_operations rose_nodes_fops = { | ||
1159 | .open = rose_nodes_open, | ||
1160 | .read = seq_read, | ||
1161 | .llseek = seq_lseek, | ||
1162 | .release = seq_release, | ||
1163 | }; | ||
1164 | |||
1165 | static void *rose_neigh_start(struct seq_file *seq, loff_t *pos) | 1153 | static void *rose_neigh_start(struct seq_file *seq, loff_t *pos) |
1166 | __acquires(rose_neigh_list_lock) | 1154 | __acquires(rose_neigh_list_lock) |
1167 | { | 1155 | { |
@@ -1226,26 +1214,13 @@ static int rose_neigh_show(struct seq_file *seq, void *v) | |||
1226 | } | 1214 | } |
1227 | 1215 | ||
1228 | 1216 | ||
1229 | static const struct seq_operations rose_neigh_seqops = { | 1217 | const struct seq_operations rose_neigh_seqops = { |
1230 | .start = rose_neigh_start, | 1218 | .start = rose_neigh_start, |
1231 | .next = rose_neigh_next, | 1219 | .next = rose_neigh_next, |
1232 | .stop = rose_neigh_stop, | 1220 | .stop = rose_neigh_stop, |
1233 | .show = rose_neigh_show, | 1221 | .show = rose_neigh_show, |
1234 | }; | 1222 | }; |
1235 | 1223 | ||
1236 | static int rose_neigh_open(struct inode *inode, struct file *file) | ||
1237 | { | ||
1238 | return seq_open(file, &rose_neigh_seqops); | ||
1239 | } | ||
1240 | |||
1241 | const struct file_operations rose_neigh_fops = { | ||
1242 | .open = rose_neigh_open, | ||
1243 | .read = seq_read, | ||
1244 | .llseek = seq_lseek, | ||
1245 | .release = seq_release, | ||
1246 | }; | ||
1247 | |||
1248 | |||
1249 | static void *rose_route_start(struct seq_file *seq, loff_t *pos) | 1224 | static void *rose_route_start(struct seq_file *seq, loff_t *pos) |
1250 | __acquires(rose_route_list_lock) | 1225 | __acquires(rose_route_list_lock) |
1251 | { | 1226 | { |
@@ -1311,25 +1286,12 @@ static int rose_route_show(struct seq_file *seq, void *v) | |||
1311 | return 0; | 1286 | return 0; |
1312 | } | 1287 | } |
1313 | 1288 | ||
1314 | static const struct seq_operations rose_route_seqops = { | 1289 | struct seq_operations rose_route_seqops = { |
1315 | .start = rose_route_start, | 1290 | .start = rose_route_start, |
1316 | .next = rose_route_next, | 1291 | .next = rose_route_next, |
1317 | .stop = rose_route_stop, | 1292 | .stop = rose_route_stop, |
1318 | .show = rose_route_show, | 1293 | .show = rose_route_show, |
1319 | }; | 1294 | }; |
1320 | |||
1321 | static int rose_route_open(struct inode *inode, struct file *file) | ||
1322 | { | ||
1323 | return seq_open(file, &rose_route_seqops); | ||
1324 | } | ||
1325 | |||
1326 | const struct file_operations rose_routes_fops = { | ||
1327 | .open = rose_route_open, | ||
1328 | .read = seq_read, | ||
1329 | .llseek = seq_lseek, | ||
1330 | .release = seq_release, | ||
1331 | }; | ||
1332 | |||
1333 | #endif /* CONFIG_PROC_FS */ | 1295 | #endif /* CONFIG_PROC_FS */ |
1334 | 1296 | ||
1335 | /* | 1297 | /* |
diff --git a/net/sctp/objcnt.c b/net/sctp/objcnt.c index fd2684ad94c8..a6179b26b80c 100644 --- a/net/sctp/objcnt.c +++ b/net/sctp/objcnt.c | |||
@@ -108,25 +108,13 @@ static const struct seq_operations sctp_objcnt_seq_ops = { | |||
108 | .show = sctp_objcnt_seq_show, | 108 | .show = sctp_objcnt_seq_show, |
109 | }; | 109 | }; |
110 | 110 | ||
111 | static int sctp_objcnt_seq_open(struct inode *inode, struct file *file) | ||
112 | { | ||
113 | return seq_open(file, &sctp_objcnt_seq_ops); | ||
114 | } | ||
115 | |||
116 | static const struct file_operations sctp_objcnt_ops = { | ||
117 | .open = sctp_objcnt_seq_open, | ||
118 | .read = seq_read, | ||
119 | .llseek = seq_lseek, | ||
120 | .release = seq_release, | ||
121 | }; | ||
122 | |||
123 | /* Initialize the objcount in the proc filesystem. */ | 111 | /* Initialize the objcount in the proc filesystem. */ |
124 | void sctp_dbg_objcnt_init(struct net *net) | 112 | void sctp_dbg_objcnt_init(struct net *net) |
125 | { | 113 | { |
126 | struct proc_dir_entry *ent; | 114 | struct proc_dir_entry *ent; |
127 | 115 | ||
128 | ent = proc_create("sctp_dbg_objcnt", 0, | 116 | ent = proc_create_seq("sctp_dbg_objcnt", 0, |
129 | net->sctp.proc_net_sctp, &sctp_objcnt_ops); | 117 | net->sctp.proc_net_sctp, &sctp_objcnt_seq_ops); |
130 | if (!ent) | 118 | if (!ent) |
131 | pr_warn("sctp_dbg_objcnt: Unable to create /proc entry.\n"); | 119 | pr_warn("sctp_dbg_objcnt: Unable to create /proc entry.\n"); |
132 | } | 120 | } |
diff --git a/net/x25/x25_proc.c b/net/x25/x25_proc.c index 64b415e93f6a..da52c9dc256c 100644 --- a/net/x25/x25_proc.c +++ b/net/x25/x25_proc.c | |||
@@ -171,57 +171,21 @@ static const struct seq_operations x25_seq_forward_ops = { | |||
171 | .show = x25_seq_forward_show, | 171 | .show = x25_seq_forward_show, |
172 | }; | 172 | }; |
173 | 173 | ||
174 | static int x25_seq_socket_open(struct inode *inode, struct file *file) | ||
175 | { | ||
176 | return seq_open(file, &x25_seq_socket_ops); | ||
177 | } | ||
178 | |||
179 | static int x25_seq_route_open(struct inode *inode, struct file *file) | ||
180 | { | ||
181 | return seq_open(file, &x25_seq_route_ops); | ||
182 | } | ||
183 | |||
184 | static int x25_seq_forward_open(struct inode *inode, struct file *file) | ||
185 | { | ||
186 | return seq_open(file, &x25_seq_forward_ops); | ||
187 | } | ||
188 | |||
189 | static const struct file_operations x25_seq_socket_fops = { | ||
190 | .open = x25_seq_socket_open, | ||
191 | .read = seq_read, | ||
192 | .llseek = seq_lseek, | ||
193 | .release = seq_release, | ||
194 | }; | ||
195 | |||
196 | static const struct file_operations x25_seq_route_fops = { | ||
197 | .open = x25_seq_route_open, | ||
198 | .read = seq_read, | ||
199 | .llseek = seq_lseek, | ||
200 | .release = seq_release, | ||
201 | }; | ||
202 | |||
203 | static const struct file_operations x25_seq_forward_fops = { | ||
204 | .open = x25_seq_forward_open, | ||
205 | .read = seq_read, | ||
206 | .llseek = seq_lseek, | ||
207 | .release = seq_release, | ||
208 | }; | ||
209 | |||
210 | int __init x25_proc_init(void) | 174 | int __init x25_proc_init(void) |
211 | { | 175 | { |
212 | if (!proc_mkdir("x25", init_net.proc_net)) | 176 | if (!proc_mkdir("x25", init_net.proc_net)) |
213 | return -ENOMEM; | 177 | return -ENOMEM; |
214 | 178 | ||
215 | if (!proc_create("x25/route", 0444, init_net.proc_net, | 179 | if (!proc_create_seq("x25/route", 0444, init_net.proc_net, |
216 | &x25_seq_route_fops)) | 180 | &x25_seq_route_ops)) |
217 | goto out; | 181 | goto out; |
218 | 182 | ||
219 | if (!proc_create("x25/socket", 0444, init_net.proc_net, | 183 | if (!proc_create_seq("x25/socket", 0444, init_net.proc_net, |
220 | &x25_seq_socket_fops)) | 184 | &x25_seq_socket_ops)) |
221 | goto out; | 185 | goto out; |
222 | 186 | ||
223 | if (!proc_create("x25/forward", 0444, init_net.proc_net, | 187 | if (!proc_create_seq("x25/forward", 0444, init_net.proc_net, |
224 | &x25_seq_forward_fops)) | 188 | &x25_seq_forward_ops)) |
225 | goto out; | 189 | goto out; |
226 | return 0; | 190 | return 0; |
227 | 191 | ||
diff --git a/security/keys/proc.c b/security/keys/proc.c index fbc4af5c6c9f..5af2934965d8 100644 --- a/security/keys/proc.c +++ b/security/keys/proc.c | |||
@@ -18,7 +18,6 @@ | |||
18 | #include <asm/errno.h> | 18 | #include <asm/errno.h> |
19 | #include "internal.h" | 19 | #include "internal.h" |
20 | 20 | ||
21 | static int proc_keys_open(struct inode *inode, struct file *file); | ||
22 | static void *proc_keys_start(struct seq_file *p, loff_t *_pos); | 21 | static void *proc_keys_start(struct seq_file *p, loff_t *_pos); |
23 | static void *proc_keys_next(struct seq_file *p, void *v, loff_t *_pos); | 22 | static void *proc_keys_next(struct seq_file *p, void *v, loff_t *_pos); |
24 | static void proc_keys_stop(struct seq_file *p, void *v); | 23 | static void proc_keys_stop(struct seq_file *p, void *v); |
@@ -31,14 +30,6 @@ static const struct seq_operations proc_keys_ops = { | |||
31 | .show = proc_keys_show, | 30 | .show = proc_keys_show, |
32 | }; | 31 | }; |
33 | 32 | ||
34 | static const struct file_operations proc_keys_fops = { | ||
35 | .open = proc_keys_open, | ||
36 | .read = seq_read, | ||
37 | .llseek = seq_lseek, | ||
38 | .release = seq_release, | ||
39 | }; | ||
40 | |||
41 | static int proc_key_users_open(struct inode *inode, struct file *file); | ||
42 | static void *proc_key_users_start(struct seq_file *p, loff_t *_pos); | 33 | static void *proc_key_users_start(struct seq_file *p, loff_t *_pos); |
43 | static void *proc_key_users_next(struct seq_file *p, void *v, loff_t *_pos); | 34 | static void *proc_key_users_next(struct seq_file *p, void *v, loff_t *_pos); |
44 | static void proc_key_users_stop(struct seq_file *p, void *v); | 35 | static void proc_key_users_stop(struct seq_file *p, void *v); |
@@ -51,13 +42,6 @@ static const struct seq_operations proc_key_users_ops = { | |||
51 | .show = proc_key_users_show, | 42 | .show = proc_key_users_show, |
52 | }; | 43 | }; |
53 | 44 | ||
54 | static const struct file_operations proc_key_users_fops = { | ||
55 | .open = proc_key_users_open, | ||
56 | .read = seq_read, | ||
57 | .llseek = seq_lseek, | ||
58 | .release = seq_release, | ||
59 | }; | ||
60 | |||
61 | /* | 45 | /* |
62 | * Declare the /proc files. | 46 | * Declare the /proc files. |
63 | */ | 47 | */ |
@@ -65,11 +49,11 @@ static int __init key_proc_init(void) | |||
65 | { | 49 | { |
66 | struct proc_dir_entry *p; | 50 | struct proc_dir_entry *p; |
67 | 51 | ||
68 | p = proc_create("keys", 0, NULL, &proc_keys_fops); | 52 | p = proc_create_seq("keys", 0, NULL, &proc_keys_ops); |
69 | if (!p) | 53 | if (!p) |
70 | panic("Cannot create /proc/keys\n"); | 54 | panic("Cannot create /proc/keys\n"); |
71 | 55 | ||
72 | p = proc_create("key-users", 0, NULL, &proc_key_users_fops); | 56 | p = proc_create_seq("key-users", 0, NULL, &proc_key_users_ops); |
73 | if (!p) | 57 | if (!p) |
74 | panic("Cannot create /proc/key-users\n"); | 58 | panic("Cannot create /proc/key-users\n"); |
75 | 59 | ||
@@ -96,11 +80,6 @@ static struct rb_node *key_serial_next(struct seq_file *p, struct rb_node *n) | |||
96 | return n; | 80 | return n; |
97 | } | 81 | } |
98 | 82 | ||
99 | static int proc_keys_open(struct inode *inode, struct file *file) | ||
100 | { | ||
101 | return seq_open(file, &proc_keys_ops); | ||
102 | } | ||
103 | |||
104 | static struct key *find_ge_key(struct seq_file *p, key_serial_t id) | 83 | static struct key *find_ge_key(struct seq_file *p, key_serial_t id) |
105 | { | 84 | { |
106 | struct user_namespace *user_ns = seq_user_ns(p); | 85 | struct user_namespace *user_ns = seq_user_ns(p); |
@@ -293,15 +272,6 @@ static struct rb_node *key_user_first(struct user_namespace *user_ns, struct rb_ | |||
293 | return __key_user_next(user_ns, n); | 272 | return __key_user_next(user_ns, n); |
294 | } | 273 | } |
295 | 274 | ||
296 | /* | ||
297 | * Implement "/proc/key-users" to provides a list of the key users and their | ||
298 | * quotas. | ||
299 | */ | ||
300 | static int proc_key_users_open(struct inode *inode, struct file *file) | ||
301 | { | ||
302 | return seq_open(file, &proc_key_users_ops); | ||
303 | } | ||
304 | |||
305 | static void *proc_key_users_start(struct seq_file *p, loff_t *_pos) | 275 | static void *proc_key_users_start(struct seq_file *p, loff_t *_pos) |
306 | __acquires(key_user_lock) | 276 | __acquires(key_user_lock) |
307 | { | 277 | { |