diff options
author | Linus Torvalds <torvalds@linux-foundation.org> | 2018-06-04 13:00:01 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2018-06-04 13:00:01 -0400 |
commit | cf626b0da78df6669c6b5f51ddd9a70a0702e579 (patch) | |
tree | 45d29a4cb7574aed7f140814ed22088ded21c291 | |
parent | 9c50eafc32ddbd166c8a2bbaecd4ad201c452b14 (diff) | |
parent | 5ef03dbd91855544cd4c7c1910c3ef5226ee87e8 (diff) |
Merge branch 'hch.procfs' of git://git.kernel.org/pub/scm/linux/kernel/git/viro/vfs
Pull procfs updates from Al Viro:
"Christoph's proc_create_... cleanups series"
* 'hch.procfs' of git://git.kernel.org/pub/scm/linux/kernel/git/viro/vfs: (44 commits)
xfs, proc: hide unused xfs procfs helpers
isdn/gigaset: add back gigaset_procinfo assignment
proc: update SIZEOF_PDE_INLINE_NAME for the new pde fields
tty: replace ->proc_fops with ->proc_show
ide: replace ->proc_fops with ->proc_show
ide: remove ide_driver_proc_write
isdn: replace ->proc_fops with ->proc_show
atm: switch to proc_create_seq_private
atm: simplify procfs code
bluetooth: switch to proc_create_seq_data
netfilter/x_tables: switch to proc_create_seq_private
netfilter/xt_hashlimit: switch to proc_create_{seq,single}_data
neigh: switch to proc_create_seq_data
hostap: switch to proc_create_{seq,single}_data
bonding: switch to proc_create_seq_data
rtc/proc: switch to proc_create_single_data
drbd: switch to proc_create_single
resource: switch to proc_create_seq_data
staging/rtl8192u: simplify procfs code
jfs: simplify procfs code
...
266 files changed, 1229 insertions, 6032 deletions
diff --git a/arch/arm/kernel/dma.c b/arch/arm/kernel/dma.c index e651c4d0a0d9..6739d37c2bc5 100644 --- a/arch/arm/kernel/dma.c +++ b/arch/arm/kernel/dma.c | |||
@@ -276,21 +276,9 @@ static int proc_dma_show(struct seq_file *m, void *v) | |||
276 | return 0; | 276 | return 0; |
277 | } | 277 | } |
278 | 278 | ||
279 | static int proc_dma_open(struct inode *inode, struct file *file) | ||
280 | { | ||
281 | return single_open(file, proc_dma_show, NULL); | ||
282 | } | ||
283 | |||
284 | static const struct file_operations proc_dma_operations = { | ||
285 | .open = proc_dma_open, | ||
286 | .read = seq_read, | ||
287 | .llseek = seq_lseek, | ||
288 | .release = single_release, | ||
289 | }; | ||
290 | |||
291 | static int __init proc_dma_init(void) | 279 | static int __init proc_dma_init(void) |
292 | { | 280 | { |
293 | proc_create("dma", 0, NULL, &proc_dma_operations); | 281 | proc_create_single("dma", 0, NULL, proc_dma_show); |
294 | return 0; | 282 | return 0; |
295 | } | 283 | } |
296 | 284 | ||
diff --git a/arch/arm/kernel/swp_emulate.c b/arch/arm/kernel/swp_emulate.c index 3bda08bee674..6e971e114879 100644 --- a/arch/arm/kernel/swp_emulate.c +++ b/arch/arm/kernel/swp_emulate.c | |||
@@ -91,18 +91,6 @@ static int proc_status_show(struct seq_file *m, void *v) | |||
91 | seq_printf(m, "Last process:\t\t%d\n", previous_pid); | 91 | seq_printf(m, "Last process:\t\t%d\n", previous_pid); |
92 | return 0; | 92 | return 0; |
93 | } | 93 | } |
94 | |||
95 | static int proc_status_open(struct inode *inode, struct file *file) | ||
96 | { | ||
97 | return single_open(file, proc_status_show, PDE_DATA(inode)); | ||
98 | } | ||
99 | |||
100 | static const struct file_operations proc_status_fops = { | ||
101 | .open = proc_status_open, | ||
102 | .read = seq_read, | ||
103 | .llseek = seq_lseek, | ||
104 | .release = single_release, | ||
105 | }; | ||
106 | #endif | 94 | #endif |
107 | 95 | ||
108 | /* | 96 | /* |
@@ -260,7 +248,8 @@ static int __init swp_emulation_init(void) | |||
260 | return 0; | 248 | return 0; |
261 | 249 | ||
262 | #ifdef CONFIG_PROC_FS | 250 | #ifdef CONFIG_PROC_FS |
263 | if (!proc_create("cpu/swp_emulation", S_IRUGO, NULL, &proc_status_fops)) | 251 | if (!proc_create_single("cpu/swp_emulation", S_IRUGO, NULL, |
252 | proc_status_show)) | ||
264 | return -ENOMEM; | 253 | return -ENOMEM; |
265 | #endif /* CONFIG_PROC_FS */ | 254 | #endif /* CONFIG_PROC_FS */ |
266 | 255 | ||
diff --git a/arch/arm/mach-rpc/ecard.c b/arch/arm/mach-rpc/ecard.c index bdb5ec1cf560..39aef4876ed4 100644 --- a/arch/arm/mach-rpc/ecard.c +++ b/arch/arm/mach-rpc/ecard.c | |||
@@ -657,25 +657,13 @@ static int ecard_devices_proc_show(struct seq_file *m, void *v) | |||
657 | return 0; | 657 | return 0; |
658 | } | 658 | } |
659 | 659 | ||
660 | static int ecard_devices_proc_open(struct inode *inode, struct file *file) | ||
661 | { | ||
662 | return single_open(file, ecard_devices_proc_show, NULL); | ||
663 | } | ||
664 | |||
665 | static const struct file_operations bus_ecard_proc_fops = { | ||
666 | .owner = THIS_MODULE, | ||
667 | .open = ecard_devices_proc_open, | ||
668 | .read = seq_read, | ||
669 | .llseek = seq_lseek, | ||
670 | .release = single_release, | ||
671 | }; | ||
672 | |||
673 | static struct proc_dir_entry *proc_bus_ecard_dir = NULL; | 660 | static struct proc_dir_entry *proc_bus_ecard_dir = NULL; |
674 | 661 | ||
675 | static void ecard_proc_init(void) | 662 | static void ecard_proc_init(void) |
676 | { | 663 | { |
677 | proc_bus_ecard_dir = proc_mkdir("bus/ecard", NULL); | 664 | proc_bus_ecard_dir = proc_mkdir("bus/ecard", NULL); |
678 | proc_create("devices", 0, proc_bus_ecard_dir, &bus_ecard_proc_fops); | 665 | proc_create_single("devices", 0, proc_bus_ecard_dir, |
666 | ecard_devices_proc_show); | ||
679 | } | 667 | } |
680 | 668 | ||
681 | #define ec_set_resource(ec,nr,st,sz) \ | 669 | #define ec_set_resource(ec,nr,st,sz) \ |
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/hp/sim/simserial.c b/arch/ia64/hp/sim/simserial.c index a419ccf33cde..663388a73d4e 100644 --- a/arch/ia64/hp/sim/simserial.c +++ b/arch/ia64/hp/sim/simserial.c | |||
@@ -435,19 +435,6 @@ static int rs_proc_show(struct seq_file *m, void *v) | |||
435 | return 0; | 435 | return 0; |
436 | } | 436 | } |
437 | 437 | ||
438 | static int rs_proc_open(struct inode *inode, struct file *file) | ||
439 | { | ||
440 | return single_open(file, rs_proc_show, NULL); | ||
441 | } | ||
442 | |||
443 | static const struct file_operations rs_proc_fops = { | ||
444 | .owner = THIS_MODULE, | ||
445 | .open = rs_proc_open, | ||
446 | .read = seq_read, | ||
447 | .llseek = seq_lseek, | ||
448 | .release = single_release, | ||
449 | }; | ||
450 | |||
451 | static const struct tty_operations hp_ops = { | 438 | static const struct tty_operations hp_ops = { |
452 | .open = rs_open, | 439 | .open = rs_open, |
453 | .close = rs_close, | 440 | .close = rs_close, |
@@ -462,7 +449,7 @@ static const struct tty_operations hp_ops = { | |||
462 | .unthrottle = rs_unthrottle, | 449 | .unthrottle = rs_unthrottle, |
463 | .send_xchar = rs_send_xchar, | 450 | .send_xchar = rs_send_xchar, |
464 | .hangup = rs_hangup, | 451 | .hangup = rs_hangup, |
465 | .proc_fops = &rs_proc_fops, | 452 | .proc_show = rs_proc_show, |
466 | }; | 453 | }; |
467 | 454 | ||
468 | static const struct tty_port_operations hp_port_ops = { | 455 | static const struct tty_port_operations hp_port_ops = { |
diff --git a/arch/ia64/kernel/palinfo.c b/arch/ia64/kernel/palinfo.c index b6e597860888..f4a94241265c 100644 --- a/arch/ia64/kernel/palinfo.c +++ b/arch/ia64/kernel/palinfo.c | |||
@@ -920,18 +920,6 @@ static int proc_palinfo_show(struct seq_file *m, void *v) | |||
920 | return 0; | 920 | return 0; |
921 | } | 921 | } |
922 | 922 | ||
923 | static int proc_palinfo_open(struct inode *inode, struct file *file) | ||
924 | { | ||
925 | return single_open(file, proc_palinfo_show, PDE_DATA(inode)); | ||
926 | } | ||
927 | |||
928 | static const struct file_operations proc_palinfo_fops = { | ||
929 | .open = proc_palinfo_open, | ||
930 | .read = seq_read, | ||
931 | .llseek = seq_lseek, | ||
932 | .release = single_release, | ||
933 | }; | ||
934 | |||
935 | static int palinfo_add_proc(unsigned int cpu) | 923 | static int palinfo_add_proc(unsigned int cpu) |
936 | { | 924 | { |
937 | pal_func_cpu_u_t f; | 925 | pal_func_cpu_u_t f; |
@@ -948,8 +936,8 @@ static int palinfo_add_proc(unsigned int cpu) | |||
948 | 936 | ||
949 | for (j=0; j < NR_PALINFO_ENTRIES; j++) { | 937 | for (j=0; j < NR_PALINFO_ENTRIES; j++) { |
950 | f.func_id = j; | 938 | f.func_id = j; |
951 | proc_create_data(palinfo_entries[j].name, 0, cpu_dir, | 939 | proc_create_single_data(palinfo_entries[j].name, 0, cpu_dir, |
952 | &proc_palinfo_fops, (void *)f.value); | 940 | proc_palinfo_show, (void *)f.value); |
953 | } | 941 | } |
954 | return 0; | 942 | return 0; |
955 | } | 943 | } |
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/ia64/kernel/salinfo.c b/arch/ia64/kernel/salinfo.c index 52c404b08904..aba1f463a8dd 100644 --- a/arch/ia64/kernel/salinfo.c +++ b/arch/ia64/kernel/salinfo.c | |||
@@ -54,8 +54,6 @@ MODULE_AUTHOR("Jesse Barnes <jbarnes@sgi.com>"); | |||
54 | MODULE_DESCRIPTION("/proc interface to IA-64 SAL features"); | 54 | MODULE_DESCRIPTION("/proc interface to IA-64 SAL features"); |
55 | MODULE_LICENSE("GPL"); | 55 | MODULE_LICENSE("GPL"); |
56 | 56 | ||
57 | static const struct file_operations proc_salinfo_fops; | ||
58 | |||
59 | typedef struct { | 57 | typedef struct { |
60 | const char *name; /* name of the proc entry */ | 58 | const char *name; /* name of the proc entry */ |
61 | unsigned long feature; /* feature bit */ | 59 | unsigned long feature; /* feature bit */ |
@@ -578,6 +576,17 @@ static int salinfo_cpu_pre_down(unsigned int cpu) | |||
578 | return 0; | 576 | return 0; |
579 | } | 577 | } |
580 | 578 | ||
579 | /* | ||
580 | * 'data' contains an integer that corresponds to the feature we're | ||
581 | * testing | ||
582 | */ | ||
583 | static int proc_salinfo_show(struct seq_file *m, void *v) | ||
584 | { | ||
585 | unsigned long data = (unsigned long)v; | ||
586 | seq_puts(m, (sal_platform_features & data) ? "1\n" : "0\n"); | ||
587 | return 0; | ||
588 | } | ||
589 | |||
581 | static int __init | 590 | static int __init |
582 | salinfo_init(void) | 591 | salinfo_init(void) |
583 | { | 592 | { |
@@ -593,9 +602,9 @@ salinfo_init(void) | |||
593 | 602 | ||
594 | for (i=0; i < NR_SALINFO_ENTRIES; i++) { | 603 | for (i=0; i < NR_SALINFO_ENTRIES; i++) { |
595 | /* pass the feature bit in question as misc data */ | 604 | /* pass the feature bit in question as misc data */ |
596 | *sdir++ = proc_create_data(salinfo_entries[i].name, 0, salinfo_dir, | 605 | *sdir++ = proc_create_single_data(salinfo_entries[i].name, 0, |
597 | &proc_salinfo_fops, | 606 | salinfo_dir, proc_salinfo_show, |
598 | (void *)salinfo_entries[i].feature); | 607 | (void *)salinfo_entries[i].feature); |
599 | } | 608 | } |
600 | 609 | ||
601 | for (i = 0; i < ARRAY_SIZE(salinfo_log_name); i++) { | 610 | for (i = 0; i < ARRAY_SIZE(salinfo_log_name); i++) { |
@@ -633,27 +642,4 @@ salinfo_init(void) | |||
633 | return 0; | 642 | return 0; |
634 | } | 643 | } |
635 | 644 | ||
636 | /* | ||
637 | * 'data' contains an integer that corresponds to the feature we're | ||
638 | * testing | ||
639 | */ | ||
640 | static int proc_salinfo_show(struct seq_file *m, void *v) | ||
641 | { | ||
642 | unsigned long data = (unsigned long)v; | ||
643 | seq_puts(m, (sal_platform_features & data) ? "1\n" : "0\n"); | ||
644 | return 0; | ||
645 | } | ||
646 | |||
647 | static int proc_salinfo_open(struct inode *inode, struct file *file) | ||
648 | { | ||
649 | return single_open(file, proc_salinfo_show, PDE_DATA(inode)); | ||
650 | } | ||
651 | |||
652 | static const struct file_operations proc_salinfo_fops = { | ||
653 | .open = proc_salinfo_open, | ||
654 | .read = seq_read, | ||
655 | .llseek = seq_lseek, | ||
656 | .release = single_release, | ||
657 | }; | ||
658 | |||
659 | module_init(salinfo_init); | 645 | module_init(salinfo_init); |
diff --git a/arch/ia64/sn/kernel/sn2/prominfo_proc.c b/arch/ia64/sn/kernel/sn2/prominfo_proc.c index ec4de2b09653..e15457bf21ac 100644 --- a/arch/ia64/sn/kernel/sn2/prominfo_proc.c +++ b/arch/ia64/sn/kernel/sn2/prominfo_proc.c | |||
@@ -140,18 +140,6 @@ static int proc_fit_show(struct seq_file *m, void *v) | |||
140 | return 0; | 140 | return 0; |
141 | } | 141 | } |
142 | 142 | ||
143 | static int proc_fit_open(struct inode *inode, struct file *file) | ||
144 | { | ||
145 | return single_open(file, proc_fit_show, PDE_DATA(inode)); | ||
146 | } | ||
147 | |||
148 | static const struct file_operations proc_fit_fops = { | ||
149 | .open = proc_fit_open, | ||
150 | .read = seq_read, | ||
151 | .llseek = seq_lseek, | ||
152 | .release = single_release, | ||
153 | }; | ||
154 | |||
155 | static int proc_version_show(struct seq_file *m, void *v) | 143 | static int proc_version_show(struct seq_file *m, void *v) |
156 | { | 144 | { |
157 | unsigned long nasid = (unsigned long)m->private; | 145 | unsigned long nasid = (unsigned long)m->private; |
@@ -174,18 +162,6 @@ static int proc_version_show(struct seq_file *m, void *v) | |||
174 | return 0; | 162 | return 0; |
175 | } | 163 | } |
176 | 164 | ||
177 | static int proc_version_open(struct inode *inode, struct file *file) | ||
178 | { | ||
179 | return single_open(file, proc_version_show, PDE_DATA(inode)); | ||
180 | } | ||
181 | |||
182 | static const struct file_operations proc_version_fops = { | ||
183 | .open = proc_version_open, | ||
184 | .read = seq_read, | ||
185 | .llseek = seq_lseek, | ||
186 | .release = single_release, | ||
187 | }; | ||
188 | |||
189 | /* module entry points */ | 165 | /* module entry points */ |
190 | int __init prominfo_init(void); | 166 | int __init prominfo_init(void); |
191 | void __exit prominfo_exit(void); | 167 | void __exit prominfo_exit(void); |
@@ -217,10 +193,10 @@ int __init prominfo_init(void) | |||
217 | if (!dir) | 193 | if (!dir) |
218 | continue; | 194 | continue; |
219 | nasid = cnodeid_to_nasid(cnodeid); | 195 | nasid = cnodeid_to_nasid(cnodeid); |
220 | proc_create_data("fit", 0, dir, | 196 | proc_create_single_data("fit", 0, dir, proc_fit_show, |
221 | &proc_fit_fops, (void *)nasid); | 197 | (void *)nasid); |
222 | proc_create_data("version", 0, dir, | 198 | proc_create_single_data("version", 0, dir, proc_version_show, |
223 | &proc_version_fops, (void *)nasid); | 199 | (void *)nasid); |
224 | } | 200 | } |
225 | return 0; | 201 | return 0; |
226 | } | 202 | } |
diff --git a/arch/ia64/sn/kernel/sn2/sn_proc_fs.c b/arch/ia64/sn/kernel/sn2/sn_proc_fs.c index 29cf8f8c08e9..c2a4d84297b0 100644 --- a/arch/ia64/sn/kernel/sn2/sn_proc_fs.c +++ b/arch/ia64/sn/kernel/sn2/sn_proc_fs.c | |||
@@ -18,33 +18,18 @@ static int partition_id_show(struct seq_file *s, void *p) | |||
18 | return 0; | 18 | return 0; |
19 | } | 19 | } |
20 | 20 | ||
21 | static int partition_id_open(struct inode *inode, struct file *file) | ||
22 | { | ||
23 | return single_open(file, partition_id_show, NULL); | ||
24 | } | ||
25 | |||
26 | static int system_serial_number_show(struct seq_file *s, void *p) | 21 | static int system_serial_number_show(struct seq_file *s, void *p) |
27 | { | 22 | { |
28 | seq_printf(s, "%s\n", sn_system_serial_number()); | 23 | seq_printf(s, "%s\n", sn_system_serial_number()); |
29 | return 0; | 24 | return 0; |
30 | } | 25 | } |
31 | 26 | ||
32 | static int system_serial_number_open(struct inode *inode, struct file *file) | ||
33 | { | ||
34 | return single_open(file, system_serial_number_show, NULL); | ||
35 | } | ||
36 | |||
37 | static int licenseID_show(struct seq_file *s, void *p) | 27 | static int licenseID_show(struct seq_file *s, void *p) |
38 | { | 28 | { |
39 | seq_printf(s, "0x%llx\n", sn_partition_serial_number_val()); | 29 | seq_printf(s, "0x%llx\n", sn_partition_serial_number_val()); |
40 | return 0; | 30 | return 0; |
41 | } | 31 | } |
42 | 32 | ||
43 | static int licenseID_open(struct inode *inode, struct file *file) | ||
44 | { | ||
45 | return single_open(file, licenseID_show, NULL); | ||
46 | } | ||
47 | |||
48 | static int coherence_id_show(struct seq_file *s, void *p) | 33 | static int coherence_id_show(struct seq_file *s, void *p) |
49 | { | 34 | { |
50 | seq_printf(s, "%d\n", partition_coherence_id()); | 35 | seq_printf(s, "%d\n", partition_coherence_id()); |
@@ -52,43 +37,10 @@ static int coherence_id_show(struct seq_file *s, void *p) | |||
52 | return 0; | 37 | return 0; |
53 | } | 38 | } |
54 | 39 | ||
55 | static int coherence_id_open(struct inode *inode, struct file *file) | ||
56 | { | ||
57 | return single_open(file, coherence_id_show, NULL); | ||
58 | } | ||
59 | |||
60 | /* /proc/sgi_sn/sn_topology uses seq_file, see sn_hwperf.c */ | 40 | /* /proc/sgi_sn/sn_topology uses seq_file, see sn_hwperf.c */ |
61 | extern int sn_topology_open(struct inode *, struct file *); | 41 | extern int sn_topology_open(struct inode *, struct file *); |
62 | extern int sn_topology_release(struct inode *, struct file *); | 42 | extern int sn_topology_release(struct inode *, struct file *); |
63 | 43 | ||
64 | static const struct file_operations proc_partition_id_fops = { | ||
65 | .open = partition_id_open, | ||
66 | .read = seq_read, | ||
67 | .llseek = seq_lseek, | ||
68 | .release = single_release, | ||
69 | }; | ||
70 | |||
71 | static const struct file_operations proc_system_sn_fops = { | ||
72 | .open = system_serial_number_open, | ||
73 | .read = seq_read, | ||
74 | .llseek = seq_lseek, | ||
75 | .release = single_release, | ||
76 | }; | ||
77 | |||
78 | static const struct file_operations proc_license_id_fops = { | ||
79 | .open = licenseID_open, | ||
80 | .read = seq_read, | ||
81 | .llseek = seq_lseek, | ||
82 | .release = single_release, | ||
83 | }; | ||
84 | |||
85 | static const struct file_operations proc_coherence_id_fops = { | ||
86 | .open = coherence_id_open, | ||
87 | .read = seq_read, | ||
88 | .llseek = seq_lseek, | ||
89 | .release = single_release, | ||
90 | }; | ||
91 | |||
92 | static const struct file_operations proc_sn_topo_fops = { | 44 | static const struct file_operations proc_sn_topo_fops = { |
93 | .open = sn_topology_open, | 45 | .open = sn_topology_open, |
94 | .read = seq_read, | 46 | .read = seq_read, |
@@ -104,13 +56,13 @@ void register_sn_procfs(void) | |||
104 | if (!(sgi_proc_dir = proc_mkdir("sgi_sn", NULL))) | 56 | if (!(sgi_proc_dir = proc_mkdir("sgi_sn", NULL))) |
105 | return; | 57 | return; |
106 | 58 | ||
107 | proc_create("partition_id", 0444, sgi_proc_dir, | 59 | proc_create_single("partition_id", 0444, sgi_proc_dir, |
108 | &proc_partition_id_fops); | 60 | partition_id_show); |
109 | proc_create("system_serial_number", 0444, sgi_proc_dir, | 61 | proc_create_single("system_serial_number", 0444, sgi_proc_dir, |
110 | &proc_system_sn_fops); | 62 | system_serial_number_show); |
111 | proc_create("licenseID", 0444, sgi_proc_dir, &proc_license_id_fops); | 63 | proc_create_single("licenseID", 0444, sgi_proc_dir, licenseID_show); |
112 | proc_create("coherence_id", 0444, sgi_proc_dir, | 64 | proc_create_single("coherence_id", 0444, sgi_proc_dir, |
113 | &proc_coherence_id_fops); | 65 | coherence_id_show); |
114 | proc_create("sn_topology", 0444, sgi_proc_dir, &proc_sn_topo_fops); | 66 | proc_create("sn_topology", 0444, sgi_proc_dir, &proc_sn_topo_fops); |
115 | } | 67 | } |
116 | 68 | ||
diff --git a/arch/m68k/kernel/setup_mm.c b/arch/m68k/kernel/setup_mm.c index dd25bfc22fb4..f35e3ebd6331 100644 --- a/arch/m68k/kernel/setup_mm.c +++ b/arch/m68k/kernel/setup_mm.c | |||
@@ -527,21 +527,9 @@ static int hardware_proc_show(struct seq_file *m, void *v) | |||
527 | return 0; | 527 | return 0; |
528 | } | 528 | } |
529 | 529 | ||
530 | static int hardware_proc_open(struct inode *inode, struct file *file) | ||
531 | { | ||
532 | return single_open(file, hardware_proc_show, NULL); | ||
533 | } | ||
534 | |||
535 | static const struct file_operations hardware_proc_fops = { | ||
536 | .open = hardware_proc_open, | ||
537 | .read = seq_read, | ||
538 | .llseek = seq_lseek, | ||
539 | .release = single_release, | ||
540 | }; | ||
541 | |||
542 | static int __init proc_hardware_init(void) | 530 | static int __init proc_hardware_init(void) |
543 | { | 531 | { |
544 | proc_create("hardware", 0, NULL, &hardware_proc_fops); | 532 | proc_create_single("hardware", 0, NULL, hardware_proc_show); |
545 | return 0; | 533 | return 0; |
546 | } | 534 | } |
547 | module_init(proc_hardware_init); | 535 | module_init(proc_hardware_init); |
diff --git a/arch/mips/pci/ops-pmcmsp.c b/arch/mips/pci/ops-pmcmsp.c index dd2d9f7e9412..7649372103af 100644 --- a/arch/mips/pci/ops-pmcmsp.c +++ b/arch/mips/pci/ops-pmcmsp.c | |||
@@ -83,18 +83,6 @@ static int show_msp_pci_counts(struct seq_file *m, void *v) | |||
83 | return 0; | 83 | return 0; |
84 | } | 84 | } |
85 | 85 | ||
86 | static int msp_pci_rd_cnt_open(struct inode *inode, struct file *file) | ||
87 | { | ||
88 | return single_open(file, show_msp_pci_counts, NULL); | ||
89 | } | ||
90 | |||
91 | static const struct file_operations msp_pci_rd_cnt_fops = { | ||
92 | .open = msp_pci_rd_cnt_open, | ||
93 | .read = seq_read, | ||
94 | .llseek = seq_lseek, | ||
95 | .release = single_release, | ||
96 | }; | ||
97 | |||
98 | /***************************************************************************** | 86 | /***************************************************************************** |
99 | * | 87 | * |
100 | * FUNCTION: gen_pci_cfg_wr_show | 88 | * FUNCTION: gen_pci_cfg_wr_show |
@@ -160,18 +148,6 @@ static int gen_pci_cfg_wr_show(struct seq_file *m, void *v) | |||
160 | return 0; | 148 | return 0; |
161 | } | 149 | } |
162 | 150 | ||
163 | static int gen_pci_cfg_wr_open(struct inode *inode, struct file *file) | ||
164 | { | ||
165 | return single_open(file, gen_pci_cfg_wr_show, NULL); | ||
166 | } | ||
167 | |||
168 | static const struct file_operations gen_pci_cfg_wr_fops = { | ||
169 | .open = gen_pci_cfg_wr_open, | ||
170 | .read = seq_read, | ||
171 | .llseek = seq_lseek, | ||
172 | .release = single_release, | ||
173 | }; | ||
174 | |||
175 | /***************************************************************************** | 151 | /***************************************************************************** |
176 | * | 152 | * |
177 | * FUNCTION: pci_proc_init | 153 | * FUNCTION: pci_proc_init |
@@ -188,8 +164,8 @@ static const struct file_operations gen_pci_cfg_wr_fops = { | |||
188 | ****************************************************************************/ | 164 | ****************************************************************************/ |
189 | static void pci_proc_init(void) | 165 | static void pci_proc_init(void) |
190 | { | 166 | { |
191 | proc_create("pmc_msp_pci_rd_cnt", 0, NULL, &msp_pci_rd_cnt_fops); | 167 | proc_create_single("pmc_msp_pci_rd_cnt", 0, NULL, show_msp_pci_counts); |
192 | proc_create("pmc_msp_pci_cfg_wr", 0, NULL, &gen_pci_cfg_wr_fops); | 168 | proc_create_single("pmc_msp_pci_cfg_wr", 0, NULL, gen_pci_cfg_wr_show); |
193 | } | 169 | } |
194 | #endif /* CONFIG_PROC_FS && PCI_COUNTERS */ | 170 | #endif /* CONFIG_PROC_FS && PCI_COUNTERS */ |
195 | 171 | ||
diff --git a/arch/mips/sibyte/common/bus_watcher.c b/arch/mips/sibyte/common/bus_watcher.c index a4e55999ecb4..4bb85de9229b 100644 --- a/arch/mips/sibyte/common/bus_watcher.c +++ b/arch/mips/sibyte/common/bus_watcher.c | |||
@@ -142,24 +142,12 @@ static int bw_proc_show(struct seq_file *m, void *v) | |||
142 | return 0; | 142 | return 0; |
143 | } | 143 | } |
144 | 144 | ||
145 | static int bw_proc_open(struct inode *inode, struct file *file) | ||
146 | { | ||
147 | return single_open(file, bw_proc_show, PDE_DATA(inode)); | ||
148 | } | ||
149 | |||
150 | static const struct file_operations bw_proc_fops = { | ||
151 | .open = bw_proc_open, | ||
152 | .read = seq_read, | ||
153 | .llseek = seq_lseek, | ||
154 | .release = single_release, | ||
155 | }; | ||
156 | |||
157 | static void create_proc_decoder(struct bw_stats_struct *stats) | 145 | static void create_proc_decoder(struct bw_stats_struct *stats) |
158 | { | 146 | { |
159 | struct proc_dir_entry *ent; | 147 | struct proc_dir_entry *ent; |
160 | 148 | ||
161 | ent = proc_create_data("bus_watcher", S_IWUSR | S_IRUGO, NULL, | 149 | ent = proc_create_single_data("bus_watcher", S_IWUSR | S_IRUGO, NULL, |
162 | &bw_proc_fops, stats); | 150 | bw_proc_show, stats); |
163 | if (!ent) { | 151 | if (!ent) { |
164 | printk(KERN_INFO "Unable to initialize bus_watcher /proc entry\n"); | 152 | printk(KERN_INFO "Unable to initialize bus_watcher /proc entry\n"); |
165 | return; | 153 | return; |
diff --git a/arch/parisc/kernel/pci-dma.c b/arch/parisc/kernel/pci-dma.c index 91bc0cac03a1..6df07ce4f3c2 100644 --- a/arch/parisc/kernel/pci-dma.c +++ b/arch/parisc/kernel/pci-dma.c | |||
@@ -367,19 +367,6 @@ static int proc_pcxl_dma_show(struct seq_file *m, void *v) | |||
367 | return 0; | 367 | return 0; |
368 | } | 368 | } |
369 | 369 | ||
370 | static int proc_pcxl_dma_open(struct inode *inode, struct file *file) | ||
371 | { | ||
372 | return single_open(file, proc_pcxl_dma_show, NULL); | ||
373 | } | ||
374 | |||
375 | static const struct file_operations proc_pcxl_dma_ops = { | ||
376 | .owner = THIS_MODULE, | ||
377 | .open = proc_pcxl_dma_open, | ||
378 | .read = seq_read, | ||
379 | .llseek = seq_lseek, | ||
380 | .release = single_release, | ||
381 | }; | ||
382 | |||
383 | static int __init | 370 | static int __init |
384 | pcxl_dma_init(void) | 371 | pcxl_dma_init(void) |
385 | { | 372 | { |
@@ -397,8 +384,8 @@ pcxl_dma_init(void) | |||
397 | "pcxl_dma_init: Unable to create gsc /proc dir entry\n"); | 384 | "pcxl_dma_init: Unable to create gsc /proc dir entry\n"); |
398 | else { | 385 | else { |
399 | struct proc_dir_entry* ent; | 386 | struct proc_dir_entry* ent; |
400 | ent = proc_create("pcxl_dma", 0, proc_gsc_root, | 387 | ent = proc_create_single("pcxl_dma", 0, proc_gsc_root, |
401 | &proc_pcxl_dma_ops); | 388 | proc_pcxl_dma_show); |
402 | if (!ent) | 389 | if (!ent) |
403 | printk(KERN_WARNING | 390 | printk(KERN_WARNING |
404 | "pci-dma.c: Unable to create pcxl_dma /proc entry.\n"); | 391 | "pci-dma.c: Unable to create pcxl_dma /proc entry.\n"); |
diff --git a/arch/parisc/kernel/pdc_chassis.c b/arch/parisc/kernel/pdc_chassis.c index 3e04242de5a7..28e07482b0f1 100644 --- a/arch/parisc/kernel/pdc_chassis.c +++ b/arch/parisc/kernel/pdc_chassis.c | |||
@@ -266,18 +266,6 @@ static int pdc_chassis_warn_show(struct seq_file *m, void *v) | |||
266 | return 0; | 266 | return 0; |
267 | } | 267 | } |
268 | 268 | ||
269 | static int pdc_chassis_warn_open(struct inode *inode, struct file *file) | ||
270 | { | ||
271 | return single_open(file, pdc_chassis_warn_show, NULL); | ||
272 | } | ||
273 | |||
274 | static const struct file_operations pdc_chassis_warn_fops = { | ||
275 | .open = pdc_chassis_warn_open, | ||
276 | .read = seq_read, | ||
277 | .llseek = seq_lseek, | ||
278 | .release = single_release, | ||
279 | }; | ||
280 | |||
281 | static int __init pdc_chassis_create_procfs(void) | 269 | static int __init pdc_chassis_create_procfs(void) |
282 | { | 270 | { |
283 | unsigned long test; | 271 | unsigned long test; |
@@ -292,7 +280,7 @@ static int __init pdc_chassis_create_procfs(void) | |||
292 | 280 | ||
293 | printk(KERN_INFO "Enabling PDC chassis warnings support v%s\n", | 281 | printk(KERN_INFO "Enabling PDC chassis warnings support v%s\n", |
294 | PDC_CHASSIS_VER); | 282 | PDC_CHASSIS_VER); |
295 | proc_create("chassis", 0400, NULL, &pdc_chassis_warn_fops); | 283 | proc_create_single("chassis", 0400, NULL, pdc_chassis_warn_show); |
296 | return 0; | 284 | return 0; |
297 | } | 285 | } |
298 | 286 | ||
diff --git a/arch/powerpc/kernel/eeh.c b/arch/powerpc/kernel/eeh.c index bc640e4c5ca5..90bb39b1a23c 100644 --- a/arch/powerpc/kernel/eeh.c +++ b/arch/powerpc/kernel/eeh.c | |||
@@ -1775,18 +1775,6 @@ static int proc_eeh_show(struct seq_file *m, void *v) | |||
1775 | return 0; | 1775 | return 0; |
1776 | } | 1776 | } |
1777 | 1777 | ||
1778 | static int proc_eeh_open(struct inode *inode, struct file *file) | ||
1779 | { | ||
1780 | return single_open(file, proc_eeh_show, NULL); | ||
1781 | } | ||
1782 | |||
1783 | static const struct file_operations proc_eeh_operations = { | ||
1784 | .open = proc_eeh_open, | ||
1785 | .read = seq_read, | ||
1786 | .llseek = seq_lseek, | ||
1787 | .release = single_release, | ||
1788 | }; | ||
1789 | |||
1790 | #ifdef CONFIG_DEBUG_FS | 1778 | #ifdef CONFIG_DEBUG_FS |
1791 | static int eeh_enable_dbgfs_set(void *data, u64 val) | 1779 | static int eeh_enable_dbgfs_set(void *data, u64 val) |
1792 | { | 1780 | { |
@@ -1828,7 +1816,7 @@ DEFINE_SIMPLE_ATTRIBUTE(eeh_freeze_dbgfs_ops, eeh_freeze_dbgfs_get, | |||
1828 | static int __init eeh_init_proc(void) | 1816 | static int __init eeh_init_proc(void) |
1829 | { | 1817 | { |
1830 | if (machine_is(pseries) || machine_is(powernv)) { | 1818 | if (machine_is(pseries) || machine_is(powernv)) { |
1831 | proc_create("powerpc/eeh", 0, NULL, &proc_eeh_operations); | 1819 | proc_create_single("powerpc/eeh", 0, NULL, proc_eeh_show); |
1832 | #ifdef CONFIG_DEBUG_FS | 1820 | #ifdef CONFIG_DEBUG_FS |
1833 | debugfs_create_file("eeh_enable", 0600, | 1821 | debugfs_create_file("eeh_enable", 0600, |
1834 | powerpc_debugfs_root, NULL, | 1822 | powerpc_debugfs_root, NULL, |
diff --git a/arch/powerpc/kernel/rtas-proc.c b/arch/powerpc/kernel/rtas-proc.c index fb070d8cad07..d49063d0baa4 100644 --- a/arch/powerpc/kernel/rtas-proc.c +++ b/arch/powerpc/kernel/rtas-proc.c | |||
@@ -154,18 +154,6 @@ static ssize_t ppc_rtas_tone_volume_write(struct file *file, | |||
154 | static int ppc_rtas_tone_volume_show(struct seq_file *m, void *v); | 154 | static int ppc_rtas_tone_volume_show(struct seq_file *m, void *v); |
155 | static int ppc_rtas_rmo_buf_show(struct seq_file *m, void *v); | 155 | static int ppc_rtas_rmo_buf_show(struct seq_file *m, void *v); |
156 | 156 | ||
157 | static int sensors_open(struct inode *inode, struct file *file) | ||
158 | { | ||
159 | return single_open(file, ppc_rtas_sensors_show, NULL); | ||
160 | } | ||
161 | |||
162 | static const struct file_operations ppc_rtas_sensors_operations = { | ||
163 | .open = sensors_open, | ||
164 | .read = seq_read, | ||
165 | .llseek = seq_lseek, | ||
166 | .release = single_release, | ||
167 | }; | ||
168 | |||
169 | static int poweron_open(struct inode *inode, struct file *file) | 157 | static int poweron_open(struct inode *inode, struct file *file) |
170 | { | 158 | { |
171 | return single_open(file, ppc_rtas_poweron_show, NULL); | 159 | return single_open(file, ppc_rtas_poweron_show, NULL); |
@@ -231,18 +219,6 @@ static const struct file_operations ppc_rtas_tone_volume_operations = { | |||
231 | .release = single_release, | 219 | .release = single_release, |
232 | }; | 220 | }; |
233 | 221 | ||
234 | static int rmo_buf_open(struct inode *inode, struct file *file) | ||
235 | { | ||
236 | return single_open(file, ppc_rtas_rmo_buf_show, NULL); | ||
237 | } | ||
238 | |||
239 | static const struct file_operations ppc_rtas_rmo_buf_ops = { | ||
240 | .open = rmo_buf_open, | ||
241 | .read = seq_read, | ||
242 | .llseek = seq_lseek, | ||
243 | .release = single_release, | ||
244 | }; | ||
245 | |||
246 | static int ppc_rtas_find_all_sensors(void); | 222 | static int ppc_rtas_find_all_sensors(void); |
247 | static void ppc_rtas_process_sensor(struct seq_file *m, | 223 | static void ppc_rtas_process_sensor(struct seq_file *m, |
248 | struct individual_sensor *s, int state, int error, const char *loc); | 224 | struct individual_sensor *s, int state, int error, const char *loc); |
@@ -267,14 +243,14 @@ static int __init proc_rtas_init(void) | |||
267 | &ppc_rtas_clock_operations); | 243 | &ppc_rtas_clock_operations); |
268 | proc_create("powerpc/rtas/poweron", 0644, NULL, | 244 | proc_create("powerpc/rtas/poweron", 0644, NULL, |
269 | &ppc_rtas_poweron_operations); | 245 | &ppc_rtas_poweron_operations); |
270 | proc_create("powerpc/rtas/sensors", 0444, NULL, | 246 | proc_create_single("powerpc/rtas/sensors", 0444, NULL, |
271 | &ppc_rtas_sensors_operations); | 247 | ppc_rtas_sensors_show); |
272 | proc_create("powerpc/rtas/frequency", 0644, NULL, | 248 | proc_create("powerpc/rtas/frequency", 0644, NULL, |
273 | &ppc_rtas_tone_freq_operations); | 249 | &ppc_rtas_tone_freq_operations); |
274 | proc_create("powerpc/rtas/volume", 0644, NULL, | 250 | proc_create("powerpc/rtas/volume", 0644, NULL, |
275 | &ppc_rtas_tone_volume_operations); | 251 | &ppc_rtas_tone_volume_operations); |
276 | proc_create("powerpc/rtas/rmo_buffer", 0400, NULL, | 252 | proc_create_single("powerpc/rtas/rmo_buffer", 0400, NULL, |
277 | &ppc_rtas_rmo_buf_ops); | 253 | ppc_rtas_rmo_buf_show); |
278 | return 0; | 254 | return 0; |
279 | } | 255 | } |
280 | 256 | ||
diff --git a/arch/powerpc/platforms/cell/spufs/sched.c b/arch/powerpc/platforms/cell/spufs/sched.c index ccc421503363..c9ef3c532169 100644 --- a/arch/powerpc/platforms/cell/spufs/sched.c +++ b/arch/powerpc/platforms/cell/spufs/sched.c | |||
@@ -1095,18 +1095,6 @@ static int show_spu_loadavg(struct seq_file *s, void *private) | |||
1095 | atomic_read(&nr_spu_contexts), | 1095 | atomic_read(&nr_spu_contexts), |
1096 | idr_get_cursor(&task_active_pid_ns(current)->idr) - 1); | 1096 | idr_get_cursor(&task_active_pid_ns(current)->idr) - 1); |
1097 | return 0; | 1097 | return 0; |
1098 | } | ||
1099 | |||
1100 | static int spu_loadavg_open(struct inode *inode, struct file *file) | ||
1101 | { | ||
1102 | return single_open(file, show_spu_loadavg, NULL); | ||
1103 | } | ||
1104 | |||
1105 | static const struct file_operations spu_loadavg_fops = { | ||
1106 | .open = spu_loadavg_open, | ||
1107 | .read = seq_read, | ||
1108 | .llseek = seq_lseek, | ||
1109 | .release = single_release, | ||
1110 | }; | 1098 | }; |
1111 | 1099 | ||
1112 | int __init spu_sched_init(void) | 1100 | int __init spu_sched_init(void) |
@@ -1135,7 +1123,7 @@ int __init spu_sched_init(void) | |||
1135 | 1123 | ||
1136 | mod_timer(&spuloadavg_timer, 0); | 1124 | mod_timer(&spuloadavg_timer, 0); |
1137 | 1125 | ||
1138 | entry = proc_create("spu_loadavg", 0, NULL, &spu_loadavg_fops); | 1126 | entry = proc_create_single("spu_loadavg", 0, NULL, show_spu_loadavg); |
1139 | if (!entry) | 1127 | if (!entry) |
1140 | goto out_stop_kthread; | 1128 | goto out_stop_kthread; |
1141 | 1129 | ||
diff --git a/arch/s390/kernel/sysinfo.c b/arch/s390/kernel/sysinfo.c index fc7e04c2195b..54f5496913fa 100644 --- a/arch/s390/kernel/sysinfo.c +++ b/arch/s390/kernel/sysinfo.c | |||
@@ -294,21 +294,9 @@ static int sysinfo_show(struct seq_file *m, void *v) | |||
294 | return 0; | 294 | return 0; |
295 | } | 295 | } |
296 | 296 | ||
297 | static int sysinfo_open(struct inode *inode, struct file *file) | ||
298 | { | ||
299 | return single_open(file, sysinfo_show, NULL); | ||
300 | } | ||
301 | |||
302 | static const struct file_operations sysinfo_fops = { | ||
303 | .open = sysinfo_open, | ||
304 | .read = seq_read, | ||
305 | .llseek = seq_lseek, | ||
306 | .release = single_release, | ||
307 | }; | ||
308 | |||
309 | static int __init sysinfo_create_proc(void) | 297 | static int __init sysinfo_create_proc(void) |
310 | { | 298 | { |
311 | proc_create("sysinfo", 0444, NULL, &sysinfo_fops); | 299 | proc_create_single("sysinfo", 0444, NULL, sysinfo_show); |
312 | return 0; | 300 | return 0; |
313 | } | 301 | } |
314 | device_initcall(sysinfo_create_proc); | 302 | device_initcall(sysinfo_create_proc); |
@@ -386,18 +374,6 @@ static const struct seq_operations service_level_seq_ops = { | |||
386 | .show = service_level_show | 374 | .show = service_level_show |
387 | }; | 375 | }; |
388 | 376 | ||
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, | 377 | static void service_level_vm_print(struct seq_file *m, |
402 | struct service_level *slr) | 378 | struct service_level *slr) |
403 | { | 379 | { |
@@ -420,7 +396,7 @@ static struct service_level service_level_vm = { | |||
420 | 396 | ||
421 | static __init int create_proc_service_level(void) | 397 | static __init int create_proc_service_level(void) |
422 | { | 398 | { |
423 | proc_create("service_levels", 0, NULL, &service_level_ops); | 399 | proc_create_seq("service_levels", 0, NULL, &service_level_seq_ops); |
424 | if (MACHINE_IS_VM) | 400 | if (MACHINE_IS_VM) |
425 | register_service_level(&service_level_vm); | 401 | register_service_level(&service_level_vm); |
426 | return 0; | 402 | return 0; |
diff --git a/arch/sh/drivers/dma/dma-api.c b/arch/sh/drivers/dma/dma-api.c index c0eec08d8f95..b05be597b19f 100644 --- a/arch/sh/drivers/dma/dma-api.c +++ b/arch/sh/drivers/dma/dma-api.c | |||
@@ -339,18 +339,6 @@ static int dma_proc_show(struct seq_file *m, void *v) | |||
339 | return 0; | 339 | return 0; |
340 | } | 340 | } |
341 | 341 | ||
342 | static int dma_proc_open(struct inode *inode, struct file *file) | ||
343 | { | ||
344 | return single_open(file, dma_proc_show, NULL); | ||
345 | } | ||
346 | |||
347 | static const struct file_operations dma_proc_fops = { | ||
348 | .open = dma_proc_open, | ||
349 | .read = seq_read, | ||
350 | .llseek = seq_lseek, | ||
351 | .release = single_release, | ||
352 | }; | ||
353 | |||
354 | int register_dmac(struct dma_info *info) | 342 | int register_dmac(struct dma_info *info) |
355 | { | 343 | { |
356 | unsigned int total_channels, i; | 344 | unsigned int total_channels, i; |
@@ -423,7 +411,7 @@ EXPORT_SYMBOL(unregister_dmac); | |||
423 | static int __init dma_api_init(void) | 411 | static int __init dma_api_init(void) |
424 | { | 412 | { |
425 | printk(KERN_NOTICE "DMA: Registering DMA API.\n"); | 413 | printk(KERN_NOTICE "DMA: Registering DMA API.\n"); |
426 | return proc_create("dma", 0, NULL, &dma_proc_fops) ? 0 : -ENOMEM; | 414 | return proc_create_single("dma", 0, NULL, dma_proc_show) ? 0 : -ENOMEM; |
427 | } | 415 | } |
428 | subsys_initcall(dma_api_init); | 416 | subsys_initcall(dma_api_init); |
429 | 417 | ||
diff --git a/arch/sparc/kernel/ioport.c b/arch/sparc/kernel/ioport.c index 3bcef9ce74df..cca9134cfa7d 100644 --- a/arch/sparc/kernel/ioport.c +++ b/arch/sparc/kernel/ioport.c | |||
@@ -678,25 +678,14 @@ static int sparc_io_proc_show(struct seq_file *m, void *v) | |||
678 | 678 | ||
679 | return 0; | 679 | return 0; |
680 | } | 680 | } |
681 | |||
682 | static int sparc_io_proc_open(struct inode *inode, struct file *file) | ||
683 | { | ||
684 | return single_open(file, sparc_io_proc_show, PDE_DATA(inode)); | ||
685 | } | ||
686 | |||
687 | static const struct file_operations sparc_io_proc_fops = { | ||
688 | .owner = THIS_MODULE, | ||
689 | .open = sparc_io_proc_open, | ||
690 | .read = seq_read, | ||
691 | .llseek = seq_lseek, | ||
692 | .release = single_release, | ||
693 | }; | ||
694 | #endif /* CONFIG_PROC_FS */ | 681 | #endif /* CONFIG_PROC_FS */ |
695 | 682 | ||
696 | static void register_proc_sparc_ioport(void) | 683 | static void register_proc_sparc_ioport(void) |
697 | { | 684 | { |
698 | #ifdef CONFIG_PROC_FS | 685 | #ifdef CONFIG_PROC_FS |
699 | proc_create_data("io_map", 0, NULL, &sparc_io_proc_fops, &sparc_iomap); | 686 | proc_create_single_data("io_map", 0, NULL, sparc_io_proc_show, |
700 | proc_create_data("dvma_map", 0, NULL, &sparc_io_proc_fops, &_sparc_dvma); | 687 | &sparc_iomap); |
688 | proc_create_single_data("dvma_map", 0, NULL, sparc_io_proc_show, | ||
689 | &_sparc_dvma); | ||
701 | #endif | 690 | #endif |
702 | } | 691 | } |
diff --git a/arch/um/drivers/ubd_kern.c b/arch/um/drivers/ubd_kern.c index d4e8c497ae86..dcf5ea28a281 100644 --- a/arch/um/drivers/ubd_kern.c +++ b/arch/um/drivers/ubd_kern.c | |||
@@ -208,19 +208,6 @@ static int fake_ide_media_proc_show(struct seq_file *m, void *v) | |||
208 | return 0; | 208 | return 0; |
209 | } | 209 | } |
210 | 210 | ||
211 | static int fake_ide_media_proc_open(struct inode *inode, struct file *file) | ||
212 | { | ||
213 | return single_open(file, fake_ide_media_proc_show, NULL); | ||
214 | } | ||
215 | |||
216 | static const struct file_operations fake_ide_media_proc_fops = { | ||
217 | .owner = THIS_MODULE, | ||
218 | .open = fake_ide_media_proc_open, | ||
219 | .read = seq_read, | ||
220 | .llseek = seq_lseek, | ||
221 | .release = single_release, | ||
222 | }; | ||
223 | |||
224 | static void make_ide_entries(const char *dev_name) | 211 | static void make_ide_entries(const char *dev_name) |
225 | { | 212 | { |
226 | struct proc_dir_entry *dir, *ent; | 213 | struct proc_dir_entry *dir, *ent; |
@@ -231,7 +218,8 @@ static void make_ide_entries(const char *dev_name) | |||
231 | dir = proc_mkdir(dev_name, proc_ide); | 218 | dir = proc_mkdir(dev_name, proc_ide); |
232 | if(!dir) return; | 219 | if(!dir) return; |
233 | 220 | ||
234 | ent = proc_create("media", S_IRUGO, dir, &fake_ide_media_proc_fops); | 221 | ent = proc_create_single("media", S_IRUGO, dir, |
222 | fake_ide_media_proc_show); | ||
235 | if(!ent) return; | 223 | if(!ent) return; |
236 | snprintf(name, sizeof(name), "ide0/%s", dev_name); | 224 | snprintf(name, sizeof(name), "ide0/%s", dev_name); |
237 | proc_symlink(dev_name, proc_ide_root, name); | 225 | proc_symlink(dev_name, proc_ide_root, name); |
diff --git a/arch/x86/kernel/apm_32.c b/arch/x86/kernel/apm_32.c index dfcbe6924eaf..cadeafabf167 100644 --- a/arch/x86/kernel/apm_32.c +++ b/arch/x86/kernel/apm_32.c | |||
@@ -1715,19 +1715,6 @@ static int proc_apm_show(struct seq_file *m, void *v) | |||
1715 | return 0; | 1715 | return 0; |
1716 | } | 1716 | } |
1717 | 1717 | ||
1718 | static int proc_apm_open(struct inode *inode, struct file *file) | ||
1719 | { | ||
1720 | return single_open(file, proc_apm_show, NULL); | ||
1721 | } | ||
1722 | |||
1723 | static const struct file_operations apm_file_ops = { | ||
1724 | .owner = THIS_MODULE, | ||
1725 | .open = proc_apm_open, | ||
1726 | .read = seq_read, | ||
1727 | .llseek = seq_lseek, | ||
1728 | .release = single_release, | ||
1729 | }; | ||
1730 | |||
1731 | static int apm(void *unused) | 1718 | static int apm(void *unused) |
1732 | { | 1719 | { |
1733 | unsigned short bx; | 1720 | unsigned short bx; |
@@ -2360,7 +2347,7 @@ static int __init apm_init(void) | |||
2360 | set_desc_base(&gdt[APM_DS >> 3], | 2347 | set_desc_base(&gdt[APM_DS >> 3], |
2361 | (unsigned long)__va((unsigned long)apm_info.bios.dseg << 4)); | 2348 | (unsigned long)__va((unsigned long)apm_info.bios.dseg << 4)); |
2362 | 2349 | ||
2363 | proc_create("apm", 0, NULL, &apm_file_ops); | 2350 | proc_create_single("apm", 0, NULL, proc_apm_show); |
2364 | 2351 | ||
2365 | kapmd_task = kthread_create(apm, NULL, "kapmd"); | 2352 | kapmd_task = kthread_create(apm, NULL, "kapmd"); |
2366 | if (IS_ERR(kapmd_task)) { | 2353 | if (IS_ERR(kapmd_task)) { |
diff --git a/arch/xtensa/platforms/iss/console.c b/arch/xtensa/platforms/iss/console.c index 92f567f9a21e..af81a62faba6 100644 --- a/arch/xtensa/platforms/iss/console.c +++ b/arch/xtensa/platforms/iss/console.c | |||
@@ -153,19 +153,6 @@ static int rs_proc_show(struct seq_file *m, void *v) | |||
153 | return 0; | 153 | return 0; |
154 | } | 154 | } |
155 | 155 | ||
156 | static int rs_proc_open(struct inode *inode, struct file *file) | ||
157 | { | ||
158 | return single_open(file, rs_proc_show, NULL); | ||
159 | } | ||
160 | |||
161 | static const struct file_operations rs_proc_fops = { | ||
162 | .owner = THIS_MODULE, | ||
163 | .open = rs_proc_open, | ||
164 | .read = seq_read, | ||
165 | .llseek = seq_lseek, | ||
166 | .release = single_release, | ||
167 | }; | ||
168 | |||
169 | static const struct tty_operations serial_ops = { | 156 | static const struct tty_operations serial_ops = { |
170 | .open = rs_open, | 157 | .open = rs_open, |
171 | .close = rs_close, | 158 | .close = rs_close, |
@@ -176,7 +163,7 @@ static const struct tty_operations serial_ops = { | |||
176 | .chars_in_buffer = rs_chars_in_buffer, | 163 | .chars_in_buffer = rs_chars_in_buffer, |
177 | .hangup = rs_hangup, | 164 | .hangup = rs_hangup, |
178 | .wait_until_sent = rs_wait_until_sent, | 165 | .wait_until_sent = rs_wait_until_sent, |
179 | .proc_fops = &rs_proc_fops, | 166 | .proc_show = rs_proc_show, |
180 | }; | 167 | }; |
181 | 168 | ||
182 | int __init rs_init(void) | 169 | int __init rs_init(void) |
diff --git a/block/genhd.c b/block/genhd.c index 4d694035d343..f1543a45e73b 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 | ||
@@ -1374,22 +1362,10 @@ static const struct seq_operations diskstats_op = { | |||
1374 | .show = diskstats_show | 1362 | .show = diskstats_show |
1375 | }; | 1363 | }; |
1376 | 1364 | ||
1377 | static int diskstats_open(struct inode *inode, struct file *file) | ||
1378 | { | ||
1379 | return seq_open(file, &diskstats_op); | ||
1380 | } | ||
1381 | |||
1382 | static const struct file_operations proc_diskstats_operations = { | ||
1383 | .open = diskstats_open, | ||
1384 | .read = seq_read, | ||
1385 | .llseek = seq_lseek, | ||
1386 | .release = seq_release, | ||
1387 | }; | ||
1388 | |||
1389 | static int __init proc_genhd_init(void) | 1365 | static int __init proc_genhd_init(void) |
1390 | { | 1366 | { |
1391 | proc_create("diskstats", 0, NULL, &proc_diskstats_operations); | 1367 | proc_create_seq("diskstats", 0, NULL, &diskstats_op); |
1392 | proc_create("partitions", 0, NULL, &proc_partitions_operations); | 1368 | proc_create_seq("partitions", 0, NULL, &partitions_op); |
1393 | return 0; | 1369 | return 0; |
1394 | } | 1370 | } |
1395 | module_init(proc_genhd_init); | 1371 | 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/acpi/ac.c b/drivers/acpi/ac.c index 2d8de2f8c1ed..84fdfa70920a 100644 --- a/drivers/acpi/ac.c +++ b/drivers/acpi/ac.c | |||
@@ -82,7 +82,6 @@ static SIMPLE_DEV_PM_OPS(acpi_ac_pm, NULL, acpi_ac_resume); | |||
82 | #ifdef CONFIG_ACPI_PROCFS_POWER | 82 | #ifdef CONFIG_ACPI_PROCFS_POWER |
83 | extern struct proc_dir_entry *acpi_lock_ac_dir(void); | 83 | extern struct proc_dir_entry *acpi_lock_ac_dir(void); |
84 | extern void *acpi_unlock_ac_dir(struct proc_dir_entry *acpi_ac_dir); | 84 | extern void *acpi_unlock_ac_dir(struct proc_dir_entry *acpi_ac_dir); |
85 | static int acpi_ac_open_fs(struct inode *inode, struct file *file); | ||
86 | #endif | 85 | #endif |
87 | 86 | ||
88 | 87 | ||
@@ -111,16 +110,6 @@ struct acpi_ac { | |||
111 | 110 | ||
112 | #define to_acpi_ac(x) power_supply_get_drvdata(x) | 111 | #define to_acpi_ac(x) power_supply_get_drvdata(x) |
113 | 112 | ||
114 | #ifdef CONFIG_ACPI_PROCFS_POWER | ||
115 | static const struct file_operations acpi_ac_fops = { | ||
116 | .owner = THIS_MODULE, | ||
117 | .open = acpi_ac_open_fs, | ||
118 | .read = seq_read, | ||
119 | .llseek = seq_lseek, | ||
120 | .release = single_release, | ||
121 | }; | ||
122 | #endif | ||
123 | |||
124 | /* -------------------------------------------------------------------------- | 113 | /* -------------------------------------------------------------------------- |
125 | AC Adapter Management | 114 | AC Adapter Management |
126 | -------------------------------------------------------------------------- */ | 115 | -------------------------------------------------------------------------- */ |
@@ -209,11 +198,6 @@ static int acpi_ac_seq_show(struct seq_file *seq, void *offset) | |||
209 | return 0; | 198 | return 0; |
210 | } | 199 | } |
211 | 200 | ||
212 | static int acpi_ac_open_fs(struct inode *inode, struct file *file) | ||
213 | { | ||
214 | return single_open(file, acpi_ac_seq_show, PDE_DATA(inode)); | ||
215 | } | ||
216 | |||
217 | static int acpi_ac_add_fs(struct acpi_ac *ac) | 201 | static int acpi_ac_add_fs(struct acpi_ac *ac) |
218 | { | 202 | { |
219 | struct proc_dir_entry *entry = NULL; | 203 | struct proc_dir_entry *entry = NULL; |
@@ -228,9 +212,8 @@ static int acpi_ac_add_fs(struct acpi_ac *ac) | |||
228 | } | 212 | } |
229 | 213 | ||
230 | /* 'state' [R] */ | 214 | /* 'state' [R] */ |
231 | entry = proc_create_data(ACPI_AC_FILE_STATE, | 215 | entry = proc_create_single_data(ACPI_AC_FILE_STATE, S_IRUGO, |
232 | S_IRUGO, acpi_device_dir(ac->device), | 216 | acpi_device_dir(ac->device), acpi_ac_seq_show, ac); |
233 | &acpi_ac_fops, ac); | ||
234 | if (!entry) | 217 | if (!entry) |
235 | return -ENODEV; | 218 | return -ENODEV; |
236 | return 0; | 219 | return 0; |
diff --git a/drivers/acpi/battery.c b/drivers/acpi/battery.c index bdb24d636d9a..76550689ce10 100644 --- a/drivers/acpi/battery.c +++ b/drivers/acpi/battery.c | |||
@@ -81,14 +81,6 @@ MODULE_PARM_DESC(cache_time, "cache time in milliseconds"); | |||
81 | #ifdef CONFIG_ACPI_PROCFS_POWER | 81 | #ifdef CONFIG_ACPI_PROCFS_POWER |
82 | extern struct proc_dir_entry *acpi_lock_battery_dir(void); | 82 | extern struct proc_dir_entry *acpi_lock_battery_dir(void); |
83 | extern void *acpi_unlock_battery_dir(struct proc_dir_entry *acpi_battery_dir); | 83 | extern void *acpi_unlock_battery_dir(struct proc_dir_entry *acpi_battery_dir); |
84 | |||
85 | enum acpi_battery_files { | ||
86 | info_tag = 0, | ||
87 | state_tag, | ||
88 | alarm_tag, | ||
89 | ACPI_BATTERY_NUMFILES, | ||
90 | }; | ||
91 | |||
92 | #endif | 84 | #endif |
93 | 85 | ||
94 | static const struct acpi_device_id battery_device_ids[] = { | 86 | static const struct acpi_device_id battery_device_ids[] = { |
@@ -985,9 +977,10 @@ static const char *acpi_battery_units(const struct acpi_battery *battery) | |||
985 | "mA" : "mW"; | 977 | "mA" : "mW"; |
986 | } | 978 | } |
987 | 979 | ||
988 | static int acpi_battery_print_info(struct seq_file *seq, int result) | 980 | static int acpi_battery_info_proc_show(struct seq_file *seq, void *offset) |
989 | { | 981 | { |
990 | struct acpi_battery *battery = seq->private; | 982 | struct acpi_battery *battery = seq->private; |
983 | int result = acpi_battery_update(battery, false); | ||
991 | 984 | ||
992 | if (result) | 985 | if (result) |
993 | goto end; | 986 | goto end; |
@@ -1041,9 +1034,10 @@ static int acpi_battery_print_info(struct seq_file *seq, int result) | |||
1041 | return result; | 1034 | return result; |
1042 | } | 1035 | } |
1043 | 1036 | ||
1044 | static int acpi_battery_print_state(struct seq_file *seq, int result) | 1037 | static int acpi_battery_state_proc_show(struct seq_file *seq, void *offset) |
1045 | { | 1038 | { |
1046 | struct acpi_battery *battery = seq->private; | 1039 | struct acpi_battery *battery = seq->private; |
1040 | int result = acpi_battery_update(battery, false); | ||
1047 | 1041 | ||
1048 | if (result) | 1042 | if (result) |
1049 | goto end; | 1043 | goto end; |
@@ -1088,9 +1082,10 @@ static int acpi_battery_print_state(struct seq_file *seq, int result) | |||
1088 | return result; | 1082 | return result; |
1089 | } | 1083 | } |
1090 | 1084 | ||
1091 | static int acpi_battery_print_alarm(struct seq_file *seq, int result) | 1085 | static int acpi_battery_alarm_proc_show(struct seq_file *seq, void *offset) |
1092 | { | 1086 | { |
1093 | struct acpi_battery *battery = seq->private; | 1087 | struct acpi_battery *battery = seq->private; |
1088 | int result = acpi_battery_update(battery, false); | ||
1094 | 1089 | ||
1095 | if (result) | 1090 | if (result) |
1096 | goto end; | 1091 | goto end; |
@@ -1142,82 +1137,22 @@ static ssize_t acpi_battery_write_alarm(struct file *file, | |||
1142 | return result; | 1137 | return result; |
1143 | } | 1138 | } |
1144 | 1139 | ||
1145 | typedef int(*print_func)(struct seq_file *seq, int result); | 1140 | static int acpi_battery_alarm_proc_open(struct inode *inode, struct file *file) |
1146 | |||
1147 | static print_func acpi_print_funcs[ACPI_BATTERY_NUMFILES] = { | ||
1148 | acpi_battery_print_info, | ||
1149 | acpi_battery_print_state, | ||
1150 | acpi_battery_print_alarm, | ||
1151 | }; | ||
1152 | |||
1153 | static int acpi_battery_read(int fid, struct seq_file *seq) | ||
1154 | { | 1141 | { |
1155 | struct acpi_battery *battery = seq->private; | 1142 | return single_open(file, acpi_battery_alarm_proc_show, PDE_DATA(inode)); |
1156 | int result = acpi_battery_update(battery, false); | ||
1157 | return acpi_print_funcs[fid](seq, result); | ||
1158 | } | 1143 | } |
1159 | 1144 | ||
1160 | #define DECLARE_FILE_FUNCTIONS(_name) \ | 1145 | static const struct file_operations acpi_battery_alarm_fops = { |
1161 | static int acpi_battery_read_##_name(struct seq_file *seq, void *offset) \ | 1146 | .owner = THIS_MODULE, |
1162 | { \ | 1147 | .open = acpi_battery_alarm_proc_open, |
1163 | return acpi_battery_read(_name##_tag, seq); \ | 1148 | .read = seq_read, |
1164 | } \ | 1149 | .write = acpi_battery_write_alarm, |
1165 | static int acpi_battery_##_name##_open_fs(struct inode *inode, struct file *file) \ | 1150 | .llseek = seq_lseek, |
1166 | { \ | 1151 | .release = single_release, |
1167 | return single_open(file, acpi_battery_read_##_name, PDE_DATA(inode)); \ | ||
1168 | } | ||
1169 | |||
1170 | DECLARE_FILE_FUNCTIONS(info); | ||
1171 | DECLARE_FILE_FUNCTIONS(state); | ||
1172 | DECLARE_FILE_FUNCTIONS(alarm); | ||
1173 | |||
1174 | #undef DECLARE_FILE_FUNCTIONS | ||
1175 | |||
1176 | #define FILE_DESCRIPTION_RO(_name) \ | ||
1177 | { \ | ||
1178 | .name = __stringify(_name), \ | ||
1179 | .mode = S_IRUGO, \ | ||
1180 | .ops = { \ | ||
1181 | .open = acpi_battery_##_name##_open_fs, \ | ||
1182 | .read = seq_read, \ | ||
1183 | .llseek = seq_lseek, \ | ||
1184 | .release = single_release, \ | ||
1185 | .owner = THIS_MODULE, \ | ||
1186 | }, \ | ||
1187 | } | ||
1188 | |||
1189 | #define FILE_DESCRIPTION_RW(_name) \ | ||
1190 | { \ | ||
1191 | .name = __stringify(_name), \ | ||
1192 | .mode = S_IFREG | S_IRUGO | S_IWUSR, \ | ||
1193 | .ops = { \ | ||
1194 | .open = acpi_battery_##_name##_open_fs, \ | ||
1195 | .read = seq_read, \ | ||
1196 | .llseek = seq_lseek, \ | ||
1197 | .write = acpi_battery_write_##_name, \ | ||
1198 | .release = single_release, \ | ||
1199 | .owner = THIS_MODULE, \ | ||
1200 | }, \ | ||
1201 | } | ||
1202 | |||
1203 | static const struct battery_file { | ||
1204 | struct file_operations ops; | ||
1205 | umode_t mode; | ||
1206 | const char *name; | ||
1207 | } acpi_battery_file[] = { | ||
1208 | FILE_DESCRIPTION_RO(info), | ||
1209 | FILE_DESCRIPTION_RO(state), | ||
1210 | FILE_DESCRIPTION_RW(alarm), | ||
1211 | }; | 1152 | }; |
1212 | 1153 | ||
1213 | #undef FILE_DESCRIPTION_RO | ||
1214 | #undef FILE_DESCRIPTION_RW | ||
1215 | |||
1216 | static int acpi_battery_add_fs(struct acpi_device *device) | 1154 | static int acpi_battery_add_fs(struct acpi_device *device) |
1217 | { | 1155 | { |
1218 | struct proc_dir_entry *entry = NULL; | ||
1219 | int i; | ||
1220 | |||
1221 | printk(KERN_WARNING PREFIX "Deprecated procfs I/F for battery is loaded," | 1156 | printk(KERN_WARNING PREFIX "Deprecated procfs I/F for battery is loaded," |
1222 | " please retry with CONFIG_ACPI_PROCFS_POWER cleared\n"); | 1157 | " please retry with CONFIG_ACPI_PROCFS_POWER cleared\n"); |
1223 | if (!acpi_device_dir(device)) { | 1158 | if (!acpi_device_dir(device)) { |
@@ -1227,28 +1162,24 @@ static int acpi_battery_add_fs(struct acpi_device *device) | |||
1227 | return -ENODEV; | 1162 | return -ENODEV; |
1228 | } | 1163 | } |
1229 | 1164 | ||
1230 | for (i = 0; i < ACPI_BATTERY_NUMFILES; ++i) { | 1165 | if (!proc_create_single_data("info", S_IRUGO, acpi_device_dir(device), |
1231 | entry = proc_create_data(acpi_battery_file[i].name, | 1166 | acpi_battery_info_proc_show, acpi_driver_data(device))) |
1232 | acpi_battery_file[i].mode, | 1167 | return -ENODEV; |
1233 | acpi_device_dir(device), | 1168 | if (!proc_create_single_data("state", S_IRUGO, acpi_device_dir(device), |
1234 | &acpi_battery_file[i].ops, | 1169 | acpi_battery_state_proc_show, acpi_driver_data(device))) |
1235 | acpi_driver_data(device)); | 1170 | return -ENODEV; |
1236 | if (!entry) | 1171 | if (!proc_create_data("alarm", S_IFREG | S_IRUGO | S_IWUSR, |
1237 | return -ENODEV; | 1172 | acpi_device_dir(device), &acpi_battery_alarm_fops, |
1238 | } | 1173 | acpi_driver_data(device))) |
1174 | return -ENODEV; | ||
1239 | return 0; | 1175 | return 0; |
1240 | } | 1176 | } |
1241 | 1177 | ||
1242 | static void acpi_battery_remove_fs(struct acpi_device *device) | 1178 | static void acpi_battery_remove_fs(struct acpi_device *device) |
1243 | { | 1179 | { |
1244 | int i; | ||
1245 | if (!acpi_device_dir(device)) | 1180 | if (!acpi_device_dir(device)) |
1246 | return; | 1181 | return; |
1247 | for (i = 0; i < ACPI_BATTERY_NUMFILES; ++i) | 1182 | remove_proc_subtree(acpi_device_bid(device), acpi_battery_dir); |
1248 | remove_proc_entry(acpi_battery_file[i].name, | ||
1249 | acpi_device_dir(device)); | ||
1250 | |||
1251 | remove_proc_entry(acpi_device_bid(device), acpi_battery_dir); | ||
1252 | acpi_device_dir(device) = NULL; | 1183 | acpi_device_dir(device) = NULL; |
1253 | } | 1184 | } |
1254 | 1185 | ||
diff --git a/drivers/acpi/button.c b/drivers/acpi/button.c index f1cc4f9d31cd..2345a5ee2dbb 100644 --- a/drivers/acpi/button.c +++ b/drivers/acpi/button.c | |||
@@ -263,19 +263,6 @@ static int acpi_button_state_seq_show(struct seq_file *seq, void *offset) | |||
263 | return 0; | 263 | return 0; |
264 | } | 264 | } |
265 | 265 | ||
266 | static int acpi_button_state_open_fs(struct inode *inode, struct file *file) | ||
267 | { | ||
268 | return single_open(file, acpi_button_state_seq_show, PDE_DATA(inode)); | ||
269 | } | ||
270 | |||
271 | static const struct file_operations acpi_button_state_fops = { | ||
272 | .owner = THIS_MODULE, | ||
273 | .open = acpi_button_state_open_fs, | ||
274 | .read = seq_read, | ||
275 | .llseek = seq_lseek, | ||
276 | .release = single_release, | ||
277 | }; | ||
278 | |||
279 | static int acpi_button_add_fs(struct acpi_device *device) | 266 | static int acpi_button_add_fs(struct acpi_device *device) |
280 | { | 267 | { |
281 | struct acpi_button *button = acpi_driver_data(device); | 268 | struct acpi_button *button = acpi_driver_data(device); |
@@ -311,9 +298,9 @@ static int acpi_button_add_fs(struct acpi_device *device) | |||
311 | } | 298 | } |
312 | 299 | ||
313 | /* create /proc/acpi/button/lid/LID/state */ | 300 | /* create /proc/acpi/button/lid/LID/state */ |
314 | entry = proc_create_data(ACPI_BUTTON_FILE_STATE, | 301 | entry = proc_create_single_data(ACPI_BUTTON_FILE_STATE, S_IRUGO, |
315 | S_IRUGO, acpi_device_dir(device), | 302 | acpi_device_dir(device), acpi_button_state_seq_show, |
316 | &acpi_button_state_fops, device); | 303 | device); |
317 | if (!entry) { | 304 | if (!entry) { |
318 | ret = -ENODEV; | 305 | ret = -ENODEV; |
319 | goto remove_dev_dir; | 306 | goto remove_dev_dir; |
diff --git a/drivers/block/DAC960.c b/drivers/block/DAC960.c index 7c3887a7e534..6ca77d6047d6 100644 --- a/drivers/block/DAC960.c +++ b/drivers/block/DAC960.c | |||
@@ -6446,19 +6446,6 @@ static int dac960_proc_show(struct seq_file *m, void *v) | |||
6446 | return 0; | 6446 | return 0; |
6447 | } | 6447 | } |
6448 | 6448 | ||
6449 | static int dac960_proc_open(struct inode *inode, struct file *file) | ||
6450 | { | ||
6451 | return single_open(file, dac960_proc_show, NULL); | ||
6452 | } | ||
6453 | |||
6454 | static const struct file_operations dac960_proc_fops = { | ||
6455 | .owner = THIS_MODULE, | ||
6456 | .open = dac960_proc_open, | ||
6457 | .read = seq_read, | ||
6458 | .llseek = seq_lseek, | ||
6459 | .release = single_release, | ||
6460 | }; | ||
6461 | |||
6462 | static int dac960_initial_status_proc_show(struct seq_file *m, void *v) | 6449 | static int dac960_initial_status_proc_show(struct seq_file *m, void *v) |
6463 | { | 6450 | { |
6464 | DAC960_Controller_T *Controller = (DAC960_Controller_T *)m->private; | 6451 | DAC960_Controller_T *Controller = (DAC960_Controller_T *)m->private; |
@@ -6466,19 +6453,6 @@ static int dac960_initial_status_proc_show(struct seq_file *m, void *v) | |||
6466 | return 0; | 6453 | return 0; |
6467 | } | 6454 | } |
6468 | 6455 | ||
6469 | static int dac960_initial_status_proc_open(struct inode *inode, struct file *file) | ||
6470 | { | ||
6471 | return single_open(file, dac960_initial_status_proc_show, PDE_DATA(inode)); | ||
6472 | } | ||
6473 | |||
6474 | static const struct file_operations dac960_initial_status_proc_fops = { | ||
6475 | .owner = THIS_MODULE, | ||
6476 | .open = dac960_initial_status_proc_open, | ||
6477 | .read = seq_read, | ||
6478 | .llseek = seq_lseek, | ||
6479 | .release = single_release, | ||
6480 | }; | ||
6481 | |||
6482 | static int dac960_current_status_proc_show(struct seq_file *m, void *v) | 6456 | static int dac960_current_status_proc_show(struct seq_file *m, void *v) |
6483 | { | 6457 | { |
6484 | DAC960_Controller_T *Controller = (DAC960_Controller_T *) m->private; | 6458 | DAC960_Controller_T *Controller = (DAC960_Controller_T *) m->private; |
@@ -6512,19 +6486,6 @@ static int dac960_current_status_proc_show(struct seq_file *m, void *v) | |||
6512 | return 0; | 6486 | return 0; |
6513 | } | 6487 | } |
6514 | 6488 | ||
6515 | static int dac960_current_status_proc_open(struct inode *inode, struct file *file) | ||
6516 | { | ||
6517 | return single_open(file, dac960_current_status_proc_show, PDE_DATA(inode)); | ||
6518 | } | ||
6519 | |||
6520 | static const struct file_operations dac960_current_status_proc_fops = { | ||
6521 | .owner = THIS_MODULE, | ||
6522 | .open = dac960_current_status_proc_open, | ||
6523 | .read = seq_read, | ||
6524 | .llseek = seq_lseek, | ||
6525 | .release = single_release, | ||
6526 | }; | ||
6527 | |||
6528 | static int dac960_user_command_proc_show(struct seq_file *m, void *v) | 6489 | static int dac960_user_command_proc_show(struct seq_file *m, void *v) |
6529 | { | 6490 | { |
6530 | DAC960_Controller_T *Controller = (DAC960_Controller_T *)m->private; | 6491 | DAC960_Controller_T *Controller = (DAC960_Controller_T *)m->private; |
@@ -6579,16 +6540,18 @@ static void DAC960_CreateProcEntries(DAC960_Controller_T *Controller) | |||
6579 | 6540 | ||
6580 | if (DAC960_ProcDirectoryEntry == NULL) { | 6541 | if (DAC960_ProcDirectoryEntry == NULL) { |
6581 | DAC960_ProcDirectoryEntry = proc_mkdir("rd", NULL); | 6542 | DAC960_ProcDirectoryEntry = proc_mkdir("rd", NULL); |
6582 | proc_create("status", 0, DAC960_ProcDirectoryEntry, | 6543 | proc_create_single("status", 0, DAC960_ProcDirectoryEntry, |
6583 | &dac960_proc_fops); | 6544 | dac960_proc_show); |
6584 | } | 6545 | } |
6585 | 6546 | ||
6586 | snprintf(Controller->ControllerName, sizeof(Controller->ControllerName), | 6547 | snprintf(Controller->ControllerName, sizeof(Controller->ControllerName), |
6587 | "c%d", Controller->ControllerNumber); | 6548 | "c%d", Controller->ControllerNumber); |
6588 | ControllerProcEntry = proc_mkdir(Controller->ControllerName, | 6549 | ControllerProcEntry = proc_mkdir(Controller->ControllerName, |
6589 | DAC960_ProcDirectoryEntry); | 6550 | DAC960_ProcDirectoryEntry); |
6590 | proc_create_data("initial_status", 0, ControllerProcEntry, &dac960_initial_status_proc_fops, Controller); | 6551 | proc_create_single_data("initial_status", 0, ControllerProcEntry, |
6591 | proc_create_data("current_status", 0, ControllerProcEntry, &dac960_current_status_proc_fops, Controller); | 6552 | dac960_initial_status_proc_show, Controller); |
6553 | proc_create_single_data("current_status", 0, ControllerProcEntry, | ||
6554 | dac960_current_status_proc_show, Controller); | ||
6592 | proc_create_data("user_command", 0600, ControllerProcEntry, &dac960_user_command_proc_fops, Controller); | 6555 | proc_create_data("user_command", 0600, ControllerProcEntry, &dac960_user_command_proc_fops, Controller); |
6593 | Controller->ControllerProcEntry = ControllerProcEntry; | 6556 | Controller->ControllerProcEntry = ControllerProcEntry; |
6594 | } | 6557 | } |
diff --git a/drivers/block/drbd/drbd_int.h b/drivers/block/drbd/drbd_int.h index 21b4186add6f..bc4ed2ed40a2 100644 --- a/drivers/block/drbd/drbd_int.h +++ b/drivers/block/drbd/drbd_int.h | |||
@@ -1643,7 +1643,7 @@ void drbd_bump_write_ordering(struct drbd_resource *resource, struct drbd_backin | |||
1643 | 1643 | ||
1644 | /* drbd_proc.c */ | 1644 | /* drbd_proc.c */ |
1645 | extern struct proc_dir_entry *drbd_proc; | 1645 | extern struct proc_dir_entry *drbd_proc; |
1646 | extern const struct file_operations drbd_proc_fops; | 1646 | int drbd_seq_show(struct seq_file *seq, void *v); |
1647 | 1647 | ||
1648 | /* drbd_actlog.c */ | 1648 | /* drbd_actlog.c */ |
1649 | extern bool drbd_al_begin_io_prepare(struct drbd_device *device, struct drbd_interval *i); | 1649 | extern bool drbd_al_begin_io_prepare(struct drbd_device *device, struct drbd_interval *i); |
diff --git a/drivers/block/drbd/drbd_main.c b/drivers/block/drbd/drbd_main.c index a233e71e58ff..7655d6133139 100644 --- a/drivers/block/drbd/drbd_main.c +++ b/drivers/block/drbd/drbd_main.c | |||
@@ -2989,7 +2989,7 @@ static int __init drbd_init(void) | |||
2989 | goto fail; | 2989 | goto fail; |
2990 | 2990 | ||
2991 | err = -ENOMEM; | 2991 | err = -ENOMEM; |
2992 | drbd_proc = proc_create_data("drbd", S_IFREG | 0444 , NULL, &drbd_proc_fops, NULL); | 2992 | drbd_proc = proc_create_single("drbd", S_IFREG | 0444 , NULL, drbd_seq_show); |
2993 | if (!drbd_proc) { | 2993 | if (!drbd_proc) { |
2994 | pr_err("unable to register proc file\n"); | 2994 | pr_err("unable to register proc file\n"); |
2995 | goto fail; | 2995 | goto fail; |
diff --git a/drivers/block/drbd/drbd_proc.c b/drivers/block/drbd/drbd_proc.c index 582caeb0de86..74ef29247bb5 100644 --- a/drivers/block/drbd/drbd_proc.c +++ b/drivers/block/drbd/drbd_proc.c | |||
@@ -33,18 +33,7 @@ | |||
33 | #include <linux/drbd.h> | 33 | #include <linux/drbd.h> |
34 | #include "drbd_int.h" | 34 | #include "drbd_int.h" |
35 | 35 | ||
36 | static int drbd_proc_open(struct inode *inode, struct file *file); | ||
37 | static int drbd_proc_release(struct inode *inode, struct file *file); | ||
38 | |||
39 | |||
40 | struct proc_dir_entry *drbd_proc; | 36 | struct proc_dir_entry *drbd_proc; |
41 | const struct file_operations drbd_proc_fops = { | ||
42 | .owner = THIS_MODULE, | ||
43 | .open = drbd_proc_open, | ||
44 | .read = seq_read, | ||
45 | .llseek = seq_lseek, | ||
46 | .release = drbd_proc_release, | ||
47 | }; | ||
48 | 37 | ||
49 | static void seq_printf_with_thousands_grouping(struct seq_file *seq, long v) | 38 | static void seq_printf_with_thousands_grouping(struct seq_file *seq, long v) |
50 | { | 39 | { |
@@ -235,7 +224,7 @@ static void drbd_syncer_progress(struct drbd_device *device, struct seq_file *se | |||
235 | } | 224 | } |
236 | } | 225 | } |
237 | 226 | ||
238 | static int drbd_seq_show(struct seq_file *seq, void *v) | 227 | int drbd_seq_show(struct seq_file *seq, void *v) |
239 | { | 228 | { |
240 | int i, prev_i = -1; | 229 | int i, prev_i = -1; |
241 | const char *sn; | 230 | const char *sn; |
@@ -345,24 +334,3 @@ static int drbd_seq_show(struct seq_file *seq, void *v) | |||
345 | 334 | ||
346 | return 0; | 335 | return 0; |
347 | } | 336 | } |
348 | |||
349 | static int drbd_proc_open(struct inode *inode, struct file *file) | ||
350 | { | ||
351 | int err; | ||
352 | |||
353 | if (try_module_get(THIS_MODULE)) { | ||
354 | err = single_open(file, drbd_seq_show, NULL); | ||
355 | if (err) | ||
356 | module_put(THIS_MODULE); | ||
357 | return err; | ||
358 | } | ||
359 | return -ENODEV; | ||
360 | } | ||
361 | |||
362 | static int drbd_proc_release(struct inode *inode, struct file *file) | ||
363 | { | ||
364 | module_put(THIS_MODULE); | ||
365 | return single_release(inode, file); | ||
366 | } | ||
367 | |||
368 | /* PROC FS stuff end */ | ||
diff --git a/drivers/block/pktcdvd.c b/drivers/block/pktcdvd.c index 1a2c0101cfcb..b3f83cd96f33 100644 --- a/drivers/block/pktcdvd.c +++ b/drivers/block/pktcdvd.c | |||
@@ -2538,18 +2538,6 @@ static int pkt_seq_show(struct seq_file *m, void *p) | |||
2538 | return 0; | 2538 | return 0; |
2539 | } | 2539 | } |
2540 | 2540 | ||
2541 | static int pkt_seq_open(struct inode *inode, struct file *file) | ||
2542 | { | ||
2543 | return single_open(file, pkt_seq_show, PDE_DATA(inode)); | ||
2544 | } | ||
2545 | |||
2546 | static const struct file_operations pkt_proc_fops = { | ||
2547 | .open = pkt_seq_open, | ||
2548 | .read = seq_read, | ||
2549 | .llseek = seq_lseek, | ||
2550 | .release = single_release | ||
2551 | }; | ||
2552 | |||
2553 | static int pkt_new_dev(struct pktcdvd_device *pd, dev_t dev) | 2541 | static int pkt_new_dev(struct pktcdvd_device *pd, dev_t dev) |
2554 | { | 2542 | { |
2555 | int i; | 2543 | int i; |
@@ -2604,7 +2592,7 @@ static int pkt_new_dev(struct pktcdvd_device *pd, dev_t dev) | |||
2604 | goto out_mem; | 2592 | goto out_mem; |
2605 | } | 2593 | } |
2606 | 2594 | ||
2607 | proc_create_data(pd->name, 0, pkt_proc, &pkt_proc_fops, pd); | 2595 | proc_create_single_data(pd->name, 0, pkt_proc, pkt_seq_show, pd); |
2608 | pkt_dbg(1, pd, "writer mapped to %s\n", bdevname(bdev, b)); | 2596 | pkt_dbg(1, pd, "writer mapped to %s\n", bdevname(bdev, b)); |
2609 | return 0; | 2597 | return 0; |
2610 | 2598 | ||
diff --git a/drivers/block/ps3vram.c b/drivers/block/ps3vram.c index 6a55959cbf78..8fa4533a1249 100644 --- a/drivers/block/ps3vram.c +++ b/drivers/block/ps3vram.c | |||
@@ -521,26 +521,13 @@ static int ps3vram_proc_show(struct seq_file *m, void *v) | |||
521 | return 0; | 521 | return 0; |
522 | } | 522 | } |
523 | 523 | ||
524 | static int ps3vram_proc_open(struct inode *inode, struct file *file) | ||
525 | { | ||
526 | return single_open(file, ps3vram_proc_show, PDE_DATA(inode)); | ||
527 | } | ||
528 | |||
529 | static const struct file_operations ps3vram_proc_fops = { | ||
530 | .owner = THIS_MODULE, | ||
531 | .open = ps3vram_proc_open, | ||
532 | .read = seq_read, | ||
533 | .llseek = seq_lseek, | ||
534 | .release = single_release, | ||
535 | }; | ||
536 | |||
537 | static void ps3vram_proc_init(struct ps3_system_bus_device *dev) | 524 | static void ps3vram_proc_init(struct ps3_system_bus_device *dev) |
538 | { | 525 | { |
539 | struct ps3vram_priv *priv = ps3_system_bus_get_drvdata(dev); | 526 | struct ps3vram_priv *priv = ps3_system_bus_get_drvdata(dev); |
540 | struct proc_dir_entry *pde; | 527 | struct proc_dir_entry *pde; |
541 | 528 | ||
542 | pde = proc_create_data(DEVICE_NAME, 0444, NULL, &ps3vram_proc_fops, | 529 | pde = proc_create_single_data(DEVICE_NAME, 0444, NULL, |
543 | priv); | 530 | ps3vram_proc_show, priv); |
544 | if (!pde) | 531 | if (!pde) |
545 | dev_warn(&dev->core, "failed to create /proc entry\n"); | 532 | dev_warn(&dev->core, "failed to create /proc entry\n"); |
546 | } | 533 | } |
diff --git a/drivers/char/apm-emulation.c b/drivers/char/apm-emulation.c index a5e2f9e557ea..53436c03dbce 100644 --- a/drivers/char/apm-emulation.c +++ b/drivers/char/apm-emulation.c | |||
@@ -461,19 +461,6 @@ static int proc_apm_show(struct seq_file *m, void *v) | |||
461 | 461 | ||
462 | return 0; | 462 | return 0; |
463 | } | 463 | } |
464 | |||
465 | static int proc_apm_open(struct inode *inode, struct file *file) | ||
466 | { | ||
467 | return single_open(file, proc_apm_show, NULL); | ||
468 | } | ||
469 | |||
470 | static const struct file_operations apm_proc_fops = { | ||
471 | .owner = THIS_MODULE, | ||
472 | .open = proc_apm_open, | ||
473 | .read = seq_read, | ||
474 | .llseek = seq_lseek, | ||
475 | .release = single_release, | ||
476 | }; | ||
477 | #endif | 464 | #endif |
478 | 465 | ||
479 | static int kapmd(void *arg) | 466 | static int kapmd(void *arg) |
@@ -657,7 +644,7 @@ static int __init apm_init(void) | |||
657 | wake_up_process(kapmd_tsk); | 644 | wake_up_process(kapmd_tsk); |
658 | 645 | ||
659 | #ifdef CONFIG_PROC_FS | 646 | #ifdef CONFIG_PROC_FS |
660 | proc_create("apm", 0, NULL, &apm_proc_fops); | 647 | proc_create_single("apm", 0, NULL, proc_apm_show); |
661 | #endif | 648 | #endif |
662 | 649 | ||
663 | ret = misc_register(&apm_device); | 650 | ret = misc_register(&apm_device); |
diff --git a/drivers/char/ds1620.c b/drivers/char/ds1620.c index eb53cbadb68f..a5ecf6dae02e 100644 --- a/drivers/char/ds1620.c +++ b/drivers/char/ds1620.c | |||
@@ -345,18 +345,6 @@ static int ds1620_proc_therm_show(struct seq_file *m, void *v) | |||
345 | fan_state[netwinder_get_fan()]); | 345 | fan_state[netwinder_get_fan()]); |
346 | return 0; | 346 | return 0; |
347 | } | 347 | } |
348 | |||
349 | static int ds1620_proc_therm_open(struct inode *inode, struct file *file) | ||
350 | { | ||
351 | return single_open(file, ds1620_proc_therm_show, NULL); | ||
352 | } | ||
353 | |||
354 | static const struct file_operations ds1620_proc_therm_fops = { | ||
355 | .open = ds1620_proc_therm_open, | ||
356 | .read = seq_read, | ||
357 | .llseek = seq_lseek, | ||
358 | .release = single_release, | ||
359 | }; | ||
360 | #endif | 348 | #endif |
361 | 349 | ||
362 | static const struct file_operations ds1620_fops = { | 350 | static const struct file_operations ds1620_fops = { |
@@ -404,7 +392,7 @@ static int __init ds1620_init(void) | |||
404 | return ret; | 392 | return ret; |
405 | 393 | ||
406 | #ifdef THERM_USE_PROC | 394 | #ifdef THERM_USE_PROC |
407 | if (!proc_create("therm", 0, NULL, &ds1620_proc_therm_fops)) | 395 | if (!proc_create_single("therm", 0, NULL, ds1620_proc_therm_show)) |
408 | printk(KERN_ERR "therm: unable to register /proc/therm\n"); | 396 | printk(KERN_ERR "therm: unable to register /proc/therm\n"); |
409 | #endif | 397 | #endif |
410 | 398 | ||
diff --git a/drivers/char/efirtc.c b/drivers/char/efirtc.c index dc62568b7dde..d9aab643997e 100644 --- a/drivers/char/efirtc.c +++ b/drivers/char/efirtc.c | |||
@@ -358,19 +358,6 @@ static int efi_rtc_proc_show(struct seq_file *m, void *v) | |||
358 | 358 | ||
359 | return 0; | 359 | return 0; |
360 | } | 360 | } |
361 | |||
362 | static int efi_rtc_proc_open(struct inode *inode, struct file *file) | ||
363 | { | ||
364 | return single_open(file, efi_rtc_proc_show, NULL); | ||
365 | } | ||
366 | |||
367 | static const struct file_operations efi_rtc_proc_fops = { | ||
368 | .open = efi_rtc_proc_open, | ||
369 | .read = seq_read, | ||
370 | .llseek = seq_lseek, | ||
371 | .release = single_release, | ||
372 | }; | ||
373 | |||
374 | static int __init | 361 | static int __init |
375 | efi_rtc_init(void) | 362 | efi_rtc_init(void) |
376 | { | 363 | { |
@@ -386,7 +373,7 @@ efi_rtc_init(void) | |||
386 | return ret; | 373 | return ret; |
387 | } | 374 | } |
388 | 375 | ||
389 | dir = proc_create("driver/efirtc", 0, NULL, &efi_rtc_proc_fops); | 376 | dir = proc_create_single("driver/efirtc", 0, NULL, efi_rtc_proc_show); |
390 | if (dir == NULL) { | 377 | if (dir == NULL) { |
391 | printk(KERN_ERR "efirtc: can't create /proc/driver/efirtc.\n"); | 378 | printk(KERN_ERR "efirtc: can't create /proc/driver/efirtc.\n"); |
392 | misc_deregister(&efi_rtc_dev); | 379 | misc_deregister(&efi_rtc_dev); |
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/char/nvram.c b/drivers/char/nvram.c index 678fa97e41fb..25264d65e716 100644 --- a/drivers/char/nvram.c +++ b/drivers/char/nvram.c | |||
@@ -389,22 +389,9 @@ static int nvram_proc_read(struct seq_file *seq, void *offset) | |||
389 | return 0; | 389 | return 0; |
390 | } | 390 | } |
391 | 391 | ||
392 | static int nvram_proc_open(struct inode *inode, struct file *file) | ||
393 | { | ||
394 | return single_open(file, nvram_proc_read, NULL); | ||
395 | } | ||
396 | |||
397 | static const struct file_operations nvram_proc_fops = { | ||
398 | .owner = THIS_MODULE, | ||
399 | .open = nvram_proc_open, | ||
400 | .read = seq_read, | ||
401 | .llseek = seq_lseek, | ||
402 | .release = single_release, | ||
403 | }; | ||
404 | |||
405 | static int nvram_add_proc_fs(void) | 392 | static int nvram_add_proc_fs(void) |
406 | { | 393 | { |
407 | if (!proc_create("driver/nvram", 0, NULL, &nvram_proc_fops)) | 394 | if (!proc_create_single("driver/nvram", 0, NULL, nvram_proc_read)) |
408 | return -ENOMEM; | 395 | return -ENOMEM; |
409 | return 0; | 396 | return 0; |
410 | } | 397 | } |
diff --git a/drivers/char/pcmcia/synclink_cs.c b/drivers/char/pcmcia/synclink_cs.c index aa502e9fb7fa..66b04194aa9f 100644 --- a/drivers/char/pcmcia/synclink_cs.c +++ b/drivers/char/pcmcia/synclink_cs.c | |||
@@ -2616,19 +2616,6 @@ static int mgslpc_proc_show(struct seq_file *m, void *v) | |||
2616 | return 0; | 2616 | return 0; |
2617 | } | 2617 | } |
2618 | 2618 | ||
2619 | static int mgslpc_proc_open(struct inode *inode, struct file *file) | ||
2620 | { | ||
2621 | return single_open(file, mgslpc_proc_show, NULL); | ||
2622 | } | ||
2623 | |||
2624 | static const struct file_operations mgslpc_proc_fops = { | ||
2625 | .owner = THIS_MODULE, | ||
2626 | .open = mgslpc_proc_open, | ||
2627 | .read = seq_read, | ||
2628 | .llseek = seq_lseek, | ||
2629 | .release = single_release, | ||
2630 | }; | ||
2631 | |||
2632 | static int rx_alloc_buffers(MGSLPC_INFO *info) | 2619 | static int rx_alloc_buffers(MGSLPC_INFO *info) |
2633 | { | 2620 | { |
2634 | /* each buffer has header and data */ | 2621 | /* each buffer has header and data */ |
@@ -2815,7 +2802,7 @@ static const struct tty_operations mgslpc_ops = { | |||
2815 | .tiocmget = tiocmget, | 2802 | .tiocmget = tiocmget, |
2816 | .tiocmset = tiocmset, | 2803 | .tiocmset = tiocmset, |
2817 | .get_icount = mgslpc_get_icount, | 2804 | .get_icount = mgslpc_get_icount, |
2818 | .proc_fops = &mgslpc_proc_fops, | 2805 | .proc_show = mgslpc_proc_show, |
2819 | }; | 2806 | }; |
2820 | 2807 | ||
2821 | static int __init synclink_cs_init(void) | 2808 | static int __init synclink_cs_init(void) |
diff --git a/drivers/char/rtc.c b/drivers/char/rtc.c index 57dc546628b5..94fedeeec035 100644 --- a/drivers/char/rtc.c +++ b/drivers/char/rtc.c | |||
@@ -171,7 +171,7 @@ static void mask_rtc_irq_bit(unsigned char bit) | |||
171 | #endif | 171 | #endif |
172 | 172 | ||
173 | #ifdef CONFIG_PROC_FS | 173 | #ifdef CONFIG_PROC_FS |
174 | static int rtc_proc_open(struct inode *inode, struct file *file); | 174 | static int rtc_proc_show(struct seq_file *seq, void *v); |
175 | #endif | 175 | #endif |
176 | 176 | ||
177 | /* | 177 | /* |
@@ -832,16 +832,6 @@ static struct miscdevice rtc_dev = { | |||
832 | .fops = &rtc_fops, | 832 | .fops = &rtc_fops, |
833 | }; | 833 | }; |
834 | 834 | ||
835 | #ifdef CONFIG_PROC_FS | ||
836 | static const struct file_operations rtc_proc_fops = { | ||
837 | .owner = THIS_MODULE, | ||
838 | .open = rtc_proc_open, | ||
839 | .read = seq_read, | ||
840 | .llseek = seq_lseek, | ||
841 | .release = single_release, | ||
842 | }; | ||
843 | #endif | ||
844 | |||
845 | static resource_size_t rtc_size; | 835 | static resource_size_t rtc_size; |
846 | 836 | ||
847 | static struct resource * __init rtc_request_region(resource_size_t size) | 837 | static struct resource * __init rtc_request_region(resource_size_t size) |
@@ -982,7 +972,7 @@ no_irq: | |||
982 | } | 972 | } |
983 | 973 | ||
984 | #ifdef CONFIG_PROC_FS | 974 | #ifdef CONFIG_PROC_FS |
985 | ent = proc_create("driver/rtc", 0, NULL, &rtc_proc_fops); | 975 | ent = proc_create_single("driver/rtc", 0, NULL, rtc_proc_show); |
986 | if (!ent) | 976 | if (!ent) |
987 | printk(KERN_WARNING "rtc: Failed to register with procfs.\n"); | 977 | printk(KERN_WARNING "rtc: Failed to register with procfs.\n"); |
988 | #endif | 978 | #endif |
@@ -1201,11 +1191,6 @@ static int rtc_proc_show(struct seq_file *seq, void *v) | |||
1201 | #undef YN | 1191 | #undef YN |
1202 | #undef NY | 1192 | #undef NY |
1203 | } | 1193 | } |
1204 | |||
1205 | static int rtc_proc_open(struct inode *inode, struct file *file) | ||
1206 | { | ||
1207 | return single_open(file, rtc_proc_show, NULL); | ||
1208 | } | ||
1209 | #endif | 1194 | #endif |
1210 | 1195 | ||
1211 | static void rtc_get_rtc_time(struct rtc_time *rtc_tm) | 1196 | static void rtc_get_rtc_time(struct rtc_time *rtc_tm) |
diff --git a/drivers/char/toshiba.c b/drivers/char/toshiba.c index 5488516da8ea..802376fe851a 100644 --- a/drivers/char/toshiba.c +++ b/drivers/char/toshiba.c | |||
@@ -326,19 +326,6 @@ static int proc_toshiba_show(struct seq_file *m, void *v) | |||
326 | key); | 326 | key); |
327 | return 0; | 327 | return 0; |
328 | } | 328 | } |
329 | |||
330 | static int proc_toshiba_open(struct inode *inode, struct file *file) | ||
331 | { | ||
332 | return single_open(file, proc_toshiba_show, NULL); | ||
333 | } | ||
334 | |||
335 | static const struct file_operations proc_toshiba_fops = { | ||
336 | .owner = THIS_MODULE, | ||
337 | .open = proc_toshiba_open, | ||
338 | .read = seq_read, | ||
339 | .llseek = seq_lseek, | ||
340 | .release = single_release, | ||
341 | }; | ||
342 | #endif | 329 | #endif |
343 | 330 | ||
344 | 331 | ||
@@ -524,7 +511,7 @@ static int __init toshiba_init(void) | |||
524 | { | 511 | { |
525 | struct proc_dir_entry *pde; | 512 | struct proc_dir_entry *pde; |
526 | 513 | ||
527 | pde = proc_create("toshiba", 0, NULL, &proc_toshiba_fops); | 514 | pde = proc_create_single("toshiba", 0, NULL, proc_toshiba_show); |
528 | if (!pde) { | 515 | if (!pde) { |
529 | misc_deregister(&tosh_device); | 516 | misc_deregister(&tosh_device); |
530 | return -ENOMEM; | 517 | return -ENOMEM; |
diff --git a/drivers/connector/connector.c b/drivers/connector/connector.c index 8615594bd065..e718b8c69a56 100644 --- a/drivers/connector/connector.c +++ b/drivers/connector/connector.c | |||
@@ -260,19 +260,6 @@ static int cn_proc_show(struct seq_file *m, void *v) | |||
260 | return 0; | 260 | return 0; |
261 | } | 261 | } |
262 | 262 | ||
263 | static int cn_proc_open(struct inode *inode, struct file *file) | ||
264 | { | ||
265 | return single_open(file, cn_proc_show, NULL); | ||
266 | } | ||
267 | |||
268 | static const struct file_operations cn_file_ops = { | ||
269 | .owner = THIS_MODULE, | ||
270 | .open = cn_proc_open, | ||
271 | .read = seq_read, | ||
272 | .llseek = seq_lseek, | ||
273 | .release = single_release | ||
274 | }; | ||
275 | |||
276 | static struct cn_dev cdev = { | 263 | static struct cn_dev cdev = { |
277 | .input = cn_rx_skb, | 264 | .input = cn_rx_skb, |
278 | }; | 265 | }; |
@@ -297,7 +284,7 @@ static int cn_init(void) | |||
297 | 284 | ||
298 | cn_already_initialized = 1; | 285 | cn_already_initialized = 1; |
299 | 286 | ||
300 | proc_create("connector", S_IRUGO, init_net.proc_net, &cn_file_ops); | 287 | proc_create_single("connector", S_IRUGO, init_net.proc_net, cn_proc_show); |
301 | 288 | ||
302 | return 0; | 289 | return 0; |
303 | } | 290 | } |
diff --git a/drivers/ide/ide-cd.c b/drivers/ide/ide-cd.c index 32af6f063cb3..5f178384876f 100644 --- a/drivers/ide/ide-cd.c +++ b/drivers/ide/ide-cd.c | |||
@@ -1426,21 +1426,8 @@ static int idecd_capacity_proc_show(struct seq_file *m, void *v) | |||
1426 | return 0; | 1426 | return 0; |
1427 | } | 1427 | } |
1428 | 1428 | ||
1429 | static int idecd_capacity_proc_open(struct inode *inode, struct file *file) | ||
1430 | { | ||
1431 | return single_open(file, idecd_capacity_proc_show, PDE_DATA(inode)); | ||
1432 | } | ||
1433 | |||
1434 | static const struct file_operations idecd_capacity_proc_fops = { | ||
1435 | .owner = THIS_MODULE, | ||
1436 | .open = idecd_capacity_proc_open, | ||
1437 | .read = seq_read, | ||
1438 | .llseek = seq_lseek, | ||
1439 | .release = single_release, | ||
1440 | }; | ||
1441 | |||
1442 | static ide_proc_entry_t idecd_proc[] = { | 1429 | static ide_proc_entry_t idecd_proc[] = { |
1443 | { "capacity", S_IFREG|S_IRUGO, &idecd_capacity_proc_fops }, | 1430 | { "capacity", S_IFREG|S_IRUGO, idecd_capacity_proc_show }, |
1444 | {} | 1431 | {} |
1445 | }; | 1432 | }; |
1446 | 1433 | ||
diff --git a/drivers/ide/ide-disk_proc.c b/drivers/ide/ide-disk_proc.c index 82a36ced4e96..95d239b2f646 100644 --- a/drivers/ide/ide-disk_proc.c +++ b/drivers/ide/ide-disk_proc.c | |||
@@ -52,19 +52,6 @@ static int idedisk_cache_proc_show(struct seq_file *m, void *v) | |||
52 | return 0; | 52 | return 0; |
53 | } | 53 | } |
54 | 54 | ||
55 | static int idedisk_cache_proc_open(struct inode *inode, struct file *file) | ||
56 | { | ||
57 | return single_open(file, idedisk_cache_proc_show, PDE_DATA(inode)); | ||
58 | } | ||
59 | |||
60 | static const struct file_operations idedisk_cache_proc_fops = { | ||
61 | .owner = THIS_MODULE, | ||
62 | .open = idedisk_cache_proc_open, | ||
63 | .read = seq_read, | ||
64 | .llseek = seq_lseek, | ||
65 | .release = single_release, | ||
66 | }; | ||
67 | |||
68 | static int idedisk_capacity_proc_show(struct seq_file *m, void *v) | 55 | static int idedisk_capacity_proc_show(struct seq_file *m, void *v) |
69 | { | 56 | { |
70 | ide_drive_t*drive = (ide_drive_t *)m->private; | 57 | ide_drive_t*drive = (ide_drive_t *)m->private; |
@@ -73,19 +60,6 @@ static int idedisk_capacity_proc_show(struct seq_file *m, void *v) | |||
73 | return 0; | 60 | return 0; |
74 | } | 61 | } |
75 | 62 | ||
76 | static int idedisk_capacity_proc_open(struct inode *inode, struct file *file) | ||
77 | { | ||
78 | return single_open(file, idedisk_capacity_proc_show, PDE_DATA(inode)); | ||
79 | } | ||
80 | |||
81 | static const struct file_operations idedisk_capacity_proc_fops = { | ||
82 | .owner = THIS_MODULE, | ||
83 | .open = idedisk_capacity_proc_open, | ||
84 | .read = seq_read, | ||
85 | .llseek = seq_lseek, | ||
86 | .release = single_release, | ||
87 | }; | ||
88 | |||
89 | static int __idedisk_proc_show(struct seq_file *m, ide_drive_t *drive, u8 sub_cmd) | 63 | static int __idedisk_proc_show(struct seq_file *m, ide_drive_t *drive, u8 sub_cmd) |
90 | { | 64 | { |
91 | u8 *buf; | 65 | u8 *buf; |
@@ -114,43 +88,17 @@ static int idedisk_sv_proc_show(struct seq_file *m, void *v) | |||
114 | return __idedisk_proc_show(m, m->private, ATA_SMART_READ_VALUES); | 88 | return __idedisk_proc_show(m, m->private, ATA_SMART_READ_VALUES); |
115 | } | 89 | } |
116 | 90 | ||
117 | static int idedisk_sv_proc_open(struct inode *inode, struct file *file) | ||
118 | { | ||
119 | return single_open(file, idedisk_sv_proc_show, PDE_DATA(inode)); | ||
120 | } | ||
121 | |||
122 | static const struct file_operations idedisk_sv_proc_fops = { | ||
123 | .owner = THIS_MODULE, | ||
124 | .open = idedisk_sv_proc_open, | ||
125 | .read = seq_read, | ||
126 | .llseek = seq_lseek, | ||
127 | .release = single_release, | ||
128 | }; | ||
129 | |||
130 | static int idedisk_st_proc_show(struct seq_file *m, void *v) | 91 | static int idedisk_st_proc_show(struct seq_file *m, void *v) |
131 | { | 92 | { |
132 | return __idedisk_proc_show(m, m->private, ATA_SMART_READ_THRESHOLDS); | 93 | return __idedisk_proc_show(m, m->private, ATA_SMART_READ_THRESHOLDS); |
133 | } | 94 | } |
134 | 95 | ||
135 | static int idedisk_st_proc_open(struct inode *inode, struct file *file) | ||
136 | { | ||
137 | return single_open(file, idedisk_st_proc_show, PDE_DATA(inode)); | ||
138 | } | ||
139 | |||
140 | static const struct file_operations idedisk_st_proc_fops = { | ||
141 | .owner = THIS_MODULE, | ||
142 | .open = idedisk_st_proc_open, | ||
143 | .read = seq_read, | ||
144 | .llseek = seq_lseek, | ||
145 | .release = single_release, | ||
146 | }; | ||
147 | |||
148 | ide_proc_entry_t ide_disk_proc[] = { | 96 | ide_proc_entry_t ide_disk_proc[] = { |
149 | { "cache", S_IFREG|S_IRUGO, &idedisk_cache_proc_fops }, | 97 | { "cache", S_IFREG|S_IRUGO, idedisk_cache_proc_show }, |
150 | { "capacity", S_IFREG|S_IRUGO, &idedisk_capacity_proc_fops }, | 98 | { "capacity", S_IFREG|S_IRUGO, idedisk_capacity_proc_show }, |
151 | { "geometry", S_IFREG|S_IRUGO, &ide_geometry_proc_fops }, | 99 | { "geometry", S_IFREG|S_IRUGO, ide_geometry_proc_show }, |
152 | { "smart_values", S_IFREG|S_IRUSR, &idedisk_sv_proc_fops }, | 100 | { "smart_values", S_IFREG|S_IRUSR, idedisk_sv_proc_show }, |
153 | { "smart_thresholds", S_IFREG|S_IRUSR, &idedisk_st_proc_fops }, | 101 | { "smart_thresholds", S_IFREG|S_IRUSR, idedisk_st_proc_show }, |
154 | {} | 102 | {} |
155 | }; | 103 | }; |
156 | 104 | ||
diff --git a/drivers/ide/ide-floppy_proc.c b/drivers/ide/ide-floppy_proc.c index 471457ebea67..7f697ddb5fe5 100644 --- a/drivers/ide/ide-floppy_proc.c +++ b/drivers/ide/ide-floppy_proc.c | |||
@@ -14,22 +14,9 @@ static int idefloppy_capacity_proc_show(struct seq_file *m, void *v) | |||
14 | return 0; | 14 | return 0; |
15 | } | 15 | } |
16 | 16 | ||
17 | static int idefloppy_capacity_proc_open(struct inode *inode, struct file *file) | ||
18 | { | ||
19 | return single_open(file, idefloppy_capacity_proc_show, PDE_DATA(inode)); | ||
20 | } | ||
21 | |||
22 | static const struct file_operations idefloppy_capacity_proc_fops = { | ||
23 | .owner = THIS_MODULE, | ||
24 | .open = idefloppy_capacity_proc_open, | ||
25 | .read = seq_read, | ||
26 | .llseek = seq_lseek, | ||
27 | .release = single_release, | ||
28 | }; | ||
29 | |||
30 | ide_proc_entry_t ide_floppy_proc[] = { | 17 | ide_proc_entry_t ide_floppy_proc[] = { |
31 | { "capacity", S_IFREG|S_IRUGO, &idefloppy_capacity_proc_fops }, | 18 | { "capacity", S_IFREG|S_IRUGO, idefloppy_capacity_proc_show }, |
32 | { "geometry", S_IFREG|S_IRUGO, &ide_geometry_proc_fops }, | 19 | { "geometry", S_IFREG|S_IRUGO, ide_geometry_proc_show }, |
33 | {} | 20 | {} |
34 | }; | 21 | }; |
35 | 22 | ||
diff --git a/drivers/ide/ide-proc.c b/drivers/ide/ide-proc.c index 863db44c7916..45c997430332 100644 --- a/drivers/ide/ide-proc.c +++ b/drivers/ide/ide-proc.c | |||
@@ -56,19 +56,6 @@ static int ide_imodel_proc_show(struct seq_file *m, void *v) | |||
56 | return 0; | 56 | return 0; |
57 | } | 57 | } |
58 | 58 | ||
59 | static int ide_imodel_proc_open(struct inode *inode, struct file *file) | ||
60 | { | ||
61 | return single_open(file, ide_imodel_proc_show, PDE_DATA(inode)); | ||
62 | } | ||
63 | |||
64 | static const struct file_operations ide_imodel_proc_fops = { | ||
65 | .owner = THIS_MODULE, | ||
66 | .open = ide_imodel_proc_open, | ||
67 | .read = seq_read, | ||
68 | .llseek = seq_lseek, | ||
69 | .release = single_release, | ||
70 | }; | ||
71 | |||
72 | static int ide_mate_proc_show(struct seq_file *m, void *v) | 59 | static int ide_mate_proc_show(struct seq_file *m, void *v) |
73 | { | 60 | { |
74 | ide_hwif_t *hwif = (ide_hwif_t *) m->private; | 61 | ide_hwif_t *hwif = (ide_hwif_t *) m->private; |
@@ -80,19 +67,6 @@ static int ide_mate_proc_show(struct seq_file *m, void *v) | |||
80 | return 0; | 67 | return 0; |
81 | } | 68 | } |
82 | 69 | ||
83 | static int ide_mate_proc_open(struct inode *inode, struct file *file) | ||
84 | { | ||
85 | return single_open(file, ide_mate_proc_show, PDE_DATA(inode)); | ||
86 | } | ||
87 | |||
88 | static const struct file_operations ide_mate_proc_fops = { | ||
89 | .owner = THIS_MODULE, | ||
90 | .open = ide_mate_proc_open, | ||
91 | .read = seq_read, | ||
92 | .llseek = seq_lseek, | ||
93 | .release = single_release, | ||
94 | }; | ||
95 | |||
96 | static int ide_channel_proc_show(struct seq_file *m, void *v) | 70 | static int ide_channel_proc_show(struct seq_file *m, void *v) |
97 | { | 71 | { |
98 | ide_hwif_t *hwif = (ide_hwif_t *) m->private; | 72 | ide_hwif_t *hwif = (ide_hwif_t *) m->private; |
@@ -101,19 +75,6 @@ static int ide_channel_proc_show(struct seq_file *m, void *v) | |||
101 | return 0; | 75 | return 0; |
102 | } | 76 | } |
103 | 77 | ||
104 | static int ide_channel_proc_open(struct inode *inode, struct file *file) | ||
105 | { | ||
106 | return single_open(file, ide_channel_proc_show, PDE_DATA(inode)); | ||
107 | } | ||
108 | |||
109 | static const struct file_operations ide_channel_proc_fops = { | ||
110 | .owner = THIS_MODULE, | ||
111 | .open = ide_channel_proc_open, | ||
112 | .read = seq_read, | ||
113 | .llseek = seq_lseek, | ||
114 | .release = single_release, | ||
115 | }; | ||
116 | |||
117 | static int ide_identify_proc_show(struct seq_file *m, void *v) | 78 | static int ide_identify_proc_show(struct seq_file *m, void *v) |
118 | { | 79 | { |
119 | ide_drive_t *drive = (ide_drive_t *)m->private; | 80 | ide_drive_t *drive = (ide_drive_t *)m->private; |
@@ -141,19 +102,6 @@ static int ide_identify_proc_show(struct seq_file *m, void *v) | |||
141 | return 0; | 102 | return 0; |
142 | } | 103 | } |
143 | 104 | ||
144 | static int ide_identify_proc_open(struct inode *inode, struct file *file) | ||
145 | { | ||
146 | return single_open(file, ide_identify_proc_show, PDE_DATA(inode)); | ||
147 | } | ||
148 | |||
149 | static const struct file_operations ide_identify_proc_fops = { | ||
150 | .owner = THIS_MODULE, | ||
151 | .open = ide_identify_proc_open, | ||
152 | .read = seq_read, | ||
153 | .llseek = seq_lseek, | ||
154 | .release = single_release, | ||
155 | }; | ||
156 | |||
157 | /** | 105 | /** |
158 | * ide_find_setting - find a specific setting | 106 | * ide_find_setting - find a specific setting |
159 | * @st: setting table pointer | 107 | * @st: setting table pointer |
@@ -441,27 +389,14 @@ static const struct file_operations ide_settings_proc_fops = { | |||
441 | .write = ide_settings_proc_write, | 389 | .write = ide_settings_proc_write, |
442 | }; | 390 | }; |
443 | 391 | ||
444 | static int ide_capacity_proc_show(struct seq_file *m, void *v) | 392 | int ide_capacity_proc_show(struct seq_file *m, void *v) |
445 | { | 393 | { |
446 | seq_printf(m, "%llu\n", (long long)0x7fffffff); | 394 | seq_printf(m, "%llu\n", (long long)0x7fffffff); |
447 | return 0; | 395 | return 0; |
448 | } | 396 | } |
397 | EXPORT_SYMBOL_GPL(ide_capacity_proc_show); | ||
449 | 398 | ||
450 | static int ide_capacity_proc_open(struct inode *inode, struct file *file) | 399 | int ide_geometry_proc_show(struct seq_file *m, void *v) |
451 | { | ||
452 | return single_open(file, ide_capacity_proc_show, NULL); | ||
453 | } | ||
454 | |||
455 | const struct file_operations ide_capacity_proc_fops = { | ||
456 | .owner = THIS_MODULE, | ||
457 | .open = ide_capacity_proc_open, | ||
458 | .read = seq_read, | ||
459 | .llseek = seq_lseek, | ||
460 | .release = single_release, | ||
461 | }; | ||
462 | EXPORT_SYMBOL_GPL(ide_capacity_proc_fops); | ||
463 | |||
464 | static int ide_geometry_proc_show(struct seq_file *m, void *v) | ||
465 | { | 400 | { |
466 | ide_drive_t *drive = (ide_drive_t *) m->private; | 401 | ide_drive_t *drive = (ide_drive_t *) m->private; |
467 | 402 | ||
@@ -471,20 +406,7 @@ static int ide_geometry_proc_show(struct seq_file *m, void *v) | |||
471 | drive->bios_cyl, drive->bios_head, drive->bios_sect); | 406 | drive->bios_cyl, drive->bios_head, drive->bios_sect); |
472 | return 0; | 407 | return 0; |
473 | } | 408 | } |
474 | 409 | EXPORT_SYMBOL(ide_geometry_proc_show); | |
475 | static int ide_geometry_proc_open(struct inode *inode, struct file *file) | ||
476 | { | ||
477 | return single_open(file, ide_geometry_proc_show, PDE_DATA(inode)); | ||
478 | } | ||
479 | |||
480 | const struct file_operations ide_geometry_proc_fops = { | ||
481 | .owner = THIS_MODULE, | ||
482 | .open = ide_geometry_proc_open, | ||
483 | .read = seq_read, | ||
484 | .llseek = seq_lseek, | ||
485 | .release = single_release, | ||
486 | }; | ||
487 | EXPORT_SYMBOL(ide_geometry_proc_fops); | ||
488 | 410 | ||
489 | static int ide_dmodel_proc_show(struct seq_file *seq, void *v) | 411 | static int ide_dmodel_proc_show(struct seq_file *seq, void *v) |
490 | { | 412 | { |
@@ -495,19 +417,6 @@ static int ide_dmodel_proc_show(struct seq_file *seq, void *v) | |||
495 | return 0; | 417 | return 0; |
496 | } | 418 | } |
497 | 419 | ||
498 | static int ide_dmodel_proc_open(struct inode *inode, struct file *file) | ||
499 | { | ||
500 | return single_open(file, ide_dmodel_proc_show, PDE_DATA(inode)); | ||
501 | } | ||
502 | |||
503 | static const struct file_operations ide_dmodel_proc_fops = { | ||
504 | .owner = THIS_MODULE, | ||
505 | .open = ide_dmodel_proc_open, | ||
506 | .read = seq_read, | ||
507 | .llseek = seq_lseek, | ||
508 | .release = single_release, | ||
509 | }; | ||
510 | |||
511 | static int ide_driver_proc_show(struct seq_file *m, void *v) | 420 | static int ide_driver_proc_show(struct seq_file *m, void *v) |
512 | { | 421 | { |
513 | ide_drive_t *drive = (ide_drive_t *)m->private; | 422 | ide_drive_t *drive = (ide_drive_t *)m->private; |
@@ -523,65 +432,6 @@ static int ide_driver_proc_show(struct seq_file *m, void *v) | |||
523 | return 0; | 432 | return 0; |
524 | } | 433 | } |
525 | 434 | ||
526 | static int ide_driver_proc_open(struct inode *inode, struct file *file) | ||
527 | { | ||
528 | return single_open(file, ide_driver_proc_show, PDE_DATA(inode)); | ||
529 | } | ||
530 | |||
531 | static int ide_replace_subdriver(ide_drive_t *drive, const char *driver) | ||
532 | { | ||
533 | struct device *dev = &drive->gendev; | ||
534 | int ret = 1; | ||
535 | int err; | ||
536 | |||
537 | device_release_driver(dev); | ||
538 | /* FIXME: device can still be in use by previous driver */ | ||
539 | strlcpy(drive->driver_req, driver, sizeof(drive->driver_req)); | ||
540 | err = device_attach(dev); | ||
541 | if (err < 0) | ||
542 | printk(KERN_WARNING "IDE: %s: device_attach error: %d\n", | ||
543 | __func__, err); | ||
544 | drive->driver_req[0] = 0; | ||
545 | if (dev->driver == NULL) { | ||
546 | err = device_attach(dev); | ||
547 | if (err < 0) | ||
548 | printk(KERN_WARNING | ||
549 | "IDE: %s: device_attach(2) error: %d\n", | ||
550 | __func__, err); | ||
551 | } | ||
552 | if (dev->driver && !strcmp(dev->driver->name, driver)) | ||
553 | ret = 0; | ||
554 | |||
555 | return ret; | ||
556 | } | ||
557 | |||
558 | static ssize_t ide_driver_proc_write(struct file *file, const char __user *buffer, | ||
559 | size_t count, loff_t *pos) | ||
560 | { | ||
561 | ide_drive_t *drive = PDE_DATA(file_inode(file)); | ||
562 | char name[32]; | ||
563 | |||
564 | if (!capable(CAP_SYS_ADMIN)) | ||
565 | return -EACCES; | ||
566 | if (count > 31) | ||
567 | count = 31; | ||
568 | if (copy_from_user(name, buffer, count)) | ||
569 | return -EFAULT; | ||
570 | name[count] = '\0'; | ||
571 | if (ide_replace_subdriver(drive, name)) | ||
572 | return -EINVAL; | ||
573 | return count; | ||
574 | } | ||
575 | |||
576 | static const struct file_operations ide_driver_proc_fops = { | ||
577 | .owner = THIS_MODULE, | ||
578 | .open = ide_driver_proc_open, | ||
579 | .read = seq_read, | ||
580 | .llseek = seq_lseek, | ||
581 | .release = single_release, | ||
582 | .write = ide_driver_proc_write, | ||
583 | }; | ||
584 | |||
585 | static int ide_media_proc_show(struct seq_file *m, void *v) | 435 | static int ide_media_proc_show(struct seq_file *m, void *v) |
586 | { | 436 | { |
587 | ide_drive_t *drive = (ide_drive_t *) m->private; | 437 | ide_drive_t *drive = (ide_drive_t *) m->private; |
@@ -613,11 +463,10 @@ static const struct file_operations ide_media_proc_fops = { | |||
613 | }; | 463 | }; |
614 | 464 | ||
615 | static ide_proc_entry_t generic_drive_entries[] = { | 465 | static ide_proc_entry_t generic_drive_entries[] = { |
616 | { "driver", S_IFREG|S_IRUGO, &ide_driver_proc_fops }, | 466 | { "driver", S_IFREG|S_IRUGO, ide_driver_proc_show }, |
617 | { "identify", S_IFREG|S_IRUSR, &ide_identify_proc_fops}, | 467 | { "identify", S_IFREG|S_IRUSR, ide_identify_proc_show }, |
618 | { "media", S_IFREG|S_IRUGO, &ide_media_proc_fops }, | 468 | { "media", S_IFREG|S_IRUGO, ide_media_proc_show }, |
619 | { "model", S_IFREG|S_IRUGO, &ide_dmodel_proc_fops }, | 469 | { "model", S_IFREG|S_IRUGO, ide_dmodel_proc_show }, |
620 | { "settings", S_IFREG|S_IRUSR|S_IWUSR, &ide_settings_proc_fops}, | ||
621 | {} | 470 | {} |
622 | }; | 471 | }; |
623 | 472 | ||
@@ -628,7 +477,7 @@ static void ide_add_proc_entries(struct proc_dir_entry *dir, ide_proc_entry_t *p | |||
628 | if (!dir || !p) | 477 | if (!dir || !p) |
629 | return; | 478 | return; |
630 | while (p->name != NULL) { | 479 | while (p->name != NULL) { |
631 | ent = proc_create_data(p->name, p->mode, dir, p->proc_fops, data); | 480 | ent = proc_create_single_data(p->name, p->mode, dir, p->show, data); |
632 | if (!ent) return; | 481 | if (!ent) return; |
633 | p++; | 482 | p++; |
634 | } | 483 | } |
@@ -693,8 +542,12 @@ void ide_proc_port_register_devices(ide_hwif_t *hwif) | |||
693 | continue; | 542 | continue; |
694 | 543 | ||
695 | drive->proc = proc_mkdir(drive->name, parent); | 544 | drive->proc = proc_mkdir(drive->name, parent); |
696 | if (drive->proc) | 545 | if (drive->proc) { |
697 | ide_add_proc_entries(drive->proc, generic_drive_entries, drive); | 546 | ide_add_proc_entries(drive->proc, generic_drive_entries, drive); |
547 | proc_create_data("setting", S_IFREG|S_IRUSR|S_IWUSR, | ||
548 | drive->proc, &ide_settings_proc_fops, | ||
549 | drive); | ||
550 | } | ||
698 | sprintf(name, "ide%d/%s", (drive->name[2]-'a')/2, drive->name); | 551 | sprintf(name, "ide%d/%s", (drive->name[2]-'a')/2, drive->name); |
699 | ent = proc_symlink(drive->name, proc_ide_root, name); | 552 | ent = proc_symlink(drive->name, proc_ide_root, name); |
700 | if (!ent) return; | 553 | if (!ent) return; |
@@ -704,6 +557,7 @@ void ide_proc_port_register_devices(ide_hwif_t *hwif) | |||
704 | void ide_proc_unregister_device(ide_drive_t *drive) | 557 | void ide_proc_unregister_device(ide_drive_t *drive) |
705 | { | 558 | { |
706 | if (drive->proc) { | 559 | if (drive->proc) { |
560 | remove_proc_entry("settings", drive->proc); | ||
707 | ide_remove_proc_entries(drive->proc, generic_drive_entries); | 561 | ide_remove_proc_entries(drive->proc, generic_drive_entries); |
708 | remove_proc_entry(drive->name, proc_ide_root); | 562 | remove_proc_entry(drive->name, proc_ide_root); |
709 | remove_proc_entry(drive->name, drive->hwif->proc); | 563 | remove_proc_entry(drive->name, drive->hwif->proc); |
@@ -712,9 +566,9 @@ void ide_proc_unregister_device(ide_drive_t *drive) | |||
712 | } | 566 | } |
713 | 567 | ||
714 | static ide_proc_entry_t hwif_entries[] = { | 568 | static ide_proc_entry_t hwif_entries[] = { |
715 | { "channel", S_IFREG|S_IRUGO, &ide_channel_proc_fops }, | 569 | { "channel", S_IFREG|S_IRUGO, ide_channel_proc_show }, |
716 | { "mate", S_IFREG|S_IRUGO, &ide_mate_proc_fops }, | 570 | { "mate", S_IFREG|S_IRUGO, ide_mate_proc_show }, |
717 | { "model", S_IFREG|S_IRUGO, &ide_imodel_proc_fops }, | 571 | { "model", S_IFREG|S_IRUGO, ide_imodel_proc_show }, |
718 | {} | 572 | {} |
719 | }; | 573 | }; |
720 | 574 | ||
diff --git a/drivers/ide/ide-tape.c b/drivers/ide/ide-tape.c index 62c1a19a9aed..aee7b46d2330 100644 --- a/drivers/ide/ide-tape.c +++ b/drivers/ide/ide-tape.c | |||
@@ -1847,22 +1847,9 @@ static int idetape_name_proc_show(struct seq_file *m, void *v) | |||
1847 | return 0; | 1847 | return 0; |
1848 | } | 1848 | } |
1849 | 1849 | ||
1850 | static int idetape_name_proc_open(struct inode *inode, struct file *file) | ||
1851 | { | ||
1852 | return single_open(file, idetape_name_proc_show, PDE_DATA(inode)); | ||
1853 | } | ||
1854 | |||
1855 | static const struct file_operations idetape_name_proc_fops = { | ||
1856 | .owner = THIS_MODULE, | ||
1857 | .open = idetape_name_proc_open, | ||
1858 | .read = seq_read, | ||
1859 | .llseek = seq_lseek, | ||
1860 | .release = single_release, | ||
1861 | }; | ||
1862 | |||
1863 | static ide_proc_entry_t idetape_proc[] = { | 1850 | static ide_proc_entry_t idetape_proc[] = { |
1864 | { "capacity", S_IFREG|S_IRUGO, &ide_capacity_proc_fops }, | 1851 | { "capacity", S_IFREG|S_IRUGO, ide_capacity_proc_show }, |
1865 | { "name", S_IFREG|S_IRUGO, &idetape_name_proc_fops }, | 1852 | { "name", S_IFREG|S_IRUGO, idetape_name_proc_show }, |
1866 | {} | 1853 | {} |
1867 | }; | 1854 | }; |
1868 | 1855 | ||
diff --git a/drivers/input/misc/hp_sdc_rtc.c b/drivers/input/misc/hp_sdc_rtc.c index 49b34de0aed4..47eb8ca729fe 100644 --- a/drivers/input/misc/hp_sdc_rtc.c +++ b/drivers/input/misc/hp_sdc_rtc.c | |||
@@ -509,18 +509,6 @@ static int hp_sdc_rtc_proc_show(struct seq_file *m, void *v) | |||
509 | #undef NY | 509 | #undef NY |
510 | } | 510 | } |
511 | 511 | ||
512 | static int hp_sdc_rtc_proc_open(struct inode *inode, struct file *file) | ||
513 | { | ||
514 | return single_open(file, hp_sdc_rtc_proc_show, NULL); | ||
515 | } | ||
516 | |||
517 | static const struct file_operations hp_sdc_rtc_proc_fops = { | ||
518 | .open = hp_sdc_rtc_proc_open, | ||
519 | .read = seq_read, | ||
520 | .llseek = seq_lseek, | ||
521 | .release = single_release, | ||
522 | }; | ||
523 | |||
524 | static int hp_sdc_rtc_ioctl(struct file *file, | 512 | static int hp_sdc_rtc_ioctl(struct file *file, |
525 | unsigned int cmd, unsigned long arg) | 513 | unsigned int cmd, unsigned long arg) |
526 | { | 514 | { |
@@ -713,7 +701,7 @@ static int __init hp_sdc_rtc_init(void) | |||
713 | if (misc_register(&hp_sdc_rtc_dev) != 0) | 701 | if (misc_register(&hp_sdc_rtc_dev) != 0) |
714 | printk(KERN_INFO "Could not register misc. dev for i8042 rtc\n"); | 702 | printk(KERN_INFO "Could not register misc. dev for i8042 rtc\n"); |
715 | 703 | ||
716 | proc_create("driver/rtc", 0, NULL, &hp_sdc_rtc_proc_fops); | 704 | proc_create_single("driver/rtc", 0, NULL, hp_sdc_rtc_proc_show); |
717 | 705 | ||
718 | printk(KERN_INFO "HP i8042 SDC + MSM-58321 RTC support loaded " | 706 | printk(KERN_INFO "HP i8042 SDC + MSM-58321 RTC support loaded " |
719 | "(RTC v " RTC_VERSION ")\n"); | 707 | "(RTC v " RTC_VERSION ")\n"); |
diff --git a/drivers/isdn/capi/capi.c b/drivers/isdn/capi/capi.c index 19cd93783c87..baa1ee2bc2ac 100644 --- a/drivers/isdn/capi/capi.c +++ b/drivers/isdn/capi/capi.c | |||
@@ -1340,19 +1340,6 @@ static int capi20_proc_show(struct seq_file *m, void *v) | |||
1340 | return 0; | 1340 | return 0; |
1341 | } | 1341 | } |
1342 | 1342 | ||
1343 | static int capi20_proc_open(struct inode *inode, struct file *file) | ||
1344 | { | ||
1345 | return single_open(file, capi20_proc_show, NULL); | ||
1346 | } | ||
1347 | |||
1348 | static const struct file_operations capi20_proc_fops = { | ||
1349 | .owner = THIS_MODULE, | ||
1350 | .open = capi20_proc_open, | ||
1351 | .read = seq_read, | ||
1352 | .llseek = seq_lseek, | ||
1353 | .release = single_release, | ||
1354 | }; | ||
1355 | |||
1356 | /* | 1343 | /* |
1357 | * /proc/capi/capi20ncci: | 1344 | * /proc/capi/capi20ncci: |
1358 | * applid ncci | 1345 | * applid ncci |
@@ -1373,23 +1360,10 @@ static int capi20ncci_proc_show(struct seq_file *m, void *v) | |||
1373 | return 0; | 1360 | return 0; |
1374 | } | 1361 | } |
1375 | 1362 | ||
1376 | static int capi20ncci_proc_open(struct inode *inode, struct file *file) | ||
1377 | { | ||
1378 | return single_open(file, capi20ncci_proc_show, NULL); | ||
1379 | } | ||
1380 | |||
1381 | static const struct file_operations capi20ncci_proc_fops = { | ||
1382 | .owner = THIS_MODULE, | ||
1383 | .open = capi20ncci_proc_open, | ||
1384 | .read = seq_read, | ||
1385 | .llseek = seq_lseek, | ||
1386 | .release = single_release, | ||
1387 | }; | ||
1388 | |||
1389 | static void __init proc_init(void) | 1363 | static void __init proc_init(void) |
1390 | { | 1364 | { |
1391 | proc_create("capi/capi20", 0, NULL, &capi20_proc_fops); | 1365 | proc_create_single("capi/capi20", 0, NULL, capi20_proc_show); |
1392 | proc_create("capi/capi20ncci", 0, NULL, &capi20ncci_proc_fops); | 1366 | proc_create_single("capi/capi20ncci", 0, NULL, capi20ncci_proc_show); |
1393 | } | 1367 | } |
1394 | 1368 | ||
1395 | static void __exit proc_exit(void) | 1369 | static void __exit proc_exit(void) |
diff --git a/drivers/isdn/capi/capidrv.c b/drivers/isdn/capi/capidrv.c index 49fef08858c5..7ac51798949d 100644 --- a/drivers/isdn/capi/capidrv.c +++ b/drivers/isdn/capi/capidrv.c | |||
@@ -2460,22 +2460,9 @@ static int capidrv_proc_show(struct seq_file *m, void *v) | |||
2460 | return 0; | 2460 | return 0; |
2461 | } | 2461 | } |
2462 | 2462 | ||
2463 | static int capidrv_proc_open(struct inode *inode, struct file *file) | ||
2464 | { | ||
2465 | return single_open(file, capidrv_proc_show, NULL); | ||
2466 | } | ||
2467 | |||
2468 | static const struct file_operations capidrv_proc_fops = { | ||
2469 | .owner = THIS_MODULE, | ||
2470 | .open = capidrv_proc_open, | ||
2471 | .read = seq_read, | ||
2472 | .llseek = seq_lseek, | ||
2473 | .release = single_release, | ||
2474 | }; | ||
2475 | |||
2476 | static void __init proc_init(void) | 2463 | static void __init proc_init(void) |
2477 | { | 2464 | { |
2478 | proc_create("capi/capidrv", 0, NULL, &capidrv_proc_fops); | 2465 | proc_create_single("capi/capidrv", 0, NULL, capidrv_proc_show); |
2479 | } | 2466 | } |
2480 | 2467 | ||
2481 | static void __exit proc_exit(void) | 2468 | static void __exit proc_exit(void) |
diff --git a/drivers/isdn/capi/kcapi.c b/drivers/isdn/capi/kcapi.c index 46c189ad8d94..0ff517d3c98f 100644 --- a/drivers/isdn/capi/kcapi.c +++ b/drivers/isdn/capi/kcapi.c | |||
@@ -534,7 +534,8 @@ int attach_capi_ctr(struct capi_ctr *ctr) | |||
534 | init_waitqueue_head(&ctr->state_wait_queue); | 534 | init_waitqueue_head(&ctr->state_wait_queue); |
535 | 535 | ||
536 | sprintf(ctr->procfn, "capi/controllers/%d", ctr->cnr); | 536 | sprintf(ctr->procfn, "capi/controllers/%d", ctr->cnr); |
537 | ctr->procent = proc_create_data(ctr->procfn, 0, NULL, ctr->proc_fops, ctr); | 537 | ctr->procent = proc_create_single_data(ctr->procfn, 0, NULL, |
538 | ctr->proc_show, ctr); | ||
538 | 539 | ||
539 | ncontrollers++; | 540 | ncontrollers++; |
540 | 541 | ||
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/isdn/gigaset/capi.c b/drivers/isdn/gigaset/capi.c index ccec7778cad2..56748af78c04 100644 --- a/drivers/isdn/gigaset/capi.c +++ b/drivers/isdn/gigaset/capi.c | |||
@@ -2437,19 +2437,6 @@ static int gigaset_proc_show(struct seq_file *m, void *v) | |||
2437 | return 0; | 2437 | return 0; |
2438 | } | 2438 | } |
2439 | 2439 | ||
2440 | static int gigaset_proc_open(struct inode *inode, struct file *file) | ||
2441 | { | ||
2442 | return single_open(file, gigaset_proc_show, PDE_DATA(inode)); | ||
2443 | } | ||
2444 | |||
2445 | static const struct file_operations gigaset_proc_fops = { | ||
2446 | .owner = THIS_MODULE, | ||
2447 | .open = gigaset_proc_open, | ||
2448 | .read = seq_read, | ||
2449 | .llseek = seq_lseek, | ||
2450 | .release = single_release, | ||
2451 | }; | ||
2452 | |||
2453 | /** | 2440 | /** |
2454 | * gigaset_isdn_regdev() - register device to LL | 2441 | * gigaset_isdn_regdev() - register device to LL |
2455 | * @cs: device descriptor structure. | 2442 | * @cs: device descriptor structure. |
@@ -2479,7 +2466,7 @@ int gigaset_isdn_regdev(struct cardstate *cs, const char *isdnid) | |||
2479 | iif->ctr.release_appl = gigaset_release_appl; | 2466 | iif->ctr.release_appl = gigaset_release_appl; |
2480 | iif->ctr.send_message = gigaset_send_message; | 2467 | iif->ctr.send_message = gigaset_send_message; |
2481 | iif->ctr.procinfo = gigaset_procinfo; | 2468 | iif->ctr.procinfo = gigaset_procinfo; |
2482 | iif->ctr.proc_fops = &gigaset_proc_fops; | 2469 | iif->ctr.proc_show = gigaset_proc_show, |
2483 | INIT_LIST_HEAD(&iif->appls); | 2470 | INIT_LIST_HEAD(&iif->appls); |
2484 | skb_queue_head_init(&iif->sendqueue); | 2471 | skb_queue_head_init(&iif->sendqueue); |
2485 | atomic_set(&iif->sendqlen, 0); | 2472 | atomic_set(&iif->sendqlen, 0); |
diff --git a/drivers/isdn/hardware/avm/avmcard.h b/drivers/isdn/hardware/avm/avmcard.h index c95712dbfa9f..cdfa89c71997 100644 --- a/drivers/isdn/hardware/avm/avmcard.h +++ b/drivers/isdn/hardware/avm/avmcard.h | |||
@@ -556,7 +556,7 @@ u16 b1_send_message(struct capi_ctr *ctrl, struct sk_buff *skb); | |||
556 | void b1_parse_version(avmctrl_info *card); | 556 | void b1_parse_version(avmctrl_info *card); |
557 | irqreturn_t b1_interrupt(int interrupt, void *devptr); | 557 | irqreturn_t b1_interrupt(int interrupt, void *devptr); |
558 | 558 | ||
559 | extern const struct file_operations b1ctl_proc_fops; | 559 | int b1_proc_show(struct seq_file *m, void *v); |
560 | 560 | ||
561 | avmcard_dmainfo *avmcard_dma_alloc(char *name, struct pci_dev *, | 561 | avmcard_dmainfo *avmcard_dma_alloc(char *name, struct pci_dev *, |
562 | long rsize, long ssize); | 562 | long rsize, long ssize); |
@@ -576,6 +576,6 @@ void b1dma_register_appl(struct capi_ctr *ctrl, | |||
576 | capi_register_params *rp); | 576 | capi_register_params *rp); |
577 | void b1dma_release_appl(struct capi_ctr *ctrl, u16 appl); | 577 | void b1dma_release_appl(struct capi_ctr *ctrl, u16 appl); |
578 | u16 b1dma_send_message(struct capi_ctr *ctrl, struct sk_buff *skb); | 578 | u16 b1dma_send_message(struct capi_ctr *ctrl, struct sk_buff *skb); |
579 | extern const struct file_operations b1dmactl_proc_fops; | 579 | int b1dma_proc_show(struct seq_file *m, void *v); |
580 | 580 | ||
581 | #endif /* _AVMCARD_H_ */ | 581 | #endif /* _AVMCARD_H_ */ |
diff --git a/drivers/isdn/hardware/avm/b1.c b/drivers/isdn/hardware/avm/b1.c index b1833d08a5fe..5ee5489d3f15 100644 --- a/drivers/isdn/hardware/avm/b1.c +++ b/drivers/isdn/hardware/avm/b1.c | |||
@@ -637,7 +637,7 @@ irqreturn_t b1_interrupt(int interrupt, void *devptr) | |||
637 | } | 637 | } |
638 | 638 | ||
639 | /* ------------------------------------------------------------- */ | 639 | /* ------------------------------------------------------------- */ |
640 | static int b1ctl_proc_show(struct seq_file *m, void *v) | 640 | int b1_proc_show(struct seq_file *m, void *v) |
641 | { | 641 | { |
642 | struct capi_ctr *ctrl = m->private; | 642 | struct capi_ctr *ctrl = m->private; |
643 | avmctrl_info *cinfo = (avmctrl_info *)(ctrl->driverdata); | 643 | avmctrl_info *cinfo = (avmctrl_info *)(ctrl->driverdata); |
@@ -699,20 +699,7 @@ static int b1ctl_proc_show(struct seq_file *m, void *v) | |||
699 | 699 | ||
700 | return 0; | 700 | return 0; |
701 | } | 701 | } |
702 | 702 | EXPORT_SYMBOL(b1_proc_show); | |
703 | static int b1ctl_proc_open(struct inode *inode, struct file *file) | ||
704 | { | ||
705 | return single_open(file, b1ctl_proc_show, PDE_DATA(inode)); | ||
706 | } | ||
707 | |||
708 | const struct file_operations b1ctl_proc_fops = { | ||
709 | .owner = THIS_MODULE, | ||
710 | .open = b1ctl_proc_open, | ||
711 | .read = seq_read, | ||
712 | .llseek = seq_lseek, | ||
713 | .release = single_release, | ||
714 | }; | ||
715 | EXPORT_SYMBOL(b1ctl_proc_fops); | ||
716 | 703 | ||
717 | /* ------------------------------------------------------------- */ | 704 | /* ------------------------------------------------------------- */ |
718 | 705 | ||
diff --git a/drivers/isdn/hardware/avm/b1dma.c b/drivers/isdn/hardware/avm/b1dma.c index 9538a9e5e1a8..6a3dc9937ce5 100644 --- a/drivers/isdn/hardware/avm/b1dma.c +++ b/drivers/isdn/hardware/avm/b1dma.c | |||
@@ -858,7 +858,7 @@ u16 b1dma_send_message(struct capi_ctr *ctrl, struct sk_buff *skb) | |||
858 | 858 | ||
859 | /* ------------------------------------------------------------- */ | 859 | /* ------------------------------------------------------------- */ |
860 | 860 | ||
861 | static int b1dmactl_proc_show(struct seq_file *m, void *v) | 861 | int b1dma_proc_show(struct seq_file *m, void *v) |
862 | { | 862 | { |
863 | struct capi_ctr *ctrl = m->private; | 863 | struct capi_ctr *ctrl = m->private; |
864 | avmctrl_info *cinfo = (avmctrl_info *)(ctrl->driverdata); | 864 | avmctrl_info *cinfo = (avmctrl_info *)(ctrl->driverdata); |
@@ -941,20 +941,7 @@ static int b1dmactl_proc_show(struct seq_file *m, void *v) | |||
941 | 941 | ||
942 | return 0; | 942 | return 0; |
943 | } | 943 | } |
944 | 944 | EXPORT_SYMBOL(b1dma_proc_show); | |
945 | static int b1dmactl_proc_open(struct inode *inode, struct file *file) | ||
946 | { | ||
947 | return single_open(file, b1dmactl_proc_show, PDE_DATA(inode)); | ||
948 | } | ||
949 | |||
950 | const struct file_operations b1dmactl_proc_fops = { | ||
951 | .owner = THIS_MODULE, | ||
952 | .open = b1dmactl_proc_open, | ||
953 | .read = seq_read, | ||
954 | .llseek = seq_lseek, | ||
955 | .release = single_release, | ||
956 | }; | ||
957 | EXPORT_SYMBOL(b1dmactl_proc_fops); | ||
958 | 945 | ||
959 | /* ------------------------------------------------------------- */ | 946 | /* ------------------------------------------------------------- */ |
960 | 947 | ||
diff --git a/drivers/isdn/hardware/avm/b1isa.c b/drivers/isdn/hardware/avm/b1isa.c index 54e871a47387..cdfea72e0ef6 100644 --- a/drivers/isdn/hardware/avm/b1isa.c +++ b/drivers/isdn/hardware/avm/b1isa.c | |||
@@ -121,7 +121,7 @@ static int b1isa_probe(struct pci_dev *pdev) | |||
121 | cinfo->capi_ctrl.load_firmware = b1_load_firmware; | 121 | cinfo->capi_ctrl.load_firmware = b1_load_firmware; |
122 | cinfo->capi_ctrl.reset_ctr = b1_reset_ctr; | 122 | cinfo->capi_ctrl.reset_ctr = b1_reset_ctr; |
123 | cinfo->capi_ctrl.procinfo = b1isa_procinfo; | 123 | cinfo->capi_ctrl.procinfo = b1isa_procinfo; |
124 | cinfo->capi_ctrl.proc_fops = &b1ctl_proc_fops; | 124 | cinfo->capi_ctrl.proc_show = b1_proc_show; |
125 | strcpy(cinfo->capi_ctrl.name, card->name); | 125 | strcpy(cinfo->capi_ctrl.name, card->name); |
126 | 126 | ||
127 | retval = attach_capi_ctr(&cinfo->capi_ctrl); | 127 | retval = attach_capi_ctr(&cinfo->capi_ctrl); |
diff --git a/drivers/isdn/hardware/avm/b1pci.c b/drivers/isdn/hardware/avm/b1pci.c index ac4863c2ecbc..b76b57a82c02 100644 --- a/drivers/isdn/hardware/avm/b1pci.c +++ b/drivers/isdn/hardware/avm/b1pci.c | |||
@@ -112,7 +112,7 @@ static int b1pci_probe(struct capicardparams *p, struct pci_dev *pdev) | |||
112 | cinfo->capi_ctrl.load_firmware = b1_load_firmware; | 112 | cinfo->capi_ctrl.load_firmware = b1_load_firmware; |
113 | cinfo->capi_ctrl.reset_ctr = b1_reset_ctr; | 113 | cinfo->capi_ctrl.reset_ctr = b1_reset_ctr; |
114 | cinfo->capi_ctrl.procinfo = b1pci_procinfo; | 114 | cinfo->capi_ctrl.procinfo = b1pci_procinfo; |
115 | cinfo->capi_ctrl.proc_fops = &b1ctl_proc_fops; | 115 | cinfo->capi_ctrl.proc_show = b1_proc_show; |
116 | strcpy(cinfo->capi_ctrl.name, card->name); | 116 | strcpy(cinfo->capi_ctrl.name, card->name); |
117 | cinfo->capi_ctrl.owner = THIS_MODULE; | 117 | cinfo->capi_ctrl.owner = THIS_MODULE; |
118 | 118 | ||
@@ -251,7 +251,7 @@ static int b1pciv4_probe(struct capicardparams *p, struct pci_dev *pdev) | |||
251 | cinfo->capi_ctrl.load_firmware = b1dma_load_firmware; | 251 | cinfo->capi_ctrl.load_firmware = b1dma_load_firmware; |
252 | cinfo->capi_ctrl.reset_ctr = b1dma_reset_ctr; | 252 | cinfo->capi_ctrl.reset_ctr = b1dma_reset_ctr; |
253 | cinfo->capi_ctrl.procinfo = b1pciv4_procinfo; | 253 | cinfo->capi_ctrl.procinfo = b1pciv4_procinfo; |
254 | cinfo->capi_ctrl.proc_fops = &b1dmactl_proc_fops; | 254 | cinfo->capi_ctrl.proc_show = b1dma_proc_show; |
255 | strcpy(cinfo->capi_ctrl.name, card->name); | 255 | strcpy(cinfo->capi_ctrl.name, card->name); |
256 | 256 | ||
257 | retval = attach_capi_ctr(&cinfo->capi_ctrl); | 257 | retval = attach_capi_ctr(&cinfo->capi_ctrl); |
diff --git a/drivers/isdn/hardware/avm/b1pcmcia.c b/drivers/isdn/hardware/avm/b1pcmcia.c index 6b0d19d963d5..3aca16e62902 100644 --- a/drivers/isdn/hardware/avm/b1pcmcia.c +++ b/drivers/isdn/hardware/avm/b1pcmcia.c | |||
@@ -108,7 +108,7 @@ static int b1pcmcia_add_card(unsigned int port, unsigned irq, | |||
108 | cinfo->capi_ctrl.load_firmware = b1_load_firmware; | 108 | cinfo->capi_ctrl.load_firmware = b1_load_firmware; |
109 | cinfo->capi_ctrl.reset_ctr = b1_reset_ctr; | 109 | cinfo->capi_ctrl.reset_ctr = b1_reset_ctr; |
110 | cinfo->capi_ctrl.procinfo = b1pcmcia_procinfo; | 110 | cinfo->capi_ctrl.procinfo = b1pcmcia_procinfo; |
111 | cinfo->capi_ctrl.proc_fops = &b1ctl_proc_fops; | 111 | cinfo->capi_ctrl.proc_show = b1_proc_show; |
112 | strcpy(cinfo->capi_ctrl.name, card->name); | 112 | strcpy(cinfo->capi_ctrl.name, card->name); |
113 | 113 | ||
114 | retval = attach_capi_ctr(&cinfo->capi_ctrl); | 114 | retval = attach_capi_ctr(&cinfo->capi_ctrl); |
diff --git a/drivers/isdn/hardware/avm/c4.c b/drivers/isdn/hardware/avm/c4.c index 034cabac699d..ac72cd204c4d 100644 --- a/drivers/isdn/hardware/avm/c4.c +++ b/drivers/isdn/hardware/avm/c4.c | |||
@@ -1127,19 +1127,6 @@ static int c4_proc_show(struct seq_file *m, void *v) | |||
1127 | return 0; | 1127 | return 0; |
1128 | } | 1128 | } |
1129 | 1129 | ||
1130 | static int c4_proc_open(struct inode *inode, struct file *file) | ||
1131 | { | ||
1132 | return single_open(file, c4_proc_show, PDE_DATA(inode)); | ||
1133 | } | ||
1134 | |||
1135 | static const struct file_operations c4_proc_fops = { | ||
1136 | .owner = THIS_MODULE, | ||
1137 | .open = c4_proc_open, | ||
1138 | .read = seq_read, | ||
1139 | .llseek = seq_lseek, | ||
1140 | .release = single_release, | ||
1141 | }; | ||
1142 | |||
1143 | /* ------------------------------------------------------------- */ | 1130 | /* ------------------------------------------------------------- */ |
1144 | 1131 | ||
1145 | static int c4_add_card(struct capicardparams *p, struct pci_dev *dev, | 1132 | static int c4_add_card(struct capicardparams *p, struct pci_dev *dev, |
@@ -1211,7 +1198,7 @@ static int c4_add_card(struct capicardparams *p, struct pci_dev *dev, | |||
1211 | cinfo->capi_ctrl.load_firmware = c4_load_firmware; | 1198 | cinfo->capi_ctrl.load_firmware = c4_load_firmware; |
1212 | cinfo->capi_ctrl.reset_ctr = c4_reset_ctr; | 1199 | cinfo->capi_ctrl.reset_ctr = c4_reset_ctr; |
1213 | cinfo->capi_ctrl.procinfo = c4_procinfo; | 1200 | cinfo->capi_ctrl.procinfo = c4_procinfo; |
1214 | cinfo->capi_ctrl.proc_fops = &c4_proc_fops; | 1201 | cinfo->capi_ctrl.proc_show = c4_proc_show; |
1215 | strcpy(cinfo->capi_ctrl.name, card->name); | 1202 | strcpy(cinfo->capi_ctrl.name, card->name); |
1216 | 1203 | ||
1217 | retval = attach_capi_ctr(&cinfo->capi_ctrl); | 1204 | retval = attach_capi_ctr(&cinfo->capi_ctrl); |
diff --git a/drivers/isdn/hardware/avm/t1isa.c b/drivers/isdn/hardware/avm/t1isa.c index 9f80d20ced87..2153619c5b31 100644 --- a/drivers/isdn/hardware/avm/t1isa.c +++ b/drivers/isdn/hardware/avm/t1isa.c | |||
@@ -430,7 +430,7 @@ static int t1isa_probe(struct pci_dev *pdev, int cardnr) | |||
430 | cinfo->capi_ctrl.load_firmware = t1isa_load_firmware; | 430 | cinfo->capi_ctrl.load_firmware = t1isa_load_firmware; |
431 | cinfo->capi_ctrl.reset_ctr = t1isa_reset_ctr; | 431 | cinfo->capi_ctrl.reset_ctr = t1isa_reset_ctr; |
432 | cinfo->capi_ctrl.procinfo = t1isa_procinfo; | 432 | cinfo->capi_ctrl.procinfo = t1isa_procinfo; |
433 | cinfo->capi_ctrl.proc_fops = &b1ctl_proc_fops; | 433 | cinfo->capi_ctrl.proc_show = b1_proc_show; |
434 | strcpy(cinfo->capi_ctrl.name, card->name); | 434 | strcpy(cinfo->capi_ctrl.name, card->name); |
435 | 435 | ||
436 | retval = attach_capi_ctr(&cinfo->capi_ctrl); | 436 | retval = attach_capi_ctr(&cinfo->capi_ctrl); |
diff --git a/drivers/isdn/hardware/avm/t1pci.c b/drivers/isdn/hardware/avm/t1pci.c index 2180b1685691..f5ed1d5004c9 100644 --- a/drivers/isdn/hardware/avm/t1pci.c +++ b/drivers/isdn/hardware/avm/t1pci.c | |||
@@ -119,7 +119,7 @@ static int t1pci_add_card(struct capicardparams *p, struct pci_dev *pdev) | |||
119 | cinfo->capi_ctrl.load_firmware = b1dma_load_firmware; | 119 | cinfo->capi_ctrl.load_firmware = b1dma_load_firmware; |
120 | cinfo->capi_ctrl.reset_ctr = b1dma_reset_ctr; | 120 | cinfo->capi_ctrl.reset_ctr = b1dma_reset_ctr; |
121 | cinfo->capi_ctrl.procinfo = t1pci_procinfo; | 121 | cinfo->capi_ctrl.procinfo = t1pci_procinfo; |
122 | cinfo->capi_ctrl.proc_fops = &b1dmactl_proc_fops; | 122 | cinfo->capi_ctrl.proc_show = b1dma_proc_show; |
123 | strcpy(cinfo->capi_ctrl.name, card->name); | 123 | strcpy(cinfo->capi_ctrl.name, card->name); |
124 | 124 | ||
125 | retval = attach_capi_ctr(&cinfo->capi_ctrl); | 125 | retval = attach_capi_ctr(&cinfo->capi_ctrl); |
diff --git a/drivers/isdn/hardware/eicon/capimain.c b/drivers/isdn/hardware/eicon/capimain.c index be36d82004d6..f9244dc1c3c9 100644 --- a/drivers/isdn/hardware/eicon/capimain.c +++ b/drivers/isdn/hardware/eicon/capimain.c | |||
@@ -90,19 +90,6 @@ static int diva_ctl_proc_show(struct seq_file *m, void *v) | |||
90 | return 0; | 90 | return 0; |
91 | } | 91 | } |
92 | 92 | ||
93 | static int diva_ctl_proc_open(struct inode *inode, struct file *file) | ||
94 | { | ||
95 | return single_open(file, diva_ctl_proc_show, NULL); | ||
96 | } | ||
97 | |||
98 | static const struct file_operations diva_ctl_proc_fops = { | ||
99 | .owner = THIS_MODULE, | ||
100 | .open = diva_ctl_proc_open, | ||
101 | .read = seq_read, | ||
102 | .llseek = seq_lseek, | ||
103 | .release = single_release, | ||
104 | }; | ||
105 | |||
106 | /* | 93 | /* |
107 | * set additional os settings in capi_ctr struct | 94 | * set additional os settings in capi_ctr struct |
108 | */ | 95 | */ |
@@ -111,7 +98,7 @@ void diva_os_set_controller_struct(struct capi_ctr *ctrl) | |||
111 | ctrl->driver_name = DRIVERLNAME; | 98 | ctrl->driver_name = DRIVERLNAME; |
112 | ctrl->load_firmware = NULL; | 99 | ctrl->load_firmware = NULL; |
113 | ctrl->reset_ctr = NULL; | 100 | ctrl->reset_ctr = NULL; |
114 | ctrl->proc_fops = &diva_ctl_proc_fops; | 101 | ctrl->proc_show = diva_ctl_proc_show; |
115 | ctrl->owner = THIS_MODULE; | 102 | ctrl->owner = THIS_MODULE; |
116 | } | 103 | } |
117 | 104 | ||
diff --git a/drivers/isdn/hardware/eicon/diva_didd.c b/drivers/isdn/hardware/eicon/diva_didd.c index fab6ccfb00d5..60e79257dd5f 100644 --- a/drivers/isdn/hardware/eicon/diva_didd.c +++ b/drivers/isdn/hardware/eicon/diva_didd.c | |||
@@ -78,26 +78,13 @@ static int divadidd_proc_show(struct seq_file *m, void *v) | |||
78 | return 0; | 78 | return 0; |
79 | } | 79 | } |
80 | 80 | ||
81 | static int divadidd_proc_open(struct inode *inode, struct file *file) | ||
82 | { | ||
83 | return single_open(file, divadidd_proc_show, NULL); | ||
84 | } | ||
85 | |||
86 | static const struct file_operations divadidd_proc_fops = { | ||
87 | .owner = THIS_MODULE, | ||
88 | .open = divadidd_proc_open, | ||
89 | .read = seq_read, | ||
90 | .llseek = seq_lseek, | ||
91 | .release = single_release, | ||
92 | }; | ||
93 | |||
94 | static int __init create_proc(void) | 81 | static int __init create_proc(void) |
95 | { | 82 | { |
96 | proc_net_eicon = proc_mkdir("eicon", init_net.proc_net); | 83 | proc_net_eicon = proc_mkdir("eicon", init_net.proc_net); |
97 | 84 | ||
98 | if (proc_net_eicon) { | 85 | if (proc_net_eicon) { |
99 | proc_didd = proc_create(DRIVERLNAME, S_IRUGO, proc_net_eicon, | 86 | proc_didd = proc_create_single(DRIVERLNAME, S_IRUGO, |
100 | &divadidd_proc_fops); | 87 | proc_net_eicon, divadidd_proc_show); |
101 | return (1); | 88 | return (1); |
102 | } | 89 | } |
103 | return (0); | 90 | return (0); |
diff --git a/drivers/isdn/hardware/eicon/divasi.c b/drivers/isdn/hardware/eicon/divasi.c index 525518c945fe..e7081e0c0e35 100644 --- a/drivers/isdn/hardware/eicon/divasi.c +++ b/drivers/isdn/hardware/eicon/divasi.c | |||
@@ -101,23 +101,10 @@ static int um_idi_proc_show(struct seq_file *m, void *v) | |||
101 | return 0; | 101 | return 0; |
102 | } | 102 | } |
103 | 103 | ||
104 | static int um_idi_proc_open(struct inode *inode, struct file *file) | ||
105 | { | ||
106 | return single_open(file, um_idi_proc_show, NULL); | ||
107 | } | ||
108 | |||
109 | static const struct file_operations um_idi_proc_fops = { | ||
110 | .owner = THIS_MODULE, | ||
111 | .open = um_idi_proc_open, | ||
112 | .read = seq_read, | ||
113 | .llseek = seq_lseek, | ||
114 | .release = single_release, | ||
115 | }; | ||
116 | |||
117 | static int __init create_um_idi_proc(void) | 104 | static int __init create_um_idi_proc(void) |
118 | { | 105 | { |
119 | um_idi_proc_entry = proc_create(DRIVERLNAME, S_IRUGO, proc_net_eicon, | 106 | um_idi_proc_entry = proc_create_single(DRIVERLNAME, S_IRUGO, |
120 | &um_idi_proc_fops); | 107 | proc_net_eicon, um_idi_proc_show); |
121 | if (!um_idi_proc_entry) | 108 | if (!um_idi_proc_entry) |
122 | return (0); | 109 | return (0); |
123 | return (1); | 110 | return (1); |
diff --git a/drivers/isdn/hysdn/hycapi.c b/drivers/isdn/hysdn/hycapi.c index eac0f51a0f60..a2c15cd7bf67 100644 --- a/drivers/isdn/hysdn/hycapi.c +++ b/drivers/isdn/hysdn/hycapi.c | |||
@@ -467,19 +467,6 @@ static int hycapi_proc_show(struct seq_file *m, void *v) | |||
467 | return 0; | 467 | return 0; |
468 | } | 468 | } |
469 | 469 | ||
470 | static int hycapi_proc_open(struct inode *inode, struct file *file) | ||
471 | { | ||
472 | return single_open(file, hycapi_proc_show, PDE_DATA(inode)); | ||
473 | } | ||
474 | |||
475 | static const struct file_operations hycapi_proc_fops = { | ||
476 | .owner = THIS_MODULE, | ||
477 | .open = hycapi_proc_open, | ||
478 | .read = seq_read, | ||
479 | .llseek = seq_lseek, | ||
480 | .release = single_release, | ||
481 | }; | ||
482 | |||
483 | /************************************************************** | 470 | /************************************************************** |
484 | hycapi_load_firmware | 471 | hycapi_load_firmware |
485 | 472 | ||
@@ -774,7 +761,7 @@ hycapi_capi_create(hysdn_card *card) | |||
774 | ctrl->load_firmware = hycapi_load_firmware; | 761 | ctrl->load_firmware = hycapi_load_firmware; |
775 | ctrl->reset_ctr = hycapi_reset_ctr; | 762 | ctrl->reset_ctr = hycapi_reset_ctr; |
776 | ctrl->procinfo = hycapi_procinfo; | 763 | ctrl->procinfo = hycapi_procinfo; |
777 | ctrl->proc_fops = &hycapi_proc_fops; | 764 | ctrl->proc_show = hycapi_proc_show; |
778 | strcpy(ctrl->name, cinfo->cardname); | 765 | strcpy(ctrl->name, cinfo->cardname); |
779 | ctrl->owner = THIS_MODULE; | 766 | ctrl->owner = THIS_MODULE; |
780 | 767 | ||
diff --git a/drivers/macintosh/via-pmu.c b/drivers/macintosh/via-pmu.c index 433dbeddfcf9..6663893f41c4 100644 --- a/drivers/macintosh/via-pmu.c +++ b/drivers/macintosh/via-pmu.c | |||
@@ -191,10 +191,10 @@ static int init_pmu(void); | |||
191 | static void pmu_start(void); | 191 | static void pmu_start(void); |
192 | static irqreturn_t via_pmu_interrupt(int irq, void *arg); | 192 | static irqreturn_t via_pmu_interrupt(int irq, void *arg); |
193 | static irqreturn_t gpio1_interrupt(int irq, void *arg); | 193 | static irqreturn_t gpio1_interrupt(int irq, void *arg); |
194 | static const struct file_operations pmu_info_proc_fops; | 194 | static int pmu_info_proc_show(struct seq_file *m, void *v); |
195 | static const struct file_operations pmu_irqstats_proc_fops; | 195 | static int pmu_irqstats_proc_show(struct seq_file *m, void *v); |
196 | static int pmu_battery_proc_show(struct seq_file *m, void *v); | ||
196 | static void pmu_pass_intr(unsigned char *data, int len); | 197 | static void pmu_pass_intr(unsigned char *data, int len); |
197 | static const struct file_operations pmu_battery_proc_fops; | ||
198 | static const struct file_operations pmu_options_proc_fops; | 198 | static const struct file_operations pmu_options_proc_fops; |
199 | 199 | ||
200 | #ifdef CONFIG_ADB | 200 | #ifdef CONFIG_ADB |
@@ -511,13 +511,15 @@ static int __init via_pmu_dev_init(void) | |||
511 | for (i=0; i<pmu_battery_count; i++) { | 511 | for (i=0; i<pmu_battery_count; i++) { |
512 | char title[16]; | 512 | char title[16]; |
513 | sprintf(title, "battery_%ld", i); | 513 | sprintf(title, "battery_%ld", i); |
514 | proc_pmu_batt[i] = proc_create_data(title, 0, proc_pmu_root, | 514 | proc_pmu_batt[i] = proc_create_single_data(title, 0, |
515 | &pmu_battery_proc_fops, (void *)i); | 515 | proc_pmu_root, pmu_battery_proc_show, |
516 | (void *)i); | ||
516 | } | 517 | } |
517 | 518 | ||
518 | proc_pmu_info = proc_create("info", 0, proc_pmu_root, &pmu_info_proc_fops); | 519 | proc_pmu_info = proc_create_single("info", 0, proc_pmu_root, |
519 | proc_pmu_irqstats = proc_create("interrupts", 0, proc_pmu_root, | 520 | pmu_info_proc_show); |
520 | &pmu_irqstats_proc_fops); | 521 | proc_pmu_irqstats = proc_create_single("interrupts", 0, |
522 | proc_pmu_root, pmu_irqstats_proc_show); | ||
521 | proc_pmu_options = proc_create("options", 0600, proc_pmu_root, | 523 | proc_pmu_options = proc_create("options", 0600, proc_pmu_root, |
522 | &pmu_options_proc_fops); | 524 | &pmu_options_proc_fops); |
523 | } | 525 | } |
@@ -811,19 +813,6 @@ static int pmu_info_proc_show(struct seq_file *m, void *v) | |||
811 | return 0; | 813 | return 0; |
812 | } | 814 | } |
813 | 815 | ||
814 | static int pmu_info_proc_open(struct inode *inode, struct file *file) | ||
815 | { | ||
816 | return single_open(file, pmu_info_proc_show, NULL); | ||
817 | } | ||
818 | |||
819 | static const struct file_operations pmu_info_proc_fops = { | ||
820 | .owner = THIS_MODULE, | ||
821 | .open = pmu_info_proc_open, | ||
822 | .read = seq_read, | ||
823 | .llseek = seq_lseek, | ||
824 | .release = single_release, | ||
825 | }; | ||
826 | |||
827 | static int pmu_irqstats_proc_show(struct seq_file *m, void *v) | 816 | static int pmu_irqstats_proc_show(struct seq_file *m, void *v) |
828 | { | 817 | { |
829 | int i; | 818 | int i; |
@@ -848,19 +837,6 @@ static int pmu_irqstats_proc_show(struct seq_file *m, void *v) | |||
848 | return 0; | 837 | return 0; |
849 | } | 838 | } |
850 | 839 | ||
851 | static int pmu_irqstats_proc_open(struct inode *inode, struct file *file) | ||
852 | { | ||
853 | return single_open(file, pmu_irqstats_proc_show, NULL); | ||
854 | } | ||
855 | |||
856 | static const struct file_operations pmu_irqstats_proc_fops = { | ||
857 | .owner = THIS_MODULE, | ||
858 | .open = pmu_irqstats_proc_open, | ||
859 | .read = seq_read, | ||
860 | .llseek = seq_lseek, | ||
861 | .release = single_release, | ||
862 | }; | ||
863 | |||
864 | static int pmu_battery_proc_show(struct seq_file *m, void *v) | 840 | static int pmu_battery_proc_show(struct seq_file *m, void *v) |
865 | { | 841 | { |
866 | long batnum = (long)m->private; | 842 | long batnum = (long)m->private; |
@@ -875,19 +851,6 @@ static int pmu_battery_proc_show(struct seq_file *m, void *v) | |||
875 | return 0; | 851 | return 0; |
876 | } | 852 | } |
877 | 853 | ||
878 | static int pmu_battery_proc_open(struct inode *inode, struct file *file) | ||
879 | { | ||
880 | return single_open(file, pmu_battery_proc_show, PDE_DATA(inode)); | ||
881 | } | ||
882 | |||
883 | static const struct file_operations pmu_battery_proc_fops = { | ||
884 | .owner = THIS_MODULE, | ||
885 | .open = pmu_battery_proc_open, | ||
886 | .read = seq_read, | ||
887 | .llseek = seq_lseek, | ||
888 | .release = single_release, | ||
889 | }; | ||
890 | |||
891 | static int pmu_options_proc_show(struct seq_file *m, void *v) | 854 | static int pmu_options_proc_show(struct seq_file *m, void *v) |
892 | { | 855 | { |
893 | #if defined(CONFIG_SUSPEND) && defined(CONFIG_PPC32) | 856 | #if defined(CONFIG_SUSPEND) && defined(CONFIG_PPC32) |
diff --git a/drivers/media/pci/saa7164/saa7164-core.c b/drivers/media/pci/saa7164/saa7164-core.c index fca36a4910c2..d697e1ad929c 100644 --- a/drivers/media/pci/saa7164/saa7164-core.c +++ b/drivers/media/pci/saa7164/saa7164-core.c | |||
@@ -1122,23 +1122,11 @@ static int saa7164_proc_show(struct seq_file *m, void *v) | |||
1122 | return 0; | 1122 | return 0; |
1123 | } | 1123 | } |
1124 | 1124 | ||
1125 | static int saa7164_proc_open(struct inode *inode, struct file *filp) | ||
1126 | { | ||
1127 | return single_open(filp, saa7164_proc_show, NULL); | ||
1128 | } | ||
1129 | |||
1130 | static const struct file_operations saa7164_proc_fops = { | ||
1131 | .open = saa7164_proc_open, | ||
1132 | .read = seq_read, | ||
1133 | .llseek = seq_lseek, | ||
1134 | .release = single_release, | ||
1135 | }; | ||
1136 | |||
1137 | static int saa7164_proc_create(void) | 1125 | static int saa7164_proc_create(void) |
1138 | { | 1126 | { |
1139 | struct proc_dir_entry *pe; | 1127 | struct proc_dir_entry *pe; |
1140 | 1128 | ||
1141 | pe = proc_create("saa7164", S_IRUGO, NULL, &saa7164_proc_fops); | 1129 | pe = proc_create_single("saa7164", S_IRUGO, NULL, saa7164_proc_show); |
1142 | if (!pe) | 1130 | if (!pe) |
1143 | return -ENOMEM; | 1131 | return -ENOMEM; |
1144 | 1132 | ||
diff --git a/drivers/media/pci/zoran/videocodec.c b/drivers/media/pci/zoran/videocodec.c index 5ff23ef89215..4427ae7126e2 100644 --- a/drivers/media/pci/zoran/videocodec.c +++ b/drivers/media/pci/zoran/videocodec.c | |||
@@ -344,19 +344,6 @@ static int proc_videocodecs_show(struct seq_file *m, void *v) | |||
344 | 344 | ||
345 | return 0; | 345 | return 0; |
346 | } | 346 | } |
347 | |||
348 | static int proc_videocodecs_open(struct inode *inode, struct file *file) | ||
349 | { | ||
350 | return single_open(file, proc_videocodecs_show, NULL); | ||
351 | } | ||
352 | |||
353 | static const struct file_operations videocodecs_proc_fops = { | ||
354 | .owner = THIS_MODULE, | ||
355 | .open = proc_videocodecs_open, | ||
356 | .read = seq_read, | ||
357 | .llseek = seq_lseek, | ||
358 | .release = single_release, | ||
359 | }; | ||
360 | #endif | 347 | #endif |
361 | 348 | ||
362 | /* ===================== */ | 349 | /* ===================== */ |
@@ -373,7 +360,8 @@ videocodec_init (void) | |||
373 | VIDEOCODEC_VERSION); | 360 | VIDEOCODEC_VERSION); |
374 | 361 | ||
375 | #ifdef CONFIG_PROC_FS | 362 | #ifdef CONFIG_PROC_FS |
376 | videocodec_proc_entry = proc_create("videocodecs", 0, NULL, &videocodecs_proc_fops); | 363 | videocodec_proc_entry = proc_create_single("videocodecs", 0, NULL, |
364 | proc_videocodecs_show); | ||
377 | if (!videocodec_proc_entry) { | 365 | if (!videocodec_proc_entry) { |
378 | dprintk(1, KERN_ERR "videocodec: can't init procfs.\n"); | 366 | dprintk(1, KERN_ERR "videocodec: can't init procfs.\n"); |
379 | } | 367 | } |
diff --git a/drivers/message/fusion/mptbase.c b/drivers/message/fusion/mptbase.c index 51eb1b027963..a746ccdd630a 100644 --- a/drivers/message/fusion/mptbase.c +++ b/drivers/message/fusion/mptbase.c | |||
@@ -197,9 +197,9 @@ static int mpt_host_page_access_control(MPT_ADAPTER *ioc, u8 access_control_valu | |||
197 | static int mpt_host_page_alloc(MPT_ADAPTER *ioc, pIOCInit_t ioc_init); | 197 | static int mpt_host_page_alloc(MPT_ADAPTER *ioc, pIOCInit_t ioc_init); |
198 | 198 | ||
199 | #ifdef CONFIG_PROC_FS | 199 | #ifdef CONFIG_PROC_FS |
200 | static const struct file_operations mpt_summary_proc_fops; | 200 | static int mpt_summary_proc_show(struct seq_file *m, void *v); |
201 | static const struct file_operations mpt_version_proc_fops; | 201 | static int mpt_version_proc_show(struct seq_file *m, void *v); |
202 | static const struct file_operations mpt_iocinfo_proc_fops; | 202 | static int mpt_iocinfo_proc_show(struct seq_file *m, void *v); |
203 | #endif | 203 | #endif |
204 | static void mpt_get_fw_exp_ver(char *buf, MPT_ADAPTER *ioc); | 204 | static void mpt_get_fw_exp_ver(char *buf, MPT_ADAPTER *ioc); |
205 | 205 | ||
@@ -2040,8 +2040,10 @@ mpt_attach(struct pci_dev *pdev, const struct pci_device_id *id) | |||
2040 | */ | 2040 | */ |
2041 | dent = proc_mkdir(ioc->name, mpt_proc_root_dir); | 2041 | dent = proc_mkdir(ioc->name, mpt_proc_root_dir); |
2042 | if (dent) { | 2042 | if (dent) { |
2043 | proc_create_data("info", S_IRUGO, dent, &mpt_iocinfo_proc_fops, ioc); | 2043 | proc_create_single_data("info", S_IRUGO, dent, |
2044 | proc_create_data("summary", S_IRUGO, dent, &mpt_summary_proc_fops, ioc); | 2044 | mpt_iocinfo_proc_show, ioc); |
2045 | proc_create_single_data("summary", S_IRUGO, dent, | ||
2046 | mpt_summary_proc_show, ioc); | ||
2045 | } | 2047 | } |
2046 | #endif | 2048 | #endif |
2047 | 2049 | ||
@@ -6606,8 +6608,10 @@ procmpt_create(void) | |||
6606 | if (mpt_proc_root_dir == NULL) | 6608 | if (mpt_proc_root_dir == NULL) |
6607 | return -ENOTDIR; | 6609 | return -ENOTDIR; |
6608 | 6610 | ||
6609 | proc_create("summary", S_IRUGO, mpt_proc_root_dir, &mpt_summary_proc_fops); | 6611 | proc_create_single("summary", S_IRUGO, mpt_proc_root_dir, |
6610 | proc_create("version", S_IRUGO, mpt_proc_root_dir, &mpt_version_proc_fops); | 6612 | mpt_summary_proc_show); |
6613 | proc_create_single("version", S_IRUGO, mpt_proc_root_dir, | ||
6614 | mpt_version_proc_show); | ||
6611 | return 0; | 6615 | return 0; |
6612 | } | 6616 | } |
6613 | 6617 | ||
@@ -6646,19 +6650,6 @@ static int mpt_summary_proc_show(struct seq_file *m, void *v) | |||
6646 | return 0; | 6650 | return 0; |
6647 | } | 6651 | } |
6648 | 6652 | ||
6649 | static int mpt_summary_proc_open(struct inode *inode, struct file *file) | ||
6650 | { | ||
6651 | return single_open(file, mpt_summary_proc_show, PDE_DATA(inode)); | ||
6652 | } | ||
6653 | |||
6654 | static const struct file_operations mpt_summary_proc_fops = { | ||
6655 | .owner = THIS_MODULE, | ||
6656 | .open = mpt_summary_proc_open, | ||
6657 | .read = seq_read, | ||
6658 | .llseek = seq_lseek, | ||
6659 | .release = single_release, | ||
6660 | }; | ||
6661 | |||
6662 | static int mpt_version_proc_show(struct seq_file *m, void *v) | 6653 | static int mpt_version_proc_show(struct seq_file *m, void *v) |
6663 | { | 6654 | { |
6664 | u8 cb_idx; | 6655 | u8 cb_idx; |
@@ -6701,19 +6692,6 @@ static int mpt_version_proc_show(struct seq_file *m, void *v) | |||
6701 | return 0; | 6692 | return 0; |
6702 | } | 6693 | } |
6703 | 6694 | ||
6704 | static int mpt_version_proc_open(struct inode *inode, struct file *file) | ||
6705 | { | ||
6706 | return single_open(file, mpt_version_proc_show, NULL); | ||
6707 | } | ||
6708 | |||
6709 | static const struct file_operations mpt_version_proc_fops = { | ||
6710 | .owner = THIS_MODULE, | ||
6711 | .open = mpt_version_proc_open, | ||
6712 | .read = seq_read, | ||
6713 | .llseek = seq_lseek, | ||
6714 | .release = single_release, | ||
6715 | }; | ||
6716 | |||
6717 | static int mpt_iocinfo_proc_show(struct seq_file *m, void *v) | 6695 | static int mpt_iocinfo_proc_show(struct seq_file *m, void *v) |
6718 | { | 6696 | { |
6719 | MPT_ADAPTER *ioc = m->private; | 6697 | MPT_ADAPTER *ioc = m->private; |
@@ -6793,19 +6771,6 @@ static int mpt_iocinfo_proc_show(struct seq_file *m, void *v) | |||
6793 | 6771 | ||
6794 | return 0; | 6772 | return 0; |
6795 | } | 6773 | } |
6796 | |||
6797 | static int mpt_iocinfo_proc_open(struct inode *inode, struct file *file) | ||
6798 | { | ||
6799 | return single_open(file, mpt_iocinfo_proc_show, PDE_DATA(inode)); | ||
6800 | } | ||
6801 | |||
6802 | static const struct file_operations mpt_iocinfo_proc_fops = { | ||
6803 | .owner = THIS_MODULE, | ||
6804 | .open = mpt_iocinfo_proc_open, | ||
6805 | .read = seq_read, | ||
6806 | .llseek = seq_lseek, | ||
6807 | .release = single_release, | ||
6808 | }; | ||
6809 | #endif /* CONFIG_PROC_FS } */ | 6774 | #endif /* CONFIG_PROC_FS } */ |
6810 | 6775 | ||
6811 | /*=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=*/ | 6776 | /*=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=*/ |
diff --git a/drivers/misc/sgi-gru/gruprocfs.c b/drivers/misc/sgi-gru/gruprocfs.c index 4f7635922394..42ea2eccaee9 100644 --- a/drivers/misc/sgi-gru/gruprocfs.c +++ b/drivers/misc/sgi-gru/gruprocfs.c | |||
@@ -270,16 +270,6 @@ static int options_open(struct inode *inode, struct file *file) | |||
270 | return single_open(file, options_show, NULL); | 270 | return single_open(file, options_show, NULL); |
271 | } | 271 | } |
272 | 272 | ||
273 | static int cch_open(struct inode *inode, struct file *file) | ||
274 | { | ||
275 | return seq_open(file, &cch_seq_ops); | ||
276 | } | ||
277 | |||
278 | static int gru_open(struct inode *inode, struct file *file) | ||
279 | { | ||
280 | return seq_open(file, &gru_seq_ops); | ||
281 | } | ||
282 | |||
283 | /* *INDENT-OFF* */ | 273 | /* *INDENT-OFF* */ |
284 | static const struct file_operations statistics_fops = { | 274 | static const struct file_operations statistics_fops = { |
285 | .open = statistics_open, | 275 | .open = statistics_open, |
@@ -305,73 +295,30 @@ static const struct file_operations options_fops = { | |||
305 | .release = single_release, | 295 | .release = single_release, |
306 | }; | 296 | }; |
307 | 297 | ||
308 | static const struct file_operations cch_fops = { | ||
309 | .open = cch_open, | ||
310 | .read = seq_read, | ||
311 | .llseek = seq_lseek, | ||
312 | .release = seq_release, | ||
313 | }; | ||
314 | static const struct file_operations gru_fops = { | ||
315 | .open = gru_open, | ||
316 | .read = seq_read, | ||
317 | .llseek = seq_lseek, | ||
318 | .release = seq_release, | ||
319 | }; | ||
320 | |||
321 | static struct proc_entry { | ||
322 | char *name; | ||
323 | umode_t mode; | ||
324 | const struct file_operations *fops; | ||
325 | struct proc_dir_entry *entry; | ||
326 | } proc_files[] = { | ||
327 | {"statistics", 0644, &statistics_fops}, | ||
328 | {"mcs_statistics", 0644, &mcs_statistics_fops}, | ||
329 | {"debug_options", 0644, &options_fops}, | ||
330 | {"cch_status", 0444, &cch_fops}, | ||
331 | {"gru_status", 0444, &gru_fops}, | ||
332 | {NULL} | ||
333 | }; | ||
334 | /* *INDENT-ON* */ | ||
335 | |||
336 | static struct proc_dir_entry *proc_gru __read_mostly; | 298 | static struct proc_dir_entry *proc_gru __read_mostly; |
337 | 299 | ||
338 | static int create_proc_file(struct proc_entry *p) | ||
339 | { | ||
340 | p->entry = proc_create(p->name, p->mode, proc_gru, p->fops); | ||
341 | if (!p->entry) | ||
342 | return -1; | ||
343 | return 0; | ||
344 | } | ||
345 | |||
346 | static void delete_proc_files(void) | ||
347 | { | ||
348 | struct proc_entry *p; | ||
349 | |||
350 | if (proc_gru) { | ||
351 | for (p = proc_files; p->name; p++) | ||
352 | if (p->entry) | ||
353 | remove_proc_entry(p->name, proc_gru); | ||
354 | proc_remove(proc_gru); | ||
355 | } | ||
356 | } | ||
357 | |||
358 | int gru_proc_init(void) | 300 | int gru_proc_init(void) |
359 | { | 301 | { |
360 | struct proc_entry *p; | ||
361 | |||
362 | proc_gru = proc_mkdir("sgi_uv/gru", NULL); | 302 | proc_gru = proc_mkdir("sgi_uv/gru", NULL); |
363 | 303 | if (!proc_gru) | |
364 | for (p = proc_files; p->name; p++) | 304 | return -1; |
365 | if (create_proc_file(p)) | 305 | if (!proc_create("statistics", 0644, proc_gru, &statistics_fops)) |
366 | goto err; | 306 | goto err; |
307 | if (!proc_create("mcs_statistics", 0644, proc_gru, &mcs_statistics_fops)) | ||
308 | goto err; | ||
309 | if (!proc_create("debug_options", 0644, proc_gru, &options_fops)) | ||
310 | goto err; | ||
311 | if (!proc_create_seq("cch_status", 0444, proc_gru, &cch_seq_ops)) | ||
312 | goto err; | ||
313 | if (!proc_create_seq("gru_status", 0444, proc_gru, &gru_seq_ops)) | ||
314 | goto err; | ||
367 | return 0; | 315 | return 0; |
368 | |||
369 | err: | 316 | err: |
370 | delete_proc_files(); | 317 | remove_proc_subtree("sgi_uv/gru", NULL); |
371 | return -1; | 318 | return -1; |
372 | } | 319 | } |
373 | 320 | ||
374 | void gru_proc_exit(void) | 321 | void gru_proc_exit(void) |
375 | { | 322 | { |
376 | delete_proc_files(); | 323 | remove_proc_subtree("sgi_uv/gru", NULL); |
377 | } | 324 | } |
diff --git a/drivers/mmc/core/sdio_uart.c b/drivers/mmc/core/sdio_uart.c index d3c91f412b69..25e113001a3c 100644 --- a/drivers/mmc/core/sdio_uart.c +++ b/drivers/mmc/core/sdio_uart.c | |||
@@ -1008,19 +1008,6 @@ static int sdio_uart_proc_show(struct seq_file *m, void *v) | |||
1008 | return 0; | 1008 | return 0; |
1009 | } | 1009 | } |
1010 | 1010 | ||
1011 | static int sdio_uart_proc_open(struct inode *inode, struct file *file) | ||
1012 | { | ||
1013 | return single_open(file, sdio_uart_proc_show, NULL); | ||
1014 | } | ||
1015 | |||
1016 | static const struct file_operations sdio_uart_proc_fops = { | ||
1017 | .owner = THIS_MODULE, | ||
1018 | .open = sdio_uart_proc_open, | ||
1019 | .read = seq_read, | ||
1020 | .llseek = seq_lseek, | ||
1021 | .release = single_release, | ||
1022 | }; | ||
1023 | |||
1024 | static const struct tty_port_operations sdio_uart_port_ops = { | 1011 | static const struct tty_port_operations sdio_uart_port_ops = { |
1025 | .dtr_rts = uart_dtr_rts, | 1012 | .dtr_rts = uart_dtr_rts, |
1026 | .carrier_raised = uart_carrier_raised, | 1013 | .carrier_raised = uart_carrier_raised, |
@@ -1045,7 +1032,7 @@ static const struct tty_operations sdio_uart_ops = { | |||
1045 | .tiocmset = sdio_uart_tiocmset, | 1032 | .tiocmset = sdio_uart_tiocmset, |
1046 | .install = sdio_uart_install, | 1033 | .install = sdio_uart_install, |
1047 | .cleanup = sdio_uart_cleanup, | 1034 | .cleanup = sdio_uart_cleanup, |
1048 | .proc_fops = &sdio_uart_proc_fops, | 1035 | .proc_show = sdio_uart_proc_show, |
1049 | }; | 1036 | }; |
1050 | 1037 | ||
1051 | static struct tty_driver *sdio_uart_tty_driver; | 1038 | static struct tty_driver *sdio_uart_tty_driver; |
diff --git a/drivers/mtd/mtdcore.c b/drivers/mtd/mtdcore.c index 807d17d863b3..64a1fcaafd9a 100644 --- a/drivers/mtd/mtdcore.c +++ b/drivers/mtd/mtdcore.c | |||
@@ -1829,18 +1829,6 @@ static int mtd_proc_show(struct seq_file *m, void *v) | |||
1829 | mutex_unlock(&mtd_table_mutex); | 1829 | mutex_unlock(&mtd_table_mutex); |
1830 | return 0; | 1830 | return 0; |
1831 | } | 1831 | } |
1832 | |||
1833 | static int mtd_proc_open(struct inode *inode, struct file *file) | ||
1834 | { | ||
1835 | return single_open(file, mtd_proc_show, NULL); | ||
1836 | } | ||
1837 | |||
1838 | static const struct file_operations mtd_proc_ops = { | ||
1839 | .open = mtd_proc_open, | ||
1840 | .read = seq_read, | ||
1841 | .llseek = seq_lseek, | ||
1842 | .release = single_release, | ||
1843 | }; | ||
1844 | #endif /* CONFIG_PROC_FS */ | 1832 | #endif /* CONFIG_PROC_FS */ |
1845 | 1833 | ||
1846 | /*====================================================================*/ | 1834 | /*====================================================================*/ |
@@ -1883,7 +1871,7 @@ static int __init init_mtd(void) | |||
1883 | goto err_bdi; | 1871 | goto err_bdi; |
1884 | } | 1872 | } |
1885 | 1873 | ||
1886 | proc_mtd = proc_create("mtd", 0, NULL, &mtd_proc_ops); | 1874 | proc_mtd = proc_create_single("mtd", 0, NULL, mtd_proc_show); |
1887 | 1875 | ||
1888 | ret = init_mtdchar(); | 1876 | ret = init_mtdchar(); |
1889 | if (ret) | 1877 | if (ret) |
diff --git a/drivers/net/bonding/bond_procfs.c b/drivers/net/bonding/bond_procfs.c index 01059f1a7bca..9f7d83e827c3 100644 --- a/drivers/net/bonding/bond_procfs.c +++ b/drivers/net/bonding/bond_procfs.c | |||
@@ -10,7 +10,7 @@ | |||
10 | static void *bond_info_seq_start(struct seq_file *seq, loff_t *pos) | 10 | static void *bond_info_seq_start(struct seq_file *seq, loff_t *pos) |
11 | __acquires(RCU) | 11 | __acquires(RCU) |
12 | { | 12 | { |
13 | struct bonding *bond = seq->private; | 13 | struct bonding *bond = PDE_DATA(file_inode(seq->file)); |
14 | struct list_head *iter; | 14 | struct list_head *iter; |
15 | struct slave *slave; | 15 | struct slave *slave; |
16 | loff_t off = 0; | 16 | loff_t off = 0; |
@@ -29,7 +29,7 @@ static void *bond_info_seq_start(struct seq_file *seq, loff_t *pos) | |||
29 | 29 | ||
30 | static void *bond_info_seq_next(struct seq_file *seq, void *v, loff_t *pos) | 30 | static void *bond_info_seq_next(struct seq_file *seq, void *v, loff_t *pos) |
31 | { | 31 | { |
32 | struct bonding *bond = seq->private; | 32 | struct bonding *bond = PDE_DATA(file_inode(seq->file)); |
33 | struct list_head *iter; | 33 | struct list_head *iter; |
34 | struct slave *slave; | 34 | struct slave *slave; |
35 | bool found = false; | 35 | bool found = false; |
@@ -56,7 +56,7 @@ static void bond_info_seq_stop(struct seq_file *seq, void *v) | |||
56 | 56 | ||
57 | static void bond_info_show_master(struct seq_file *seq) | 57 | static void bond_info_show_master(struct seq_file *seq) |
58 | { | 58 | { |
59 | struct bonding *bond = seq->private; | 59 | struct bonding *bond = PDE_DATA(file_inode(seq->file)); |
60 | const struct bond_opt_value *optval; | 60 | const struct bond_opt_value *optval; |
61 | struct slave *curr, *primary; | 61 | struct slave *curr, *primary; |
62 | int i; | 62 | int i; |
@@ -167,7 +167,7 @@ static void bond_info_show_master(struct seq_file *seq) | |||
167 | static void bond_info_show_slave(struct seq_file *seq, | 167 | static void bond_info_show_slave(struct seq_file *seq, |
168 | const struct slave *slave) | 168 | const struct slave *slave) |
169 | { | 169 | { |
170 | struct bonding *bond = seq->private; | 170 | struct bonding *bond = PDE_DATA(file_inode(seq->file)); |
171 | 171 | ||
172 | seq_printf(seq, "\nSlave Interface: %s\n", slave->dev->name); | 172 | seq_printf(seq, "\nSlave Interface: %s\n", slave->dev->name); |
173 | seq_printf(seq, "MII Status: %s\n", bond_slave_link_status(slave->link)); | 173 | seq_printf(seq, "MII Status: %s\n", bond_slave_link_status(slave->link)); |
@@ -257,38 +257,14 @@ static const struct seq_operations bond_info_seq_ops = { | |||
257 | .show = bond_info_seq_show, | 257 | .show = bond_info_seq_show, |
258 | }; | 258 | }; |
259 | 259 | ||
260 | static int bond_info_open(struct inode *inode, struct file *file) | ||
261 | { | ||
262 | struct seq_file *seq; | ||
263 | int res; | ||
264 | |||
265 | res = seq_open(file, &bond_info_seq_ops); | ||
266 | if (!res) { | ||
267 | /* recover the pointer buried in proc_dir_entry data */ | ||
268 | seq = file->private_data; | ||
269 | seq->private = PDE_DATA(inode); | ||
270 | } | ||
271 | |||
272 | return res; | ||
273 | } | ||
274 | |||
275 | static const struct file_operations bond_info_fops = { | ||
276 | .owner = THIS_MODULE, | ||
277 | .open = bond_info_open, | ||
278 | .read = seq_read, | ||
279 | .llseek = seq_lseek, | ||
280 | .release = seq_release, | ||
281 | }; | ||
282 | |||
283 | void bond_create_proc_entry(struct bonding *bond) | 260 | void bond_create_proc_entry(struct bonding *bond) |
284 | { | 261 | { |
285 | struct net_device *bond_dev = bond->dev; | 262 | struct net_device *bond_dev = bond->dev; |
286 | struct bond_net *bn = net_generic(dev_net(bond_dev), bond_net_id); | 263 | struct bond_net *bn = net_generic(dev_net(bond_dev), bond_net_id); |
287 | 264 | ||
288 | if (bn->proc_dir) { | 265 | if (bn->proc_dir) { |
289 | bond->proc_entry = proc_create_data(bond_dev->name, | 266 | bond->proc_entry = proc_create_seq_data(bond_dev->name, 0444, |
290 | 0444, bn->proc_dir, | 267 | bn->proc_dir, &bond_info_seq_ops, bond); |
291 | &bond_info_fops, bond); | ||
292 | if (bond->proc_entry == NULL) | 268 | if (bond->proc_entry == NULL) |
293 | netdev_warn(bond_dev, "Cannot create /proc/net/%s/%s\n", | 269 | netdev_warn(bond_dev, "Cannot create /proc/net/%s/%s\n", |
294 | DRV_NAME, bond_dev->name); | 270 | DRV_NAME, bond_dev->name); |
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/net/ppp/pppoe.c b/drivers/net/ppp/pppoe.c index 7df07337d69c..ce61231e96ea 100644 --- a/drivers/net/ppp/pppoe.c +++ b/drivers/net/ppp/pppoe.c | |||
@@ -1096,21 +1096,6 @@ static const struct seq_operations pppoe_seq_ops = { | |||
1096 | .stop = pppoe_seq_stop, | 1096 | .stop = pppoe_seq_stop, |
1097 | .show = pppoe_seq_show, | 1097 | .show = pppoe_seq_show, |
1098 | }; | 1098 | }; |
1099 | |||
1100 | static int pppoe_seq_open(struct inode *inode, struct file *file) | ||
1101 | { | ||
1102 | return seq_open_net(inode, file, &pppoe_seq_ops, | ||
1103 | sizeof(struct seq_net_private)); | ||
1104 | } | ||
1105 | |||
1106 | static const struct file_operations pppoe_seq_fops = { | ||
1107 | .owner = THIS_MODULE, | ||
1108 | .open = pppoe_seq_open, | ||
1109 | .read = seq_read, | ||
1110 | .llseek = seq_lseek, | ||
1111 | .release = seq_release_net, | ||
1112 | }; | ||
1113 | |||
1114 | #endif /* CONFIG_PROC_FS */ | 1099 | #endif /* CONFIG_PROC_FS */ |
1115 | 1100 | ||
1116 | static const struct proto_ops pppoe_ops = { | 1101 | static const struct proto_ops pppoe_ops = { |
@@ -1146,7 +1131,8 @@ static __net_init int pppoe_init_net(struct net *net) | |||
1146 | 1131 | ||
1147 | rwlock_init(&pn->hash_lock); | 1132 | rwlock_init(&pn->hash_lock); |
1148 | 1133 | ||
1149 | pde = proc_create("pppoe", 0444, net->proc_net, &pppoe_seq_fops); | 1134 | pde = proc_create_net("pppoe", 0444, net->proc_net, |
1135 | &pppoe_seq_ops, sizeof(struct seq_net_private)); | ||
1150 | #ifdef CONFIG_PROC_FS | 1136 | #ifdef CONFIG_PROC_FS |
1151 | if (!pde) | 1137 | if (!pde) |
1152 | return -ENOMEM; | 1138 | return -ENOMEM; |
diff --git a/drivers/net/wireless/atmel/atmel.c b/drivers/net/wireless/atmel/atmel.c index d122386c382b..b01dc34d55af 100644 --- a/drivers/net/wireless/atmel/atmel.c +++ b/drivers/net/wireless/atmel/atmel.c | |||
@@ -1482,18 +1482,6 @@ static int atmel_proc_show(struct seq_file *m, void *v) | |||
1482 | return 0; | 1482 | return 0; |
1483 | } | 1483 | } |
1484 | 1484 | ||
1485 | static int atmel_proc_open(struct inode *inode, struct file *file) | ||
1486 | { | ||
1487 | return single_open(file, atmel_proc_show, PDE_DATA(inode)); | ||
1488 | } | ||
1489 | |||
1490 | static const struct file_operations atmel_proc_fops = { | ||
1491 | .open = atmel_proc_open, | ||
1492 | .read = seq_read, | ||
1493 | .llseek = seq_lseek, | ||
1494 | .release = single_release, | ||
1495 | }; | ||
1496 | |||
1497 | static const struct net_device_ops atmel_netdev_ops = { | 1485 | static const struct net_device_ops atmel_netdev_ops = { |
1498 | .ndo_open = atmel_open, | 1486 | .ndo_open = atmel_open, |
1499 | .ndo_stop = atmel_close, | 1487 | .ndo_stop = atmel_close, |
@@ -1614,7 +1602,8 @@ struct net_device *init_atmel_card(unsigned short irq, unsigned long port, | |||
1614 | 1602 | ||
1615 | netif_carrier_off(dev); | 1603 | netif_carrier_off(dev); |
1616 | 1604 | ||
1617 | if (!proc_create_data("driver/atmel", 0, NULL, &atmel_proc_fops, priv)) | 1605 | if (!proc_create_single_data("driver/atmel", 0, NULL, atmel_proc_show, |
1606 | priv)) | ||
1618 | printk(KERN_WARNING "atmel: unable to create /proc entry.\n"); | 1607 | printk(KERN_WARNING "atmel: unable to create /proc entry.\n"); |
1619 | 1608 | ||
1620 | printk(KERN_INFO "%s: Atmel at76c50x. Version %d.%d. MAC %pM\n", | 1609 | printk(KERN_INFO "%s: Atmel at76c50x. Version %d.%d. MAC %pM\n", |
diff --git a/drivers/net/wireless/intersil/hostap/hostap_ap.c b/drivers/net/wireless/intersil/hostap/hostap_ap.c index b4dfe1893d18..d1884b8913e7 100644 --- a/drivers/net/wireless/intersil/hostap/hostap_ap.c +++ b/drivers/net/wireless/intersil/hostap/hostap_ap.c | |||
@@ -69,7 +69,7 @@ static void prism2_send_mgmt(struct net_device *dev, | |||
69 | #ifndef PRISM2_NO_PROCFS_DEBUG | 69 | #ifndef PRISM2_NO_PROCFS_DEBUG |
70 | static int ap_debug_proc_show(struct seq_file *m, void *v) | 70 | static int ap_debug_proc_show(struct seq_file *m, void *v) |
71 | { | 71 | { |
72 | struct ap_data *ap = m->private; | 72 | struct ap_data *ap = PDE_DATA(file_inode(m->file)); |
73 | 73 | ||
74 | seq_printf(m, "BridgedUnicastFrames=%u\n", ap->bridged_unicast); | 74 | seq_printf(m, "BridgedUnicastFrames=%u\n", ap->bridged_unicast); |
75 | seq_printf(m, "BridgedMulticastFrames=%u\n", ap->bridged_multicast); | 75 | seq_printf(m, "BridgedMulticastFrames=%u\n", ap->bridged_multicast); |
@@ -81,18 +81,6 @@ static int ap_debug_proc_show(struct seq_file *m, void *v) | |||
81 | seq_printf(m, "tx_drop_nonassoc=%u\n", ap->tx_drop_nonassoc); | 81 | seq_printf(m, "tx_drop_nonassoc=%u\n", ap->tx_drop_nonassoc); |
82 | return 0; | 82 | return 0; |
83 | } | 83 | } |
84 | |||
85 | static int ap_debug_proc_open(struct inode *inode, struct file *file) | ||
86 | { | ||
87 | return single_open(file, ap_debug_proc_show, PDE_DATA(inode)); | ||
88 | } | ||
89 | |||
90 | static const struct file_operations ap_debug_proc_fops = { | ||
91 | .open = ap_debug_proc_open, | ||
92 | .read = seq_read, | ||
93 | .llseek = seq_lseek, | ||
94 | .release = single_release, | ||
95 | }; | ||
96 | #endif /* PRISM2_NO_PROCFS_DEBUG */ | 84 | #endif /* PRISM2_NO_PROCFS_DEBUG */ |
97 | 85 | ||
98 | 86 | ||
@@ -333,7 +321,7 @@ void hostap_deauth_all_stas(struct net_device *dev, struct ap_data *ap, | |||
333 | 321 | ||
334 | static int ap_control_proc_show(struct seq_file *m, void *v) | 322 | static int ap_control_proc_show(struct seq_file *m, void *v) |
335 | { | 323 | { |
336 | struct ap_data *ap = m->private; | 324 | struct ap_data *ap = PDE_DATA(file_inode(m->file)); |
337 | char *policy_txt; | 325 | char *policy_txt; |
338 | struct mac_entry *entry; | 326 | struct mac_entry *entry; |
339 | 327 | ||
@@ -365,20 +353,20 @@ static int ap_control_proc_show(struct seq_file *m, void *v) | |||
365 | 353 | ||
366 | static void *ap_control_proc_start(struct seq_file *m, loff_t *_pos) | 354 | static void *ap_control_proc_start(struct seq_file *m, loff_t *_pos) |
367 | { | 355 | { |
368 | struct ap_data *ap = m->private; | 356 | struct ap_data *ap = PDE_DATA(file_inode(m->file)); |
369 | spin_lock_bh(&ap->mac_restrictions.lock); | 357 | spin_lock_bh(&ap->mac_restrictions.lock); |
370 | return seq_list_start_head(&ap->mac_restrictions.mac_list, *_pos); | 358 | return seq_list_start_head(&ap->mac_restrictions.mac_list, *_pos); |
371 | } | 359 | } |
372 | 360 | ||
373 | static void *ap_control_proc_next(struct seq_file *m, void *v, loff_t *_pos) | 361 | static void *ap_control_proc_next(struct seq_file *m, void *v, loff_t *_pos) |
374 | { | 362 | { |
375 | struct ap_data *ap = m->private; | 363 | struct ap_data *ap = PDE_DATA(file_inode(m->file)); |
376 | return seq_list_next(v, &ap->mac_restrictions.mac_list, _pos); | 364 | return seq_list_next(v, &ap->mac_restrictions.mac_list, _pos); |
377 | } | 365 | } |
378 | 366 | ||
379 | static void ap_control_proc_stop(struct seq_file *m, void *v) | 367 | static void ap_control_proc_stop(struct seq_file *m, void *v) |
380 | { | 368 | { |
381 | struct ap_data *ap = m->private; | 369 | struct ap_data *ap = PDE_DATA(file_inode(m->file)); |
382 | spin_unlock_bh(&ap->mac_restrictions.lock); | 370 | spin_unlock_bh(&ap->mac_restrictions.lock); |
383 | } | 371 | } |
384 | 372 | ||
@@ -389,24 +377,6 @@ static const struct seq_operations ap_control_proc_seqops = { | |||
389 | .show = ap_control_proc_show, | 377 | .show = ap_control_proc_show, |
390 | }; | 378 | }; |
391 | 379 | ||
392 | static int ap_control_proc_open(struct inode *inode, struct file *file) | ||
393 | { | ||
394 | int ret = seq_open(file, &ap_control_proc_seqops); | ||
395 | if (ret == 0) { | ||
396 | struct seq_file *m = file->private_data; | ||
397 | m->private = PDE_DATA(inode); | ||
398 | } | ||
399 | return ret; | ||
400 | } | ||
401 | |||
402 | static const struct file_operations ap_control_proc_fops = { | ||
403 | .open = ap_control_proc_open, | ||
404 | .read = seq_read, | ||
405 | .llseek = seq_lseek, | ||
406 | .release = seq_release, | ||
407 | }; | ||
408 | |||
409 | |||
410 | int ap_control_add_mac(struct mac_restrictions *mac_restrictions, u8 *mac) | 380 | int ap_control_add_mac(struct mac_restrictions *mac_restrictions, u8 *mac) |
411 | { | 381 | { |
412 | struct mac_entry *entry; | 382 | struct mac_entry *entry; |
@@ -585,20 +555,20 @@ static int prism2_ap_proc_show(struct seq_file *m, void *v) | |||
585 | 555 | ||
586 | static void *prism2_ap_proc_start(struct seq_file *m, loff_t *_pos) | 556 | static void *prism2_ap_proc_start(struct seq_file *m, loff_t *_pos) |
587 | { | 557 | { |
588 | struct ap_data *ap = m->private; | 558 | struct ap_data *ap = PDE_DATA(file_inode(m->file)); |
589 | spin_lock_bh(&ap->sta_table_lock); | 559 | spin_lock_bh(&ap->sta_table_lock); |
590 | return seq_list_start_head(&ap->sta_list, *_pos); | 560 | return seq_list_start_head(&ap->sta_list, *_pos); |
591 | } | 561 | } |
592 | 562 | ||
593 | static void *prism2_ap_proc_next(struct seq_file *m, void *v, loff_t *_pos) | 563 | static void *prism2_ap_proc_next(struct seq_file *m, void *v, loff_t *_pos) |
594 | { | 564 | { |
595 | struct ap_data *ap = m->private; | 565 | struct ap_data *ap = PDE_DATA(file_inode(m->file)); |
596 | return seq_list_next(v, &ap->sta_list, _pos); | 566 | return seq_list_next(v, &ap->sta_list, _pos); |
597 | } | 567 | } |
598 | 568 | ||
599 | static void prism2_ap_proc_stop(struct seq_file *m, void *v) | 569 | static void prism2_ap_proc_stop(struct seq_file *m, void *v) |
600 | { | 570 | { |
601 | struct ap_data *ap = m->private; | 571 | struct ap_data *ap = PDE_DATA(file_inode(m->file)); |
602 | spin_unlock_bh(&ap->sta_table_lock); | 572 | spin_unlock_bh(&ap->sta_table_lock); |
603 | } | 573 | } |
604 | 574 | ||
@@ -608,23 +578,6 @@ static const struct seq_operations prism2_ap_proc_seqops = { | |||
608 | .stop = prism2_ap_proc_stop, | 578 | .stop = prism2_ap_proc_stop, |
609 | .show = prism2_ap_proc_show, | 579 | .show = prism2_ap_proc_show, |
610 | }; | 580 | }; |
611 | |||
612 | static int prism2_ap_proc_open(struct inode *inode, struct file *file) | ||
613 | { | ||
614 | int ret = seq_open(file, &prism2_ap_proc_seqops); | ||
615 | if (ret == 0) { | ||
616 | struct seq_file *m = file->private_data; | ||
617 | m->private = PDE_DATA(inode); | ||
618 | } | ||
619 | return ret; | ||
620 | } | ||
621 | |||
622 | static const struct file_operations prism2_ap_proc_fops = { | ||
623 | .open = prism2_ap_proc_open, | ||
624 | .read = seq_read, | ||
625 | .llseek = seq_lseek, | ||
626 | .release = seq_release, | ||
627 | }; | ||
628 | #endif /* PRISM2_NO_KERNEL_IEEE80211_MGMT */ | 581 | #endif /* PRISM2_NO_KERNEL_IEEE80211_MGMT */ |
629 | 582 | ||
630 | 583 | ||
@@ -896,12 +849,13 @@ void hostap_init_ap_proc(local_info_t *local) | |||
896 | return; | 849 | return; |
897 | 850 | ||
898 | #ifndef PRISM2_NO_PROCFS_DEBUG | 851 | #ifndef PRISM2_NO_PROCFS_DEBUG |
899 | proc_create_data("ap_debug", 0, ap->proc, &ap_debug_proc_fops, ap); | 852 | proc_create_single_data("ap_debug", 0, ap->proc, ap_debug_proc_show, ap); |
900 | #endif /* PRISM2_NO_PROCFS_DEBUG */ | 853 | #endif /* PRISM2_NO_PROCFS_DEBUG */ |
901 | 854 | ||
902 | #ifndef PRISM2_NO_KERNEL_IEEE80211_MGMT | 855 | #ifndef PRISM2_NO_KERNEL_IEEE80211_MGMT |
903 | proc_create_data("ap_control", 0, ap->proc, &ap_control_proc_fops, ap); | 856 | proc_create_seq_data("ap_control", 0, ap->proc, &ap_control_proc_seqops, |
904 | proc_create_data("ap", 0, ap->proc, &prism2_ap_proc_fops, ap); | 857 | ap); |
858 | proc_create_seq_data("ap", 0, ap->proc, &prism2_ap_proc_seqops, ap); | ||
905 | #endif /* PRISM2_NO_KERNEL_IEEE80211_MGMT */ | 859 | #endif /* PRISM2_NO_KERNEL_IEEE80211_MGMT */ |
906 | 860 | ||
907 | } | 861 | } |
@@ -1106,18 +1060,6 @@ static int prism2_sta_proc_show(struct seq_file *m, void *v) | |||
1106 | return 0; | 1060 | return 0; |
1107 | } | 1061 | } |
1108 | 1062 | ||
1109 | static int prism2_sta_proc_open(struct inode *inode, struct file *file) | ||
1110 | { | ||
1111 | return single_open(file, prism2_sta_proc_show, PDE_DATA(inode)); | ||
1112 | } | ||
1113 | |||
1114 | static const struct file_operations prism2_sta_proc_fops = { | ||
1115 | .open = prism2_sta_proc_open, | ||
1116 | .read = seq_read, | ||
1117 | .llseek = seq_lseek, | ||
1118 | .release = single_release, | ||
1119 | }; | ||
1120 | |||
1121 | static void handle_add_proc_queue(struct work_struct *work) | 1063 | static void handle_add_proc_queue(struct work_struct *work) |
1122 | { | 1064 | { |
1123 | struct ap_data *ap = container_of(work, struct ap_data, | 1065 | struct ap_data *ap = container_of(work, struct ap_data, |
@@ -1138,9 +1080,9 @@ static void handle_add_proc_queue(struct work_struct *work) | |||
1138 | 1080 | ||
1139 | if (sta) { | 1081 | if (sta) { |
1140 | sprintf(name, "%pM", sta->addr); | 1082 | sprintf(name, "%pM", sta->addr); |
1141 | sta->proc = proc_create_data( | 1083 | sta->proc = proc_create_single_data( |
1142 | name, 0, ap->proc, | 1084 | name, 0, ap->proc, |
1143 | &prism2_sta_proc_fops, sta); | 1085 | prism2_sta_proc_show, sta); |
1144 | 1086 | ||
1145 | atomic_dec(&sta->users); | 1087 | atomic_dec(&sta->users); |
1146 | } | 1088 | } |
diff --git a/drivers/net/wireless/intersil/hostap/hostap_hw.c b/drivers/net/wireless/intersil/hostap/hostap_hw.c index 5c4a17a18968..2720aa39f530 100644 --- a/drivers/net/wireless/intersil/hostap/hostap_hw.c +++ b/drivers/net/wireless/intersil/hostap/hostap_hw.c | |||
@@ -2951,19 +2951,6 @@ static int prism2_registers_proc_show(struct seq_file *m, void *v) | |||
2951 | 2951 | ||
2952 | return 0; | 2952 | return 0; |
2953 | } | 2953 | } |
2954 | |||
2955 | static int prism2_registers_proc_open(struct inode *inode, struct file *file) | ||
2956 | { | ||
2957 | return single_open(file, prism2_registers_proc_show, PDE_DATA(inode)); | ||
2958 | } | ||
2959 | |||
2960 | static const struct file_operations prism2_registers_proc_fops = { | ||
2961 | .open = prism2_registers_proc_open, | ||
2962 | .read = seq_read, | ||
2963 | .llseek = seq_lseek, | ||
2964 | .release = single_release, | ||
2965 | }; | ||
2966 | |||
2967 | #endif /* PRISM2_NO_PROCFS_DEBUG */ | 2954 | #endif /* PRISM2_NO_PROCFS_DEBUG */ |
2968 | 2955 | ||
2969 | 2956 | ||
@@ -3279,8 +3266,8 @@ static int hostap_hw_ready(struct net_device *dev) | |||
3279 | } | 3266 | } |
3280 | hostap_init_proc(local); | 3267 | hostap_init_proc(local); |
3281 | #ifndef PRISM2_NO_PROCFS_DEBUG | 3268 | #ifndef PRISM2_NO_PROCFS_DEBUG |
3282 | proc_create_data("registers", 0, local->proc, | 3269 | proc_create_single_data("registers", 0, local->proc, |
3283 | &prism2_registers_proc_fops, local); | 3270 | prism2_registers_proc_show, local); |
3284 | #endif /* PRISM2_NO_PROCFS_DEBUG */ | 3271 | #endif /* PRISM2_NO_PROCFS_DEBUG */ |
3285 | hostap_init_ap_proc(local); | 3272 | hostap_init_ap_proc(local); |
3286 | return 0; | 3273 | return 0; |
diff --git a/drivers/net/wireless/intersil/hostap/hostap_proc.c b/drivers/net/wireless/intersil/hostap/hostap_proc.c index d234231bf532..5b33ccab9188 100644 --- a/drivers/net/wireless/intersil/hostap/hostap_proc.c +++ b/drivers/net/wireless/intersil/hostap/hostap_proc.c | |||
@@ -43,18 +43,6 @@ static int prism2_debug_proc_show(struct seq_file *m, void *v) | |||
43 | 43 | ||
44 | return 0; | 44 | return 0; |
45 | } | 45 | } |
46 | |||
47 | static int prism2_debug_proc_open(struct inode *inode, struct file *file) | ||
48 | { | ||
49 | return single_open(file, prism2_debug_proc_show, PDE_DATA(inode)); | ||
50 | } | ||
51 | |||
52 | static const struct file_operations prism2_debug_proc_fops = { | ||
53 | .open = prism2_debug_proc_open, | ||
54 | .read = seq_read, | ||
55 | .llseek = seq_lseek, | ||
56 | .release = single_release, | ||
57 | }; | ||
58 | #endif /* PRISM2_NO_PROCFS_DEBUG */ | 46 | #endif /* PRISM2_NO_PROCFS_DEBUG */ |
59 | 47 | ||
60 | 48 | ||
@@ -95,19 +83,6 @@ static int prism2_stats_proc_show(struct seq_file *m, void *v) | |||
95 | return 0; | 83 | return 0; |
96 | } | 84 | } |
97 | 85 | ||
98 | static int prism2_stats_proc_open(struct inode *inode, struct file *file) | ||
99 | { | ||
100 | return single_open(file, prism2_stats_proc_show, PDE_DATA(inode)); | ||
101 | } | ||
102 | |||
103 | static const struct file_operations prism2_stats_proc_fops = { | ||
104 | .open = prism2_stats_proc_open, | ||
105 | .read = seq_read, | ||
106 | .llseek = seq_lseek, | ||
107 | .release = single_release, | ||
108 | }; | ||
109 | |||
110 | |||
111 | static int prism2_wds_proc_show(struct seq_file *m, void *v) | 86 | static int prism2_wds_proc_show(struct seq_file *m, void *v) |
112 | { | 87 | { |
113 | struct list_head *ptr = v; | 88 | struct list_head *ptr = v; |
@@ -122,20 +97,20 @@ static int prism2_wds_proc_show(struct seq_file *m, void *v) | |||
122 | 97 | ||
123 | static void *prism2_wds_proc_start(struct seq_file *m, loff_t *_pos) | 98 | static void *prism2_wds_proc_start(struct seq_file *m, loff_t *_pos) |
124 | { | 99 | { |
125 | local_info_t *local = m->private; | 100 | local_info_t *local = PDE_DATA(file_inode(m->file)); |
126 | read_lock_bh(&local->iface_lock); | 101 | read_lock_bh(&local->iface_lock); |
127 | return seq_list_start(&local->hostap_interfaces, *_pos); | 102 | return seq_list_start(&local->hostap_interfaces, *_pos); |
128 | } | 103 | } |
129 | 104 | ||
130 | static void *prism2_wds_proc_next(struct seq_file *m, void *v, loff_t *_pos) | 105 | static void *prism2_wds_proc_next(struct seq_file *m, void *v, loff_t *_pos) |
131 | { | 106 | { |
132 | local_info_t *local = m->private; | 107 | local_info_t *local = PDE_DATA(file_inode(m->file)); |
133 | return seq_list_next(v, &local->hostap_interfaces, _pos); | 108 | return seq_list_next(v, &local->hostap_interfaces, _pos); |
134 | } | 109 | } |
135 | 110 | ||
136 | static void prism2_wds_proc_stop(struct seq_file *m, void *v) | 111 | static void prism2_wds_proc_stop(struct seq_file *m, void *v) |
137 | { | 112 | { |
138 | local_info_t *local = m->private; | 113 | local_info_t *local = PDE_DATA(file_inode(m->file)); |
139 | read_unlock_bh(&local->iface_lock); | 114 | read_unlock_bh(&local->iface_lock); |
140 | } | 115 | } |
141 | 116 | ||
@@ -146,27 +121,9 @@ static const struct seq_operations prism2_wds_proc_seqops = { | |||
146 | .show = prism2_wds_proc_show, | 121 | .show = prism2_wds_proc_show, |
147 | }; | 122 | }; |
148 | 123 | ||
149 | static int prism2_wds_proc_open(struct inode *inode, struct file *file) | ||
150 | { | ||
151 | int ret = seq_open(file, &prism2_wds_proc_seqops); | ||
152 | if (ret == 0) { | ||
153 | struct seq_file *m = file->private_data; | ||
154 | m->private = PDE_DATA(inode); | ||
155 | } | ||
156 | return ret; | ||
157 | } | ||
158 | |||
159 | static const struct file_operations prism2_wds_proc_fops = { | ||
160 | .open = prism2_wds_proc_open, | ||
161 | .read = seq_read, | ||
162 | .llseek = seq_lseek, | ||
163 | .release = seq_release, | ||
164 | }; | ||
165 | |||
166 | |||
167 | static int prism2_bss_list_proc_show(struct seq_file *m, void *v) | 124 | static int prism2_bss_list_proc_show(struct seq_file *m, void *v) |
168 | { | 125 | { |
169 | local_info_t *local = m->private; | 126 | local_info_t *local = PDE_DATA(file_inode(m->file)); |
170 | struct list_head *ptr = v; | 127 | struct list_head *ptr = v; |
171 | struct hostap_bss_info *bss; | 128 | struct hostap_bss_info *bss; |
172 | 129 | ||
@@ -193,20 +150,20 @@ static int prism2_bss_list_proc_show(struct seq_file *m, void *v) | |||
193 | 150 | ||
194 | static void *prism2_bss_list_proc_start(struct seq_file *m, loff_t *_pos) | 151 | static void *prism2_bss_list_proc_start(struct seq_file *m, loff_t *_pos) |
195 | { | 152 | { |
196 | local_info_t *local = m->private; | 153 | local_info_t *local = PDE_DATA(file_inode(m->file)); |
197 | spin_lock_bh(&local->lock); | 154 | spin_lock_bh(&local->lock); |
198 | return seq_list_start_head(&local->bss_list, *_pos); | 155 | return seq_list_start_head(&local->bss_list, *_pos); |
199 | } | 156 | } |
200 | 157 | ||
201 | static void *prism2_bss_list_proc_next(struct seq_file *m, void *v, loff_t *_pos) | 158 | static void *prism2_bss_list_proc_next(struct seq_file *m, void *v, loff_t *_pos) |
202 | { | 159 | { |
203 | local_info_t *local = m->private; | 160 | local_info_t *local = PDE_DATA(file_inode(m->file)); |
204 | return seq_list_next(v, &local->bss_list, _pos); | 161 | return seq_list_next(v, &local->bss_list, _pos); |
205 | } | 162 | } |
206 | 163 | ||
207 | static void prism2_bss_list_proc_stop(struct seq_file *m, void *v) | 164 | static void prism2_bss_list_proc_stop(struct seq_file *m, void *v) |
208 | { | 165 | { |
209 | local_info_t *local = m->private; | 166 | local_info_t *local = PDE_DATA(file_inode(m->file)); |
210 | spin_unlock_bh(&local->lock); | 167 | spin_unlock_bh(&local->lock); |
211 | } | 168 | } |
212 | 169 | ||
@@ -217,24 +174,6 @@ static const struct seq_operations prism2_bss_list_proc_seqops = { | |||
217 | .show = prism2_bss_list_proc_show, | 174 | .show = prism2_bss_list_proc_show, |
218 | }; | 175 | }; |
219 | 176 | ||
220 | static int prism2_bss_list_proc_open(struct inode *inode, struct file *file) | ||
221 | { | ||
222 | int ret = seq_open(file, &prism2_bss_list_proc_seqops); | ||
223 | if (ret == 0) { | ||
224 | struct seq_file *m = file->private_data; | ||
225 | m->private = PDE_DATA(inode); | ||
226 | } | ||
227 | return ret; | ||
228 | } | ||
229 | |||
230 | static const struct file_operations prism2_bss_list_proc_fops = { | ||
231 | .open = prism2_bss_list_proc_open, | ||
232 | .read = seq_read, | ||
233 | .llseek = seq_lseek, | ||
234 | .release = seq_release, | ||
235 | }; | ||
236 | |||
237 | |||
238 | static int prism2_crypt_proc_show(struct seq_file *m, void *v) | 177 | static int prism2_crypt_proc_show(struct seq_file *m, void *v) |
239 | { | 178 | { |
240 | local_info_t *local = m->private; | 179 | local_info_t *local = m->private; |
@@ -252,19 +191,6 @@ static int prism2_crypt_proc_show(struct seq_file *m, void *v) | |||
252 | return 0; | 191 | return 0; |
253 | } | 192 | } |
254 | 193 | ||
255 | static int prism2_crypt_proc_open(struct inode *inode, struct file *file) | ||
256 | { | ||
257 | return single_open(file, prism2_crypt_proc_show, PDE_DATA(inode)); | ||
258 | } | ||
259 | |||
260 | static const struct file_operations prism2_crypt_proc_fops = { | ||
261 | .open = prism2_crypt_proc_open, | ||
262 | .read = seq_read, | ||
263 | .llseek = seq_lseek, | ||
264 | .release = single_release, | ||
265 | }; | ||
266 | |||
267 | |||
268 | static ssize_t prism2_pda_proc_read(struct file *file, char __user *buf, | 194 | static ssize_t prism2_pda_proc_read(struct file *file, char __user *buf, |
269 | size_t count, loff_t *_pos) | 195 | size_t count, loff_t *_pos) |
270 | { | 196 | { |
@@ -342,7 +268,7 @@ static int prism2_io_debug_proc_read(char *page, char **start, off_t off, | |||
342 | #ifndef PRISM2_NO_STATION_MODES | 268 | #ifndef PRISM2_NO_STATION_MODES |
343 | static int prism2_scan_results_proc_show(struct seq_file *m, void *v) | 269 | static int prism2_scan_results_proc_show(struct seq_file *m, void *v) |
344 | { | 270 | { |
345 | local_info_t *local = m->private; | 271 | local_info_t *local = PDE_DATA(file_inode(m->file)); |
346 | unsigned long entry; | 272 | unsigned long entry; |
347 | int i, len; | 273 | int i, len; |
348 | struct hfa384x_hostscan_result *scanres; | 274 | struct hfa384x_hostscan_result *scanres; |
@@ -392,7 +318,7 @@ static int prism2_scan_results_proc_show(struct seq_file *m, void *v) | |||
392 | 318 | ||
393 | static void *prism2_scan_results_proc_start(struct seq_file *m, loff_t *_pos) | 319 | static void *prism2_scan_results_proc_start(struct seq_file *m, loff_t *_pos) |
394 | { | 320 | { |
395 | local_info_t *local = m->private; | 321 | local_info_t *local = PDE_DATA(file_inode(m->file)); |
396 | spin_lock_bh(&local->lock); | 322 | spin_lock_bh(&local->lock); |
397 | 323 | ||
398 | /* We have a header (pos 0) + N results to show (pos 1...N) */ | 324 | /* We have a header (pos 0) + N results to show (pos 1...N) */ |
@@ -403,7 +329,7 @@ static void *prism2_scan_results_proc_start(struct seq_file *m, loff_t *_pos) | |||
403 | 329 | ||
404 | static void *prism2_scan_results_proc_next(struct seq_file *m, void *v, loff_t *_pos) | 330 | static void *prism2_scan_results_proc_next(struct seq_file *m, void *v, loff_t *_pos) |
405 | { | 331 | { |
406 | local_info_t *local = m->private; | 332 | local_info_t *local = PDE_DATA(file_inode(m->file)); |
407 | 333 | ||
408 | ++*_pos; | 334 | ++*_pos; |
409 | if (*_pos > local->last_scan_results_count) | 335 | if (*_pos > local->last_scan_results_count) |
@@ -413,7 +339,7 @@ static void *prism2_scan_results_proc_next(struct seq_file *m, void *v, loff_t * | |||
413 | 339 | ||
414 | static void prism2_scan_results_proc_stop(struct seq_file *m, void *v) | 340 | static void prism2_scan_results_proc_stop(struct seq_file *m, void *v) |
415 | { | 341 | { |
416 | local_info_t *local = m->private; | 342 | local_info_t *local = PDE_DATA(file_inode(m->file)); |
417 | spin_unlock_bh(&local->lock); | 343 | spin_unlock_bh(&local->lock); |
418 | } | 344 | } |
419 | 345 | ||
@@ -423,25 +349,6 @@ static const struct seq_operations prism2_scan_results_proc_seqops = { | |||
423 | .stop = prism2_scan_results_proc_stop, | 349 | .stop = prism2_scan_results_proc_stop, |
424 | .show = prism2_scan_results_proc_show, | 350 | .show = prism2_scan_results_proc_show, |
425 | }; | 351 | }; |
426 | |||
427 | static int prism2_scan_results_proc_open(struct inode *inode, struct file *file) | ||
428 | { | ||
429 | int ret = seq_open(file, &prism2_scan_results_proc_seqops); | ||
430 | if (ret == 0) { | ||
431 | struct seq_file *m = file->private_data; | ||
432 | m->private = PDE_DATA(inode); | ||
433 | } | ||
434 | return ret; | ||
435 | } | ||
436 | |||
437 | static const struct file_operations prism2_scan_results_proc_fops = { | ||
438 | .open = prism2_scan_results_proc_open, | ||
439 | .read = seq_read, | ||
440 | .llseek = seq_lseek, | ||
441 | .release = seq_release, | ||
442 | }; | ||
443 | |||
444 | |||
445 | #endif /* PRISM2_NO_STATION_MODES */ | 352 | #endif /* PRISM2_NO_STATION_MODES */ |
446 | 353 | ||
447 | 354 | ||
@@ -463,29 +370,29 @@ void hostap_init_proc(local_info_t *local) | |||
463 | } | 370 | } |
464 | 371 | ||
465 | #ifndef PRISM2_NO_PROCFS_DEBUG | 372 | #ifndef PRISM2_NO_PROCFS_DEBUG |
466 | proc_create_data("debug", 0, local->proc, | 373 | proc_create_single_data("debug", 0, local->proc, |
467 | &prism2_debug_proc_fops, local); | 374 | prism2_debug_proc_show, local); |
468 | #endif /* PRISM2_NO_PROCFS_DEBUG */ | 375 | #endif /* PRISM2_NO_PROCFS_DEBUG */ |
469 | proc_create_data("stats", 0, local->proc, | 376 | proc_create_single_data("stats", 0, local->proc, prism2_stats_proc_show, |
470 | &prism2_stats_proc_fops, local); | 377 | local); |
471 | proc_create_data("wds", 0, local->proc, | 378 | proc_create_seq_data("wds", 0, local->proc, |
472 | &prism2_wds_proc_fops, local); | 379 | &prism2_wds_proc_seqops, local); |
473 | proc_create_data("pda", 0, local->proc, | 380 | proc_create_data("pda", 0, local->proc, |
474 | &prism2_pda_proc_fops, local); | 381 | &prism2_pda_proc_fops, local); |
475 | proc_create_data("aux_dump", 0, local->proc, | 382 | proc_create_data("aux_dump", 0, local->proc, |
476 | local->func->read_aux_fops ?: &prism2_aux_dump_proc_fops, | 383 | local->func->read_aux_fops ?: &prism2_aux_dump_proc_fops, |
477 | local); | 384 | local); |
478 | proc_create_data("bss_list", 0, local->proc, | 385 | proc_create_seq_data("bss_list", 0, local->proc, |
479 | &prism2_bss_list_proc_fops, local); | 386 | &prism2_bss_list_proc_seqops, local); |
480 | proc_create_data("crypt", 0, local->proc, | 387 | proc_create_single_data("crypt", 0, local->proc, prism2_crypt_proc_show, |
481 | &prism2_crypt_proc_fops, local); | 388 | local); |
482 | #ifdef PRISM2_IO_DEBUG | 389 | #ifdef PRISM2_IO_DEBUG |
483 | proc_create_data("io_debug", 0, local->proc, | 390 | proc_create_single_data("io_debug", 0, local->proc, |
484 | &prism2_io_debug_proc_fops, local); | 391 | prism2_debug_proc_show, local); |
485 | #endif /* PRISM2_IO_DEBUG */ | 392 | #endif /* PRISM2_IO_DEBUG */ |
486 | #ifndef PRISM2_NO_STATION_MODES | 393 | #ifndef PRISM2_NO_STATION_MODES |
487 | proc_create_data("scan_results", 0, local->proc, | 394 | proc_create_seq_data("scan_results", 0, local->proc, |
488 | &prism2_scan_results_proc_fops, local); | 395 | &prism2_scan_results_proc_seqops, local); |
489 | #endif /* PRISM2_NO_STATION_MODES */ | 396 | #endif /* PRISM2_NO_STATION_MODES */ |
490 | } | 397 | } |
491 | 398 | ||
diff --git a/drivers/net/wireless/ray_cs.c b/drivers/net/wireless/ray_cs.c index 7f9b16b97ea3..a7e0a17aa7e8 100644 --- a/drivers/net/wireless/ray_cs.c +++ b/drivers/net/wireless/ray_cs.c | |||
@@ -2663,19 +2663,6 @@ static int ray_cs_proc_show(struct seq_file *m, void *v) | |||
2663 | } | 2663 | } |
2664 | return 0; | 2664 | return 0; |
2665 | } | 2665 | } |
2666 | |||
2667 | static int ray_cs_proc_open(struct inode *inode, struct file *file) | ||
2668 | { | ||
2669 | return single_open(file, ray_cs_proc_show, NULL); | ||
2670 | } | ||
2671 | |||
2672 | static const struct file_operations ray_cs_proc_fops = { | ||
2673 | .owner = THIS_MODULE, | ||
2674 | .open = ray_cs_proc_open, | ||
2675 | .read = seq_read, | ||
2676 | .llseek = seq_lseek, | ||
2677 | .release = single_release, | ||
2678 | }; | ||
2679 | #endif | 2666 | #endif |
2680 | /*===========================================================================*/ | 2667 | /*===========================================================================*/ |
2681 | static int build_auth_frame(ray_dev_t *local, UCHAR *dest, int auth_type) | 2668 | static int build_auth_frame(ray_dev_t *local, UCHAR *dest, int auth_type) |
@@ -2814,7 +2801,7 @@ static int __init init_ray_cs(void) | |||
2814 | #ifdef CONFIG_PROC_FS | 2801 | #ifdef CONFIG_PROC_FS |
2815 | proc_mkdir("driver/ray_cs", NULL); | 2802 | proc_mkdir("driver/ray_cs", NULL); |
2816 | 2803 | ||
2817 | proc_create("driver/ray_cs/ray_cs", 0, NULL, &ray_cs_proc_fops); | 2804 | proc_create_single("driver/ray_cs/ray_cs", 0, NULL, ray_cs_proc_show); |
2818 | proc_create("driver/ray_cs/essid", 0200, NULL, &ray_cs_essid_proc_fops); | 2805 | proc_create("driver/ray_cs/essid", 0200, NULL, &ray_cs_essid_proc_fops); |
2819 | proc_create_data("driver/ray_cs/net_type", 0200, NULL, &int_proc_fops, | 2806 | proc_create_data("driver/ray_cs/net_type", 0200, NULL, &int_proc_fops, |
2820 | &net_type); | 2807 | &net_type); |
diff --git a/drivers/nubus/proc.c b/drivers/nubus/proc.c index c2e5a7e6bd3e..88e1f9a0faaf 100644 --- a/drivers/nubus/proc.c +++ b/drivers/nubus/proc.c | |||
@@ -45,18 +45,6 @@ nubus_devices_proc_show(struct seq_file *m, void *v) | |||
45 | return 0; | 45 | return 0; |
46 | } | 46 | } |
47 | 47 | ||
48 | static int nubus_devices_proc_open(struct inode *inode, struct file *file) | ||
49 | { | ||
50 | return single_open(file, nubus_devices_proc_show, NULL); | ||
51 | } | ||
52 | |||
53 | static const struct file_operations nubus_devices_proc_fops = { | ||
54 | .open = nubus_devices_proc_open, | ||
55 | .read = seq_read, | ||
56 | .llseek = seq_lseek, | ||
57 | .release = single_release, | ||
58 | }; | ||
59 | |||
60 | static struct proc_dir_entry *proc_bus_nubus_dir; | 48 | static struct proc_dir_entry *proc_bus_nubus_dir; |
61 | 49 | ||
62 | /* | 50 | /* |
@@ -149,18 +137,6 @@ static int nubus_proc_rsrc_show(struct seq_file *m, void *v) | |||
149 | return 0; | 137 | return 0; |
150 | } | 138 | } |
151 | 139 | ||
152 | static int nubus_proc_rsrc_open(struct inode *inode, struct file *file) | ||
153 | { | ||
154 | return single_open(file, nubus_proc_rsrc_show, inode); | ||
155 | } | ||
156 | |||
157 | static const struct file_operations nubus_proc_rsrc_fops = { | ||
158 | .open = nubus_proc_rsrc_open, | ||
159 | .read = seq_read, | ||
160 | .llseek = seq_lseek, | ||
161 | .release = single_release, | ||
162 | }; | ||
163 | |||
164 | void nubus_proc_add_rsrc_mem(struct proc_dir_entry *procdir, | 140 | void nubus_proc_add_rsrc_mem(struct proc_dir_entry *procdir, |
165 | const struct nubus_dirent *ent, | 141 | const struct nubus_dirent *ent, |
166 | unsigned int size) | 142 | unsigned int size) |
@@ -176,8 +152,8 @@ void nubus_proc_add_rsrc_mem(struct proc_dir_entry *procdir, | |||
176 | pde_data = nubus_proc_alloc_pde_data(nubus_dirptr(ent), size); | 152 | pde_data = nubus_proc_alloc_pde_data(nubus_dirptr(ent), size); |
177 | else | 153 | else |
178 | pde_data = NULL; | 154 | pde_data = NULL; |
179 | proc_create_data(name, S_IFREG | 0444, procdir, | 155 | proc_create_single_data(name, S_IFREG | 0444, procdir, |
180 | &nubus_proc_rsrc_fops, pde_data); | 156 | nubus_proc_rsrc_show, pde_data); |
181 | } | 157 | } |
182 | 158 | ||
183 | void nubus_proc_add_rsrc(struct proc_dir_entry *procdir, | 159 | void nubus_proc_add_rsrc(struct proc_dir_entry *procdir, |
@@ -190,32 +166,21 @@ void nubus_proc_add_rsrc(struct proc_dir_entry *procdir, | |||
190 | return; | 166 | return; |
191 | 167 | ||
192 | snprintf(name, sizeof(name), "%x", ent->type); | 168 | snprintf(name, sizeof(name), "%x", ent->type); |
193 | proc_create_data(name, S_IFREG | 0444, procdir, | 169 | proc_create_single_data(name, S_IFREG | 0444, procdir, |
194 | &nubus_proc_rsrc_fops, | 170 | nubus_proc_rsrc_show, |
195 | nubus_proc_alloc_pde_data(data, 0)); | 171 | nubus_proc_alloc_pde_data(data, 0)); |
196 | } | 172 | } |
197 | 173 | ||
198 | /* | 174 | /* |
199 | * /proc/nubus stuff | 175 | * /proc/nubus stuff |
200 | */ | 176 | */ |
201 | 177 | ||
202 | static int nubus_proc_open(struct inode *inode, struct file *file) | ||
203 | { | ||
204 | return single_open(file, nubus_proc_show, NULL); | ||
205 | } | ||
206 | |||
207 | static const struct file_operations nubus_proc_fops = { | ||
208 | .open = nubus_proc_open, | ||
209 | .read = seq_read, | ||
210 | .llseek = seq_lseek, | ||
211 | .release = single_release, | ||
212 | }; | ||
213 | |||
214 | void __init nubus_proc_init(void) | 178 | void __init nubus_proc_init(void) |
215 | { | 179 | { |
216 | proc_create("nubus", 0, NULL, &nubus_proc_fops); | 180 | proc_create_single("nubus", 0, NULL, nubus_proc_show); |
217 | proc_bus_nubus_dir = proc_mkdir("bus/nubus", NULL); | 181 | proc_bus_nubus_dir = proc_mkdir("bus/nubus", NULL); |
218 | if (!proc_bus_nubus_dir) | 182 | if (!proc_bus_nubus_dir) |
219 | return; | 183 | return; |
220 | proc_create("devices", 0, proc_bus_nubus_dir, &nubus_devices_proc_fops); | 184 | proc_create_single("devices", 0, proc_bus_nubus_dir, |
185 | nubus_devices_proc_show); | ||
221 | } | 186 | } |
diff --git a/drivers/parisc/ccio-dma.c b/drivers/parisc/ccio-dma.c index 297599fcbc32..d29cedb3f23b 100644 --- a/drivers/parisc/ccio-dma.c +++ b/drivers/parisc/ccio-dma.c | |||
@@ -1108,19 +1108,6 @@ static int ccio_proc_info(struct seq_file *m, void *p) | |||
1108 | return 0; | 1108 | return 0; |
1109 | } | 1109 | } |
1110 | 1110 | ||
1111 | static int ccio_proc_info_open(struct inode *inode, struct file *file) | ||
1112 | { | ||
1113 | return single_open(file, &ccio_proc_info, NULL); | ||
1114 | } | ||
1115 | |||
1116 | static const struct file_operations ccio_proc_info_fops = { | ||
1117 | .owner = THIS_MODULE, | ||
1118 | .open = ccio_proc_info_open, | ||
1119 | .read = seq_read, | ||
1120 | .llseek = seq_lseek, | ||
1121 | .release = single_release, | ||
1122 | }; | ||
1123 | |||
1124 | static int ccio_proc_bitmap_info(struct seq_file *m, void *p) | 1111 | static int ccio_proc_bitmap_info(struct seq_file *m, void *p) |
1125 | { | 1112 | { |
1126 | struct ioc *ioc = ioc_list; | 1113 | struct ioc *ioc = ioc_list; |
@@ -1135,19 +1122,6 @@ static int ccio_proc_bitmap_info(struct seq_file *m, void *p) | |||
1135 | 1122 | ||
1136 | return 0; | 1123 | return 0; |
1137 | } | 1124 | } |
1138 | |||
1139 | static int ccio_proc_bitmap_open(struct inode *inode, struct file *file) | ||
1140 | { | ||
1141 | return single_open(file, &ccio_proc_bitmap_info, NULL); | ||
1142 | } | ||
1143 | |||
1144 | static const struct file_operations ccio_proc_bitmap_fops = { | ||
1145 | .owner = THIS_MODULE, | ||
1146 | .open = ccio_proc_bitmap_open, | ||
1147 | .read = seq_read, | ||
1148 | .llseek = seq_lseek, | ||
1149 | .release = single_release, | ||
1150 | }; | ||
1151 | #endif /* CONFIG_PROC_FS */ | 1125 | #endif /* CONFIG_PROC_FS */ |
1152 | 1126 | ||
1153 | /** | 1127 | /** |
@@ -1589,10 +1563,10 @@ static int __init ccio_probe(struct parisc_device *dev) | |||
1589 | 1563 | ||
1590 | #ifdef CONFIG_PROC_FS | 1564 | #ifdef CONFIG_PROC_FS |
1591 | if (ioc_count == 0) { | 1565 | if (ioc_count == 0) { |
1592 | proc_create(MODULE_NAME, 0, proc_runway_root, | 1566 | proc_create_single(MODULE_NAME, 0, proc_runway_root, |
1593 | &ccio_proc_info_fops); | 1567 | ccio_proc_info); |
1594 | proc_create(MODULE_NAME"-bitmap", 0, proc_runway_root, | 1568 | proc_create_single(MODULE_NAME"-bitmap", 0, proc_runway_root, |
1595 | &ccio_proc_bitmap_fops); | 1569 | ccio_proc_bitmap_info); |
1596 | } | 1570 | } |
1597 | #endif | 1571 | #endif |
1598 | ioc_count++; | 1572 | ioc_count++; |
diff --git a/drivers/parisc/sba_iommu.c b/drivers/parisc/sba_iommu.c index 0a9c762a70fa..0d33d1f86d10 100644 --- a/drivers/parisc/sba_iommu.c +++ b/drivers/parisc/sba_iommu.c | |||
@@ -1864,20 +1864,6 @@ static int sba_proc_info(struct seq_file *m, void *p) | |||
1864 | } | 1864 | } |
1865 | 1865 | ||
1866 | static int | 1866 | static int |
1867 | sba_proc_open(struct inode *i, struct file *f) | ||
1868 | { | ||
1869 | return single_open(f, &sba_proc_info, NULL); | ||
1870 | } | ||
1871 | |||
1872 | static const struct file_operations sba_proc_fops = { | ||
1873 | .owner = THIS_MODULE, | ||
1874 | .open = sba_proc_open, | ||
1875 | .read = seq_read, | ||
1876 | .llseek = seq_lseek, | ||
1877 | .release = single_release, | ||
1878 | }; | ||
1879 | |||
1880 | static int | ||
1881 | sba_proc_bitmap_info(struct seq_file *m, void *p) | 1867 | sba_proc_bitmap_info(struct seq_file *m, void *p) |
1882 | { | 1868 | { |
1883 | struct sba_device *sba_dev = sba_list; | 1869 | struct sba_device *sba_dev = sba_list; |
@@ -1889,20 +1875,6 @@ sba_proc_bitmap_info(struct seq_file *m, void *p) | |||
1889 | 1875 | ||
1890 | return 0; | 1876 | return 0; |
1891 | } | 1877 | } |
1892 | |||
1893 | static int | ||
1894 | sba_proc_bitmap_open(struct inode *i, struct file *f) | ||
1895 | { | ||
1896 | return single_open(f, &sba_proc_bitmap_info, NULL); | ||
1897 | } | ||
1898 | |||
1899 | static const struct file_operations sba_proc_bitmap_fops = { | ||
1900 | .owner = THIS_MODULE, | ||
1901 | .open = sba_proc_bitmap_open, | ||
1902 | .read = seq_read, | ||
1903 | .llseek = seq_lseek, | ||
1904 | .release = single_release, | ||
1905 | }; | ||
1906 | #endif /* CONFIG_PROC_FS */ | 1878 | #endif /* CONFIG_PROC_FS */ |
1907 | 1879 | ||
1908 | static const struct parisc_device_id sba_tbl[] __initconst = { | 1880 | static const struct parisc_device_id sba_tbl[] __initconst = { |
@@ -2014,8 +1986,8 @@ static int __init sba_driver_callback(struct parisc_device *dev) | |||
2014 | break; | 1986 | break; |
2015 | } | 1987 | } |
2016 | 1988 | ||
2017 | proc_create("sba_iommu", 0, root, &sba_proc_fops); | 1989 | proc_create_single("sba_iommu", 0, root, sba_proc_info); |
2018 | proc_create("sba_iommu-bitmap", 0, root, &sba_proc_bitmap_fops); | 1990 | proc_create_single("sba_iommu-bitmap", 0, root, sba_proc_bitmap_info); |
2019 | #endif | 1991 | #endif |
2020 | 1992 | ||
2021 | parisc_has_iommu(); | 1993 | parisc_has_iommu(); |
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/platform/x86/toshiba_acpi.c b/drivers/platform/x86/toshiba_acpi.c index e8d058c5ef21..eef76bfa5d73 100644 --- a/drivers/platform/x86/toshiba_acpi.c +++ b/drivers/platform/x86/toshiba_acpi.c | |||
@@ -1689,19 +1689,6 @@ static int version_proc_show(struct seq_file *m, void *v) | |||
1689 | return 0; | 1689 | return 0; |
1690 | } | 1690 | } |
1691 | 1691 | ||
1692 | static int version_proc_open(struct inode *inode, struct file *file) | ||
1693 | { | ||
1694 | return single_open(file, version_proc_show, PDE_DATA(inode)); | ||
1695 | } | ||
1696 | |||
1697 | static const struct file_operations version_proc_fops = { | ||
1698 | .owner = THIS_MODULE, | ||
1699 | .open = version_proc_open, | ||
1700 | .read = seq_read, | ||
1701 | .llseek = seq_lseek, | ||
1702 | .release = single_release, | ||
1703 | }; | ||
1704 | |||
1705 | /* | 1692 | /* |
1706 | * Proc and module init | 1693 | * Proc and module init |
1707 | */ | 1694 | */ |
@@ -1722,8 +1709,8 @@ static void create_toshiba_proc_entries(struct toshiba_acpi_dev *dev) | |||
1722 | if (dev->hotkey_dev) | 1709 | if (dev->hotkey_dev) |
1723 | proc_create_data("keys", S_IRUGO | S_IWUSR, toshiba_proc_dir, | 1710 | proc_create_data("keys", S_IRUGO | S_IWUSR, toshiba_proc_dir, |
1724 | &keys_proc_fops, dev); | 1711 | &keys_proc_fops, dev); |
1725 | proc_create_data("version", S_IRUGO, toshiba_proc_dir, | 1712 | proc_create_single_data("version", S_IRUGO, toshiba_proc_dir, |
1726 | &version_proc_fops, dev); | 1713 | version_proc_show, dev); |
1727 | } | 1714 | } |
1728 | 1715 | ||
1729 | static void remove_toshiba_proc_entries(struct toshiba_acpi_dev *dev) | 1716 | static void remove_toshiba_proc_entries(struct toshiba_acpi_dev *dev) |
diff --git a/drivers/pnp/pnpbios/proc.c b/drivers/pnp/pnpbios/proc.c index 7d4aca7948dd..fe1c8f5d9af0 100644 --- a/drivers/pnp/pnpbios/proc.c +++ b/drivers/pnp/pnpbios/proc.c | |||
@@ -47,19 +47,6 @@ static int pnpconfig_proc_show(struct seq_file *m, void *v) | |||
47 | return 0; | 47 | return 0; |
48 | } | 48 | } |
49 | 49 | ||
50 | static int pnpconfig_proc_open(struct inode *inode, struct file *file) | ||
51 | { | ||
52 | return single_open(file, pnpconfig_proc_show, NULL); | ||
53 | } | ||
54 | |||
55 | static const struct file_operations pnpconfig_proc_fops = { | ||
56 | .owner = THIS_MODULE, | ||
57 | .open = pnpconfig_proc_open, | ||
58 | .read = seq_read, | ||
59 | .llseek = seq_lseek, | ||
60 | .release = single_release, | ||
61 | }; | ||
62 | |||
63 | static int escd_info_proc_show(struct seq_file *m, void *v) | 50 | static int escd_info_proc_show(struct seq_file *m, void *v) |
64 | { | 51 | { |
65 | struct escd_info_struc escd; | 52 | struct escd_info_struc escd; |
@@ -74,19 +61,6 @@ static int escd_info_proc_show(struct seq_file *m, void *v) | |||
74 | return 0; | 61 | return 0; |
75 | } | 62 | } |
76 | 63 | ||
77 | static int escd_info_proc_open(struct inode *inode, struct file *file) | ||
78 | { | ||
79 | return single_open(file, escd_info_proc_show, NULL); | ||
80 | } | ||
81 | |||
82 | static const struct file_operations escd_info_proc_fops = { | ||
83 | .owner = THIS_MODULE, | ||
84 | .open = escd_info_proc_open, | ||
85 | .read = seq_read, | ||
86 | .llseek = seq_lseek, | ||
87 | .release = single_release, | ||
88 | }; | ||
89 | |||
90 | #define MAX_SANE_ESCD_SIZE (32*1024) | 64 | #define MAX_SANE_ESCD_SIZE (32*1024) |
91 | static int escd_proc_show(struct seq_file *m, void *v) | 65 | static int escd_proc_show(struct seq_file *m, void *v) |
92 | { | 66 | { |
@@ -129,19 +103,6 @@ static int escd_proc_show(struct seq_file *m, void *v) | |||
129 | return 0; | 103 | return 0; |
130 | } | 104 | } |
131 | 105 | ||
132 | static int escd_proc_open(struct inode *inode, struct file *file) | ||
133 | { | ||
134 | return single_open(file, escd_proc_show, NULL); | ||
135 | } | ||
136 | |||
137 | static const struct file_operations escd_proc_fops = { | ||
138 | .owner = THIS_MODULE, | ||
139 | .open = escd_proc_open, | ||
140 | .read = seq_read, | ||
141 | .llseek = seq_lseek, | ||
142 | .release = single_release, | ||
143 | }; | ||
144 | |||
145 | static int pnp_legacyres_proc_show(struct seq_file *m, void *v) | 106 | static int pnp_legacyres_proc_show(struct seq_file *m, void *v) |
146 | { | 107 | { |
147 | void *buf; | 108 | void *buf; |
@@ -159,19 +120,6 @@ static int pnp_legacyres_proc_show(struct seq_file *m, void *v) | |||
159 | return 0; | 120 | return 0; |
160 | } | 121 | } |
161 | 122 | ||
162 | static int pnp_legacyres_proc_open(struct inode *inode, struct file *file) | ||
163 | { | ||
164 | return single_open(file, pnp_legacyres_proc_show, NULL); | ||
165 | } | ||
166 | |||
167 | static const struct file_operations pnp_legacyres_proc_fops = { | ||
168 | .owner = THIS_MODULE, | ||
169 | .open = pnp_legacyres_proc_open, | ||
170 | .read = seq_read, | ||
171 | .llseek = seq_lseek, | ||
172 | .release = single_release, | ||
173 | }; | ||
174 | |||
175 | static int pnp_devices_proc_show(struct seq_file *m, void *v) | 123 | static int pnp_devices_proc_show(struct seq_file *m, void *v) |
176 | { | 124 | { |
177 | struct pnp_bios_node *node; | 125 | struct pnp_bios_node *node; |
@@ -202,19 +150,6 @@ static int pnp_devices_proc_show(struct seq_file *m, void *v) | |||
202 | return 0; | 150 | return 0; |
203 | } | 151 | } |
204 | 152 | ||
205 | static int pnp_devices_proc_open(struct inode *inode, struct file *file) | ||
206 | { | ||
207 | return single_open(file, pnp_devices_proc_show, NULL); | ||
208 | } | ||
209 | |||
210 | static const struct file_operations pnp_devices_proc_fops = { | ||
211 | .owner = THIS_MODULE, | ||
212 | .open = pnp_devices_proc_open, | ||
213 | .read = seq_read, | ||
214 | .llseek = seq_lseek, | ||
215 | .release = single_release, | ||
216 | }; | ||
217 | |||
218 | static int pnpbios_proc_show(struct seq_file *m, void *v) | 153 | static int pnpbios_proc_show(struct seq_file *m, void *v) |
219 | { | 154 | { |
220 | void *data = m->private; | 155 | void *data = m->private; |
@@ -318,12 +253,13 @@ int __init pnpbios_proc_init(void) | |||
318 | proc_pnp_boot = proc_mkdir("boot", proc_pnp); | 253 | proc_pnp_boot = proc_mkdir("boot", proc_pnp); |
319 | if (!proc_pnp_boot) | 254 | if (!proc_pnp_boot) |
320 | return -EIO; | 255 | return -EIO; |
321 | proc_create("devices", 0, proc_pnp, &pnp_devices_proc_fops); | 256 | proc_create_single("devices", 0, proc_pnp, pnp_devices_proc_show); |
322 | proc_create("configuration_info", 0, proc_pnp, &pnpconfig_proc_fops); | 257 | proc_create_single("configuration_info", 0, proc_pnp, |
323 | proc_create("escd_info", 0, proc_pnp, &escd_info_proc_fops); | 258 | pnpconfig_proc_show); |
324 | proc_create("escd", S_IRUSR, proc_pnp, &escd_proc_fops); | 259 | proc_create_single("escd_info", 0, proc_pnp, escd_info_proc_show); |
325 | proc_create("legacy_device_resources", 0, proc_pnp, &pnp_legacyres_proc_fops); | 260 | proc_create_single("escd", S_IRUSR, proc_pnp, escd_proc_show); |
326 | 261 | proc_create_single("legacy_device_resources", 0, proc_pnp, | |
262 | pnp_legacyres_proc_show); | ||
327 | return 0; | 263 | return 0; |
328 | } | 264 | } |
329 | 265 | ||
diff --git a/drivers/rtc/rtc-proc.c b/drivers/rtc/rtc-proc.c index 31e7e23cc5be..a9dd9218fae2 100644 --- a/drivers/rtc/rtc-proc.c +++ b/drivers/rtc/rtc-proc.c | |||
@@ -107,40 +107,11 @@ static int rtc_proc_show(struct seq_file *seq, void *offset) | |||
107 | return 0; | 107 | return 0; |
108 | } | 108 | } |
109 | 109 | ||
110 | static int rtc_proc_open(struct inode *inode, struct file *file) | ||
111 | { | ||
112 | int ret; | ||
113 | struct rtc_device *rtc = PDE_DATA(inode); | ||
114 | |||
115 | if (!try_module_get(rtc->owner)) | ||
116 | return -ENODEV; | ||
117 | |||
118 | ret = single_open(file, rtc_proc_show, rtc); | ||
119 | if (ret) | ||
120 | module_put(rtc->owner); | ||
121 | return ret; | ||
122 | } | ||
123 | |||
124 | static int rtc_proc_release(struct inode *inode, struct file *file) | ||
125 | { | ||
126 | int res = single_release(inode, file); | ||
127 | struct rtc_device *rtc = PDE_DATA(inode); | ||
128 | |||
129 | module_put(rtc->owner); | ||
130 | return res; | ||
131 | } | ||
132 | |||
133 | static const struct file_operations rtc_proc_fops = { | ||
134 | .open = rtc_proc_open, | ||
135 | .read = seq_read, | ||
136 | .llseek = seq_lseek, | ||
137 | .release = rtc_proc_release, | ||
138 | }; | ||
139 | |||
140 | void rtc_proc_add_device(struct rtc_device *rtc) | 110 | void rtc_proc_add_device(struct rtc_device *rtc) |
141 | { | 111 | { |
142 | if (is_rtc_hctosys(rtc)) | 112 | if (is_rtc_hctosys(rtc)) |
143 | proc_create_data("driver/rtc", 0, NULL, &rtc_proc_fops, rtc); | 113 | proc_create_single_data("driver/rtc", 0, NULL, rtc_proc_show, |
114 | rtc); | ||
144 | } | 115 | } |
145 | 116 | ||
146 | void rtc_proc_del_device(struct rtc_device *rtc) | 117 | void rtc_proc_del_device(struct rtc_device *rtc) |
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/scsi/megaraid.c b/drivers/scsi/megaraid.c index 7195cff51d4c..91f5e2c68dbc 100644 --- a/drivers/scsi/megaraid.c +++ b/drivers/scsi/megaraid.c | |||
@@ -2731,53 +2731,6 @@ proc_show_rdrv_40(struct seq_file *m, void *v) | |||
2731 | return proc_show_rdrv(m, m->private, 30, 39); | 2731 | return proc_show_rdrv(m, m->private, 30, 39); |
2732 | } | 2732 | } |
2733 | 2733 | ||
2734 | |||
2735 | /* | ||
2736 | * seq_file wrappers for procfile show routines. | ||
2737 | */ | ||
2738 | static int mega_proc_open(struct inode *inode, struct file *file) | ||
2739 | { | ||
2740 | adapter_t *adapter = proc_get_parent_data(inode); | ||
2741 | int (*show)(struct seq_file *, void *) = PDE_DATA(inode); | ||
2742 | |||
2743 | return single_open(file, show, adapter); | ||
2744 | } | ||
2745 | |||
2746 | static const struct file_operations mega_proc_fops = { | ||
2747 | .open = mega_proc_open, | ||
2748 | .read = seq_read, | ||
2749 | .llseek = seq_lseek, | ||
2750 | .release = single_release, | ||
2751 | }; | ||
2752 | |||
2753 | /* | ||
2754 | * Table of proc files we need to create. | ||
2755 | */ | ||
2756 | struct mega_proc_file { | ||
2757 | const char *name; | ||
2758 | unsigned short ptr_offset; | ||
2759 | int (*show) (struct seq_file *m, void *v); | ||
2760 | }; | ||
2761 | |||
2762 | static const struct mega_proc_file mega_proc_files[] = { | ||
2763 | { "config", offsetof(adapter_t, proc_read), proc_show_config }, | ||
2764 | { "stat", offsetof(adapter_t, proc_stat), proc_show_stat }, | ||
2765 | { "mailbox", offsetof(adapter_t, proc_mbox), proc_show_mbox }, | ||
2766 | #if MEGA_HAVE_ENH_PROC | ||
2767 | { "rebuild-rate", offsetof(adapter_t, proc_rr), proc_show_rebuild_rate }, | ||
2768 | { "battery-status", offsetof(adapter_t, proc_battery), proc_show_battery }, | ||
2769 | { "diskdrives-ch0", offsetof(adapter_t, proc_pdrvstat[0]), proc_show_pdrv_ch0 }, | ||
2770 | { "diskdrives-ch1", offsetof(adapter_t, proc_pdrvstat[1]), proc_show_pdrv_ch1 }, | ||
2771 | { "diskdrives-ch2", offsetof(adapter_t, proc_pdrvstat[2]), proc_show_pdrv_ch2 }, | ||
2772 | { "diskdrives-ch3", offsetof(adapter_t, proc_pdrvstat[3]), proc_show_pdrv_ch3 }, | ||
2773 | { "raiddrives-0-9", offsetof(adapter_t, proc_rdrvstat[0]), proc_show_rdrv_10 }, | ||
2774 | { "raiddrives-10-19", offsetof(adapter_t, proc_rdrvstat[1]), proc_show_rdrv_20 }, | ||
2775 | { "raiddrives-20-29", offsetof(adapter_t, proc_rdrvstat[2]), proc_show_rdrv_30 }, | ||
2776 | { "raiddrives-30-39", offsetof(adapter_t, proc_rdrvstat[3]), proc_show_rdrv_40 }, | ||
2777 | #endif | ||
2778 | { NULL } | ||
2779 | }; | ||
2780 | |||
2781 | /** | 2734 | /** |
2782 | * mega_create_proc_entry() | 2735 | * mega_create_proc_entry() |
2783 | * @index - index in soft state array | 2736 | * @index - index in soft state array |
@@ -2788,31 +2741,45 @@ static const struct mega_proc_file mega_proc_files[] = { | |||
2788 | static void | 2741 | static void |
2789 | mega_create_proc_entry(int index, struct proc_dir_entry *parent) | 2742 | mega_create_proc_entry(int index, struct proc_dir_entry *parent) |
2790 | { | 2743 | { |
2791 | const struct mega_proc_file *f; | 2744 | adapter_t *adapter = hba_soft_state[index]; |
2792 | adapter_t *adapter = hba_soft_state[index]; | 2745 | struct proc_dir_entry *dir; |
2793 | struct proc_dir_entry *dir, *de, **ppde; | 2746 | u8 string[16]; |
2794 | u8 string[16]; | ||
2795 | 2747 | ||
2796 | sprintf(string, "hba%d", adapter->host->host_no); | 2748 | sprintf(string, "hba%d", adapter->host->host_no); |
2797 | 2749 | dir = proc_mkdir_data(string, 0, parent, adapter); | |
2798 | dir = adapter->controller_proc_dir_entry = | 2750 | if (!dir) { |
2799 | proc_mkdir_data(string, 0, parent, adapter); | ||
2800 | if(!dir) { | ||
2801 | dev_warn(&adapter->dev->dev, "proc_mkdir failed\n"); | 2751 | dev_warn(&adapter->dev->dev, "proc_mkdir failed\n"); |
2802 | return; | 2752 | return; |
2803 | } | 2753 | } |
2804 | 2754 | ||
2805 | for (f = mega_proc_files; f->name; f++) { | 2755 | proc_create_single_data("config", S_IRUSR, dir, |
2806 | de = proc_create_data(f->name, S_IRUSR, dir, &mega_proc_fops, | 2756 | proc_show_config, adapter); |
2807 | f->show); | 2757 | proc_create_single_data("stat", S_IRUSR, dir, |
2808 | if (!de) { | 2758 | proc_show_stat, adapter); |
2809 | dev_warn(&adapter->dev->dev, "proc_create failed\n"); | 2759 | proc_create_single_data("mailbox", S_IRUSR, dir, |
2810 | return; | 2760 | proc_show_mbox, adapter); |
2811 | } | 2761 | #if MEGA_HAVE_ENH_PROC |
2812 | 2762 | proc_create_single_data("rebuild-rate", S_IRUSR, dir, | |
2813 | ppde = (void *)adapter + f->ptr_offset; | 2763 | proc_show_rebuild_rate, adapter); |
2814 | *ppde = de; | 2764 | proc_create_single_data("battery-status", S_IRUSR, dir, |
2815 | } | 2765 | proc_show_battery, adapter); |
2766 | proc_create_single_data("diskdrives-ch0", S_IRUSR, dir, | ||
2767 | proc_show_pdrv_ch0, adapter); | ||
2768 | proc_create_single_data("diskdrives-ch1", S_IRUSR, dir, | ||
2769 | proc_show_pdrv_ch1, adapter); | ||
2770 | proc_create_single_data("diskdrives-ch2", S_IRUSR, dir, | ||
2771 | proc_show_pdrv_ch2, adapter); | ||
2772 | proc_create_single_data("diskdrives-ch3", S_IRUSR, dir, | ||
2773 | proc_show_pdrv_ch3, adapter); | ||
2774 | proc_create_single_data("raiddrives-0-9", S_IRUSR, dir, | ||
2775 | proc_show_rdrv_10, adapter); | ||
2776 | proc_create_single_data("raiddrives-10-19", S_IRUSR, dir, | ||
2777 | proc_show_rdrv_20, adapter); | ||
2778 | proc_create_single_data("raiddrives-20-29", S_IRUSR, dir, | ||
2779 | proc_show_rdrv_30, adapter); | ||
2780 | proc_create_single_data("raiddrives-30-39", S_IRUSR, dir, | ||
2781 | proc_show_rdrv_40, adapter); | ||
2782 | #endif | ||
2816 | } | 2783 | } |
2817 | 2784 | ||
2818 | #else | 2785 | #else |
@@ -4580,6 +4547,7 @@ megaraid_remove_one(struct pci_dev *pdev) | |||
4580 | { | 4547 | { |
4581 | struct Scsi_Host *host = pci_get_drvdata(pdev); | 4548 | struct Scsi_Host *host = pci_get_drvdata(pdev); |
4582 | adapter_t *adapter = (adapter_t *)host->hostdata; | 4549 | adapter_t *adapter = (adapter_t *)host->hostdata; |
4550 | char buf[12] = { 0 }; | ||
4583 | 4551 | ||
4584 | scsi_remove_host(host); | 4552 | scsi_remove_host(host); |
4585 | 4553 | ||
@@ -4594,44 +4562,8 @@ megaraid_remove_one(struct pci_dev *pdev) | |||
4594 | 4562 | ||
4595 | mega_free_sgl(adapter); | 4563 | mega_free_sgl(adapter); |
4596 | 4564 | ||
4597 | #ifdef CONFIG_PROC_FS | 4565 | sprintf(buf, "hba%d", adapter->host->host_no); |
4598 | if (adapter->controller_proc_dir_entry) { | 4566 | remove_proc_subtree(buf, mega_proc_dir_entry); |
4599 | remove_proc_entry("stat", adapter->controller_proc_dir_entry); | ||
4600 | remove_proc_entry("config", | ||
4601 | adapter->controller_proc_dir_entry); | ||
4602 | remove_proc_entry("mailbox", | ||
4603 | adapter->controller_proc_dir_entry); | ||
4604 | #if MEGA_HAVE_ENH_PROC | ||
4605 | remove_proc_entry("rebuild-rate", | ||
4606 | adapter->controller_proc_dir_entry); | ||
4607 | remove_proc_entry("battery-status", | ||
4608 | adapter->controller_proc_dir_entry); | ||
4609 | |||
4610 | remove_proc_entry("diskdrives-ch0", | ||
4611 | adapter->controller_proc_dir_entry); | ||
4612 | remove_proc_entry("diskdrives-ch1", | ||
4613 | adapter->controller_proc_dir_entry); | ||
4614 | remove_proc_entry("diskdrives-ch2", | ||
4615 | adapter->controller_proc_dir_entry); | ||
4616 | remove_proc_entry("diskdrives-ch3", | ||
4617 | adapter->controller_proc_dir_entry); | ||
4618 | |||
4619 | remove_proc_entry("raiddrives-0-9", | ||
4620 | adapter->controller_proc_dir_entry); | ||
4621 | remove_proc_entry("raiddrives-10-19", | ||
4622 | adapter->controller_proc_dir_entry); | ||
4623 | remove_proc_entry("raiddrives-20-29", | ||
4624 | adapter->controller_proc_dir_entry); | ||
4625 | remove_proc_entry("raiddrives-30-39", | ||
4626 | adapter->controller_proc_dir_entry); | ||
4627 | #endif | ||
4628 | { | ||
4629 | char buf[12] = { 0 }; | ||
4630 | sprintf(buf, "hba%d", adapter->host->host_no); | ||
4631 | remove_proc_entry(buf, mega_proc_dir_entry); | ||
4632 | } | ||
4633 | } | ||
4634 | #endif | ||
4635 | 4567 | ||
4636 | pci_free_consistent(adapter->dev, MEGA_BUFFER_SIZE, | 4568 | pci_free_consistent(adapter->dev, MEGA_BUFFER_SIZE, |
4637 | adapter->mega_buffer, adapter->buf_dma_handle); | 4569 | adapter->mega_buffer, adapter->buf_dma_handle); |
diff --git a/drivers/scsi/megaraid.h b/drivers/scsi/megaraid.h index 21eba2fd465a..18e85d9267ff 100644 --- a/drivers/scsi/megaraid.h +++ b/drivers/scsi/megaraid.h | |||
@@ -814,18 +814,6 @@ typedef struct { | |||
814 | 814 | ||
815 | #ifdef CONFIG_PROC_FS | 815 | #ifdef CONFIG_PROC_FS |
816 | struct proc_dir_entry *controller_proc_dir_entry; | 816 | struct proc_dir_entry *controller_proc_dir_entry; |
817 | struct proc_dir_entry *proc_read; | ||
818 | struct proc_dir_entry *proc_stat; | ||
819 | struct proc_dir_entry *proc_mbox; | ||
820 | |||
821 | #if MEGA_HAVE_ENH_PROC | ||
822 | struct proc_dir_entry *proc_rr; | ||
823 | struct proc_dir_entry *proc_battery; | ||
824 | #define MAX_PROC_CHANNELS 4 | ||
825 | struct proc_dir_entry *proc_pdrvstat[MAX_PROC_CHANNELS]; | ||
826 | struct proc_dir_entry *proc_rdrvstat[MAX_PROC_CHANNELS]; | ||
827 | #endif | ||
828 | |||
829 | #endif | 817 | #endif |
830 | 818 | ||
831 | int has_64bit_addr; /* are we using 64-bit addressing */ | 819 | int has_64bit_addr; /* are we using 64-bit addressing */ |
diff --git a/drivers/scsi/sg.c b/drivers/scsi/sg.c index b6f174df9c8c..6fc58e2c99d3 100644 --- a/drivers/scsi/sg.c +++ b/drivers/scsi/sg.c | |||
@@ -66,7 +66,6 @@ static int sg_version_num = 30536; /* 2 digits for each component */ | |||
66 | static char *sg_version_date = "20140603"; | 66 | static char *sg_version_date = "20140603"; |
67 | 67 | ||
68 | static int sg_proc_init(void); | 68 | static int sg_proc_init(void); |
69 | static void sg_proc_cleanup(void); | ||
70 | #endif | 69 | #endif |
71 | 70 | ||
72 | #define SG_ALLOW_DIO_DEF 0 | 71 | #define SG_ALLOW_DIO_DEF 0 |
@@ -1661,7 +1660,7 @@ static void __exit | |||
1661 | exit_sg(void) | 1660 | exit_sg(void) |
1662 | { | 1661 | { |
1663 | #ifdef CONFIG_SCSI_PROC_FS | 1662 | #ifdef CONFIG_SCSI_PROC_FS |
1664 | sg_proc_cleanup(); | 1663 | remove_proc_subtree("scsi/sg", NULL); |
1665 | #endif /* CONFIG_SCSI_PROC_FS */ | 1664 | #endif /* CONFIG_SCSI_PROC_FS */ |
1666 | scsi_unregister_interface(&sg_interface); | 1665 | scsi_unregister_interface(&sg_interface); |
1667 | class_destroy(sg_sysfs_class); | 1666 | class_destroy(sg_sysfs_class); |
@@ -2274,11 +2273,6 @@ sg_get_dev(int dev) | |||
2274 | } | 2273 | } |
2275 | 2274 | ||
2276 | #ifdef CONFIG_SCSI_PROC_FS | 2275 | #ifdef CONFIG_SCSI_PROC_FS |
2277 | |||
2278 | static struct proc_dir_entry *sg_proc_sgp = NULL; | ||
2279 | |||
2280 | static char sg_proc_sg_dirname[] = "scsi/sg"; | ||
2281 | |||
2282 | static int sg_proc_seq_show_int(struct seq_file *s, void *v); | 2276 | static int sg_proc_seq_show_int(struct seq_file *s, void *v); |
2283 | 2277 | ||
2284 | static int sg_proc_single_open_adio(struct inode *inode, struct file *file); | 2278 | static int sg_proc_single_open_adio(struct inode *inode, struct file *file); |
@@ -2306,37 +2300,11 @@ static const struct file_operations dressz_fops = { | |||
2306 | }; | 2300 | }; |
2307 | 2301 | ||
2308 | static int sg_proc_seq_show_version(struct seq_file *s, void *v); | 2302 | static int sg_proc_seq_show_version(struct seq_file *s, void *v); |
2309 | static int sg_proc_single_open_version(struct inode *inode, struct file *file); | ||
2310 | static const struct file_operations version_fops = { | ||
2311 | .owner = THIS_MODULE, | ||
2312 | .open = sg_proc_single_open_version, | ||
2313 | .read = seq_read, | ||
2314 | .llseek = seq_lseek, | ||
2315 | .release = single_release, | ||
2316 | }; | ||
2317 | |||
2318 | static int sg_proc_seq_show_devhdr(struct seq_file *s, void *v); | 2303 | static int sg_proc_seq_show_devhdr(struct seq_file *s, void *v); |
2319 | static int sg_proc_single_open_devhdr(struct inode *inode, struct file *file); | ||
2320 | static const struct file_operations devhdr_fops = { | ||
2321 | .owner = THIS_MODULE, | ||
2322 | .open = sg_proc_single_open_devhdr, | ||
2323 | .read = seq_read, | ||
2324 | .llseek = seq_lseek, | ||
2325 | .release = single_release, | ||
2326 | }; | ||
2327 | |||
2328 | static int sg_proc_seq_show_dev(struct seq_file *s, void *v); | 2304 | static int sg_proc_seq_show_dev(struct seq_file *s, void *v); |
2329 | static int sg_proc_open_dev(struct inode *inode, struct file *file); | ||
2330 | static void * dev_seq_start(struct seq_file *s, loff_t *pos); | 2305 | static void * dev_seq_start(struct seq_file *s, loff_t *pos); |
2331 | static void * dev_seq_next(struct seq_file *s, void *v, loff_t *pos); | 2306 | static void * dev_seq_next(struct seq_file *s, void *v, loff_t *pos); |
2332 | static void dev_seq_stop(struct seq_file *s, void *v); | 2307 | static void dev_seq_stop(struct seq_file *s, void *v); |
2333 | static const struct file_operations dev_fops = { | ||
2334 | .owner = THIS_MODULE, | ||
2335 | .open = sg_proc_open_dev, | ||
2336 | .read = seq_read, | ||
2337 | .llseek = seq_lseek, | ||
2338 | .release = seq_release, | ||
2339 | }; | ||
2340 | static const struct seq_operations dev_seq_ops = { | 2308 | static const struct seq_operations dev_seq_ops = { |
2341 | .start = dev_seq_start, | 2309 | .start = dev_seq_start, |
2342 | .next = dev_seq_next, | 2310 | .next = dev_seq_next, |
@@ -2345,14 +2313,6 @@ static const struct seq_operations dev_seq_ops = { | |||
2345 | }; | 2313 | }; |
2346 | 2314 | ||
2347 | static int sg_proc_seq_show_devstrs(struct seq_file *s, void *v); | 2315 | static int sg_proc_seq_show_devstrs(struct seq_file *s, void *v); |
2348 | static int sg_proc_open_devstrs(struct inode *inode, struct file *file); | ||
2349 | static const struct file_operations devstrs_fops = { | ||
2350 | .owner = THIS_MODULE, | ||
2351 | .open = sg_proc_open_devstrs, | ||
2352 | .read = seq_read, | ||
2353 | .llseek = seq_lseek, | ||
2354 | .release = seq_release, | ||
2355 | }; | ||
2356 | static const struct seq_operations devstrs_seq_ops = { | 2316 | static const struct seq_operations devstrs_seq_ops = { |
2357 | .start = dev_seq_start, | 2317 | .start = dev_seq_start, |
2358 | .next = dev_seq_next, | 2318 | .next = dev_seq_next, |
@@ -2361,14 +2321,6 @@ static const struct seq_operations devstrs_seq_ops = { | |||
2361 | }; | 2321 | }; |
2362 | 2322 | ||
2363 | static int sg_proc_seq_show_debug(struct seq_file *s, void *v); | 2323 | static int sg_proc_seq_show_debug(struct seq_file *s, void *v); |
2364 | static int sg_proc_open_debug(struct inode *inode, struct file *file); | ||
2365 | static const struct file_operations debug_fops = { | ||
2366 | .owner = THIS_MODULE, | ||
2367 | .open = sg_proc_open_debug, | ||
2368 | .read = seq_read, | ||
2369 | .llseek = seq_lseek, | ||
2370 | .release = seq_release, | ||
2371 | }; | ||
2372 | static const struct seq_operations debug_seq_ops = { | 2324 | static const struct seq_operations debug_seq_ops = { |
2373 | .start = dev_seq_start, | 2325 | .start = dev_seq_start, |
2374 | .next = dev_seq_next, | 2326 | .next = dev_seq_next, |
@@ -2376,50 +2328,23 @@ static const struct seq_operations debug_seq_ops = { | |||
2376 | .show = sg_proc_seq_show_debug, | 2328 | .show = sg_proc_seq_show_debug, |
2377 | }; | 2329 | }; |
2378 | 2330 | ||
2379 | |||
2380 | struct sg_proc_leaf { | ||
2381 | const char * name; | ||
2382 | const struct file_operations * fops; | ||
2383 | }; | ||
2384 | |||
2385 | static const struct sg_proc_leaf sg_proc_leaf_arr[] = { | ||
2386 | {"allow_dio", &adio_fops}, | ||
2387 | {"debug", &debug_fops}, | ||
2388 | {"def_reserved_size", &dressz_fops}, | ||
2389 | {"device_hdr", &devhdr_fops}, | ||
2390 | {"devices", &dev_fops}, | ||
2391 | {"device_strs", &devstrs_fops}, | ||
2392 | {"version", &version_fops} | ||
2393 | }; | ||
2394 | |||
2395 | static int | 2331 | static int |
2396 | sg_proc_init(void) | 2332 | sg_proc_init(void) |
2397 | { | 2333 | { |
2398 | int num_leaves = ARRAY_SIZE(sg_proc_leaf_arr); | 2334 | struct proc_dir_entry *p; |
2399 | int k; | ||
2400 | 2335 | ||
2401 | sg_proc_sgp = proc_mkdir(sg_proc_sg_dirname, NULL); | 2336 | p = proc_mkdir("scsi/sg", NULL); |
2402 | if (!sg_proc_sgp) | 2337 | if (!p) |
2403 | return 1; | 2338 | return 1; |
2404 | for (k = 0; k < num_leaves; ++k) { | ||
2405 | const struct sg_proc_leaf *leaf = &sg_proc_leaf_arr[k]; | ||
2406 | umode_t mask = leaf->fops->write ? S_IRUGO | S_IWUSR : S_IRUGO; | ||
2407 | proc_create(leaf->name, mask, sg_proc_sgp, leaf->fops); | ||
2408 | } | ||
2409 | return 0; | ||
2410 | } | ||
2411 | 2339 | ||
2412 | static void | 2340 | proc_create("allow_dio", S_IRUGO | S_IWUSR, p, &adio_fops); |
2413 | sg_proc_cleanup(void) | 2341 | proc_create_seq("debug", S_IRUGO, p, &debug_seq_ops); |
2414 | { | 2342 | proc_create("def_reserved_size", S_IRUGO | S_IWUSR, p, &dressz_fops); |
2415 | int k; | 2343 | proc_create_single("device_hdr", S_IRUGO, p, sg_proc_seq_show_devhdr); |
2416 | int num_leaves = ARRAY_SIZE(sg_proc_leaf_arr); | 2344 | proc_create_seq("devices", S_IRUGO, p, &dev_seq_ops); |
2417 | 2345 | proc_create_seq("device_strs", S_IRUGO, p, &devstrs_seq_ops); | |
2418 | if (!sg_proc_sgp) | 2346 | proc_create_single("version", S_IRUGO, p, sg_proc_seq_show_version); |
2419 | return; | 2347 | return 0; |
2420 | for (k = 0; k < num_leaves; ++k) | ||
2421 | remove_proc_entry(sg_proc_leaf_arr[k].name, sg_proc_sgp); | ||
2422 | remove_proc_entry(sg_proc_sg_dirname, NULL); | ||
2423 | } | 2348 | } |
2424 | 2349 | ||
2425 | 2350 | ||
@@ -2482,22 +2407,12 @@ static int sg_proc_seq_show_version(struct seq_file *s, void *v) | |||
2482 | return 0; | 2407 | return 0; |
2483 | } | 2408 | } |
2484 | 2409 | ||
2485 | static int sg_proc_single_open_version(struct inode *inode, struct file *file) | ||
2486 | { | ||
2487 | return single_open(file, sg_proc_seq_show_version, NULL); | ||
2488 | } | ||
2489 | |||
2490 | static int sg_proc_seq_show_devhdr(struct seq_file *s, void *v) | 2410 | static int sg_proc_seq_show_devhdr(struct seq_file *s, void *v) |
2491 | { | 2411 | { |
2492 | seq_puts(s, "host\tchan\tid\tlun\ttype\topens\tqdepth\tbusy\tonline\n"); | 2412 | seq_puts(s, "host\tchan\tid\tlun\ttype\topens\tqdepth\tbusy\tonline\n"); |
2493 | return 0; | 2413 | return 0; |
2494 | } | 2414 | } |
2495 | 2415 | ||
2496 | static int sg_proc_single_open_devhdr(struct inode *inode, struct file *file) | ||
2497 | { | ||
2498 | return single_open(file, sg_proc_seq_show_devhdr, NULL); | ||
2499 | } | ||
2500 | |||
2501 | struct sg_proc_deviter { | 2416 | struct sg_proc_deviter { |
2502 | loff_t index; | 2417 | loff_t index; |
2503 | size_t max; | 2418 | size_t max; |
@@ -2531,11 +2446,6 @@ static void dev_seq_stop(struct seq_file *s, void *v) | |||
2531 | kfree(s->private); | 2446 | kfree(s->private); |
2532 | } | 2447 | } |
2533 | 2448 | ||
2534 | static int sg_proc_open_dev(struct inode *inode, struct file *file) | ||
2535 | { | ||
2536 | return seq_open(file, &dev_seq_ops); | ||
2537 | } | ||
2538 | |||
2539 | static int sg_proc_seq_show_dev(struct seq_file *s, void *v) | 2449 | static int sg_proc_seq_show_dev(struct seq_file *s, void *v) |
2540 | { | 2450 | { |
2541 | struct sg_proc_deviter * it = (struct sg_proc_deviter *) v; | 2451 | struct sg_proc_deviter * it = (struct sg_proc_deviter *) v; |
@@ -2562,11 +2472,6 @@ static int sg_proc_seq_show_dev(struct seq_file *s, void *v) | |||
2562 | return 0; | 2472 | return 0; |
2563 | } | 2473 | } |
2564 | 2474 | ||
2565 | static int sg_proc_open_devstrs(struct inode *inode, struct file *file) | ||
2566 | { | ||
2567 | return seq_open(file, &devstrs_seq_ops); | ||
2568 | } | ||
2569 | |||
2570 | static int sg_proc_seq_show_devstrs(struct seq_file *s, void *v) | 2475 | static int sg_proc_seq_show_devstrs(struct seq_file *s, void *v) |
2571 | { | 2476 | { |
2572 | struct sg_proc_deviter * it = (struct sg_proc_deviter *) v; | 2477 | struct sg_proc_deviter * it = (struct sg_proc_deviter *) v; |
@@ -2650,11 +2555,6 @@ static void sg_proc_debug_helper(struct seq_file *s, Sg_device * sdp) | |||
2650 | } | 2555 | } |
2651 | } | 2556 | } |
2652 | 2557 | ||
2653 | static int sg_proc_open_debug(struct inode *inode, struct file *file) | ||
2654 | { | ||
2655 | return seq_open(file, &debug_seq_ops); | ||
2656 | } | ||
2657 | |||
2658 | static int sg_proc_seq_show_debug(struct seq_file *s, void *v) | 2558 | static int sg_proc_seq_show_debug(struct seq_file *s, void *v) |
2659 | { | 2559 | { |
2660 | struct sg_proc_deviter * it = (struct sg_proc_deviter *) v; | 2560 | struct sg_proc_deviter * it = (struct sg_proc_deviter *) v; |
diff --git a/drivers/staging/comedi/proc.c b/drivers/staging/comedi/proc.c index 50d38938ac6f..8bc8e42beb90 100644 --- a/drivers/staging/comedi/proc.c +++ b/drivers/staging/comedi/proc.c | |||
@@ -62,25 +62,9 @@ static int comedi_read(struct seq_file *m, void *v) | |||
62 | return 0; | 62 | return 0; |
63 | } | 63 | } |
64 | 64 | ||
65 | /* | ||
66 | * seq_file wrappers for procfile show routines. | ||
67 | */ | ||
68 | static int comedi_proc_open(struct inode *inode, struct file *file) | ||
69 | { | ||
70 | return single_open(file, comedi_read, NULL); | ||
71 | } | ||
72 | |||
73 | static const struct file_operations comedi_proc_fops = { | ||
74 | .owner = THIS_MODULE, | ||
75 | .open = comedi_proc_open, | ||
76 | .read = seq_read, | ||
77 | .llseek = seq_lseek, | ||
78 | .release = single_release, | ||
79 | }; | ||
80 | |||
81 | void __init comedi_proc_init(void) | 65 | void __init comedi_proc_init(void) |
82 | { | 66 | { |
83 | if (!proc_create("comedi", 0444, NULL, &comedi_proc_fops)) | 67 | if (!proc_create_single("comedi", 0444, NULL, comedi_read)) |
84 | pr_warn("comedi: unable to create proc entry\n"); | 68 | pr_warn("comedi: unable to create proc entry\n"); |
85 | } | 69 | } |
86 | 70 | ||
diff --git a/drivers/staging/fwserial/fwserial.c b/drivers/staging/fwserial/fwserial.c index e8bfe5520bc7..fa0dd425b454 100644 --- a/drivers/staging/fwserial/fwserial.c +++ b/drivers/staging/fwserial/fwserial.c | |||
@@ -1506,11 +1506,6 @@ static int fwtty_debugfs_peers_show(struct seq_file *m, void *v) | |||
1506 | return 0; | 1506 | return 0; |
1507 | } | 1507 | } |
1508 | 1508 | ||
1509 | static int fwtty_proc_open(struct inode *inode, struct file *fp) | ||
1510 | { | ||
1511 | return single_open(fp, fwtty_proc_show, NULL); | ||
1512 | } | ||
1513 | |||
1514 | static int fwtty_stats_open(struct inode *inode, struct file *fp) | 1509 | static int fwtty_stats_open(struct inode *inode, struct file *fp) |
1515 | { | 1510 | { |
1516 | return single_open(fp, fwtty_debugfs_stats_show, inode->i_private); | 1511 | return single_open(fp, fwtty_debugfs_stats_show, inode->i_private); |
@@ -1537,14 +1532,6 @@ static const struct file_operations fwtty_peers_fops = { | |||
1537 | .release = single_release, | 1532 | .release = single_release, |
1538 | }; | 1533 | }; |
1539 | 1534 | ||
1540 | static const struct file_operations fwtty_proc_fops = { | ||
1541 | .owner = THIS_MODULE, | ||
1542 | .open = fwtty_proc_open, | ||
1543 | .read = seq_read, | ||
1544 | .llseek = seq_lseek, | ||
1545 | .release = single_release, | ||
1546 | }; | ||
1547 | |||
1548 | static const struct tty_port_operations fwtty_port_ops = { | 1535 | static const struct tty_port_operations fwtty_port_ops = { |
1549 | .dtr_rts = fwtty_port_dtr_rts, | 1536 | .dtr_rts = fwtty_port_dtr_rts, |
1550 | .carrier_raised = fwtty_port_carrier_raised, | 1537 | .carrier_raised = fwtty_port_carrier_raised, |
@@ -1570,7 +1557,7 @@ static const struct tty_operations fwtty_ops = { | |||
1570 | .tiocmget = fwtty_tiocmget, | 1557 | .tiocmget = fwtty_tiocmget, |
1571 | .tiocmset = fwtty_tiocmset, | 1558 | .tiocmset = fwtty_tiocmset, |
1572 | .get_icount = fwtty_get_icount, | 1559 | .get_icount = fwtty_get_icount, |
1573 | .proc_fops = &fwtty_proc_fops, | 1560 | .proc_show = fwtty_proc_show, |
1574 | }; | 1561 | }; |
1575 | 1562 | ||
1576 | static const struct tty_operations fwloop_ops = { | 1563 | static const struct tty_operations fwloop_ops = { |
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/staging/rtl8192u/r8192U_core.c b/drivers/staging/rtl8192u/r8192U_core.c index d607c59761cf..7a0dbc0fa18e 100644 --- a/drivers/staging/rtl8192u/r8192U_core.c +++ b/drivers/staging/rtl8192u/r8192U_core.c | |||
@@ -646,64 +646,25 @@ static void rtl8192_proc_module_init(void) | |||
646 | rtl8192_proc = proc_mkdir(RTL819xU_MODULE_NAME, init_net.proc_net); | 646 | rtl8192_proc = proc_mkdir(RTL819xU_MODULE_NAME, init_net.proc_net); |
647 | } | 647 | } |
648 | 648 | ||
649 | /* | ||
650 | * seq_file wrappers for procfile show routines. | ||
651 | */ | ||
652 | static int rtl8192_proc_open(struct inode *inode, struct file *file) | ||
653 | { | ||
654 | struct net_device *dev = proc_get_parent_data(inode); | ||
655 | int (*show)(struct seq_file *, void *) = PDE_DATA(inode); | ||
656 | |||
657 | return single_open(file, show, dev); | ||
658 | } | ||
659 | |||
660 | static const struct file_operations rtl8192_proc_fops = { | ||
661 | .open = rtl8192_proc_open, | ||
662 | .read = seq_read, | ||
663 | .llseek = seq_lseek, | ||
664 | .release = single_release, | ||
665 | }; | ||
666 | |||
667 | /* | ||
668 | * Table of proc files we need to create. | ||
669 | */ | ||
670 | struct rtl8192_proc_file { | ||
671 | char name[12]; | ||
672 | int (*show)(struct seq_file *, void *); | ||
673 | }; | ||
674 | |||
675 | static const struct rtl8192_proc_file rtl8192_proc_files[] = { | ||
676 | { "stats-rx", &proc_get_stats_rx }, | ||
677 | { "stats-tx", &proc_get_stats_tx }, | ||
678 | { "stats-ap", &proc_get_stats_ap }, | ||
679 | { "registers", &proc_get_registers }, | ||
680 | { "" } | ||
681 | }; | ||
682 | |||
683 | static void rtl8192_proc_init_one(struct net_device *dev) | 649 | static void rtl8192_proc_init_one(struct net_device *dev) |
684 | { | 650 | { |
685 | const struct rtl8192_proc_file *f; | ||
686 | struct proc_dir_entry *dir; | 651 | struct proc_dir_entry *dir; |
687 | 652 | ||
688 | if (rtl8192_proc) { | 653 | if (!rtl8192_proc) |
689 | dir = proc_mkdir_data(dev->name, 0, rtl8192_proc, dev); | 654 | return; |
690 | if (!dir) { | ||
691 | RT_TRACE(COMP_ERR, | ||
692 | "Unable to initialize /proc/net/rtl8192/%s\n", | ||
693 | dev->name); | ||
694 | return; | ||
695 | } | ||
696 | 655 | ||
697 | for (f = rtl8192_proc_files; f->name[0]; f++) { | 656 | dir = proc_mkdir_data(dev->name, 0, rtl8192_proc, dev); |
698 | if (!proc_create_data(f->name, S_IFREG | S_IRUGO, dir, | 657 | if (!dir) |
699 | &rtl8192_proc_fops, f->show)) { | 658 | return; |
700 | RT_TRACE(COMP_ERR, | 659 | |
701 | "Unable to initialize /proc/net/rtl8192/%s/%s\n", | 660 | proc_create_single("stats-rx", S_IFREG | S_IRUGO, dir, |
702 | dev->name, f->name); | 661 | proc_get_stats_rx); |
703 | return; | 662 | proc_create_single("stats-tx", S_IFREG | S_IRUGO, dir, |
704 | } | 663 | proc_get_stats_tx); |
705 | } | 664 | proc_create_single("stats-ap", S_IFREG | S_IRUGO, dir, |
706 | } | 665 | proc_get_stats_ap); |
666 | proc_create_single("registers", S_IFREG | S_IRUGO, dir, | ||
667 | proc_get_registers); | ||
707 | } | 668 | } |
708 | 669 | ||
709 | static void rtl8192_proc_remove_one(struct net_device *dev) | 670 | static void rtl8192_proc_remove_one(struct net_device *dev) |
diff --git a/drivers/tty/amiserial.c b/drivers/tty/amiserial.c index 32d7ce430b02..34dead614149 100644 --- a/drivers/tty/amiserial.c +++ b/drivers/tty/amiserial.c | |||
@@ -1566,19 +1566,6 @@ static int rs_proc_show(struct seq_file *m, void *v) | |||
1566 | return 0; | 1566 | return 0; |
1567 | } | 1567 | } |
1568 | 1568 | ||
1569 | static int rs_proc_open(struct inode *inode, struct file *file) | ||
1570 | { | ||
1571 | return single_open(file, rs_proc_show, NULL); | ||
1572 | } | ||
1573 | |||
1574 | static const struct file_operations rs_proc_fops = { | ||
1575 | .owner = THIS_MODULE, | ||
1576 | .open = rs_proc_open, | ||
1577 | .read = seq_read, | ||
1578 | .llseek = seq_lseek, | ||
1579 | .release = single_release, | ||
1580 | }; | ||
1581 | |||
1582 | /* | 1569 | /* |
1583 | * --------------------------------------------------------------------- | 1570 | * --------------------------------------------------------------------- |
1584 | * rs_init() and friends | 1571 | * rs_init() and friends |
@@ -1620,7 +1607,7 @@ static const struct tty_operations serial_ops = { | |||
1620 | .tiocmget = rs_tiocmget, | 1607 | .tiocmget = rs_tiocmget, |
1621 | .tiocmset = rs_tiocmset, | 1608 | .tiocmset = rs_tiocmset, |
1622 | .get_icount = rs_get_icount, | 1609 | .get_icount = rs_get_icount, |
1623 | .proc_fops = &rs_proc_fops, | 1610 | .proc_show = rs_proc_show, |
1624 | }; | 1611 | }; |
1625 | 1612 | ||
1626 | static int amiga_carrier_raised(struct tty_port *port) | 1613 | static int amiga_carrier_raised(struct tty_port *port) |
diff --git a/drivers/tty/cyclades.c b/drivers/tty/cyclades.c index cf0bde3bb927..6d3c58051ce3 100644 --- a/drivers/tty/cyclades.c +++ b/drivers/tty/cyclades.c | |||
@@ -3972,19 +3972,6 @@ static int cyclades_proc_show(struct seq_file *m, void *v) | |||
3972 | return 0; | 3972 | return 0; |
3973 | } | 3973 | } |
3974 | 3974 | ||
3975 | static int cyclades_proc_open(struct inode *inode, struct file *file) | ||
3976 | { | ||
3977 | return single_open(file, cyclades_proc_show, NULL); | ||
3978 | } | ||
3979 | |||
3980 | static const struct file_operations cyclades_proc_fops = { | ||
3981 | .owner = THIS_MODULE, | ||
3982 | .open = cyclades_proc_open, | ||
3983 | .read = seq_read, | ||
3984 | .llseek = seq_lseek, | ||
3985 | .release = single_release, | ||
3986 | }; | ||
3987 | |||
3988 | /* The serial driver boot-time initialization code! | 3975 | /* The serial driver boot-time initialization code! |
3989 | Hardware I/O ports are mapped to character special devices on a | 3976 | Hardware I/O ports are mapped to character special devices on a |
3990 | first found, first allocated manner. That is, this code searches | 3977 | first found, first allocated manner. That is, this code searches |
@@ -4024,7 +4011,7 @@ static const struct tty_operations cy_ops = { | |||
4024 | .tiocmget = cy_tiocmget, | 4011 | .tiocmget = cy_tiocmget, |
4025 | .tiocmset = cy_tiocmset, | 4012 | .tiocmset = cy_tiocmset, |
4026 | .get_icount = cy_get_icount, | 4013 | .get_icount = cy_get_icount, |
4027 | .proc_fops = &cyclades_proc_fops, | 4014 | .proc_show = cyclades_proc_show, |
4028 | }; | 4015 | }; |
4029 | 4016 | ||
4030 | static int __init cy_init(void) | 4017 | static int __init cy_init(void) |
diff --git a/drivers/tty/serial/serial_core.c b/drivers/tty/serial/serial_core.c index 0466f9f08a91..6ff9405954a6 100644 --- a/drivers/tty/serial/serial_core.c +++ b/drivers/tty/serial/serial_core.c | |||
@@ -1829,19 +1829,6 @@ static int uart_proc_show(struct seq_file *m, void *v) | |||
1829 | uart_line_info(m, drv, i); | 1829 | uart_line_info(m, drv, i); |
1830 | return 0; | 1830 | return 0; |
1831 | } | 1831 | } |
1832 | |||
1833 | static int uart_proc_open(struct inode *inode, struct file *file) | ||
1834 | { | ||
1835 | return single_open(file, uart_proc_show, PDE_DATA(inode)); | ||
1836 | } | ||
1837 | |||
1838 | static const struct file_operations uart_proc_fops = { | ||
1839 | .owner = THIS_MODULE, | ||
1840 | .open = uart_proc_open, | ||
1841 | .read = seq_read, | ||
1842 | .llseek = seq_lseek, | ||
1843 | .release = single_release, | ||
1844 | }; | ||
1845 | #endif | 1832 | #endif |
1846 | 1833 | ||
1847 | #if defined(CONFIG_SERIAL_CORE_CONSOLE) || defined(CONFIG_CONSOLE_POLL) | 1834 | #if defined(CONFIG_SERIAL_CORE_CONSOLE) || defined(CONFIG_CONSOLE_POLL) |
@@ -2415,7 +2402,7 @@ static const struct tty_operations uart_ops = { | |||
2415 | .break_ctl = uart_break_ctl, | 2402 | .break_ctl = uart_break_ctl, |
2416 | .wait_until_sent= uart_wait_until_sent, | 2403 | .wait_until_sent= uart_wait_until_sent, |
2417 | #ifdef CONFIG_PROC_FS | 2404 | #ifdef CONFIG_PROC_FS |
2418 | .proc_fops = &uart_proc_fops, | 2405 | .proc_show = uart_proc_show, |
2419 | #endif | 2406 | #endif |
2420 | .tiocmget = uart_tiocmget, | 2407 | .tiocmget = uart_tiocmget, |
2421 | .tiocmset = uart_tiocmset, | 2408 | .tiocmset = uart_tiocmset, |
diff --git a/drivers/tty/synclink.c b/drivers/tty/synclink.c index 3c4ad71f261d..fbdf4d01c6a9 100644 --- a/drivers/tty/synclink.c +++ b/drivers/tty/synclink.c | |||
@@ -3534,19 +3534,6 @@ static int mgsl_proc_show(struct seq_file *m, void *v) | |||
3534 | return 0; | 3534 | return 0; |
3535 | } | 3535 | } |
3536 | 3536 | ||
3537 | static int mgsl_proc_open(struct inode *inode, struct file *file) | ||
3538 | { | ||
3539 | return single_open(file, mgsl_proc_show, NULL); | ||
3540 | } | ||
3541 | |||
3542 | static const struct file_operations mgsl_proc_fops = { | ||
3543 | .owner = THIS_MODULE, | ||
3544 | .open = mgsl_proc_open, | ||
3545 | .read = seq_read, | ||
3546 | .llseek = seq_lseek, | ||
3547 | .release = single_release, | ||
3548 | }; | ||
3549 | |||
3550 | /* mgsl_allocate_dma_buffers() | 3537 | /* mgsl_allocate_dma_buffers() |
3551 | * | 3538 | * |
3552 | * Allocate and format DMA buffers (ISA adapter) | 3539 | * Allocate and format DMA buffers (ISA adapter) |
@@ -4298,7 +4285,7 @@ static const struct tty_operations mgsl_ops = { | |||
4298 | .tiocmget = tiocmget, | 4285 | .tiocmget = tiocmget, |
4299 | .tiocmset = tiocmset, | 4286 | .tiocmset = tiocmset, |
4300 | .get_icount = msgl_get_icount, | 4287 | .get_icount = msgl_get_icount, |
4301 | .proc_fops = &mgsl_proc_fops, | 4288 | .proc_show = mgsl_proc_show, |
4302 | }; | 4289 | }; |
4303 | 4290 | ||
4304 | /* | 4291 | /* |
diff --git a/drivers/tty/synclink_gt.c b/drivers/tty/synclink_gt.c index 255c49687877..a94086597ebd 100644 --- a/drivers/tty/synclink_gt.c +++ b/drivers/tty/synclink_gt.c | |||
@@ -1316,19 +1316,6 @@ static int synclink_gt_proc_show(struct seq_file *m, void *v) | |||
1316 | return 0; | 1316 | return 0; |
1317 | } | 1317 | } |
1318 | 1318 | ||
1319 | static int synclink_gt_proc_open(struct inode *inode, struct file *file) | ||
1320 | { | ||
1321 | return single_open(file, synclink_gt_proc_show, NULL); | ||
1322 | } | ||
1323 | |||
1324 | static const struct file_operations synclink_gt_proc_fops = { | ||
1325 | .owner = THIS_MODULE, | ||
1326 | .open = synclink_gt_proc_open, | ||
1327 | .read = seq_read, | ||
1328 | .llseek = seq_lseek, | ||
1329 | .release = single_release, | ||
1330 | }; | ||
1331 | |||
1332 | /* | 1319 | /* |
1333 | * return count of bytes in transmit buffer | 1320 | * return count of bytes in transmit buffer |
1334 | */ | 1321 | */ |
@@ -3721,7 +3708,7 @@ static const struct tty_operations ops = { | |||
3721 | .tiocmget = tiocmget, | 3708 | .tiocmget = tiocmget, |
3722 | .tiocmset = tiocmset, | 3709 | .tiocmset = tiocmset, |
3723 | .get_icount = get_icount, | 3710 | .get_icount = get_icount, |
3724 | .proc_fops = &synclink_gt_proc_fops, | 3711 | .proc_show = synclink_gt_proc_show, |
3725 | }; | 3712 | }; |
3726 | 3713 | ||
3727 | static void slgt_cleanup(void) | 3714 | static void slgt_cleanup(void) |
diff --git a/drivers/tty/synclinkmp.c b/drivers/tty/synclinkmp.c index 75f11ce1f0a1..1e4d5b9c981a 100644 --- a/drivers/tty/synclinkmp.c +++ b/drivers/tty/synclinkmp.c | |||
@@ -1421,19 +1421,6 @@ static int synclinkmp_proc_show(struct seq_file *m, void *v) | |||
1421 | return 0; | 1421 | return 0; |
1422 | } | 1422 | } |
1423 | 1423 | ||
1424 | static int synclinkmp_proc_open(struct inode *inode, struct file *file) | ||
1425 | { | ||
1426 | return single_open(file, synclinkmp_proc_show, NULL); | ||
1427 | } | ||
1428 | |||
1429 | static const struct file_operations synclinkmp_proc_fops = { | ||
1430 | .owner = THIS_MODULE, | ||
1431 | .open = synclinkmp_proc_open, | ||
1432 | .read = seq_read, | ||
1433 | .llseek = seq_lseek, | ||
1434 | .release = single_release, | ||
1435 | }; | ||
1436 | |||
1437 | /* Return the count of bytes in transmit buffer | 1424 | /* Return the count of bytes in transmit buffer |
1438 | */ | 1425 | */ |
1439 | static int chars_in_buffer(struct tty_struct *tty) | 1426 | static int chars_in_buffer(struct tty_struct *tty) |
@@ -3899,7 +3886,7 @@ static const struct tty_operations ops = { | |||
3899 | .tiocmget = tiocmget, | 3886 | .tiocmget = tiocmget, |
3900 | .tiocmset = tiocmset, | 3887 | .tiocmset = tiocmset, |
3901 | .get_icount = get_icount, | 3888 | .get_icount = get_icount, |
3902 | .proc_fops = &synclinkmp_proc_fops, | 3889 | .proc_show = synclinkmp_proc_show, |
3903 | }; | 3890 | }; |
3904 | 3891 | ||
3905 | 3892 | ||
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/usb/gadget/udc/at91_udc.c b/drivers/usb/gadget/udc/at91_udc.c index ad743a8493be..03959dc86cfd 100644 --- a/drivers/usb/gadget/udc/at91_udc.c +++ b/drivers/usb/gadget/udc/at91_udc.c | |||
@@ -234,22 +234,10 @@ static int proc_udc_show(struct seq_file *s, void *unused) | |||
234 | return 0; | 234 | return 0; |
235 | } | 235 | } |
236 | 236 | ||
237 | static int proc_udc_open(struct inode *inode, struct file *file) | ||
238 | { | ||
239 | return single_open(file, proc_udc_show, PDE_DATA(inode)); | ||
240 | } | ||
241 | |||
242 | static const struct file_operations proc_ops = { | ||
243 | .owner = THIS_MODULE, | ||
244 | .open = proc_udc_open, | ||
245 | .read = seq_read, | ||
246 | .llseek = seq_lseek, | ||
247 | .release = single_release, | ||
248 | }; | ||
249 | |||
250 | static void create_debug_file(struct at91_udc *udc) | 237 | static void create_debug_file(struct at91_udc *udc) |
251 | { | 238 | { |
252 | udc->pde = proc_create_data(debug_filename, 0, NULL, &proc_ops, udc); | 239 | udc->pde = proc_create_single_data(debug_filename, 0, NULL, |
240 | proc_udc_show, udc); | ||
253 | } | 241 | } |
254 | 242 | ||
255 | static void remove_debug_file(struct at91_udc *udc) | 243 | static void remove_debug_file(struct at91_udc *udc) |
diff --git a/drivers/usb/gadget/udc/fsl_udc_core.c b/drivers/usb/gadget/udc/fsl_udc_core.c index 56b517a38865..7d8af299dfc7 100644 --- a/drivers/usb/gadget/udc/fsl_udc_core.c +++ b/drivers/usb/gadget/udc/fsl_udc_core.c | |||
@@ -2207,22 +2207,8 @@ static int fsl_proc_read(struct seq_file *m, void *v) | |||
2207 | return 0; | 2207 | return 0; |
2208 | } | 2208 | } |
2209 | 2209 | ||
2210 | /* | 2210 | #define create_proc_file() \ |
2211 | * seq_file wrappers for procfile show routines. | 2211 | proc_create_single(proc_filename, 0, NULL, fsl_proc_read) |
2212 | */ | ||
2213 | static int fsl_proc_open(struct inode *inode, struct file *file) | ||
2214 | { | ||
2215 | return single_open(file, fsl_proc_read, NULL); | ||
2216 | } | ||
2217 | |||
2218 | static const struct file_operations fsl_proc_fops = { | ||
2219 | .open = fsl_proc_open, | ||
2220 | .read = seq_read, | ||
2221 | .llseek = seq_lseek, | ||
2222 | .release = single_release, | ||
2223 | }; | ||
2224 | |||
2225 | #define create_proc_file() proc_create(proc_filename, 0, NULL, &fsl_proc_fops) | ||
2226 | #define remove_proc_file() remove_proc_entry(proc_filename, NULL) | 2212 | #define remove_proc_file() remove_proc_entry(proc_filename, NULL) |
2227 | 2213 | ||
2228 | #else /* !CONFIG_USB_GADGET_DEBUG_FILES */ | 2214 | #else /* !CONFIG_USB_GADGET_DEBUG_FILES */ |
diff --git a/drivers/usb/gadget/udc/goku_udc.c b/drivers/usb/gadget/udc/goku_udc.c index 4504d0b202db..c3721225b61e 100644 --- a/drivers/usb/gadget/udc/goku_udc.c +++ b/drivers/usb/gadget/udc/goku_udc.c | |||
@@ -1241,22 +1241,6 @@ done: | |||
1241 | local_irq_restore(flags); | 1241 | local_irq_restore(flags); |
1242 | return 0; | 1242 | return 0; |
1243 | } | 1243 | } |
1244 | |||
1245 | /* | ||
1246 | * seq_file wrappers for procfile show routines. | ||
1247 | */ | ||
1248 | static int udc_proc_open(struct inode *inode, struct file *file) | ||
1249 | { | ||
1250 | return single_open(file, udc_proc_read, PDE_DATA(file_inode(file))); | ||
1251 | } | ||
1252 | |||
1253 | static const struct file_operations udc_proc_fops = { | ||
1254 | .open = udc_proc_open, | ||
1255 | .read = seq_read, | ||
1256 | .llseek = seq_lseek, | ||
1257 | .release = single_release, | ||
1258 | }; | ||
1259 | |||
1260 | #endif /* CONFIG_USB_GADGET_DEBUG_FILES */ | 1244 | #endif /* CONFIG_USB_GADGET_DEBUG_FILES */ |
1261 | 1245 | ||
1262 | /*-------------------------------------------------------------------------*/ | 1246 | /*-------------------------------------------------------------------------*/ |
@@ -1826,7 +1810,7 @@ static int goku_probe(struct pci_dev *pdev, const struct pci_device_id *id) | |||
1826 | 1810 | ||
1827 | 1811 | ||
1828 | #ifdef CONFIG_USB_GADGET_DEBUG_FILES | 1812 | #ifdef CONFIG_USB_GADGET_DEBUG_FILES |
1829 | proc_create_data(proc_node_name, 0, NULL, &udc_proc_fops, dev); | 1813 | proc_create_single_data(proc_node_name, 0, NULL, udc_proc_read, dev); |
1830 | #endif | 1814 | #endif |
1831 | 1815 | ||
1832 | retval = usb_add_gadget_udc_release(&pdev->dev, &dev->gadget, | 1816 | retval = usb_add_gadget_udc_release(&pdev->dev, &dev->gadget, |
diff --git a/drivers/usb/gadget/udc/omap_udc.c b/drivers/usb/gadget/udc/omap_udc.c index dc35a54bad90..3a16431da321 100644 --- a/drivers/usb/gadget/udc/omap_udc.c +++ b/drivers/usb/gadget/udc/omap_udc.c | |||
@@ -2432,22 +2432,9 @@ static int proc_udc_show(struct seq_file *s, void *_) | |||
2432 | return 0; | 2432 | return 0; |
2433 | } | 2433 | } |
2434 | 2434 | ||
2435 | static int proc_udc_open(struct inode *inode, struct file *file) | ||
2436 | { | ||
2437 | return single_open(file, proc_udc_show, NULL); | ||
2438 | } | ||
2439 | |||
2440 | static const struct file_operations proc_ops = { | ||
2441 | .owner = THIS_MODULE, | ||
2442 | .open = proc_udc_open, | ||
2443 | .read = seq_read, | ||
2444 | .llseek = seq_lseek, | ||
2445 | .release = single_release, | ||
2446 | }; | ||
2447 | |||
2448 | static void create_proc_file(void) | 2435 | static void create_proc_file(void) |
2449 | { | 2436 | { |
2450 | proc_create(proc_filename, 0, NULL, &proc_ops); | 2437 | proc_create_single(proc_filename, 0, NULL, proc_udc_show); |
2451 | } | 2438 | } |
2452 | 2439 | ||
2453 | static void remove_proc_file(void) | 2440 | static void remove_proc_file(void) |
diff --git a/drivers/usb/serial/usb-serial.c b/drivers/usb/serial/usb-serial.c index 790e0cbe3da9..268ffa6b51d2 100644 --- a/drivers/usb/serial/usb-serial.c +++ b/drivers/usb/serial/usb-serial.c | |||
@@ -476,19 +476,6 @@ static int serial_proc_show(struct seq_file *m, void *v) | |||
476 | return 0; | 476 | return 0; |
477 | } | 477 | } |
478 | 478 | ||
479 | static int serial_proc_open(struct inode *inode, struct file *file) | ||
480 | { | ||
481 | return single_open(file, serial_proc_show, NULL); | ||
482 | } | ||
483 | |||
484 | static const struct file_operations serial_proc_fops = { | ||
485 | .owner = THIS_MODULE, | ||
486 | .open = serial_proc_open, | ||
487 | .read = seq_read, | ||
488 | .llseek = seq_lseek, | ||
489 | .release = single_release, | ||
490 | }; | ||
491 | |||
492 | static int serial_tiocmget(struct tty_struct *tty) | 479 | static int serial_tiocmget(struct tty_struct *tty) |
493 | { | 480 | { |
494 | struct usb_serial_port *port = tty->driver_data; | 481 | struct usb_serial_port *port = tty->driver_data; |
@@ -1192,7 +1179,7 @@ static const struct tty_operations serial_ops = { | |||
1192 | .get_icount = serial_get_icount, | 1179 | .get_icount = serial_get_icount, |
1193 | .cleanup = serial_cleanup, | 1180 | .cleanup = serial_cleanup, |
1194 | .install = serial_install, | 1181 | .install = serial_install, |
1195 | .proc_fops = &serial_proc_fops, | 1182 | .proc_show = serial_proc_show, |
1196 | }; | 1183 | }; |
1197 | 1184 | ||
1198 | 1185 | ||
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/video/fbdev/via/viafbdev.c b/drivers/video/fbdev/via/viafbdev.c index badee04ef496..9b45125988fb 100644 --- a/drivers/video/fbdev/via/viafbdev.c +++ b/drivers/video/fbdev/via/viafbdev.c | |||
@@ -1475,19 +1475,6 @@ static int viafb_sup_odev_proc_show(struct seq_file *m, void *v) | |||
1475 | return 0; | 1475 | return 0; |
1476 | } | 1476 | } |
1477 | 1477 | ||
1478 | static int viafb_sup_odev_proc_open(struct inode *inode, struct file *file) | ||
1479 | { | ||
1480 | return single_open(file, viafb_sup_odev_proc_show, NULL); | ||
1481 | } | ||
1482 | |||
1483 | static const struct file_operations viafb_sup_odev_proc_fops = { | ||
1484 | .owner = THIS_MODULE, | ||
1485 | .open = viafb_sup_odev_proc_open, | ||
1486 | .read = seq_read, | ||
1487 | .llseek = seq_lseek, | ||
1488 | .release = single_release, | ||
1489 | }; | ||
1490 | |||
1491 | static ssize_t odev_update(const char __user *buffer, size_t count, u32 *odev) | 1478 | static ssize_t odev_update(const char __user *buffer, size_t count, u32 *odev) |
1492 | { | 1479 | { |
1493 | char buf[64], *ptr = buf; | 1480 | char buf[64], *ptr = buf; |
@@ -1616,8 +1603,8 @@ static void viafb_init_proc(struct viafb_shared *shared) | |||
1616 | &viafb_vt1636_proc_fops); | 1603 | &viafb_vt1636_proc_fops); |
1617 | #endif /* CONFIG_FB_VIA_DIRECT_PROCFS */ | 1604 | #endif /* CONFIG_FB_VIA_DIRECT_PROCFS */ |
1618 | 1605 | ||
1619 | proc_create("supported_output_devices", 0, viafb_entry, | 1606 | proc_create_single("supported_output_devices", 0, viafb_entry, |
1620 | &viafb_sup_odev_proc_fops); | 1607 | viafb_sup_odev_proc_show); |
1621 | iga1_entry = proc_mkdir("iga1", viafb_entry); | 1608 | iga1_entry = proc_mkdir("iga1", viafb_entry); |
1622 | shared->iga1_proc_entry = iga1_entry; | 1609 | shared->iga1_proc_entry = iga1_entry; |
1623 | proc_create("output_devices", 0, iga1_entry, | 1610 | proc_create("output_devices", 0, iga1_entry, |
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/afs/proc.c b/fs/afs/proc.c index 839a22280606..3aad32762989 100644 --- a/fs/afs/proc.c +++ b/fs/afs/proc.c | |||
@@ -62,7 +62,6 @@ static const struct file_operations afs_proc_rootcell_fops = { | |||
62 | .llseek = no_llseek, | 62 | .llseek = no_llseek, |
63 | }; | 63 | }; |
64 | 64 | ||
65 | static int afs_proc_cell_volumes_open(struct inode *inode, struct file *file); | ||
66 | static void *afs_proc_cell_volumes_start(struct seq_file *p, loff_t *pos); | 65 | static void *afs_proc_cell_volumes_start(struct seq_file *p, loff_t *pos); |
67 | static void *afs_proc_cell_volumes_next(struct seq_file *p, void *v, | 66 | static void *afs_proc_cell_volumes_next(struct seq_file *p, void *v, |
68 | loff_t *pos); | 67 | loff_t *pos); |
@@ -76,15 +75,6 @@ static const struct seq_operations afs_proc_cell_volumes_ops = { | |||
76 | .show = afs_proc_cell_volumes_show, | 75 | .show = afs_proc_cell_volumes_show, |
77 | }; | 76 | }; |
78 | 77 | ||
79 | static const struct file_operations afs_proc_cell_volumes_fops = { | ||
80 | .open = afs_proc_cell_volumes_open, | ||
81 | .read = seq_read, | ||
82 | .llseek = seq_lseek, | ||
83 | .release = seq_release, | ||
84 | }; | ||
85 | |||
86 | static int afs_proc_cell_vlservers_open(struct inode *inode, | ||
87 | struct file *file); | ||
88 | static void *afs_proc_cell_vlservers_start(struct seq_file *p, loff_t *pos); | 78 | static void *afs_proc_cell_vlservers_start(struct seq_file *p, loff_t *pos); |
89 | static void *afs_proc_cell_vlservers_next(struct seq_file *p, void *v, | 79 | static void *afs_proc_cell_vlservers_next(struct seq_file *p, void *v, |
90 | loff_t *pos); | 80 | loff_t *pos); |
@@ -98,14 +88,6 @@ static const struct seq_operations afs_proc_cell_vlservers_ops = { | |||
98 | .show = afs_proc_cell_vlservers_show, | 88 | .show = afs_proc_cell_vlservers_show, |
99 | }; | 89 | }; |
100 | 90 | ||
101 | static const struct file_operations afs_proc_cell_vlservers_fops = { | ||
102 | .open = afs_proc_cell_vlservers_open, | ||
103 | .read = seq_read, | ||
104 | .llseek = seq_lseek, | ||
105 | .release = seq_release, | ||
106 | }; | ||
107 | |||
108 | static int afs_proc_servers_open(struct inode *inode, struct file *file); | ||
109 | static void *afs_proc_servers_start(struct seq_file *p, loff_t *pos); | 91 | static void *afs_proc_servers_start(struct seq_file *p, loff_t *pos); |
110 | static void *afs_proc_servers_next(struct seq_file *p, void *v, | 92 | static void *afs_proc_servers_next(struct seq_file *p, void *v, |
111 | loff_t *pos); | 93 | loff_t *pos); |
@@ -119,13 +101,6 @@ static const struct seq_operations afs_proc_servers_ops = { | |||
119 | .show = afs_proc_servers_show, | 101 | .show = afs_proc_servers_show, |
120 | }; | 102 | }; |
121 | 103 | ||
122 | static const struct file_operations afs_proc_servers_fops = { | ||
123 | .open = afs_proc_servers_open, | ||
124 | .read = seq_read, | ||
125 | .llseek = seq_lseek, | ||
126 | .release = seq_release, | ||
127 | }; | ||
128 | |||
129 | static int afs_proc_sysname_open(struct inode *inode, struct file *file); | 104 | static int afs_proc_sysname_open(struct inode *inode, struct file *file); |
130 | static int afs_proc_sysname_release(struct inode *inode, struct file *file); | 105 | static int afs_proc_sysname_release(struct inode *inode, struct file *file); |
131 | static void *afs_proc_sysname_start(struct seq_file *p, loff_t *pos); | 106 | static void *afs_proc_sysname_start(struct seq_file *p, loff_t *pos); |
@@ -152,7 +127,7 @@ static const struct file_operations afs_proc_sysname_fops = { | |||
152 | .write = afs_proc_sysname_write, | 127 | .write = afs_proc_sysname_write, |
153 | }; | 128 | }; |
154 | 129 | ||
155 | static const struct file_operations afs_proc_stats_fops; | 130 | static int afs_proc_stats_show(struct seq_file *m, void *v); |
156 | 131 | ||
157 | /* | 132 | /* |
158 | * initialise the /proc/fs/afs/ directory | 133 | * initialise the /proc/fs/afs/ directory |
@@ -167,8 +142,8 @@ int afs_proc_init(struct afs_net *net) | |||
167 | 142 | ||
168 | if (!proc_create("cells", 0644, net->proc_afs, &afs_proc_cells_fops) || | 143 | if (!proc_create("cells", 0644, net->proc_afs, &afs_proc_cells_fops) || |
169 | !proc_create("rootcell", 0644, net->proc_afs, &afs_proc_rootcell_fops) || | 144 | !proc_create("rootcell", 0644, net->proc_afs, &afs_proc_rootcell_fops) || |
170 | !proc_create("servers", 0644, net->proc_afs, &afs_proc_servers_fops) || | 145 | !proc_create_seq("servers", 0644, net->proc_afs, &afs_proc_servers_ops) || |
171 | !proc_create("stats", 0644, net->proc_afs, &afs_proc_stats_fops) || | 146 | !proc_create_single("stats", 0644, net->proc_afs, afs_proc_stats_show) || |
172 | !proc_create("sysname", 0644, net->proc_afs, &afs_proc_sysname_fops)) | 147 | !proc_create("sysname", 0644, net->proc_afs, &afs_proc_sysname_fops)) |
173 | goto error_tree; | 148 | goto error_tree; |
174 | 149 | ||
@@ -196,16 +171,7 @@ void afs_proc_cleanup(struct afs_net *net) | |||
196 | */ | 171 | */ |
197 | static int afs_proc_cells_open(struct inode *inode, struct file *file) | 172 | static int afs_proc_cells_open(struct inode *inode, struct file *file) |
198 | { | 173 | { |
199 | struct seq_file *m; | 174 | return seq_open(file, &afs_proc_cells_ops); |
200 | int ret; | ||
201 | |||
202 | ret = seq_open(file, &afs_proc_cells_ops); | ||
203 | if (ret < 0) | ||
204 | return ret; | ||
205 | |||
206 | m = file->private_data; | ||
207 | m->private = PDE_DATA(inode); | ||
208 | return 0; | ||
209 | } | 175 | } |
210 | 176 | ||
211 | /* | 177 | /* |
@@ -430,10 +396,11 @@ int afs_proc_cell_setup(struct afs_net *net, struct afs_cell *cell) | |||
430 | if (!dir) | 396 | if (!dir) |
431 | goto error_dir; | 397 | goto error_dir; |
432 | 398 | ||
433 | if (!proc_create_data("vlservers", 0, dir, | 399 | if (!proc_create_seq_data("vlservers", 0, dir, |
434 | &afs_proc_cell_vlservers_fops, cell) || | 400 | &afs_proc_cell_vlservers_ops, cell)) |
435 | !proc_create_data("volumes", 0, dir, | 401 | goto error_tree; |
436 | &afs_proc_cell_volumes_fops, cell)) | 402 | if (!proc_create_seq_data("volumes", 0, dir, &afs_proc_cell_volumes_ops, |
403 | cell)) | ||
437 | goto error_tree; | 404 | goto error_tree; |
438 | 405 | ||
439 | _leave(" = 0"); | 406 | _leave(" = 0"); |
@@ -459,36 +426,13 @@ void afs_proc_cell_remove(struct afs_net *net, struct afs_cell *cell) | |||
459 | } | 426 | } |
460 | 427 | ||
461 | /* | 428 | /* |
462 | * open "/proc/fs/afs/<cell>/volumes" which provides a summary of extant cells | ||
463 | */ | ||
464 | static int afs_proc_cell_volumes_open(struct inode *inode, struct file *file) | ||
465 | { | ||
466 | struct afs_cell *cell; | ||
467 | struct seq_file *m; | ||
468 | int ret; | ||
469 | |||
470 | cell = PDE_DATA(inode); | ||
471 | if (!cell) | ||
472 | return -ENOENT; | ||
473 | |||
474 | ret = seq_open(file, &afs_proc_cell_volumes_ops); | ||
475 | if (ret < 0) | ||
476 | return ret; | ||
477 | |||
478 | m = file->private_data; | ||
479 | m->private = cell; | ||
480 | |||
481 | return 0; | ||
482 | } | ||
483 | |||
484 | /* | ||
485 | * set up the iterator to start reading from the cells list and return the | 429 | * set up the iterator to start reading from the cells list and return the |
486 | * first item | 430 | * first item |
487 | */ | 431 | */ |
488 | static void *afs_proc_cell_volumes_start(struct seq_file *m, loff_t *_pos) | 432 | static void *afs_proc_cell_volumes_start(struct seq_file *m, loff_t *_pos) |
489 | __acquires(cell->proc_lock) | 433 | __acquires(cell->proc_lock) |
490 | { | 434 | { |
491 | struct afs_cell *cell = m->private; | 435 | struct afs_cell *cell = PDE_DATA(file_inode(m->file)); |
492 | 436 | ||
493 | _enter("cell=%p pos=%Ld", cell, *_pos); | 437 | _enter("cell=%p pos=%Ld", cell, *_pos); |
494 | 438 | ||
@@ -502,7 +446,7 @@ static void *afs_proc_cell_volumes_start(struct seq_file *m, loff_t *_pos) | |||
502 | static void *afs_proc_cell_volumes_next(struct seq_file *p, void *v, | 446 | static void *afs_proc_cell_volumes_next(struct seq_file *p, void *v, |
503 | loff_t *_pos) | 447 | loff_t *_pos) |
504 | { | 448 | { |
505 | struct afs_cell *cell = p->private; | 449 | struct afs_cell *cell = PDE_DATA(file_inode(p->file)); |
506 | 450 | ||
507 | _enter("cell=%p pos=%Ld", cell, *_pos); | 451 | _enter("cell=%p pos=%Ld", cell, *_pos); |
508 | return seq_list_next(v, &cell->proc_volumes, _pos); | 452 | return seq_list_next(v, &cell->proc_volumes, _pos); |
@@ -514,7 +458,7 @@ static void *afs_proc_cell_volumes_next(struct seq_file *p, void *v, | |||
514 | static void afs_proc_cell_volumes_stop(struct seq_file *p, void *v) | 458 | static void afs_proc_cell_volumes_stop(struct seq_file *p, void *v) |
515 | __releases(cell->proc_lock) | 459 | __releases(cell->proc_lock) |
516 | { | 460 | { |
517 | struct afs_cell *cell = p->private; | 461 | struct afs_cell *cell = PDE_DATA(file_inode(p->file)); |
518 | 462 | ||
519 | read_unlock(&cell->proc_lock); | 463 | read_unlock(&cell->proc_lock); |
520 | } | 464 | } |
@@ -530,7 +474,7 @@ static const char afs_vol_types[3][3] = { | |||
530 | */ | 474 | */ |
531 | static int afs_proc_cell_volumes_show(struct seq_file *m, void *v) | 475 | static int afs_proc_cell_volumes_show(struct seq_file *m, void *v) |
532 | { | 476 | { |
533 | struct afs_cell *cell = m->private; | 477 | struct afs_cell *cell = PDE_DATA(file_inode(m->file)); |
534 | struct afs_volume *vol = list_entry(v, struct afs_volume, proc_link); | 478 | struct afs_volume *vol = list_entry(v, struct afs_volume, proc_link); |
535 | 479 | ||
536 | /* Display header on line 1 */ | 480 | /* Display header on line 1 */ |
@@ -547,30 +491,6 @@ static int afs_proc_cell_volumes_show(struct seq_file *m, void *v) | |||
547 | } | 491 | } |
548 | 492 | ||
549 | /* | 493 | /* |
550 | * open "/proc/fs/afs/<cell>/vlservers" which provides a list of volume | ||
551 | * location server | ||
552 | */ | ||
553 | static int afs_proc_cell_vlservers_open(struct inode *inode, struct file *file) | ||
554 | { | ||
555 | struct afs_cell *cell; | ||
556 | struct seq_file *m; | ||
557 | int ret; | ||
558 | |||
559 | cell = PDE_DATA(inode); | ||
560 | if (!cell) | ||
561 | return -ENOENT; | ||
562 | |||
563 | ret = seq_open(file, &afs_proc_cell_vlservers_ops); | ||
564 | if (ret<0) | ||
565 | return ret; | ||
566 | |||
567 | m = file->private_data; | ||
568 | m->private = cell; | ||
569 | |||
570 | return 0; | ||
571 | } | ||
572 | |||
573 | /* | ||
574 | * set up the iterator to start reading from the cells list and return the | 494 | * set up the iterator to start reading from the cells list and return the |
575 | * first item | 495 | * first item |
576 | */ | 496 | */ |
@@ -578,7 +498,7 @@ static void *afs_proc_cell_vlservers_start(struct seq_file *m, loff_t *_pos) | |||
578 | __acquires(rcu) | 498 | __acquires(rcu) |
579 | { | 499 | { |
580 | struct afs_addr_list *alist; | 500 | struct afs_addr_list *alist; |
581 | struct afs_cell *cell = m->private; | 501 | struct afs_cell *cell = PDE_DATA(file_inode(m->file)); |
582 | loff_t pos = *_pos; | 502 | loff_t pos = *_pos; |
583 | 503 | ||
584 | rcu_read_lock(); | 504 | rcu_read_lock(); |
@@ -603,7 +523,7 @@ static void *afs_proc_cell_vlservers_next(struct seq_file *p, void *v, | |||
603 | loff_t *_pos) | 523 | loff_t *_pos) |
604 | { | 524 | { |
605 | struct afs_addr_list *alist; | 525 | struct afs_addr_list *alist; |
606 | struct afs_cell *cell = p->private; | 526 | struct afs_cell *cell = PDE_DATA(file_inode(p->file)); |
607 | loff_t pos; | 527 | loff_t pos; |
608 | 528 | ||
609 | alist = rcu_dereference(cell->vl_addrs); | 529 | alist = rcu_dereference(cell->vl_addrs); |
@@ -644,15 +564,6 @@ static int afs_proc_cell_vlservers_show(struct seq_file *m, void *v) | |||
644 | } | 564 | } |
645 | 565 | ||
646 | /* | 566 | /* |
647 | * open "/proc/fs/afs/servers" which provides a summary of active | ||
648 | * servers | ||
649 | */ | ||
650 | static int afs_proc_servers_open(struct inode *inode, struct file *file) | ||
651 | { | ||
652 | return seq_open(file, &afs_proc_servers_ops); | ||
653 | } | ||
654 | |||
655 | /* | ||
656 | * Set up the iterator to start reading from the server list and return the | 567 | * Set up the iterator to start reading from the server list and return the |
657 | * first item. | 568 | * first item. |
658 | */ | 569 | */ |
@@ -931,18 +842,3 @@ static int afs_proc_stats_show(struct seq_file *m, void *v) | |||
931 | atomic_long_read(&net->n_store_bytes)); | 842 | atomic_long_read(&net->n_store_bytes)); |
932 | return 0; | 843 | return 0; |
933 | } | 844 | } |
934 | |||
935 | /* | ||
936 | * Open "/proc/fs/afs/stats" to allow reading of the stat counters. | ||
937 | */ | ||
938 | static int afs_proc_stats_open(struct inode *inode, struct file *file) | ||
939 | { | ||
940 | return single_open(file, afs_proc_stats_show, NULL); | ||
941 | } | ||
942 | |||
943 | static const struct file_operations afs_proc_stats_fops = { | ||
944 | .open = afs_proc_stats_open, | ||
945 | .read = seq_read, | ||
946 | .llseek = seq_lseek, | ||
947 | .release = single_release, | ||
948 | }; | ||
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/cifs/cifs_debug.c b/fs/cifs/cifs_debug.c index 9d69ea433330..4bc4a7ac61d9 100644 --- a/fs/cifs/cifs_debug.c +++ b/fs/cifs/cifs_debug.c | |||
@@ -314,18 +314,6 @@ skip_rdma: | |||
314 | return 0; | 314 | return 0; |
315 | } | 315 | } |
316 | 316 | ||
317 | static int cifs_debug_data_proc_open(struct inode *inode, struct file *file) | ||
318 | { | ||
319 | return single_open(file, cifs_debug_data_proc_show, NULL); | ||
320 | } | ||
321 | |||
322 | static const struct file_operations cifs_debug_data_proc_fops = { | ||
323 | .open = cifs_debug_data_proc_open, | ||
324 | .read = seq_read, | ||
325 | .llseek = seq_lseek, | ||
326 | .release = single_release, | ||
327 | }; | ||
328 | |||
329 | #ifdef CONFIG_CIFS_STATS | 317 | #ifdef CONFIG_CIFS_STATS |
330 | static ssize_t cifs_stats_proc_write(struct file *file, | 318 | static ssize_t cifs_stats_proc_write(struct file *file, |
331 | const char __user *buffer, size_t count, loff_t *ppos) | 319 | const char __user *buffer, size_t count, loff_t *ppos) |
@@ -497,7 +485,8 @@ cifs_proc_init(void) | |||
497 | if (proc_fs_cifs == NULL) | 485 | if (proc_fs_cifs == NULL) |
498 | return; | 486 | return; |
499 | 487 | ||
500 | proc_create("DebugData", 0, proc_fs_cifs, &cifs_debug_data_proc_fops); | 488 | proc_create_single("DebugData", 0, proc_fs_cifs, |
489 | cifs_debug_data_proc_show); | ||
501 | 490 | ||
502 | #ifdef CONFIG_CIFS_STATS | 491 | #ifdef CONFIG_CIFS_STATS |
503 | proc_create("Stats", 0, proc_fs_cifs, &cifs_stats_proc_fops); | 492 | proc_create("Stats", 0, proc_fs_cifs, &cifs_stats_proc_fops); |
diff --git a/fs/ext4/ext4.h b/fs/ext4/ext4.h index a42e71203e53..229ea4da6785 100644 --- a/fs/ext4/ext4.h +++ b/fs/ext4/ext4.h | |||
@@ -2390,7 +2390,7 @@ extern int ext4_init_inode_table(struct super_block *sb, | |||
2390 | extern void ext4_end_bitmap_read(struct buffer_head *bh, int uptodate); | 2390 | extern void ext4_end_bitmap_read(struct buffer_head *bh, int uptodate); |
2391 | 2391 | ||
2392 | /* mballoc.c */ | 2392 | /* mballoc.c */ |
2393 | extern const struct file_operations ext4_seq_mb_groups_fops; | 2393 | extern const struct seq_operations ext4_mb_seq_groups_ops; |
2394 | extern long ext4_mb_stats; | 2394 | extern long ext4_mb_stats; |
2395 | extern long ext4_mb_max_to_scan; | 2395 | extern long ext4_mb_max_to_scan; |
2396 | extern int ext4_mb_init(struct super_block *); | 2396 | extern int ext4_mb_init(struct super_block *); |
diff --git a/fs/ext4/mballoc.c b/fs/ext4/mballoc.c index 769a62708b1c..6884e81c1465 100644 --- a/fs/ext4/mballoc.c +++ b/fs/ext4/mballoc.c | |||
@@ -2254,7 +2254,7 @@ out: | |||
2254 | 2254 | ||
2255 | static void *ext4_mb_seq_groups_start(struct seq_file *seq, loff_t *pos) | 2255 | static void *ext4_mb_seq_groups_start(struct seq_file *seq, loff_t *pos) |
2256 | { | 2256 | { |
2257 | struct super_block *sb = seq->private; | 2257 | struct super_block *sb = PDE_DATA(file_inode(seq->file)); |
2258 | ext4_group_t group; | 2258 | ext4_group_t group; |
2259 | 2259 | ||
2260 | if (*pos < 0 || *pos >= ext4_get_groups_count(sb)) | 2260 | if (*pos < 0 || *pos >= ext4_get_groups_count(sb)) |
@@ -2265,7 +2265,7 @@ static void *ext4_mb_seq_groups_start(struct seq_file *seq, loff_t *pos) | |||
2265 | 2265 | ||
2266 | static void *ext4_mb_seq_groups_next(struct seq_file *seq, void *v, loff_t *pos) | 2266 | static void *ext4_mb_seq_groups_next(struct seq_file *seq, void *v, loff_t *pos) |
2267 | { | 2267 | { |
2268 | struct super_block *sb = seq->private; | 2268 | struct super_block *sb = PDE_DATA(file_inode(seq->file)); |
2269 | ext4_group_t group; | 2269 | ext4_group_t group; |
2270 | 2270 | ||
2271 | ++*pos; | 2271 | ++*pos; |
@@ -2277,7 +2277,7 @@ static void *ext4_mb_seq_groups_next(struct seq_file *seq, void *v, loff_t *pos) | |||
2277 | 2277 | ||
2278 | static int ext4_mb_seq_groups_show(struct seq_file *seq, void *v) | 2278 | static int ext4_mb_seq_groups_show(struct seq_file *seq, void *v) |
2279 | { | 2279 | { |
2280 | struct super_block *sb = seq->private; | 2280 | struct super_block *sb = PDE_DATA(file_inode(seq->file)); |
2281 | ext4_group_t group = (ext4_group_t) ((unsigned long) v); | 2281 | ext4_group_t group = (ext4_group_t) ((unsigned long) v); |
2282 | int i; | 2282 | int i; |
2283 | int err, buddy_loaded = 0; | 2283 | int err, buddy_loaded = 0; |
@@ -2330,34 +2330,13 @@ static void ext4_mb_seq_groups_stop(struct seq_file *seq, void *v) | |||
2330 | { | 2330 | { |
2331 | } | 2331 | } |
2332 | 2332 | ||
2333 | static const struct seq_operations ext4_mb_seq_groups_ops = { | 2333 | const struct seq_operations ext4_mb_seq_groups_ops = { |
2334 | .start = ext4_mb_seq_groups_start, | 2334 | .start = ext4_mb_seq_groups_start, |
2335 | .next = ext4_mb_seq_groups_next, | 2335 | .next = ext4_mb_seq_groups_next, |
2336 | .stop = ext4_mb_seq_groups_stop, | 2336 | .stop = ext4_mb_seq_groups_stop, |
2337 | .show = ext4_mb_seq_groups_show, | 2337 | .show = ext4_mb_seq_groups_show, |
2338 | }; | 2338 | }; |
2339 | 2339 | ||
2340 | static int ext4_mb_seq_groups_open(struct inode *inode, struct file *file) | ||
2341 | { | ||
2342 | struct super_block *sb = PDE_DATA(inode); | ||
2343 | int rc; | ||
2344 | |||
2345 | rc = seq_open(file, &ext4_mb_seq_groups_ops); | ||
2346 | if (rc == 0) { | ||
2347 | struct seq_file *m = file->private_data; | ||
2348 | m->private = sb; | ||
2349 | } | ||
2350 | return rc; | ||
2351 | |||
2352 | } | ||
2353 | |||
2354 | const struct file_operations ext4_seq_mb_groups_fops = { | ||
2355 | .open = ext4_mb_seq_groups_open, | ||
2356 | .read = seq_read, | ||
2357 | .llseek = seq_lseek, | ||
2358 | .release = seq_release, | ||
2359 | }; | ||
2360 | |||
2361 | static struct kmem_cache *get_groupinfo_cache(int blocksize_bits) | 2340 | static struct kmem_cache *get_groupinfo_cache(int blocksize_bits) |
2362 | { | 2341 | { |
2363 | int cache_index = blocksize_bits - EXT4_MIN_BLOCK_LOG_SIZE; | 2342 | int cache_index = blocksize_bits - EXT4_MIN_BLOCK_LOG_SIZE; |
diff --git a/fs/ext4/sysfs.c b/fs/ext4/sysfs.c index 9ebd26c957c2..f34da0bb8f17 100644 --- a/fs/ext4/sysfs.c +++ b/fs/ext4/sysfs.c | |||
@@ -346,39 +346,9 @@ static struct kobject *ext4_root; | |||
346 | 346 | ||
347 | static struct kobject *ext4_feat; | 347 | static struct kobject *ext4_feat; |
348 | 348 | ||
349 | #define PROC_FILE_SHOW_DEFN(name) \ | ||
350 | static int name##_open(struct inode *inode, struct file *file) \ | ||
351 | { \ | ||
352 | return single_open(file, ext4_seq_##name##_show, PDE_DATA(inode)); \ | ||
353 | } \ | ||
354 | \ | ||
355 | static const struct file_operations ext4_seq_##name##_fops = { \ | ||
356 | .open = name##_open, \ | ||
357 | .read = seq_read, \ | ||
358 | .llseek = seq_lseek, \ | ||
359 | .release = single_release, \ | ||
360 | } | ||
361 | |||
362 | #define PROC_FILE_LIST(name) \ | ||
363 | { __stringify(name), &ext4_seq_##name##_fops } | ||
364 | |||
365 | PROC_FILE_SHOW_DEFN(es_shrinker_info); | ||
366 | PROC_FILE_SHOW_DEFN(options); | ||
367 | |||
368 | static const struct ext4_proc_files { | ||
369 | const char *name; | ||
370 | const struct file_operations *fops; | ||
371 | } proc_files[] = { | ||
372 | PROC_FILE_LIST(options), | ||
373 | PROC_FILE_LIST(es_shrinker_info), | ||
374 | PROC_FILE_LIST(mb_groups), | ||
375 | { NULL, NULL }, | ||
376 | }; | ||
377 | |||
378 | int ext4_register_sysfs(struct super_block *sb) | 349 | int ext4_register_sysfs(struct super_block *sb) |
379 | { | 350 | { |
380 | struct ext4_sb_info *sbi = EXT4_SB(sb); | 351 | struct ext4_sb_info *sbi = EXT4_SB(sb); |
381 | const struct ext4_proc_files *p; | ||
382 | int err; | 352 | int err; |
383 | 353 | ||
384 | init_completion(&sbi->s_kobj_unregister); | 354 | init_completion(&sbi->s_kobj_unregister); |
@@ -392,11 +362,14 @@ int ext4_register_sysfs(struct super_block *sb) | |||
392 | 362 | ||
393 | if (ext4_proc_root) | 363 | if (ext4_proc_root) |
394 | sbi->s_proc = proc_mkdir(sb->s_id, ext4_proc_root); | 364 | sbi->s_proc = proc_mkdir(sb->s_id, ext4_proc_root); |
395 | |||
396 | if (sbi->s_proc) { | 365 | if (sbi->s_proc) { |
397 | for (p = proc_files; p->name; p++) | 366 | proc_create_single_data("options", S_IRUGO, sbi->s_proc, |
398 | proc_create_data(p->name, S_IRUGO, sbi->s_proc, | 367 | ext4_seq_options_show, sb); |
399 | p->fops, sb); | 368 | proc_create_single_data("es_shrinker_info", S_IRUGO, |
369 | sbi->s_proc, ext4_seq_es_shrinker_info_show, | ||
370 | sb); | ||
371 | proc_create_seq_data("mb_groups", S_IRUGO, sbi->s_proc, | ||
372 | &ext4_mb_seq_groups_ops, sb); | ||
400 | } | 373 | } |
401 | return 0; | 374 | return 0; |
402 | } | 375 | } |
@@ -404,13 +377,9 @@ int ext4_register_sysfs(struct super_block *sb) | |||
404 | void ext4_unregister_sysfs(struct super_block *sb) | 377 | void ext4_unregister_sysfs(struct super_block *sb) |
405 | { | 378 | { |
406 | struct ext4_sb_info *sbi = EXT4_SB(sb); | 379 | struct ext4_sb_info *sbi = EXT4_SB(sb); |
407 | const struct ext4_proc_files *p; | ||
408 | 380 | ||
409 | if (sbi->s_proc) { | 381 | if (sbi->s_proc) |
410 | for (p = proc_files; p->name; p++) | 382 | remove_proc_subtree(sb->s_id, ext4_proc_root); |
411 | remove_proc_entry(p->name, sbi->s_proc); | ||
412 | remove_proc_entry(sb->s_id, ext4_proc_root); | ||
413 | } | ||
414 | kobject_del(&sbi->s_kobj); | 383 | kobject_del(&sbi->s_kobj); |
415 | } | 384 | } |
416 | 385 | ||
diff --git a/fs/f2fs/sysfs.c b/fs/f2fs/sysfs.c index f33a56d6e6dd..4b47ca6296a7 100644 --- a/fs/f2fs/sysfs.c +++ b/fs/f2fs/sysfs.c | |||
@@ -572,23 +572,6 @@ static int iostat_info_seq_show(struct seq_file *seq, void *offset) | |||
572 | return 0; | 572 | return 0; |
573 | } | 573 | } |
574 | 574 | ||
575 | #define F2FS_PROC_FILE_DEF(_name) \ | ||
576 | static int _name##_open_fs(struct inode *inode, struct file *file) \ | ||
577 | { \ | ||
578 | return single_open(file, _name##_seq_show, PDE_DATA(inode)); \ | ||
579 | } \ | ||
580 | \ | ||
581 | static const struct file_operations f2fs_seq_##_name##_fops = { \ | ||
582 | .open = _name##_open_fs, \ | ||
583 | .read = seq_read, \ | ||
584 | .llseek = seq_lseek, \ | ||
585 | .release = single_release, \ | ||
586 | }; | ||
587 | |||
588 | F2FS_PROC_FILE_DEF(segment_info); | ||
589 | F2FS_PROC_FILE_DEF(segment_bits); | ||
590 | F2FS_PROC_FILE_DEF(iostat_info); | ||
591 | |||
592 | int __init f2fs_init_sysfs(void) | 575 | int __init f2fs_init_sysfs(void) |
593 | { | 576 | { |
594 | int ret; | 577 | int ret; |
@@ -632,12 +615,12 @@ int f2fs_register_sysfs(struct f2fs_sb_info *sbi) | |||
632 | sbi->s_proc = proc_mkdir(sb->s_id, f2fs_proc_root); | 615 | sbi->s_proc = proc_mkdir(sb->s_id, f2fs_proc_root); |
633 | 616 | ||
634 | if (sbi->s_proc) { | 617 | if (sbi->s_proc) { |
635 | proc_create_data("segment_info", S_IRUGO, sbi->s_proc, | 618 | proc_create_single_data("segment_info", S_IRUGO, sbi->s_proc, |
636 | &f2fs_seq_segment_info_fops, sb); | 619 | segment_info_seq_show, sb); |
637 | proc_create_data("segment_bits", S_IRUGO, sbi->s_proc, | 620 | proc_create_single_data("segment_bits", S_IRUGO, sbi->s_proc, |
638 | &f2fs_seq_segment_bits_fops, sb); | 621 | segment_bits_seq_show, sb); |
639 | proc_create_data("iostat_info", S_IRUGO, sbi->s_proc, | 622 | proc_create_single_data("iostat_info", S_IRUGO, sbi->s_proc, |
640 | &f2fs_seq_iostat_info_fops, sb); | 623 | iostat_info_seq_show, sb); |
641 | } | 624 | } |
642 | return 0; | 625 | return 0; |
643 | } | 626 | } |
diff --git a/fs/filesystems.c b/fs/filesystems.c index f2728a4a03a1..b03f57b1105b 100644 --- a/fs/filesystems.c +++ b/fs/filesystems.c | |||
@@ -238,21 +238,9 @@ static int filesystems_proc_show(struct seq_file *m, void *v) | |||
238 | return 0; | 238 | return 0; |
239 | } | 239 | } |
240 | 240 | ||
241 | static int filesystems_proc_open(struct inode *inode, struct file *file) | ||
242 | { | ||
243 | return single_open(file, filesystems_proc_show, NULL); | ||
244 | } | ||
245 | |||
246 | static const struct file_operations filesystems_proc_fops = { | ||
247 | .open = filesystems_proc_open, | ||
248 | .read = seq_read, | ||
249 | .llseek = seq_lseek, | ||
250 | .release = single_release, | ||
251 | }; | ||
252 | |||
253 | static int __init proc_filesystems_init(void) | 241 | static int __init proc_filesystems_init(void) |
254 | { | 242 | { |
255 | proc_create("filesystems", 0, NULL, &filesystems_proc_fops); | 243 | proc_create_single("filesystems", 0, NULL, filesystems_proc_show); |
256 | return 0; | 244 | return 0; |
257 | } | 245 | } |
258 | module_init(proc_filesystems_init); | 246 | module_init(proc_filesystems_init); |
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..f83328a7f048 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) |
@@ -294,7 +295,7 @@ static inline void fscache_stat_d(atomic_t *stat) | |||
294 | 295 | ||
295 | #define __fscache_stat(stat) (stat) | 296 | #define __fscache_stat(stat) (stat) |
296 | 297 | ||
297 | extern const struct file_operations fscache_stats_fops; | 298 | int fscache_stats_show(struct seq_file *m, void *v); |
298 | #else | 299 | #else |
299 | 300 | ||
300 | #define __fscache_stat(stat) (NULL) | 301 | #define __fscache_stat(stat) (NULL) |
diff --git a/fs/fscache/proc.c b/fs/fscache/proc.c index 1d9e4951a597..49a8c90414bc 100644 --- a/fs/fscache/proc.c +++ b/fs/fscache/proc.c | |||
@@ -26,14 +26,14 @@ int __init fscache_proc_init(void) | |||
26 | goto error_dir; | 26 | goto error_dir; |
27 | 27 | ||
28 | #ifdef CONFIG_FSCACHE_STATS | 28 | #ifdef CONFIG_FSCACHE_STATS |
29 | if (!proc_create("fs/fscache/stats", S_IFREG | 0444, NULL, | 29 | if (!proc_create_single("fs/fscache/stats", S_IFREG | 0444, NULL, |
30 | &fscache_stats_fops)) | 30 | fscache_stats_show)) |
31 | goto error_stats; | 31 | goto error_stats; |
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/fscache/stats.c b/fs/fscache/stats.c index fcc8c2f2690e..00564a1dfd76 100644 --- a/fs/fscache/stats.c +++ b/fs/fscache/stats.c | |||
@@ -138,7 +138,7 @@ atomic_t fscache_n_cache_culled_objects; | |||
138 | /* | 138 | /* |
139 | * display the general statistics | 139 | * display the general statistics |
140 | */ | 140 | */ |
141 | static int fscache_stats_show(struct seq_file *m, void *v) | 141 | int fscache_stats_show(struct seq_file *m, void *v) |
142 | { | 142 | { |
143 | seq_puts(m, "FS-Cache statistics\n"); | 143 | seq_puts(m, "FS-Cache statistics\n"); |
144 | 144 | ||
@@ -284,18 +284,3 @@ static int fscache_stats_show(struct seq_file *m, void *v) | |||
284 | atomic_read(&fscache_n_cache_culled_objects)); | 284 | atomic_read(&fscache_n_cache_culled_objects)); |
285 | return 0; | 285 | return 0; |
286 | } | 286 | } |
287 | |||
288 | /* | ||
289 | * open "/proc/fs/fscache/stats" allowing provision of a statistical summary | ||
290 | */ | ||
291 | static int fscache_stats_open(struct inode *inode, struct file *file) | ||
292 | { | ||
293 | return single_open(file, fscache_stats_show, NULL); | ||
294 | } | ||
295 | |||
296 | const struct file_operations fscache_stats_fops = { | ||
297 | .open = fscache_stats_open, | ||
298 | .read = seq_read, | ||
299 | .llseek = seq_lseek, | ||
300 | .release = single_release, | ||
301 | }; | ||
diff --git a/fs/jfs/jfs_debug.c b/fs/jfs/jfs_debug.c index a70907606025..35a5b2a81ae0 100644 --- a/fs/jfs/jfs_debug.c +++ b/fs/jfs/jfs_debug.c | |||
@@ -29,7 +29,6 @@ | |||
29 | 29 | ||
30 | #ifdef PROC_FS_JFS /* see jfs_debug.h */ | 30 | #ifdef PROC_FS_JFS /* see jfs_debug.h */ |
31 | 31 | ||
32 | static struct proc_dir_entry *base; | ||
33 | #ifdef CONFIG_JFS_DEBUG | 32 | #ifdef CONFIG_JFS_DEBUG |
34 | static int jfs_loglevel_proc_show(struct seq_file *m, void *v) | 33 | static int jfs_loglevel_proc_show(struct seq_file *m, void *v) |
35 | { | 34 | { |
@@ -66,43 +65,29 @@ static const struct file_operations jfs_loglevel_proc_fops = { | |||
66 | }; | 65 | }; |
67 | #endif | 66 | #endif |
68 | 67 | ||
69 | static struct { | ||
70 | const char *name; | ||
71 | const struct file_operations *proc_fops; | ||
72 | } Entries[] = { | ||
73 | #ifdef CONFIG_JFS_STATISTICS | ||
74 | { "lmstats", &jfs_lmstats_proc_fops, }, | ||
75 | { "txstats", &jfs_txstats_proc_fops, }, | ||
76 | { "xtstat", &jfs_xtstat_proc_fops, }, | ||
77 | { "mpstat", &jfs_mpstat_proc_fops, }, | ||
78 | #endif | ||
79 | #ifdef CONFIG_JFS_DEBUG | ||
80 | { "TxAnchor", &jfs_txanchor_proc_fops, }, | ||
81 | { "loglevel", &jfs_loglevel_proc_fops } | ||
82 | #endif | ||
83 | }; | ||
84 | #define NPROCENT ARRAY_SIZE(Entries) | ||
85 | |||
86 | void jfs_proc_init(void) | 68 | void jfs_proc_init(void) |
87 | { | 69 | { |
88 | int i; | 70 | struct proc_dir_entry *base; |
89 | 71 | ||
90 | if (!(base = proc_mkdir("fs/jfs", NULL))) | 72 | base = proc_mkdir("fs/jfs", NULL); |
73 | if (!base) | ||
91 | return; | 74 | return; |
92 | 75 | ||
93 | for (i = 0; i < NPROCENT; i++) | 76 | #ifdef CONFIG_JFS_STATISTICS |
94 | proc_create(Entries[i].name, 0, base, Entries[i].proc_fops); | 77 | proc_create_single("lmstats", 0, base, jfs_lmstats_proc_show); |
78 | proc_create_single("txstats", 0, base, jfs_txstats_proc_show); | ||
79 | proc_create_single("xtstat", 0, base, jfs_xtstat_proc_show); | ||
80 | proc_create_single("mpstat", 0, base, jfs_mpstat_proc_show); | ||
81 | #endif | ||
82 | #ifdef CONFIG_JFS_DEBUG | ||
83 | proc_create_single("TxAnchor", 0, base, jfs_txanchor_proc_show); | ||
84 | proc_create("loglevel", 0, base, &jfs_loglevel_proc_fops); | ||
85 | #endif | ||
95 | } | 86 | } |
96 | 87 | ||
97 | void jfs_proc_clean(void) | 88 | void jfs_proc_clean(void) |
98 | { | 89 | { |
99 | int i; | 90 | remove_proc_subtree("fs/jfs", NULL); |
100 | |||
101 | if (base) { | ||
102 | for (i = 0; i < NPROCENT; i++) | ||
103 | remove_proc_entry(Entries[i].name, base); | ||
104 | remove_proc_entry("fs/jfs", NULL); | ||
105 | } | ||
106 | } | 91 | } |
107 | 92 | ||
108 | #endif /* PROC_FS_JFS */ | 93 | #endif /* PROC_FS_JFS */ |
diff --git a/fs/jfs/jfs_debug.h b/fs/jfs/jfs_debug.h index eafd1300a00b..0d9e35da8462 100644 --- a/fs/jfs/jfs_debug.h +++ b/fs/jfs/jfs_debug.h | |||
@@ -62,7 +62,7 @@ extern void jfs_proc_clean(void); | |||
62 | 62 | ||
63 | extern int jfsloglevel; | 63 | extern int jfsloglevel; |
64 | 64 | ||
65 | extern const struct file_operations jfs_txanchor_proc_fops; | 65 | int jfs_txanchor_proc_show(struct seq_file *m, void *v); |
66 | 66 | ||
67 | /* information message: e.g., configuration, major event */ | 67 | /* information message: e.g., configuration, major event */ |
68 | #define jfs_info(fmt, arg...) do { \ | 68 | #define jfs_info(fmt, arg...) do { \ |
@@ -105,10 +105,10 @@ extern const struct file_operations jfs_txanchor_proc_fops; | |||
105 | * ---------- | 105 | * ---------- |
106 | */ | 106 | */ |
107 | #ifdef CONFIG_JFS_STATISTICS | 107 | #ifdef CONFIG_JFS_STATISTICS |
108 | extern const struct file_operations jfs_lmstats_proc_fops; | 108 | int jfs_lmstats_proc_show(struct seq_file *m, void *v); |
109 | extern const struct file_operations jfs_txstats_proc_fops; | 109 | int jfs_txstats_proc_show(struct seq_file *m, void *v); |
110 | extern const struct file_operations jfs_mpstat_proc_fops; | 110 | int jfs_mpstat_proc_show(struct seq_file *m, void *v); |
111 | extern const struct file_operations jfs_xtstat_proc_fops; | 111 | int jfs_xtstat_proc_show(struct seq_file *m, void *v); |
112 | 112 | ||
113 | #define INCREMENT(x) ((x)++) | 113 | #define INCREMENT(x) ((x)++) |
114 | #define DECREMENT(x) ((x)--) | 114 | #define DECREMENT(x) ((x)--) |
diff --git a/fs/jfs/jfs_logmgr.c b/fs/jfs/jfs_logmgr.c index 0e5d412c0b01..6b68df395892 100644 --- a/fs/jfs/jfs_logmgr.c +++ b/fs/jfs/jfs_logmgr.c | |||
@@ -2493,7 +2493,7 @@ exit: | |||
2493 | } | 2493 | } |
2494 | 2494 | ||
2495 | #ifdef CONFIG_JFS_STATISTICS | 2495 | #ifdef CONFIG_JFS_STATISTICS |
2496 | static int jfs_lmstats_proc_show(struct seq_file *m, void *v) | 2496 | int jfs_lmstats_proc_show(struct seq_file *m, void *v) |
2497 | { | 2497 | { |
2498 | seq_printf(m, | 2498 | seq_printf(m, |
2499 | "JFS Logmgr stats\n" | 2499 | "JFS Logmgr stats\n" |
@@ -2510,16 +2510,4 @@ static int jfs_lmstats_proc_show(struct seq_file *m, void *v) | |||
2510 | lmStat.partial_page); | 2510 | lmStat.partial_page); |
2511 | return 0; | 2511 | return 0; |
2512 | } | 2512 | } |
2513 | |||
2514 | static int jfs_lmstats_proc_open(struct inode *inode, struct file *file) | ||
2515 | { | ||
2516 | return single_open(file, jfs_lmstats_proc_show, NULL); | ||
2517 | } | ||
2518 | |||
2519 | const struct file_operations jfs_lmstats_proc_fops = { | ||
2520 | .open = jfs_lmstats_proc_open, | ||
2521 | .read = seq_read, | ||
2522 | .llseek = seq_lseek, | ||
2523 | .release = single_release, | ||
2524 | }; | ||
2525 | #endif /* CONFIG_JFS_STATISTICS */ | 2513 | #endif /* CONFIG_JFS_STATISTICS */ |
diff --git a/fs/jfs/jfs_metapage.c b/fs/jfs/jfs_metapage.c index 1a3b0cc22ad3..fa2c6824c7f2 100644 --- a/fs/jfs/jfs_metapage.c +++ b/fs/jfs/jfs_metapage.c | |||
@@ -815,7 +815,7 @@ void __invalidate_metapages(struct inode *ip, s64 addr, int len) | |||
815 | } | 815 | } |
816 | 816 | ||
817 | #ifdef CONFIG_JFS_STATISTICS | 817 | #ifdef CONFIG_JFS_STATISTICS |
818 | static int jfs_mpstat_proc_show(struct seq_file *m, void *v) | 818 | int jfs_mpstat_proc_show(struct seq_file *m, void *v) |
819 | { | 819 | { |
820 | seq_printf(m, | 820 | seq_printf(m, |
821 | "JFS Metapage statistics\n" | 821 | "JFS Metapage statistics\n" |
@@ -828,16 +828,4 @@ static int jfs_mpstat_proc_show(struct seq_file *m, void *v) | |||
828 | mpStat.lockwait); | 828 | mpStat.lockwait); |
829 | return 0; | 829 | return 0; |
830 | } | 830 | } |
831 | |||
832 | static int jfs_mpstat_proc_open(struct inode *inode, struct file *file) | ||
833 | { | ||
834 | return single_open(file, jfs_mpstat_proc_show, NULL); | ||
835 | } | ||
836 | |||
837 | const struct file_operations jfs_mpstat_proc_fops = { | ||
838 | .open = jfs_mpstat_proc_open, | ||
839 | .read = seq_read, | ||
840 | .llseek = seq_lseek, | ||
841 | .release = single_release, | ||
842 | }; | ||
843 | #endif | 831 | #endif |
diff --git a/fs/jfs/jfs_txnmgr.c b/fs/jfs/jfs_txnmgr.c index 4d973524c887..a5663cb621d8 100644 --- a/fs/jfs/jfs_txnmgr.c +++ b/fs/jfs/jfs_txnmgr.c | |||
@@ -2998,7 +2998,7 @@ int jfs_sync(void *arg) | |||
2998 | } | 2998 | } |
2999 | 2999 | ||
3000 | #if defined(CONFIG_PROC_FS) && defined(CONFIG_JFS_DEBUG) | 3000 | #if defined(CONFIG_PROC_FS) && defined(CONFIG_JFS_DEBUG) |
3001 | static int jfs_txanchor_proc_show(struct seq_file *m, void *v) | 3001 | int jfs_txanchor_proc_show(struct seq_file *m, void *v) |
3002 | { | 3002 | { |
3003 | char *freewait; | 3003 | char *freewait; |
3004 | char *freelockwait; | 3004 | char *freelockwait; |
@@ -3032,22 +3032,10 @@ static int jfs_txanchor_proc_show(struct seq_file *m, void *v) | |||
3032 | list_empty(&TxAnchor.unlock_queue) ? "" : "not "); | 3032 | list_empty(&TxAnchor.unlock_queue) ? "" : "not "); |
3033 | return 0; | 3033 | return 0; |
3034 | } | 3034 | } |
3035 | |||
3036 | static int jfs_txanchor_proc_open(struct inode *inode, struct file *file) | ||
3037 | { | ||
3038 | return single_open(file, jfs_txanchor_proc_show, NULL); | ||
3039 | } | ||
3040 | |||
3041 | const struct file_operations jfs_txanchor_proc_fops = { | ||
3042 | .open = jfs_txanchor_proc_open, | ||
3043 | .read = seq_read, | ||
3044 | .llseek = seq_lseek, | ||
3045 | .release = single_release, | ||
3046 | }; | ||
3047 | #endif | 3035 | #endif |
3048 | 3036 | ||
3049 | #if defined(CONFIG_PROC_FS) && defined(CONFIG_JFS_STATISTICS) | 3037 | #if defined(CONFIG_PROC_FS) && defined(CONFIG_JFS_STATISTICS) |
3050 | static int jfs_txstats_proc_show(struct seq_file *m, void *v) | 3038 | int jfs_txstats_proc_show(struct seq_file *m, void *v) |
3051 | { | 3039 | { |
3052 | seq_printf(m, | 3040 | seq_printf(m, |
3053 | "JFS TxStats\n" | 3041 | "JFS TxStats\n" |
@@ -3072,16 +3060,4 @@ static int jfs_txstats_proc_show(struct seq_file *m, void *v) | |||
3072 | TxStat.txLockAlloc_freelock); | 3060 | TxStat.txLockAlloc_freelock); |
3073 | return 0; | 3061 | return 0; |
3074 | } | 3062 | } |
3075 | |||
3076 | static int jfs_txstats_proc_open(struct inode *inode, struct file *file) | ||
3077 | { | ||
3078 | return single_open(file, jfs_txstats_proc_show, NULL); | ||
3079 | } | ||
3080 | |||
3081 | const struct file_operations jfs_txstats_proc_fops = { | ||
3082 | .open = jfs_txstats_proc_open, | ||
3083 | .read = seq_read, | ||
3084 | .llseek = seq_lseek, | ||
3085 | .release = single_release, | ||
3086 | }; | ||
3087 | #endif | 3063 | #endif |
diff --git a/fs/jfs/jfs_xtree.c b/fs/jfs/jfs_xtree.c index 5cde6d2fcfca..2c200b5256a6 100644 --- a/fs/jfs/jfs_xtree.c +++ b/fs/jfs/jfs_xtree.c | |||
@@ -3874,7 +3874,7 @@ s64 xtTruncate_pmap(tid_t tid, struct inode *ip, s64 committed_size) | |||
3874 | } | 3874 | } |
3875 | 3875 | ||
3876 | #ifdef CONFIG_JFS_STATISTICS | 3876 | #ifdef CONFIG_JFS_STATISTICS |
3877 | static int jfs_xtstat_proc_show(struct seq_file *m, void *v) | 3877 | int jfs_xtstat_proc_show(struct seq_file *m, void *v) |
3878 | { | 3878 | { |
3879 | seq_printf(m, | 3879 | seq_printf(m, |
3880 | "JFS Xtree statistics\n" | 3880 | "JFS Xtree statistics\n" |
@@ -3887,16 +3887,4 @@ static int jfs_xtstat_proc_show(struct seq_file *m, void *v) | |||
3887 | xtStat.split); | 3887 | xtStat.split); |
3888 | return 0; | 3888 | return 0; |
3889 | } | 3889 | } |
3890 | |||
3891 | static int jfs_xtstat_proc_open(struct inode *inode, struct file *file) | ||
3892 | { | ||
3893 | return single_open(file, jfs_xtstat_proc_show, NULL); | ||
3894 | } | ||
3895 | |||
3896 | const struct file_operations jfs_xtstat_proc_fops = { | ||
3897 | .open = jfs_xtstat_proc_open, | ||
3898 | .read = seq_read, | ||
3899 | .llseek = seq_lseek, | ||
3900 | .release = single_release, | ||
3901 | }; | ||
3902 | #endif | 3890 | #endif |
diff --git a/fs/locks.c b/fs/locks.c index 62bbe8b31f26..05e211be8684 100644 --- a/fs/locks.c +++ b/fs/locks.c | |||
@@ -2788,22 +2788,10 @@ static const struct seq_operations locks_seq_operations = { | |||
2788 | .show = locks_show, | 2788 | .show = locks_show, |
2789 | }; | 2789 | }; |
2790 | 2790 | ||
2791 | static int locks_open(struct inode *inode, struct file *filp) | ||
2792 | { | ||
2793 | return seq_open_private(filp, &locks_seq_operations, | ||
2794 | sizeof(struct locks_iterator)); | ||
2795 | } | ||
2796 | |||
2797 | static const struct file_operations proc_locks_operations = { | ||
2798 | .open = locks_open, | ||
2799 | .read = seq_read, | ||
2800 | .llseek = seq_lseek, | ||
2801 | .release = seq_release_private, | ||
2802 | }; | ||
2803 | |||
2804 | static int __init proc_locks_init(void) | 2791 | static int __init proc_locks_init(void) |
2805 | { | 2792 | { |
2806 | proc_create("locks", 0, NULL, &proc_locks_operations); | 2793 | proc_create_seq_private("locks", 0, NULL, &locks_seq_operations, |
2794 | sizeof(struct locks_iterator), NULL); | ||
2807 | return 0; | 2795 | return 0; |
2808 | } | 2796 | } |
2809 | fs_initcall(proc_locks_init); | 2797 | fs_initcall(proc_locks_init); |
diff --git a/fs/nfs/client.c b/fs/nfs/client.c index b9129e2befea..bbc91d7ca1bd 100644 --- a/fs/nfs/client.c +++ b/fs/nfs/client.c | |||
@@ -1067,7 +1067,6 @@ void nfs_clients_init(struct net *net) | |||
1067 | } | 1067 | } |
1068 | 1068 | ||
1069 | #ifdef CONFIG_PROC_FS | 1069 | #ifdef CONFIG_PROC_FS |
1070 | static int nfs_server_list_open(struct inode *inode, struct file *file); | ||
1071 | static void *nfs_server_list_start(struct seq_file *p, loff_t *pos); | 1070 | static void *nfs_server_list_start(struct seq_file *p, loff_t *pos); |
1072 | static void *nfs_server_list_next(struct seq_file *p, void *v, loff_t *pos); | 1071 | static void *nfs_server_list_next(struct seq_file *p, void *v, loff_t *pos); |
1073 | static void nfs_server_list_stop(struct seq_file *p, void *v); | 1072 | static void nfs_server_list_stop(struct seq_file *p, void *v); |
@@ -1080,14 +1079,6 @@ static const struct seq_operations nfs_server_list_ops = { | |||
1080 | .show = nfs_server_list_show, | 1079 | .show = nfs_server_list_show, |
1081 | }; | 1080 | }; |
1082 | 1081 | ||
1083 | static const struct file_operations nfs_server_list_fops = { | ||
1084 | .open = nfs_server_list_open, | ||
1085 | .read = seq_read, | ||
1086 | .llseek = seq_lseek, | ||
1087 | .release = seq_release_net, | ||
1088 | }; | ||
1089 | |||
1090 | static int nfs_volume_list_open(struct inode *inode, struct file *file); | ||
1091 | static void *nfs_volume_list_start(struct seq_file *p, loff_t *pos); | 1082 | static void *nfs_volume_list_start(struct seq_file *p, loff_t *pos); |
1092 | static void *nfs_volume_list_next(struct seq_file *p, void *v, loff_t *pos); | 1083 | static void *nfs_volume_list_next(struct seq_file *p, void *v, loff_t *pos); |
1093 | static void nfs_volume_list_stop(struct seq_file *p, void *v); | 1084 | static void nfs_volume_list_stop(struct seq_file *p, void *v); |
@@ -1100,23 +1091,6 @@ static const struct seq_operations nfs_volume_list_ops = { | |||
1100 | .show = nfs_volume_list_show, | 1091 | .show = nfs_volume_list_show, |
1101 | }; | 1092 | }; |
1102 | 1093 | ||
1103 | static const struct file_operations nfs_volume_list_fops = { | ||
1104 | .open = nfs_volume_list_open, | ||
1105 | .read = seq_read, | ||
1106 | .llseek = seq_lseek, | ||
1107 | .release = seq_release_net, | ||
1108 | }; | ||
1109 | |||
1110 | /* | ||
1111 | * open "/proc/fs/nfsfs/servers" which provides a summary of servers with which | ||
1112 | * we're dealing | ||
1113 | */ | ||
1114 | static int nfs_server_list_open(struct inode *inode, struct file *file) | ||
1115 | { | ||
1116 | return seq_open_net(inode, file, &nfs_server_list_ops, | ||
1117 | sizeof(struct seq_net_private)); | ||
1118 | } | ||
1119 | |||
1120 | /* | 1094 | /* |
1121 | * set up the iterator to start reading from the server list and return the first item | 1095 | * set up the iterator to start reading from the server list and return the first item |
1122 | */ | 1096 | */ |
@@ -1185,15 +1159,6 @@ static int nfs_server_list_show(struct seq_file *m, void *v) | |||
1185 | } | 1159 | } |
1186 | 1160 | ||
1187 | /* | 1161 | /* |
1188 | * open "/proc/fs/nfsfs/volumes" which provides a summary of extant volumes | ||
1189 | */ | ||
1190 | static int nfs_volume_list_open(struct inode *inode, struct file *file) | ||
1191 | { | ||
1192 | return seq_open_net(inode, file, &nfs_volume_list_ops, | ||
1193 | sizeof(struct seq_net_private)); | ||
1194 | } | ||
1195 | |||
1196 | /* | ||
1197 | * set up the iterator to start reading from the volume list and return the first item | 1162 | * set up the iterator to start reading from the volume list and return the first item |
1198 | */ | 1163 | */ |
1199 | static void *nfs_volume_list_start(struct seq_file *m, loff_t *_pos) | 1164 | static void *nfs_volume_list_start(struct seq_file *m, loff_t *_pos) |
@@ -1278,14 +1243,14 @@ int nfs_fs_proc_net_init(struct net *net) | |||
1278 | goto error_0; | 1243 | goto error_0; |
1279 | 1244 | ||
1280 | /* a file of servers with which we're dealing */ | 1245 | /* a file of servers with which we're dealing */ |
1281 | p = proc_create("servers", S_IFREG|S_IRUGO, | 1246 | p = proc_create_net("servers", S_IFREG|S_IRUGO, nn->proc_nfsfs, |
1282 | nn->proc_nfsfs, &nfs_server_list_fops); | 1247 | &nfs_server_list_ops, sizeof(struct seq_net_private)); |
1283 | if (!p) | 1248 | if (!p) |
1284 | goto error_1; | 1249 | goto error_1; |
1285 | 1250 | ||
1286 | /* a file of volumes that we have mounted */ | 1251 | /* a file of volumes that we have mounted */ |
1287 | p = proc_create("volumes", S_IFREG|S_IRUGO, | 1252 | p = proc_create_net("volumes", S_IFREG|S_IRUGO, nn->proc_nfsfs, |
1288 | nn->proc_nfsfs, &nfs_volume_list_fops); | 1253 | &nfs_volume_list_ops, sizeof(struct seq_net_private)); |
1289 | if (!p) | 1254 | if (!p) |
1290 | goto error_1; | 1255 | goto error_1; |
1291 | return 0; | 1256 | return 0; |
diff --git a/fs/proc/array.c b/fs/proc/array.c index 72391b3f6927..e6d7f41b6684 100644 --- a/fs/proc/array.c +++ b/fs/proc/array.c | |||
@@ -702,25 +702,22 @@ out: | |||
702 | 702 | ||
703 | static int children_seq_show(struct seq_file *seq, void *v) | 703 | static int children_seq_show(struct seq_file *seq, void *v) |
704 | { | 704 | { |
705 | struct inode *inode = seq->private; | 705 | struct inode *inode = file_inode(seq->file); |
706 | pid_t pid; | ||
707 | |||
708 | pid = pid_nr_ns(v, inode->i_sb->s_fs_info); | ||
709 | seq_printf(seq, "%d ", pid); | ||
710 | 706 | ||
707 | seq_printf(seq, "%d ", pid_nr_ns(v, proc_pid_ns(inode))); | ||
711 | return 0; | 708 | return 0; |
712 | } | 709 | } |
713 | 710 | ||
714 | static void *children_seq_start(struct seq_file *seq, loff_t *pos) | 711 | static void *children_seq_start(struct seq_file *seq, loff_t *pos) |
715 | { | 712 | { |
716 | return get_children_pid(seq->private, NULL, *pos); | 713 | return get_children_pid(file_inode(seq->file), NULL, *pos); |
717 | } | 714 | } |
718 | 715 | ||
719 | static void *children_seq_next(struct seq_file *seq, void *v, loff_t *pos) | 716 | static void *children_seq_next(struct seq_file *seq, void *v, loff_t *pos) |
720 | { | 717 | { |
721 | struct pid *pid; | 718 | struct pid *pid; |
722 | 719 | ||
723 | pid = get_children_pid(seq->private, v, *pos + 1); | 720 | pid = get_children_pid(file_inode(seq->file), v, *pos + 1); |
724 | put_pid(v); | 721 | put_pid(v); |
725 | 722 | ||
726 | ++*pos; | 723 | ++*pos; |
@@ -741,17 +738,7 @@ static const struct seq_operations children_seq_ops = { | |||
741 | 738 | ||
742 | static int children_seq_open(struct inode *inode, struct file *file) | 739 | static int children_seq_open(struct inode *inode, struct file *file) |
743 | { | 740 | { |
744 | struct seq_file *m; | 741 | return seq_open(file, &children_seq_ops); |
745 | int ret; | ||
746 | |||
747 | ret = seq_open(file, &children_seq_ops); | ||
748 | if (ret) | ||
749 | return ret; | ||
750 | |||
751 | m = file->private_data; | ||
752 | m->private = inode; | ||
753 | |||
754 | return ret; | ||
755 | } | 742 | } |
756 | 743 | ||
757 | const struct file_operations proc_tid_children_operations = { | 744 | const struct file_operations proc_tid_children_operations = { |
diff --git a/fs/proc/base.c b/fs/proc/base.c index 1a76d751cf3c..4e35593546b1 100644 --- a/fs/proc/base.c +++ b/fs/proc/base.c | |||
@@ -698,7 +698,7 @@ static bool has_pid_permissions(struct pid_namespace *pid, | |||
698 | 698 | ||
699 | static int proc_pid_permission(struct inode *inode, int mask) | 699 | static int proc_pid_permission(struct inode *inode, int mask) |
700 | { | 700 | { |
701 | struct pid_namespace *pid = inode->i_sb->s_fs_info; | 701 | struct pid_namespace *pid = proc_pid_ns(inode); |
702 | struct task_struct *task; | 702 | struct task_struct *task; |
703 | bool has_perms; | 703 | bool has_perms; |
704 | 704 | ||
@@ -733,13 +733,11 @@ static const struct inode_operations proc_def_inode_operations = { | |||
733 | static int proc_single_show(struct seq_file *m, void *v) | 733 | static int proc_single_show(struct seq_file *m, void *v) |
734 | { | 734 | { |
735 | struct inode *inode = m->private; | 735 | struct inode *inode = m->private; |
736 | struct pid_namespace *ns; | 736 | struct pid_namespace *ns = proc_pid_ns(inode); |
737 | struct pid *pid; | 737 | struct pid *pid = proc_pid(inode); |
738 | struct task_struct *task; | 738 | struct task_struct *task; |
739 | int ret; | 739 | int ret; |
740 | 740 | ||
741 | ns = inode->i_sb->s_fs_info; | ||
742 | pid = proc_pid(inode); | ||
743 | task = get_pid_task(pid, PIDTYPE_PID); | 741 | task = get_pid_task(pid, PIDTYPE_PID); |
744 | if (!task) | 742 | if (!task) |
745 | return -ESRCH; | 743 | return -ESRCH; |
@@ -1410,7 +1408,7 @@ static const struct file_operations proc_fail_nth_operations = { | |||
1410 | static int sched_show(struct seq_file *m, void *v) | 1408 | static int sched_show(struct seq_file *m, void *v) |
1411 | { | 1409 | { |
1412 | struct inode *inode = m->private; | 1410 | struct inode *inode = m->private; |
1413 | struct pid_namespace *ns = inode->i_sb->s_fs_info; | 1411 | struct pid_namespace *ns = proc_pid_ns(inode); |
1414 | struct task_struct *p; | 1412 | struct task_struct *p; |
1415 | 1413 | ||
1416 | p = get_proc_task(inode); | 1414 | p = get_proc_task(inode); |
@@ -1782,8 +1780,8 @@ int pid_getattr(const struct path *path, struct kstat *stat, | |||
1782 | u32 request_mask, unsigned int query_flags) | 1780 | u32 request_mask, unsigned int query_flags) |
1783 | { | 1781 | { |
1784 | struct inode *inode = d_inode(path->dentry); | 1782 | struct inode *inode = d_inode(path->dentry); |
1783 | struct pid_namespace *pid = proc_pid_ns(inode); | ||
1785 | struct task_struct *task; | 1784 | struct task_struct *task; |
1786 | struct pid_namespace *pid = path->dentry->d_sb->s_fs_info; | ||
1787 | 1785 | ||
1788 | generic_fillattr(inode, stat); | 1786 | generic_fillattr(inode, stat); |
1789 | 1787 | ||
@@ -2337,7 +2335,7 @@ static int proc_timers_open(struct inode *inode, struct file *file) | |||
2337 | return -ENOMEM; | 2335 | return -ENOMEM; |
2338 | 2336 | ||
2339 | tp->pid = proc_pid(inode); | 2337 | tp->pid = proc_pid(inode); |
2340 | tp->ns = inode->i_sb->s_fs_info; | 2338 | tp->ns = proc_pid_ns(inode); |
2341 | return 0; | 2339 | return 0; |
2342 | } | 2340 | } |
2343 | 2341 | ||
@@ -3239,7 +3237,7 @@ retry: | |||
3239 | int proc_pid_readdir(struct file *file, struct dir_context *ctx) | 3237 | int proc_pid_readdir(struct file *file, struct dir_context *ctx) |
3240 | { | 3238 | { |
3241 | struct tgid_iter iter; | 3239 | struct tgid_iter iter; |
3242 | struct pid_namespace *ns = file_inode(file)->i_sb->s_fs_info; | 3240 | struct pid_namespace *ns = proc_pid_ns(file_inode(file)); |
3243 | loff_t pos = ctx->pos; | 3241 | loff_t pos = ctx->pos; |
3244 | 3242 | ||
3245 | if (pos >= PID_MAX_LIMIT + TGID_OFFSET) | 3243 | if (pos >= PID_MAX_LIMIT + TGID_OFFSET) |
@@ -3588,7 +3586,7 @@ static int proc_task_readdir(struct file *file, struct dir_context *ctx) | |||
3588 | /* f_version caches the tgid value that the last readdir call couldn't | 3586 | /* f_version caches the tgid value that the last readdir call couldn't |
3589 | * return. lseek aka telldir automagically resets f_version to 0. | 3587 | * return. lseek aka telldir automagically resets f_version to 0. |
3590 | */ | 3588 | */ |
3591 | ns = inode->i_sb->s_fs_info; | 3589 | ns = proc_pid_ns(inode); |
3592 | tid = (int)file->f_version; | 3590 | tid = (int)file->f_version; |
3593 | file->f_version = 0; | 3591 | file->f_version = 0; |
3594 | for (task = first_tid(proc_pid(inode), tid, ctx->pos - 2, ns); | 3592 | for (task = first_tid(proc_pid(inode), tid, ctx->pos - 2, ns); |
diff --git a/fs/proc/cmdline.c b/fs/proc/cmdline.c index 8233e7af9389..fa762c5fbcb2 100644 --- a/fs/proc/cmdline.c +++ b/fs/proc/cmdline.c | |||
@@ -11,21 +11,9 @@ static int cmdline_proc_show(struct seq_file *m, void *v) | |||
11 | return 0; | 11 | return 0; |
12 | } | 12 | } |
13 | 13 | ||
14 | static int cmdline_proc_open(struct inode *inode, struct file *file) | ||
15 | { | ||
16 | return single_open(file, cmdline_proc_show, NULL); | ||
17 | } | ||
18 | |||
19 | static const struct file_operations cmdline_proc_fops = { | ||
20 | .open = cmdline_proc_open, | ||
21 | .read = seq_read, | ||
22 | .llseek = seq_lseek, | ||
23 | .release = single_release, | ||
24 | }; | ||
25 | |||
26 | static int __init proc_cmdline_init(void) | 14 | static int __init proc_cmdline_init(void) |
27 | { | 15 | { |
28 | proc_create("cmdline", 0, NULL, &cmdline_proc_fops); | 16 | proc_create_single("cmdline", 0, NULL, cmdline_proc_show); |
29 | return 0; | 17 | return 0; |
30 | } | 18 | } |
31 | fs_initcall(proc_cmdline_init); | 19 | fs_initcall(proc_cmdline_init); |
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 2078e70e1595..02bb1914f5f7 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 | ||
@@ -346,13 +347,12 @@ static const struct inode_operations proc_dir_inode_operations = { | |||
346 | .setattr = proc_notify_change, | 347 | .setattr = proc_notify_change, |
347 | }; | 348 | }; |
348 | 349 | ||
349 | static int proc_register(struct proc_dir_entry * dir, struct proc_dir_entry * dp) | 350 | /* returns the registered entry, or frees dp and returns NULL on failure */ |
351 | struct proc_dir_entry *proc_register(struct proc_dir_entry *dir, | ||
352 | struct proc_dir_entry *dp) | ||
350 | { | 353 | { |
351 | int ret; | 354 | if (proc_alloc_inum(&dp->low_ino)) |
352 | 355 | goto out_free_entry; | |
353 | ret = proc_alloc_inum(&dp->low_ino); | ||
354 | if (ret) | ||
355 | return ret; | ||
356 | 356 | ||
357 | write_lock(&proc_subdir_lock); | 357 | write_lock(&proc_subdir_lock); |
358 | dp->parent = dir; | 358 | dp->parent = dir; |
@@ -360,12 +360,16 @@ static int proc_register(struct proc_dir_entry * dir, struct proc_dir_entry * dp | |||
360 | WARN(1, "proc_dir_entry '%s/%s' already registered\n", | 360 | WARN(1, "proc_dir_entry '%s/%s' already registered\n", |
361 | dir->name, dp->name); | 361 | dir->name, dp->name); |
362 | write_unlock(&proc_subdir_lock); | 362 | write_unlock(&proc_subdir_lock); |
363 | proc_free_inum(dp->low_ino); | 363 | goto out_free_inum; |
364 | return -EEXIST; | ||
365 | } | 364 | } |
366 | write_unlock(&proc_subdir_lock); | 365 | write_unlock(&proc_subdir_lock); |
367 | 366 | ||
368 | return 0; | 367 | return dp; |
368 | out_free_inum: | ||
369 | proc_free_inum(dp->low_ino); | ||
370 | out_free_entry: | ||
371 | pde_free(dp); | ||
372 | return NULL; | ||
369 | } | 373 | } |
370 | 374 | ||
371 | static struct proc_dir_entry *__proc_create(struct proc_dir_entry **parent, | 375 | static struct proc_dir_entry *__proc_create(struct proc_dir_entry **parent, |
@@ -443,10 +447,7 @@ struct proc_dir_entry *proc_symlink(const char *name, | |||
443 | if (ent->data) { | 447 | if (ent->data) { |
444 | strcpy((char*)ent->data,dest); | 448 | strcpy((char*)ent->data,dest); |
445 | ent->proc_iops = &proc_link_inode_operations; | 449 | ent->proc_iops = &proc_link_inode_operations; |
446 | if (proc_register(parent, ent) < 0) { | 450 | ent = proc_register(parent, ent); |
447 | pde_free(ent); | ||
448 | ent = NULL; | ||
449 | } | ||
450 | } else { | 451 | } else { |
451 | pde_free(ent); | 452 | pde_free(ent); |
452 | ent = NULL; | 453 | ent = NULL; |
@@ -470,11 +471,9 @@ struct proc_dir_entry *proc_mkdir_data(const char *name, umode_t mode, | |||
470 | ent->proc_fops = &proc_dir_operations; | 471 | ent->proc_fops = &proc_dir_operations; |
471 | ent->proc_iops = &proc_dir_inode_operations; | 472 | ent->proc_iops = &proc_dir_inode_operations; |
472 | parent->nlink++; | 473 | parent->nlink++; |
473 | if (proc_register(parent, ent) < 0) { | 474 | ent = proc_register(parent, ent); |
474 | pde_free(ent); | 475 | if (!ent) |
475 | parent->nlink--; | 476 | parent->nlink--; |
476 | ent = NULL; | ||
477 | } | ||
478 | } | 477 | } |
479 | return ent; | 478 | return ent; |
480 | } | 479 | } |
@@ -505,47 +504,47 @@ struct proc_dir_entry *proc_create_mount_point(const char *name) | |||
505 | ent->proc_fops = NULL; | 504 | ent->proc_fops = NULL; |
506 | ent->proc_iops = NULL; | 505 | ent->proc_iops = NULL; |
507 | parent->nlink++; | 506 | parent->nlink++; |
508 | if (proc_register(parent, ent) < 0) { | 507 | ent = proc_register(parent, ent); |
509 | pde_free(ent); | 508 | if (!ent) |
510 | parent->nlink--; | 509 | parent->nlink--; |
511 | ent = NULL; | ||
512 | } | ||
513 | } | 510 | } |
514 | return ent; | 511 | return ent; |
515 | } | 512 | } |
516 | EXPORT_SYMBOL(proc_create_mount_point); | 513 | EXPORT_SYMBOL(proc_create_mount_point); |
517 | 514 | ||
518 | struct proc_dir_entry *proc_create_data(const char *name, umode_t mode, | 515 | struct proc_dir_entry *proc_create_reg(const char *name, umode_t mode, |
519 | struct proc_dir_entry *parent, | 516 | struct proc_dir_entry **parent, void *data) |
520 | const struct file_operations *proc_fops, | ||
521 | void *data) | ||
522 | { | 517 | { |
523 | struct proc_dir_entry *pde; | 518 | struct proc_dir_entry *p; |
519 | |||
524 | if ((mode & S_IFMT) == 0) | 520 | if ((mode & S_IFMT) == 0) |
525 | mode |= S_IFREG; | 521 | mode |= S_IFREG; |
526 | 522 | if ((mode & S_IALLUGO) == 0) | |
527 | if (!S_ISREG(mode)) { | 523 | mode |= S_IRUGO; |
528 | WARN_ON(1); /* use proc_mkdir() */ | 524 | if (WARN_ON_ONCE(!S_ISREG(mode))) |
529 | return NULL; | 525 | return NULL; |
526 | |||
527 | p = __proc_create(parent, name, mode, 1); | ||
528 | if (p) { | ||
529 | p->proc_iops = &proc_file_inode_operations; | ||
530 | p->data = data; | ||
530 | } | 531 | } |
532 | return p; | ||
533 | } | ||
534 | |||
535 | struct proc_dir_entry *proc_create_data(const char *name, umode_t mode, | ||
536 | struct proc_dir_entry *parent, | ||
537 | const struct file_operations *proc_fops, void *data) | ||
538 | { | ||
539 | struct proc_dir_entry *p; | ||
531 | 540 | ||
532 | BUG_ON(proc_fops == NULL); | 541 | BUG_ON(proc_fops == NULL); |
533 | 542 | ||
534 | if ((mode & S_IALLUGO) == 0) | 543 | p = proc_create_reg(name, mode, &parent, data); |
535 | mode |= S_IRUGO; | 544 | if (!p) |
536 | pde = __proc_create(&parent, name, mode, 1); | 545 | return NULL; |
537 | if (!pde) | 546 | p->proc_fops = proc_fops; |
538 | goto out; | 547 | return proc_register(parent, p); |
539 | pde->proc_fops = proc_fops; | ||
540 | pde->data = data; | ||
541 | pde->proc_iops = &proc_file_inode_operations; | ||
542 | if (proc_register(parent, pde) < 0) | ||
543 | goto out_free; | ||
544 | return pde; | ||
545 | out_free: | ||
546 | pde_free(pde); | ||
547 | out: | ||
548 | return NULL; | ||
549 | } | 548 | } |
550 | EXPORT_SYMBOL(proc_create_data); | 549 | EXPORT_SYMBOL(proc_create_data); |
551 | 550 | ||
@@ -557,6 +556,67 @@ struct proc_dir_entry *proc_create(const char *name, umode_t mode, | |||
557 | } | 556 | } |
558 | EXPORT_SYMBOL(proc_create); | 557 | EXPORT_SYMBOL(proc_create); |
559 | 558 | ||
559 | static int proc_seq_open(struct inode *inode, struct file *file) | ||
560 | { | ||
561 | struct proc_dir_entry *de = PDE(inode); | ||
562 | |||
563 | if (de->state_size) | ||
564 | return seq_open_private(file, de->seq_ops, de->state_size); | ||
565 | return seq_open(file, de->seq_ops); | ||
566 | } | ||
567 | |||
568 | static const struct file_operations proc_seq_fops = { | ||
569 | .open = proc_seq_open, | ||
570 | .read = seq_read, | ||
571 | .llseek = seq_lseek, | ||
572 | .release = seq_release, | ||
573 | }; | ||
574 | |||
575 | struct proc_dir_entry *proc_create_seq_private(const char *name, umode_t mode, | ||
576 | struct proc_dir_entry *parent, const struct seq_operations *ops, | ||
577 | unsigned int state_size, void *data) | ||
578 | { | ||
579 | struct proc_dir_entry *p; | ||
580 | |||
581 | p = proc_create_reg(name, mode, &parent, data); | ||
582 | if (!p) | ||
583 | return NULL; | ||
584 | p->proc_fops = &proc_seq_fops; | ||
585 | p->seq_ops = ops; | ||
586 | p->state_size = state_size; | ||
587 | return proc_register(parent, p); | ||
588 | } | ||
589 | EXPORT_SYMBOL(proc_create_seq_private); | ||
590 | |||
591 | static int proc_single_open(struct inode *inode, struct file *file) | ||
592 | { | ||
593 | struct proc_dir_entry *de = PDE(inode); | ||
594 | |||
595 | return single_open(file, de->single_show, de->data); | ||
596 | } | ||
597 | |||
598 | static const struct file_operations proc_single_fops = { | ||
599 | .open = proc_single_open, | ||
600 | .read = seq_read, | ||
601 | .llseek = seq_lseek, | ||
602 | .release = single_release, | ||
603 | }; | ||
604 | |||
605 | struct proc_dir_entry *proc_create_single_data(const char *name, umode_t mode, | ||
606 | struct proc_dir_entry *parent, | ||
607 | int (*show)(struct seq_file *, void *), void *data) | ||
608 | { | ||
609 | struct proc_dir_entry *p; | ||
610 | |||
611 | p = proc_create_reg(name, mode, &parent, data); | ||
612 | if (!p) | ||
613 | return NULL; | ||
614 | p->proc_fops = &proc_single_fops; | ||
615 | p->single_show = show; | ||
616 | return proc_register(parent, p); | ||
617 | } | ||
618 | EXPORT_SYMBOL(proc_create_single_data); | ||
619 | |||
560 | void proc_set_size(struct proc_dir_entry *de, loff_t size) | 620 | void proc_set_size(struct proc_dir_entry *de, loff_t size) |
561 | { | 621 | { |
562 | de->size = size; | 622 | de->size = size; |
diff --git a/fs/proc/internal.h b/fs/proc/internal.h index 0f1692e63cb6..a318ae5b36b4 100644 --- a/fs/proc/internal.h +++ b/fs/proc/internal.h | |||
@@ -44,7 +44,12 @@ 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 | union { | ||
48 | const struct seq_operations *seq_ops; | ||
49 | int (*single_show)(struct seq_file *, void *); | ||
50 | }; | ||
47 | void *data; | 51 | void *data; |
52 | unsigned int state_size; | ||
48 | unsigned int low_ino; | 53 | unsigned int low_ino; |
49 | nlink_t nlink; | 54 | nlink_t nlink; |
50 | kuid_t uid; | 55 | kuid_t uid; |
@@ -57,9 +62,9 @@ struct proc_dir_entry { | |||
57 | umode_t mode; | 62 | umode_t mode; |
58 | u8 namelen; | 63 | u8 namelen; |
59 | #ifdef CONFIG_64BIT | 64 | #ifdef CONFIG_64BIT |
60 | #define SIZEOF_PDE_INLINE_NAME (192-139) | 65 | #define SIZEOF_PDE_INLINE_NAME (192-155) |
61 | #else | 66 | #else |
62 | #define SIZEOF_PDE_INLINE_NAME (128-87) | 67 | #define SIZEOF_PDE_INLINE_NAME (128-95) |
63 | #endif | 68 | #endif |
64 | char inline_name[SIZEOF_PDE_INLINE_NAME]; | 69 | char inline_name[SIZEOF_PDE_INLINE_NAME]; |
65 | } __randomize_layout; | 70 | } __randomize_layout; |
@@ -162,6 +167,10 @@ extern bool proc_fill_cache(struct file *, struct dir_context *, const char *, i | |||
162 | /* | 167 | /* |
163 | * generic.c | 168 | * generic.c |
164 | */ | 169 | */ |
170 | struct proc_dir_entry *proc_create_reg(const char *name, umode_t mode, | ||
171 | struct proc_dir_entry **parent, void *data); | ||
172 | struct proc_dir_entry *proc_register(struct proc_dir_entry *dir, | ||
173 | struct proc_dir_entry *dp); | ||
165 | extern struct dentry *proc_lookup(struct inode *, struct dentry *, unsigned int); | 174 | extern struct dentry *proc_lookup(struct inode *, struct dentry *, unsigned int); |
166 | struct dentry *proc_lookup_de(struct inode *, struct dentry *, struct proc_dir_entry *); | 175 | struct dentry *proc_lookup_de(struct inode *, struct dentry *, struct proc_dir_entry *); |
167 | extern int proc_readdir(struct file *, struct dir_context *); | 176 | extern int proc_readdir(struct file *, struct dir_context *); |
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/loadavg.c b/fs/proc/loadavg.c index b572cc865b92..d06694757201 100644 --- a/fs/proc/loadavg.c +++ b/fs/proc/loadavg.c | |||
@@ -28,21 +28,9 @@ static int loadavg_proc_show(struct seq_file *m, void *v) | |||
28 | return 0; | 28 | return 0; |
29 | } | 29 | } |
30 | 30 | ||
31 | static int loadavg_proc_open(struct inode *inode, struct file *file) | ||
32 | { | ||
33 | return single_open(file, loadavg_proc_show, NULL); | ||
34 | } | ||
35 | |||
36 | static const struct file_operations loadavg_proc_fops = { | ||
37 | .open = loadavg_proc_open, | ||
38 | .read = seq_read, | ||
39 | .llseek = seq_lseek, | ||
40 | .release = single_release, | ||
41 | }; | ||
42 | |||
43 | static int __init proc_loadavg_init(void) | 31 | static int __init proc_loadavg_init(void) |
44 | { | 32 | { |
45 | proc_create("loadavg", 0, NULL, &loadavg_proc_fops); | 33 | proc_create_single("loadavg", 0, NULL, loadavg_proc_show); |
46 | return 0; | 34 | return 0; |
47 | } | 35 | } |
48 | fs_initcall(proc_loadavg_init); | 36 | fs_initcall(proc_loadavg_init); |
diff --git a/fs/proc/meminfo.c b/fs/proc/meminfo.c index 65a72ab57471..2fb04846ed11 100644 --- a/fs/proc/meminfo.c +++ b/fs/proc/meminfo.c | |||
@@ -149,21 +149,9 @@ static int meminfo_proc_show(struct seq_file *m, void *v) | |||
149 | return 0; | 149 | return 0; |
150 | } | 150 | } |
151 | 151 | ||
152 | static int meminfo_proc_open(struct inode *inode, struct file *file) | ||
153 | { | ||
154 | return single_open(file, meminfo_proc_show, NULL); | ||
155 | } | ||
156 | |||
157 | static const struct file_operations meminfo_proc_fops = { | ||
158 | .open = meminfo_proc_open, | ||
159 | .read = seq_read, | ||
160 | .llseek = seq_lseek, | ||
161 | .release = single_release, | ||
162 | }; | ||
163 | |||
164 | static int __init proc_meminfo_init(void) | 152 | static int __init proc_meminfo_init(void) |
165 | { | 153 | { |
166 | proc_create("meminfo", 0, NULL, &meminfo_proc_fops); | 154 | proc_create_single("meminfo", 0, NULL, meminfo_proc_show); |
167 | return 0; | 155 | return 0; |
168 | } | 156 | } |
169 | fs_initcall(proc_meminfo_init); | 157 | fs_initcall(proc_meminfo_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_net.c b/fs/proc/proc_net.c index 1763f370489d..7d94fa005b0d 100644 --- a/fs/proc/proc_net.c +++ b/fs/proc/proc_net.c | |||
@@ -38,20 +38,20 @@ static struct net *get_proc_net(const struct inode *inode) | |||
38 | return maybe_get_net(PDE_NET(PDE(inode))); | 38 | return maybe_get_net(PDE_NET(PDE(inode))); |
39 | } | 39 | } |
40 | 40 | ||
41 | int seq_open_net(struct inode *ino, struct file *f, | 41 | static int seq_open_net(struct inode *inode, struct file *file) |
42 | const struct seq_operations *ops, int size) | ||
43 | { | 42 | { |
44 | struct net *net; | 43 | unsigned int state_size = PDE(inode)->state_size; |
45 | struct seq_net_private *p; | 44 | struct seq_net_private *p; |
45 | struct net *net; | ||
46 | 46 | ||
47 | BUG_ON(size < sizeof(*p)); | 47 | WARN_ON_ONCE(state_size < sizeof(*p)); |
48 | 48 | ||
49 | net = get_proc_net(ino); | 49 | net = get_proc_net(inode); |
50 | if (net == NULL) | 50 | if (!net) |
51 | return -ENXIO; | 51 | return -ENXIO; |
52 | 52 | ||
53 | p = __seq_open_private(f, ops, size); | 53 | p = __seq_open_private(file, PDE(inode)->seq_ops, state_size); |
54 | if (p == NULL) { | 54 | if (!p) { |
55 | put_net(net); | 55 | put_net(net); |
56 | return -ENOMEM; | 56 | return -ENOMEM; |
57 | } | 57 | } |
@@ -60,51 +60,83 @@ int seq_open_net(struct inode *ino, struct file *f, | |||
60 | #endif | 60 | #endif |
61 | return 0; | 61 | return 0; |
62 | } | 62 | } |
63 | EXPORT_SYMBOL_GPL(seq_open_net); | ||
64 | 63 | ||
65 | int single_open_net(struct inode *inode, struct file *file, | 64 | static int seq_release_net(struct inode *ino, struct file *f) |
66 | int (*show)(struct seq_file *, void *)) | ||
67 | { | 65 | { |
68 | int err; | 66 | struct seq_file *seq = f->private_data; |
69 | struct net *net; | ||
70 | |||
71 | err = -ENXIO; | ||
72 | net = get_proc_net(inode); | ||
73 | if (net == NULL) | ||
74 | goto err_net; | ||
75 | |||
76 | err = single_open(file, show, net); | ||
77 | if (err < 0) | ||
78 | goto err_open; | ||
79 | 67 | ||
68 | put_net(seq_file_net(seq)); | ||
69 | seq_release_private(ino, f); | ||
80 | return 0; | 70 | return 0; |
71 | } | ||
81 | 72 | ||
82 | err_open: | 73 | static const struct file_operations proc_net_seq_fops = { |
83 | put_net(net); | 74 | .open = seq_open_net, |
84 | err_net: | 75 | .read = seq_read, |
85 | return err; | 76 | .llseek = seq_lseek, |
77 | .release = seq_release_net, | ||
78 | }; | ||
79 | |||
80 | struct proc_dir_entry *proc_create_net_data(const char *name, umode_t mode, | ||
81 | struct proc_dir_entry *parent, const struct seq_operations *ops, | ||
82 | unsigned int state_size, void *data) | ||
83 | { | ||
84 | struct proc_dir_entry *p; | ||
85 | |||
86 | p = proc_create_reg(name, mode, &parent, data); | ||
87 | if (!p) | ||
88 | return NULL; | ||
89 | p->proc_fops = &proc_net_seq_fops; | ||
90 | p->seq_ops = ops; | ||
91 | p->state_size = state_size; | ||
92 | return proc_register(parent, p); | ||
86 | } | 93 | } |
87 | EXPORT_SYMBOL_GPL(single_open_net); | 94 | EXPORT_SYMBOL_GPL(proc_create_net_data); |
88 | 95 | ||
89 | int seq_release_net(struct inode *ino, struct file *f) | 96 | static int single_open_net(struct inode *inode, struct file *file) |
90 | { | 97 | { |
91 | struct seq_file *seq; | 98 | struct proc_dir_entry *de = PDE(inode); |
99 | struct net *net; | ||
100 | int err; | ||
92 | 101 | ||
93 | seq = f->private_data; | 102 | net = get_proc_net(inode); |
103 | if (!net) | ||
104 | return -ENXIO; | ||
94 | 105 | ||
95 | put_net(seq_file_net(seq)); | 106 | err = single_open(file, de->single_show, net); |
96 | seq_release_private(ino, f); | 107 | if (err) |
97 | return 0; | 108 | put_net(net); |
109 | return err; | ||
98 | } | 110 | } |
99 | EXPORT_SYMBOL_GPL(seq_release_net); | ||
100 | 111 | ||
101 | int single_release_net(struct inode *ino, struct file *f) | 112 | static int single_release_net(struct inode *ino, struct file *f) |
102 | { | 113 | { |
103 | struct seq_file *seq = f->private_data; | 114 | struct seq_file *seq = f->private_data; |
104 | put_net(seq->private); | 115 | put_net(seq->private); |
105 | return single_release(ino, f); | 116 | return single_release(ino, f); |
106 | } | 117 | } |
107 | EXPORT_SYMBOL_GPL(single_release_net); | 118 | |
119 | static const struct file_operations proc_net_single_fops = { | ||
120 | .open = single_open_net, | ||
121 | .read = seq_read, | ||
122 | .llseek = seq_lseek, | ||
123 | .release = single_release_net, | ||
124 | }; | ||
125 | |||
126 | struct proc_dir_entry *proc_create_net_single(const char *name, umode_t mode, | ||
127 | struct proc_dir_entry *parent, | ||
128 | int (*show)(struct seq_file *, void *), void *data) | ||
129 | { | ||
130 | struct proc_dir_entry *p; | ||
131 | |||
132 | p = proc_create_reg(name, mode, &parent, data); | ||
133 | if (!p) | ||
134 | return NULL; | ||
135 | p->proc_fops = &proc_net_single_fops; | ||
136 | p->single_show = show; | ||
137 | return proc_register(parent, p); | ||
138 | } | ||
139 | EXPORT_SYMBOL_GPL(proc_create_net_single); | ||
108 | 140 | ||
109 | static struct net *get_proc_task_net(struct inode *dir) | 141 | static struct net *get_proc_task_net(struct inode *dir) |
110 | { | 142 | { |
diff --git a/fs/proc/proc_tty.c b/fs/proc/proc_tty.c index d0cf1c50bb6c..c69ff191e5d8 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> |
@@ -147,11 +135,11 @@ void proc_tty_register_driver(struct tty_driver *driver) | |||
147 | struct proc_dir_entry *ent; | 135 | struct proc_dir_entry *ent; |
148 | 136 | ||
149 | if (!driver->driver_name || driver->proc_entry || | 137 | if (!driver->driver_name || driver->proc_entry || |
150 | !driver->ops->proc_fops) | 138 | !driver->ops->proc_show) |
151 | return; | 139 | return; |
152 | 140 | ||
153 | ent = proc_create_data(driver->driver_name, 0, proc_tty_driver, | 141 | ent = proc_create_single_data(driver->driver_name, 0, proc_tty_driver, |
154 | driver->ops->proc_fops, driver); | 142 | driver->ops->proc_show, driver); |
155 | driver->proc_entry = ent; | 143 | driver->proc_entry = ent; |
156 | } | 144 | } |
157 | 145 | ||
@@ -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/fs/proc/self.c b/fs/proc/self.c index 4d7d061696b3..127265e5c55f 100644 --- a/fs/proc/self.c +++ b/fs/proc/self.c | |||
@@ -12,7 +12,7 @@ static const char *proc_self_get_link(struct dentry *dentry, | |||
12 | struct inode *inode, | 12 | struct inode *inode, |
13 | struct delayed_call *done) | 13 | struct delayed_call *done) |
14 | { | 14 | { |
15 | struct pid_namespace *ns = inode->i_sb->s_fs_info; | 15 | struct pid_namespace *ns = proc_pid_ns(inode); |
16 | pid_t tgid = task_tgid_nr_ns(current, ns); | 16 | pid_t tgid = task_tgid_nr_ns(current, ns); |
17 | char *name; | 17 | char *name; |
18 | 18 | ||
@@ -36,7 +36,7 @@ static unsigned self_inum __ro_after_init; | |||
36 | int proc_setup_self(struct super_block *s) | 36 | int proc_setup_self(struct super_block *s) |
37 | { | 37 | { |
38 | struct inode *root_inode = d_inode(s->s_root); | 38 | struct inode *root_inode = d_inode(s->s_root); |
39 | struct pid_namespace *ns = s->s_fs_info; | 39 | struct pid_namespace *ns = proc_pid_ns(root_inode); |
40 | struct dentry *self; | 40 | struct dentry *self; |
41 | 41 | ||
42 | inode_lock(root_inode); | 42 | inode_lock(root_inode); |
diff --git a/fs/proc/softirqs.c b/fs/proc/softirqs.c index 24072cc06e65..12901dcf57e2 100644 --- a/fs/proc/softirqs.c +++ b/fs/proc/softirqs.c | |||
@@ -25,21 +25,9 @@ static int show_softirqs(struct seq_file *p, void *v) | |||
25 | return 0; | 25 | return 0; |
26 | } | 26 | } |
27 | 27 | ||
28 | static int softirqs_open(struct inode *inode, struct file *file) | ||
29 | { | ||
30 | return single_open(file, show_softirqs, NULL); | ||
31 | } | ||
32 | |||
33 | static const struct file_operations proc_softirqs_operations = { | ||
34 | .open = softirqs_open, | ||
35 | .read = seq_read, | ||
36 | .llseek = seq_lseek, | ||
37 | .release = single_release, | ||
38 | }; | ||
39 | |||
40 | static int __init proc_softirqs_init(void) | 28 | static int __init proc_softirqs_init(void) |
41 | { | 29 | { |
42 | proc_create("softirqs", 0, NULL, &proc_softirqs_operations); | 30 | proc_create_single("softirqs", 0, NULL, show_softirqs); |
43 | return 0; | 31 | return 0; |
44 | } | 32 | } |
45 | fs_initcall(proc_softirqs_init); | 33 | fs_initcall(proc_softirqs_init); |
diff --git a/fs/proc/thread_self.c b/fs/proc/thread_self.c index 9d2efaca499f..b905010ca9eb 100644 --- a/fs/proc/thread_self.c +++ b/fs/proc/thread_self.c | |||
@@ -12,7 +12,7 @@ static const char *proc_thread_self_get_link(struct dentry *dentry, | |||
12 | struct inode *inode, | 12 | struct inode *inode, |
13 | struct delayed_call *done) | 13 | struct delayed_call *done) |
14 | { | 14 | { |
15 | struct pid_namespace *ns = inode->i_sb->s_fs_info; | 15 | struct pid_namespace *ns = proc_pid_ns(inode); |
16 | pid_t tgid = task_tgid_nr_ns(current, ns); | 16 | pid_t tgid = task_tgid_nr_ns(current, ns); |
17 | pid_t pid = task_pid_nr_ns(current, ns); | 17 | pid_t pid = task_pid_nr_ns(current, ns); |
18 | char *name; | 18 | char *name; |
@@ -36,7 +36,7 @@ static unsigned thread_self_inum __ro_after_init; | |||
36 | int proc_setup_thread_self(struct super_block *s) | 36 | int proc_setup_thread_self(struct super_block *s) |
37 | { | 37 | { |
38 | struct inode *root_inode = d_inode(s->s_root); | 38 | struct inode *root_inode = d_inode(s->s_root); |
39 | struct pid_namespace *ns = s->s_fs_info; | 39 | struct pid_namespace *ns = proc_pid_ns(root_inode); |
40 | struct dentry *thread_self; | 40 | struct dentry *thread_self; |
41 | 41 | ||
42 | inode_lock(root_inode); | 42 | inode_lock(root_inode); |
diff --git a/fs/proc/uptime.c b/fs/proc/uptime.c index 95a708d83721..3bd12f955867 100644 --- a/fs/proc/uptime.c +++ b/fs/proc/uptime.c | |||
@@ -30,21 +30,9 @@ static int uptime_proc_show(struct seq_file *m, void *v) | |||
30 | return 0; | 30 | return 0; |
31 | } | 31 | } |
32 | 32 | ||
33 | static int uptime_proc_open(struct inode *inode, struct file *file) | ||
34 | { | ||
35 | return single_open(file, uptime_proc_show, NULL); | ||
36 | } | ||
37 | |||
38 | static const struct file_operations uptime_proc_fops = { | ||
39 | .open = uptime_proc_open, | ||
40 | .read = seq_read, | ||
41 | .llseek = seq_lseek, | ||
42 | .release = single_release, | ||
43 | }; | ||
44 | |||
45 | static int __init proc_uptime_init(void) | 33 | static int __init proc_uptime_init(void) |
46 | { | 34 | { |
47 | proc_create("uptime", 0, NULL, &uptime_proc_fops); | 35 | proc_create_single("uptime", 0, NULL, uptime_proc_show); |
48 | return 0; | 36 | return 0; |
49 | } | 37 | } |
50 | fs_initcall(proc_uptime_init); | 38 | fs_initcall(proc_uptime_init); |
diff --git a/fs/proc/version.c b/fs/proc/version.c index 94901e8e700d..b449f186577f 100644 --- a/fs/proc/version.c +++ b/fs/proc/version.c | |||
@@ -15,21 +15,9 @@ static int version_proc_show(struct seq_file *m, void *v) | |||
15 | return 0; | 15 | return 0; |
16 | } | 16 | } |
17 | 17 | ||
18 | static int version_proc_open(struct inode *inode, struct file *file) | ||
19 | { | ||
20 | return single_open(file, version_proc_show, NULL); | ||
21 | } | ||
22 | |||
23 | static const struct file_operations version_proc_fops = { | ||
24 | .open = version_proc_open, | ||
25 | .read = seq_read, | ||
26 | .llseek = seq_lseek, | ||
27 | .release = single_release, | ||
28 | }; | ||
29 | |||
30 | static int __init proc_version_init(void) | 18 | static int __init proc_version_init(void) |
31 | { | 19 | { |
32 | proc_create("version", 0, NULL, &version_proc_fops); | 20 | proc_create_single("version", 0, NULL, version_proc_show); |
33 | return 0; | 21 | return 0; |
34 | } | 22 | } |
35 | fs_initcall(proc_version_init); | 23 | fs_initcall(proc_version_init); |
diff --git a/fs/reiserfs/procfs.c b/fs/reiserfs/procfs.c index fe999157dd97..e39b3910d24d 100644 --- a/fs/reiserfs/procfs.c +++ b/fs/reiserfs/procfs.c | |||
@@ -389,27 +389,13 @@ static int show_journal(struct seq_file *m, void *unused) | |||
389 | return 0; | 389 | return 0; |
390 | } | 390 | } |
391 | 391 | ||
392 | static int r_open(struct inode *inode, struct file *file) | ||
393 | { | ||
394 | return single_open(file, PDE_DATA(inode), | ||
395 | proc_get_parent_data(inode)); | ||
396 | } | ||
397 | |||
398 | static const struct file_operations r_file_operations = { | ||
399 | .open = r_open, | ||
400 | .read = seq_read, | ||
401 | .llseek = seq_lseek, | ||
402 | .release = single_release, | ||
403 | }; | ||
404 | |||
405 | static struct proc_dir_entry *proc_info_root = NULL; | 392 | static struct proc_dir_entry *proc_info_root = NULL; |
406 | static const char proc_info_root_name[] = "fs/reiserfs"; | 393 | static const char proc_info_root_name[] = "fs/reiserfs"; |
407 | 394 | ||
408 | static void add_file(struct super_block *sb, char *name, | 395 | static void add_file(struct super_block *sb, char *name, |
409 | int (*func) (struct seq_file *, void *)) | 396 | int (*func) (struct seq_file *, void *)) |
410 | { | 397 | { |
411 | proc_create_data(name, 0, REISERFS_SB(sb)->procdir, | 398 | proc_create_single_data(name, 0, REISERFS_SB(sb)->procdir, func, sb); |
412 | &r_file_operations, func); | ||
413 | } | 399 | } |
414 | 400 | ||
415 | int reiserfs_proc_info_init(struct super_block *sb) | 401 | int reiserfs_proc_info_init(struct super_block *sb) |
diff --git a/fs/xfs/xfs_stats.c b/fs/xfs/xfs_stats.c index 056e12b421eb..1cc79907b377 100644 --- a/fs/xfs/xfs_stats.c +++ b/fs/xfs/xfs_stats.c | |||
@@ -113,6 +113,7 @@ void xfs_stats_clearall(struct xfsstats __percpu *stats) | |||
113 | } | 113 | } |
114 | } | 114 | } |
115 | 115 | ||
116 | #ifdef CONFIG_PROC_FS | ||
116 | /* legacy quota interfaces */ | 117 | /* legacy quota interfaces */ |
117 | #ifdef CONFIG_XFS_QUOTA | 118 | #ifdef CONFIG_XFS_QUOTA |
118 | static int xqm_proc_show(struct seq_file *m, void *v) | 119 | static int xqm_proc_show(struct seq_file *m, void *v) |
@@ -124,18 +125,6 @@ static int xqm_proc_show(struct seq_file *m, void *v) | |||
124 | return 0; | 125 | return 0; |
125 | } | 126 | } |
126 | 127 | ||
127 | static int xqm_proc_open(struct inode *inode, struct file *file) | ||
128 | { | ||
129 | return single_open(file, xqm_proc_show, NULL); | ||
130 | } | ||
131 | |||
132 | static const struct file_operations xqm_proc_fops = { | ||
133 | .open = xqm_proc_open, | ||
134 | .read = seq_read, | ||
135 | .llseek = seq_lseek, | ||
136 | .release = single_release, | ||
137 | }; | ||
138 | |||
139 | /* legacy quota stats interface no 2 */ | 128 | /* legacy quota stats interface no 2 */ |
140 | static int xqmstat_proc_show(struct seq_file *m, void *v) | 129 | static int xqmstat_proc_show(struct seq_file *m, void *v) |
141 | { | 130 | { |
@@ -147,22 +136,8 @@ static int xqmstat_proc_show(struct seq_file *m, void *v) | |||
147 | seq_putc(m, '\n'); | 136 | seq_putc(m, '\n'); |
148 | return 0; | 137 | return 0; |
149 | } | 138 | } |
150 | |||
151 | static int xqmstat_proc_open(struct inode *inode, struct file *file) | ||
152 | { | ||
153 | return single_open(file, xqmstat_proc_show, NULL); | ||
154 | } | ||
155 | |||
156 | static const struct file_operations xqmstat_proc_fops = { | ||
157 | .owner = THIS_MODULE, | ||
158 | .open = xqmstat_proc_open, | ||
159 | .read = seq_read, | ||
160 | .llseek = seq_lseek, | ||
161 | .release = single_release, | ||
162 | }; | ||
163 | #endif /* CONFIG_XFS_QUOTA */ | 139 | #endif /* CONFIG_XFS_QUOTA */ |
164 | 140 | ||
165 | #ifdef CONFIG_PROC_FS | ||
166 | int | 141 | int |
167 | xfs_init_procfs(void) | 142 | xfs_init_procfs(void) |
168 | { | 143 | { |
@@ -174,11 +149,9 @@ xfs_init_procfs(void) | |||
174 | goto out; | 149 | goto out; |
175 | 150 | ||
176 | #ifdef CONFIG_XFS_QUOTA | 151 | #ifdef CONFIG_XFS_QUOTA |
177 | if (!proc_create("fs/xfs/xqmstat", 0, NULL, | 152 | if (!proc_create_single("fs/xfs/xqmstat", 0, NULL, xqmstat_proc_show)) |
178 | &xqmstat_proc_fops)) | ||
179 | goto out; | 153 | goto out; |
180 | if (!proc_create("fs/xfs/xqm", 0, NULL, | 154 | if (!proc_create_single("fs/xfs/xqm", 0, NULL, xqm_proc_show)) |
181 | &xqm_proc_fops)) | ||
182 | goto out; | 155 | goto out; |
183 | #endif | 156 | #endif |
184 | return 0; | 157 | return 0; |
diff --git a/include/linux/atalk.h b/include/linux/atalk.h index 40373920ea58..23f805562f4e 100644 --- a/include/linux/atalk.h +++ b/include/linux/atalk.h | |||
@@ -145,7 +145,12 @@ extern rwlock_t atalk_interfaces_lock; | |||
145 | 145 | ||
146 | extern struct atalk_route atrtr_default; | 146 | extern struct atalk_route atrtr_default; |
147 | 147 | ||
148 | extern const struct file_operations atalk_seq_arp_fops; | 148 | struct aarp_iter_state { |
149 | int bucket; | ||
150 | struct aarp_entry **table; | ||
151 | }; | ||
152 | |||
153 | extern const struct seq_operations aarp_seq_ops; | ||
149 | 154 | ||
150 | extern int sysctl_aarp_expiry_time; | 155 | extern int sysctl_aarp_expiry_time; |
151 | extern int sysctl_aarp_tick_time; | 156 | extern int sysctl_aarp_tick_time; |
diff --git a/include/linux/ide.h b/include/linux/ide.h index ca9d34feb572..752464f5a772 100644 --- a/include/linux/ide.h +++ b/include/linux/ide.h | |||
@@ -961,7 +961,7 @@ __IDE_PROC_DEVSET(_name, _min, _max, NULL, NULL) | |||
961 | typedef struct { | 961 | typedef struct { |
962 | const char *name; | 962 | const char *name; |
963 | umode_t mode; | 963 | umode_t mode; |
964 | const struct file_operations *proc_fops; | 964 | int (*show)(struct seq_file *, void *); |
965 | } ide_proc_entry_t; | 965 | } ide_proc_entry_t; |
966 | 966 | ||
967 | void proc_ide_create(void); | 967 | void proc_ide_create(void); |
@@ -973,8 +973,8 @@ void ide_proc_unregister_port(ide_hwif_t *); | |||
973 | void ide_proc_register_driver(ide_drive_t *, struct ide_driver *); | 973 | void ide_proc_register_driver(ide_drive_t *, struct ide_driver *); |
974 | void ide_proc_unregister_driver(ide_drive_t *, struct ide_driver *); | 974 | void ide_proc_unregister_driver(ide_drive_t *, struct ide_driver *); |
975 | 975 | ||
976 | extern const struct file_operations ide_capacity_proc_fops; | 976 | int ide_capacity_proc_show(struct seq_file *m, void *v); |
977 | extern const struct file_operations ide_geometry_proc_fops; | 977 | int ide_geometry_proc_show(struct seq_file *m, void *v); |
978 | #else | 978 | #else |
979 | static inline void proc_ide_create(void) { ; } | 979 | static inline void proc_ide_create(void) { ; } |
980 | static inline void proc_ide_destroy(void) { ; } | 980 | static inline void proc_ide_destroy(void) { ; } |
diff --git a/include/linux/isdn/capilli.h b/include/linux/isdn/capilli.h index 11b57c485854..d75e1ad72964 100644 --- a/include/linux/isdn/capilli.h +++ b/include/linux/isdn/capilli.h | |||
@@ -50,7 +50,7 @@ struct capi_ctr { | |||
50 | u16 (*send_message)(struct capi_ctr *, struct sk_buff *skb); | 50 | u16 (*send_message)(struct capi_ctr *, struct sk_buff *skb); |
51 | 51 | ||
52 | char *(*procinfo)(struct capi_ctr *); | 52 | char *(*procinfo)(struct capi_ctr *); |
53 | const struct file_operations *proc_fops; | 53 | int (*proc_show)(struct seq_file *, void *); |
54 | 54 | ||
55 | /* filled in before calling ready callback */ | 55 | /* filled in before calling ready callback */ |
56 | u8 manu[CAPI_MANUFACTURER_LEN]; /* CAPI_GET_MANUFACTURER */ | 56 | u8 manu[CAPI_MANUFACTURER_LEN]; /* CAPI_GET_MANUFACTURER */ |
diff --git a/include/linux/proc_fs.h b/include/linux/proc_fs.h index 928ef9e4d912..e518352137e7 100644 --- a/include/linux/proc_fs.h +++ b/include/linux/proc_fs.h | |||
@@ -9,6 +9,8 @@ | |||
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_file; | ||
13 | struct seq_operations; | ||
12 | 14 | ||
13 | #ifdef CONFIG_PROC_FS | 15 | #ifdef CONFIG_PROC_FS |
14 | 16 | ||
@@ -23,6 +25,19 @@ 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, | 25 | extern struct proc_dir_entry *proc_mkdir_mode(const char *, umode_t, |
24 | struct proc_dir_entry *); | 26 | struct proc_dir_entry *); |
25 | struct proc_dir_entry *proc_create_mount_point(const char *name); | 27 | struct proc_dir_entry *proc_create_mount_point(const char *name); |
28 | |||
29 | struct proc_dir_entry *proc_create_seq_private(const char *name, umode_t mode, | ||
30 | struct proc_dir_entry *parent, const struct seq_operations *ops, | ||
31 | unsigned int state_size, void *data); | ||
32 | #define proc_create_seq_data(name, mode, parent, ops, data) \ | ||
33 | proc_create_seq_private(name, mode, parent, ops, 0, data) | ||
34 | #define proc_create_seq(name, mode, parent, ops) \ | ||
35 | proc_create_seq_private(name, mode, parent, ops, 0, NULL) | ||
36 | struct proc_dir_entry *proc_create_single_data(const char *name, umode_t mode, | ||
37 | struct proc_dir_entry *parent, | ||
38 | int (*show)(struct seq_file *, void *), void *data); | ||
39 | #define proc_create_single(name, mode, parent, show) \ | ||
40 | proc_create_single_data(name, mode, parent, show, NULL) | ||
26 | 41 | ||
27 | extern struct proc_dir_entry *proc_create_data(const char *, umode_t, | 42 | extern struct proc_dir_entry *proc_create_data(const char *, umode_t, |
28 | struct proc_dir_entry *, | 43 | struct proc_dir_entry *, |
@@ -38,6 +53,15 @@ extern void proc_remove(struct proc_dir_entry *); | |||
38 | extern void remove_proc_entry(const char *, struct proc_dir_entry *); | 53 | extern void remove_proc_entry(const char *, struct proc_dir_entry *); |
39 | extern int remove_proc_subtree(const char *, struct proc_dir_entry *); | 54 | extern int remove_proc_subtree(const char *, struct proc_dir_entry *); |
40 | 55 | ||
56 | struct proc_dir_entry *proc_create_net_data(const char *name, umode_t mode, | ||
57 | struct proc_dir_entry *parent, const struct seq_operations *ops, | ||
58 | unsigned int state_size, void *data); | ||
59 | #define proc_create_net(name, mode, parent, state_size, ops) \ | ||
60 | proc_create_net_data(name, mode, parent, state_size, ops, NULL) | ||
61 | struct proc_dir_entry *proc_create_net_single(const char *name, umode_t mode, | ||
62 | struct proc_dir_entry *parent, | ||
63 | int (*show)(struct seq_file *, void *), void *data); | ||
64 | |||
41 | #else /* CONFIG_PROC_FS */ | 65 | #else /* CONFIG_PROC_FS */ |
42 | 66 | ||
43 | static inline void proc_root_init(void) | 67 | static inline void proc_root_init(void) |
@@ -57,6 +81,11 @@ 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; } | 81 | 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, | 82 | static inline struct proc_dir_entry *proc_mkdir_mode(const char *name, |
59 | umode_t mode, struct proc_dir_entry *parent) { return NULL; } | 83 | umode_t mode, struct proc_dir_entry *parent) { return NULL; } |
84 | #define proc_create_seq_private(name, mode, parent, ops, size, data) ({NULL;}) | ||
85 | #define proc_create_seq_data(name, mode, parent, ops, data) ({NULL;}) | ||
86 | #define proc_create_seq(name, mode, parent, ops) ({NULL;}) | ||
87 | #define proc_create_single(name, mode, parent, show) ({NULL;}) | ||
88 | #define proc_create_single_data(name, mode, parent, show, data) ({NULL;}) | ||
60 | #define proc_create(name, mode, parent, proc_fops) ({NULL;}) | 89 | #define proc_create(name, mode, parent, proc_fops) ({NULL;}) |
61 | #define proc_create_data(name, mode, parent, proc_fops, data) ({NULL;}) | 90 | #define proc_create_data(name, mode, parent, proc_fops, data) ({NULL;}) |
62 | 91 | ||
@@ -69,6 +98,10 @@ static inline void proc_remove(struct proc_dir_entry *de) {} | |||
69 | #define remove_proc_entry(name, parent) do {} while (0) | 98 | #define remove_proc_entry(name, parent) do {} while (0) |
70 | static inline int remove_proc_subtree(const char *name, struct proc_dir_entry *parent) { return 0; } | 99 | static inline int remove_proc_subtree(const char *name, struct proc_dir_entry *parent) { return 0; } |
71 | 100 | ||
101 | #define proc_create_net_data(name, mode, parent, ops, state_size, data) ({NULL;}) | ||
102 | #define proc_create_net(name, mode, parent, state_size, ops) ({NULL;}) | ||
103 | #define proc_create_net_single(name, mode, parent, show, data) ({NULL;}) | ||
104 | |||
72 | #endif /* CONFIG_PROC_FS */ | 105 | #endif /* CONFIG_PROC_FS */ |
73 | 106 | ||
74 | struct net; | 107 | struct net; |
@@ -83,4 +116,10 @@ struct ns_common; | |||
83 | int open_related_ns(struct ns_common *ns, | 116 | int open_related_ns(struct ns_common *ns, |
84 | struct ns_common *(*get_ns)(struct ns_common *ns)); | 117 | struct ns_common *(*get_ns)(struct ns_common *ns)); |
85 | 118 | ||
119 | /* get the associated pid namespace for a file in procfs */ | ||
120 | static inline struct pid_namespace *proc_pid_ns(struct inode *inode) | ||
121 | { | ||
122 | return inode->i_sb->s_fs_info; | ||
123 | } | ||
124 | |||
86 | #endif /* _LINUX_PROC_FS_H */ | 125 | #endif /* _LINUX_PROC_FS_H */ |
diff --git a/include/linux/seq_file_net.h b/include/linux/seq_file_net.h index 43ccd84127b6..0fdbe1ddd8d1 100644 --- a/include/linux/seq_file_net.h +++ b/include/linux/seq_file_net.h | |||
@@ -13,12 +13,6 @@ struct seq_net_private { | |||
13 | #endif | 13 | #endif |
14 | }; | 14 | }; |
15 | 15 | ||
16 | int seq_open_net(struct inode *, struct file *, | ||
17 | const struct seq_operations *, int); | ||
18 | int single_open_net(struct inode *, struct file *file, | ||
19 | int (*show)(struct seq_file *, void *)); | ||
20 | int seq_release_net(struct inode *, struct file *); | ||
21 | int single_release_net(struct inode *, struct file *); | ||
22 | static inline struct net *seq_file_net(struct seq_file *seq) | 16 | static inline struct net *seq_file_net(struct seq_file *seq) |
23 | { | 17 | { |
24 | #ifdef CONFIG_NET_NS | 18 | #ifdef CONFIG_NET_NS |
@@ -28,4 +22,17 @@ static inline struct net *seq_file_net(struct seq_file *seq) | |||
28 | #endif | 22 | #endif |
29 | } | 23 | } |
30 | 24 | ||
25 | /* | ||
26 | * This one is needed for proc_create_net_single since net is stored directly | ||
27 | * in private not as a struct i.e. seq_file_net can't be used. | ||
28 | */ | ||
29 | static inline struct net *seq_file_single_net(struct seq_file *seq) | ||
30 | { | ||
31 | #ifdef CONFIG_NET_NS | ||
32 | return (struct net *)seq->private; | ||
33 | #else | ||
34 | return &init_net; | ||
35 | #endif | ||
36 | } | ||
37 | |||
31 | #endif | 38 | #endif |
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/linux/tty_driver.h b/include/linux/tty_driver.h index 31c2b5b166de..71dbc891851a 100644 --- a/include/linux/tty_driver.h +++ b/include/linux/tty_driver.h | |||
@@ -293,7 +293,7 @@ struct tty_operations { | |||
293 | int (*poll_get_char)(struct tty_driver *driver, int line); | 293 | int (*poll_get_char)(struct tty_driver *driver, int line); |
294 | void (*poll_put_char)(struct tty_driver *driver, int line, char ch); | 294 | void (*poll_put_char)(struct tty_driver *driver, int line, char ch); |
295 | #endif | 295 | #endif |
296 | const struct file_operations *proc_fops; | 296 | int (*proc_show)(struct seq_file *, void *); |
297 | } __randomize_layout; | 297 | } __randomize_layout; |
298 | 298 | ||
299 | struct tty_driver { | 299 | struct tty_driver { |
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/ip6_fib.h b/include/net/ip6_fib.h index 5e86fd9dc857..0e79c3408569 100644 --- a/include/net/ip6_fib.h +++ b/include/net/ip6_fib.h | |||
@@ -394,7 +394,15 @@ void fib6_gc_cleanup(void); | |||
394 | 394 | ||
395 | int fib6_init(void); | 395 | int fib6_init(void); |
396 | 396 | ||
397 | int ipv6_route_open(struct inode *inode, struct file *file); | 397 | struct ipv6_route_iter { |
398 | struct seq_net_private p; | ||
399 | struct fib6_walker w; | ||
400 | loff_t skip; | ||
401 | struct fib6_table *tbl; | ||
402 | int sernum; | ||
403 | }; | ||
404 | |||
405 | extern const struct seq_operations ipv6_route_seq_ops; | ||
398 | 406 | ||
399 | int call_fib6_notifier(struct notifier_block *nb, struct net *net, | 407 | int call_fib6_notifier(struct notifier_block *nb, struct net *net, |
400 | enum fib_event_type event_type, | 408 | enum fib_event_type event_type, |
diff --git a/include/net/ip_vs.h b/include/net/ip_vs.h index eb0bec043c96..aea7a124e66b 100644 --- a/include/net/ip_vs.h +++ b/include/net/ip_vs.h | |||
@@ -41,18 +41,6 @@ static inline struct netns_ipvs *net_ipvs(struct net* net) | |||
41 | return net->ipvs; | 41 | return net->ipvs; |
42 | } | 42 | } |
43 | 43 | ||
44 | /* This one needed for single_open_net since net is stored directly in | ||
45 | * private not as a struct i.e. seq_file_net can't be used. | ||
46 | */ | ||
47 | static inline struct net *seq_file_single_net(struct seq_file *seq) | ||
48 | { | ||
49 | #ifdef CONFIG_NET_NS | ||
50 | return (struct net *)seq->private; | ||
51 | #else | ||
52 | return &init_net; | ||
53 | #endif | ||
54 | } | ||
55 | |||
56 | /* Connections' size value needed by ip_vs_ctl.c */ | 44 | /* Connections' size value needed by ip_vs_ctl.c */ |
57 | extern int ip_vs_conn_tab_size; | 45 | extern int ip_vs_conn_tab_size; |
58 | 46 | ||
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/phonet/pn_dev.h b/include/net/phonet/pn_dev.h index 8639de5750f6..cbee32be1d9c 100644 --- a/include/net/phonet/pn_dev.h +++ b/include/net/phonet/pn_dev.h | |||
@@ -56,7 +56,7 @@ struct net_device *phonet_route_output(struct net *net, u8 daddr); | |||
56 | 56 | ||
57 | #define PN_NO_ADDR 0xff | 57 | #define PN_NO_ADDR 0xff |
58 | 58 | ||
59 | extern const struct file_operations pn_sock_seq_fops; | 59 | extern const struct seq_operations pn_sock_seq_ops; |
60 | extern const struct file_operations pn_res_seq_fops; | 60 | extern const struct seq_operations pn_res_seq_ops; |
61 | 61 | ||
62 | #endif | 62 | #endif |
diff --git a/include/net/ping.h b/include/net/ping.h index 4cd90d6b5c25..fd080e043a6e 100644 --- a/include/net/ping.h +++ b/include/net/ping.h | |||
@@ -83,20 +83,9 @@ int ping_queue_rcv_skb(struct sock *sk, struct sk_buff *skb); | |||
83 | bool ping_rcv(struct sk_buff *skb); | 83 | bool ping_rcv(struct sk_buff *skb); |
84 | 84 | ||
85 | #ifdef CONFIG_PROC_FS | 85 | #ifdef CONFIG_PROC_FS |
86 | struct ping_seq_afinfo { | ||
87 | char *name; | ||
88 | sa_family_t family; | ||
89 | const struct file_operations *seq_fops; | ||
90 | const struct seq_operations seq_ops; | ||
91 | }; | ||
92 | |||
93 | extern const struct file_operations ping_seq_fops; | ||
94 | |||
95 | void *ping_seq_start(struct seq_file *seq, loff_t *pos, sa_family_t family); | 86 | void *ping_seq_start(struct seq_file *seq, loff_t *pos, sa_family_t family); |
96 | void *ping_seq_next(struct seq_file *seq, void *v, loff_t *pos); | 87 | void *ping_seq_next(struct seq_file *seq, void *v, loff_t *pos); |
97 | void ping_seq_stop(struct seq_file *seq, void *v); | 88 | void ping_seq_stop(struct seq_file *seq, void *v); |
98 | int ping_proc_register(struct net *net, struct ping_seq_afinfo *afinfo); | ||
99 | void ping_proc_unregister(struct net *net, struct ping_seq_afinfo *afinfo); | ||
100 | 89 | ||
101 | int __init ping_proc_init(void); | 90 | int __init ping_proc_init(void); |
102 | void ping_proc_exit(void); | 91 | void ping_proc_exit(void); |
diff --git a/include/net/raw.h b/include/net/raw.h index 99d26d0c4a19..9c9fa98a91a4 100644 --- a/include/net/raw.h +++ b/include/net/raw.h | |||
@@ -48,7 +48,6 @@ void raw_proc_exit(void); | |||
48 | struct raw_iter_state { | 48 | struct raw_iter_state { |
49 | struct seq_net_private p; | 49 | struct seq_net_private p; |
50 | int bucket; | 50 | int bucket; |
51 | struct raw_hashinfo *h; | ||
52 | }; | 51 | }; |
53 | 52 | ||
54 | static inline struct raw_iter_state *raw_seq_private(struct seq_file *seq) | 53 | static inline struct raw_iter_state *raw_seq_private(struct seq_file *seq) |
@@ -58,9 +57,6 @@ static inline struct raw_iter_state *raw_seq_private(struct seq_file *seq) | |||
58 | void *raw_seq_start(struct seq_file *seq, loff_t *pos); | 57 | void *raw_seq_start(struct seq_file *seq, loff_t *pos); |
59 | void *raw_seq_next(struct seq_file *seq, void *v, loff_t *pos); | 58 | void *raw_seq_next(struct seq_file *seq, void *v, loff_t *pos); |
60 | void raw_seq_stop(struct seq_file *seq, void *v); | 59 | void raw_seq_stop(struct seq_file *seq, void *v); |
61 | int raw_seq_open(struct inode *ino, struct file *file, | ||
62 | struct raw_hashinfo *h, const struct seq_operations *ops); | ||
63 | |||
64 | #endif | 60 | #endif |
65 | 61 | ||
66 | int raw_hash_sk(struct sock *sk); | 62 | int raw_hash_sk(struct sock *sk); |
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/include/net/tcp.h b/include/net/tcp.h index 9c9b3768b350..51dc7a26a2fa 100644 --- a/include/net/tcp.h +++ b/include/net/tcp.h | |||
@@ -1747,27 +1747,22 @@ enum tcp_seq_states { | |||
1747 | TCP_SEQ_STATE_ESTABLISHED, | 1747 | TCP_SEQ_STATE_ESTABLISHED, |
1748 | }; | 1748 | }; |
1749 | 1749 | ||
1750 | int tcp_seq_open(struct inode *inode, struct file *file); | 1750 | void *tcp_seq_start(struct seq_file *seq, loff_t *pos); |
1751 | void *tcp_seq_next(struct seq_file *seq, void *v, loff_t *pos); | ||
1752 | void tcp_seq_stop(struct seq_file *seq, void *v); | ||
1751 | 1753 | ||
1752 | struct tcp_seq_afinfo { | 1754 | struct tcp_seq_afinfo { |
1753 | char *name; | ||
1754 | sa_family_t family; | 1755 | sa_family_t family; |
1755 | const struct file_operations *seq_fops; | ||
1756 | struct seq_operations seq_ops; | ||
1757 | }; | 1756 | }; |
1758 | 1757 | ||
1759 | struct tcp_iter_state { | 1758 | struct tcp_iter_state { |
1760 | struct seq_net_private p; | 1759 | struct seq_net_private p; |
1761 | sa_family_t family; | ||
1762 | enum tcp_seq_states state; | 1760 | enum tcp_seq_states state; |
1763 | struct sock *syn_wait_sk; | 1761 | struct sock *syn_wait_sk; |
1764 | int bucket, offset, sbucket, num; | 1762 | int bucket, offset, sbucket, num; |
1765 | loff_t last_pos; | 1763 | loff_t last_pos; |
1766 | }; | 1764 | }; |
1767 | 1765 | ||
1768 | int tcp_proc_register(struct net *net, struct tcp_seq_afinfo *afinfo); | ||
1769 | void tcp_proc_unregister(struct net *net, struct tcp_seq_afinfo *afinfo); | ||
1770 | |||
1771 | extern struct request_sock_ops tcp_request_sock_ops; | 1766 | extern struct request_sock_ops tcp_request_sock_ops; |
1772 | extern struct request_sock_ops tcp6_request_sock_ops; | 1767 | extern struct request_sock_ops tcp6_request_sock_ops; |
1773 | 1768 | ||
diff --git a/include/net/udp.h b/include/net/udp.h index 0676b272f6ac..621778b80e3d 100644 --- a/include/net/udp.h +++ b/include/net/udp.h | |||
@@ -408,31 +408,27 @@ do { \ | |||
408 | #define __UDPX_INC_STATS(sk, field) __UDP_INC_STATS(sock_net(sk), field, 0) | 408 | #define __UDPX_INC_STATS(sk, field) __UDP_INC_STATS(sock_net(sk), field, 0) |
409 | #endif | 409 | #endif |
410 | 410 | ||
411 | /* /proc */ | 411 | #ifdef CONFIG_PROC_FS |
412 | int udp_seq_open(struct inode *inode, struct file *file); | ||
413 | |||
414 | struct udp_seq_afinfo { | 412 | struct udp_seq_afinfo { |
415 | char *name; | ||
416 | sa_family_t family; | 413 | sa_family_t family; |
417 | struct udp_table *udp_table; | 414 | struct udp_table *udp_table; |
418 | const struct file_operations *seq_fops; | ||
419 | struct seq_operations seq_ops; | ||
420 | }; | 415 | }; |
421 | 416 | ||
422 | struct udp_iter_state { | 417 | struct udp_iter_state { |
423 | struct seq_net_private p; | 418 | struct seq_net_private p; |
424 | sa_family_t family; | ||
425 | int bucket; | 419 | int bucket; |
426 | struct udp_table *udp_table; | ||
427 | }; | 420 | }; |
428 | 421 | ||
429 | #ifdef CONFIG_PROC_FS | 422 | void *udp_seq_start(struct seq_file *seq, loff_t *pos); |
430 | int udp_proc_register(struct net *net, struct udp_seq_afinfo *afinfo); | 423 | void *udp_seq_next(struct seq_file *seq, void *v, loff_t *pos); |
431 | void udp_proc_unregister(struct net *net, struct udp_seq_afinfo *afinfo); | 424 | void udp_seq_stop(struct seq_file *seq, void *v); |
425 | |||
426 | extern const struct seq_operations udp_seq_ops; | ||
427 | extern const struct seq_operations udp6_seq_ops; | ||
432 | 428 | ||
433 | int udp4_proc_init(void); | 429 | int udp4_proc_init(void); |
434 | void udp4_proc_exit(void); | 430 | void udp4_proc_exit(void); |
435 | #endif | 431 | #endif /* CONFIG_PROC_FS */ |
436 | 432 | ||
437 | int udpv4_offload_init(void); | 433 | int udpv4_offload_init(void); |
438 | 434 | ||
diff --git a/kernel/cgroup/cgroup-internal.h b/kernel/cgroup/cgroup-internal.h index b928b27050c6..0808a33d16d3 100644 --- a/kernel/cgroup/cgroup-internal.h +++ b/kernel/cgroup/cgroup-internal.h | |||
@@ -218,9 +218,9 @@ extern const struct proc_ns_operations cgroupns_operations; | |||
218 | * cgroup-v1.c | 218 | * cgroup-v1.c |
219 | */ | 219 | */ |
220 | extern struct cftype cgroup1_base_files[]; | 220 | extern struct cftype cgroup1_base_files[]; |
221 | extern const struct file_operations proc_cgroupstats_operations; | ||
222 | extern struct kernfs_syscall_ops cgroup1_kf_syscall_ops; | 221 | extern struct kernfs_syscall_ops cgroup1_kf_syscall_ops; |
223 | 222 | ||
223 | int proc_cgroupstats_show(struct seq_file *m, void *v); | ||
224 | bool cgroup1_ssid_disabled(int ssid); | 224 | bool cgroup1_ssid_disabled(int ssid); |
225 | void cgroup1_pidlist_destroy_all(struct cgroup *cgrp); | 225 | void cgroup1_pidlist_destroy_all(struct cgroup *cgrp); |
226 | void cgroup1_release_agent(struct work_struct *work); | 226 | void cgroup1_release_agent(struct work_struct *work); |
diff --git a/kernel/cgroup/cgroup-v1.c b/kernel/cgroup/cgroup-v1.c index a2c05d2476ac..e06c97f3ed1a 100644 --- a/kernel/cgroup/cgroup-v1.c +++ b/kernel/cgroup/cgroup-v1.c | |||
@@ -682,7 +682,7 @@ struct cftype cgroup1_base_files[] = { | |||
682 | }; | 682 | }; |
683 | 683 | ||
684 | /* Display information about each subsystem and each hierarchy */ | 684 | /* Display information about each subsystem and each hierarchy */ |
685 | static int proc_cgroupstats_show(struct seq_file *m, void *v) | 685 | int proc_cgroupstats_show(struct seq_file *m, void *v) |
686 | { | 686 | { |
687 | struct cgroup_subsys *ss; | 687 | struct cgroup_subsys *ss; |
688 | int i; | 688 | int i; |
@@ -705,18 +705,6 @@ static int proc_cgroupstats_show(struct seq_file *m, void *v) | |||
705 | return 0; | 705 | return 0; |
706 | } | 706 | } |
707 | 707 | ||
708 | static int cgroupstats_open(struct inode *inode, struct file *file) | ||
709 | { | ||
710 | return single_open(file, proc_cgroupstats_show, NULL); | ||
711 | } | ||
712 | |||
713 | const struct file_operations proc_cgroupstats_operations = { | ||
714 | .open = cgroupstats_open, | ||
715 | .read = seq_read, | ||
716 | .llseek = seq_lseek, | ||
717 | .release = single_release, | ||
718 | }; | ||
719 | |||
720 | /** | 708 | /** |
721 | * cgroupstats_build - build and fill cgroupstats | 709 | * cgroupstats_build - build and fill cgroupstats |
722 | * @stats: cgroupstats to fill information into | 710 | * @stats: cgroupstats to fill information into |
diff --git a/kernel/cgroup/cgroup.c b/kernel/cgroup/cgroup.c index a662bfcbea0e..12883656e63e 100644 --- a/kernel/cgroup/cgroup.c +++ b/kernel/cgroup/cgroup.c | |||
@@ -5335,7 +5335,7 @@ int __init cgroup_init(void) | |||
5335 | WARN_ON(sysfs_create_mount_point(fs_kobj, "cgroup")); | 5335 | WARN_ON(sysfs_create_mount_point(fs_kobj, "cgroup")); |
5336 | WARN_ON(register_filesystem(&cgroup_fs_type)); | 5336 | WARN_ON(register_filesystem(&cgroup_fs_type)); |
5337 | WARN_ON(register_filesystem(&cgroup2_fs_type)); | 5337 | WARN_ON(register_filesystem(&cgroup2_fs_type)); |
5338 | WARN_ON(!proc_create("cgroups", 0, NULL, &proc_cgroupstats_operations)); | 5338 | WARN_ON(!proc_create_single("cgroups", 0, NULL, proc_cgroupstats_show)); |
5339 | 5339 | ||
5340 | return 0; | 5340 | return 0; |
5341 | } | 5341 | } |
diff --git a/kernel/dma.c b/kernel/dma.c index 3506fc34a712..40f152936316 100644 --- a/kernel/dma.c +++ b/kernel/dma.c | |||
@@ -135,21 +135,9 @@ static int proc_dma_show(struct seq_file *m, void *v) | |||
135 | } | 135 | } |
136 | #endif /* MAX_DMA_CHANNELS */ | 136 | #endif /* MAX_DMA_CHANNELS */ |
137 | 137 | ||
138 | static int proc_dma_open(struct inode *inode, struct file *file) | ||
139 | { | ||
140 | return single_open(file, proc_dma_show, NULL); | ||
141 | } | ||
142 | |||
143 | static const struct file_operations proc_dma_operations = { | ||
144 | .open = proc_dma_open, | ||
145 | .read = seq_read, | ||
146 | .llseek = seq_lseek, | ||
147 | .release = single_release, | ||
148 | }; | ||
149 | |||
150 | static int __init proc_dma_init(void) | 138 | static int __init proc_dma_init(void) |
151 | { | 139 | { |
152 | proc_create("dma", 0, NULL, &proc_dma_operations); | 140 | proc_create_single("dma", 0, NULL, proc_dma_show); |
153 | return 0; | 141 | return 0; |
154 | } | 142 | } |
155 | 143 | ||
diff --git a/kernel/exec_domain.c b/kernel/exec_domain.c index a5697119290e..33f07c5f2515 100644 --- a/kernel/exec_domain.c +++ b/kernel/exec_domain.c | |||
@@ -27,21 +27,9 @@ static int execdomains_proc_show(struct seq_file *m, void *v) | |||
27 | return 0; | 27 | return 0; |
28 | } | 28 | } |
29 | 29 | ||
30 | static int execdomains_proc_open(struct inode *inode, struct file *file) | ||
31 | { | ||
32 | return single_open(file, execdomains_proc_show, NULL); | ||
33 | } | ||
34 | |||
35 | static const struct file_operations execdomains_proc_fops = { | ||
36 | .open = execdomains_proc_open, | ||
37 | .read = seq_read, | ||
38 | .llseek = seq_lseek, | ||
39 | .release = single_release, | ||
40 | }; | ||
41 | |||
42 | static int __init proc_execdomains_init(void) | 30 | static int __init proc_execdomains_init(void) |
43 | { | 31 | { |
44 | proc_create("execdomains", 0, NULL, &execdomains_proc_fops); | 32 | proc_create_single("execdomains", 0, NULL, execdomains_proc_show); |
45 | return 0; | 33 | return 0; |
46 | } | 34 | } |
47 | module_init(proc_execdomains_init); | 35 | module_init(proc_execdomains_init); |
diff --git a/kernel/irq/proc.c b/kernel/irq/proc.c index 7cb091d81d91..37eda10f5c36 100644 --- a/kernel/irq/proc.c +++ b/kernel/irq/proc.c | |||
@@ -185,11 +185,6 @@ static int irq_affinity_list_proc_open(struct inode *inode, struct file *file) | |||
185 | return single_open(file, irq_affinity_list_proc_show, PDE_DATA(inode)); | 185 | return single_open(file, irq_affinity_list_proc_show, PDE_DATA(inode)); |
186 | } | 186 | } |
187 | 187 | ||
188 | static int irq_affinity_hint_proc_open(struct inode *inode, struct file *file) | ||
189 | { | ||
190 | return single_open(file, irq_affinity_hint_proc_show, PDE_DATA(inode)); | ||
191 | } | ||
192 | |||
193 | static const struct file_operations irq_affinity_proc_fops = { | 188 | static const struct file_operations irq_affinity_proc_fops = { |
194 | .open = irq_affinity_proc_open, | 189 | .open = irq_affinity_proc_open, |
195 | .read = seq_read, | 190 | .read = seq_read, |
@@ -198,13 +193,6 @@ static const struct file_operations irq_affinity_proc_fops = { | |||
198 | .write = irq_affinity_proc_write, | 193 | .write = irq_affinity_proc_write, |
199 | }; | 194 | }; |
200 | 195 | ||
201 | static const struct file_operations irq_affinity_hint_proc_fops = { | ||
202 | .open = irq_affinity_hint_proc_open, | ||
203 | .read = seq_read, | ||
204 | .llseek = seq_lseek, | ||
205 | .release = single_release, | ||
206 | }; | ||
207 | |||
208 | static const struct file_operations irq_affinity_list_proc_fops = { | 196 | static const struct file_operations irq_affinity_list_proc_fops = { |
209 | .open = irq_affinity_list_proc_open, | 197 | .open = irq_affinity_list_proc_open, |
210 | .read = seq_read, | 198 | .read = seq_read, |
@@ -223,32 +211,6 @@ static int irq_effective_aff_list_proc_show(struct seq_file *m, void *v) | |||
223 | { | 211 | { |
224 | return show_irq_affinity(EFFECTIVE_LIST, m); | 212 | return show_irq_affinity(EFFECTIVE_LIST, m); |
225 | } | 213 | } |
226 | |||
227 | static int irq_effective_aff_proc_open(struct inode *inode, struct file *file) | ||
228 | { | ||
229 | return single_open(file, irq_effective_aff_proc_show, PDE_DATA(inode)); | ||
230 | } | ||
231 | |||
232 | static int irq_effective_aff_list_proc_open(struct inode *inode, | ||
233 | struct file *file) | ||
234 | { | ||
235 | return single_open(file, irq_effective_aff_list_proc_show, | ||
236 | PDE_DATA(inode)); | ||
237 | } | ||
238 | |||
239 | static const struct file_operations irq_effective_aff_proc_fops = { | ||
240 | .open = irq_effective_aff_proc_open, | ||
241 | .read = seq_read, | ||
242 | .llseek = seq_lseek, | ||
243 | .release = single_release, | ||
244 | }; | ||
245 | |||
246 | static const struct file_operations irq_effective_aff_list_proc_fops = { | ||
247 | .open = irq_effective_aff_list_proc_open, | ||
248 | .read = seq_read, | ||
249 | .llseek = seq_lseek, | ||
250 | .release = single_release, | ||
251 | }; | ||
252 | #endif | 214 | #endif |
253 | 215 | ||
254 | static int default_affinity_show(struct seq_file *m, void *v) | 216 | static int default_affinity_show(struct seq_file *m, void *v) |
@@ -313,18 +275,6 @@ static int irq_node_proc_show(struct seq_file *m, void *v) | |||
313 | seq_printf(m, "%d\n", irq_desc_get_node(desc)); | 275 | seq_printf(m, "%d\n", irq_desc_get_node(desc)); |
314 | return 0; | 276 | return 0; |
315 | } | 277 | } |
316 | |||
317 | static int irq_node_proc_open(struct inode *inode, struct file *file) | ||
318 | { | ||
319 | return single_open(file, irq_node_proc_show, PDE_DATA(inode)); | ||
320 | } | ||
321 | |||
322 | static const struct file_operations irq_node_proc_fops = { | ||
323 | .open = irq_node_proc_open, | ||
324 | .read = seq_read, | ||
325 | .llseek = seq_lseek, | ||
326 | .release = single_release, | ||
327 | }; | ||
328 | #endif | 278 | #endif |
329 | 279 | ||
330 | static int irq_spurious_proc_show(struct seq_file *m, void *v) | 280 | static int irq_spurious_proc_show(struct seq_file *m, void *v) |
@@ -337,18 +287,6 @@ static int irq_spurious_proc_show(struct seq_file *m, void *v) | |||
337 | return 0; | 287 | return 0; |
338 | } | 288 | } |
339 | 289 | ||
340 | static int irq_spurious_proc_open(struct inode *inode, struct file *file) | ||
341 | { | ||
342 | return single_open(file, irq_spurious_proc_show, PDE_DATA(inode)); | ||
343 | } | ||
344 | |||
345 | static const struct file_operations irq_spurious_proc_fops = { | ||
346 | .open = irq_spurious_proc_open, | ||
347 | .read = seq_read, | ||
348 | .llseek = seq_lseek, | ||
349 | .release = single_release, | ||
350 | }; | ||
351 | |||
352 | #define MAX_NAMELEN 128 | 290 | #define MAX_NAMELEN 128 |
353 | 291 | ||
354 | static int name_unique(unsigned int irq, struct irqaction *new_action) | 292 | static int name_unique(unsigned int irq, struct irqaction *new_action) |
@@ -421,24 +359,24 @@ void register_irq_proc(unsigned int irq, struct irq_desc *desc) | |||
421 | &irq_affinity_proc_fops, irqp); | 359 | &irq_affinity_proc_fops, irqp); |
422 | 360 | ||
423 | /* create /proc/irq/<irq>/affinity_hint */ | 361 | /* create /proc/irq/<irq>/affinity_hint */ |
424 | proc_create_data("affinity_hint", 0444, desc->dir, | 362 | proc_create_single_data("affinity_hint", 0444, desc->dir, |
425 | &irq_affinity_hint_proc_fops, irqp); | 363 | irq_affinity_hint_proc_show, irqp); |
426 | 364 | ||
427 | /* create /proc/irq/<irq>/smp_affinity_list */ | 365 | /* create /proc/irq/<irq>/smp_affinity_list */ |
428 | proc_create_data("smp_affinity_list", 0644, desc->dir, | 366 | proc_create_data("smp_affinity_list", 0644, desc->dir, |
429 | &irq_affinity_list_proc_fops, irqp); | 367 | &irq_affinity_list_proc_fops, irqp); |
430 | 368 | ||
431 | proc_create_data("node", 0444, desc->dir, | 369 | proc_create_single_data("node", 0444, desc->dir, irq_node_proc_show, |
432 | &irq_node_proc_fops, irqp); | 370 | irqp); |
433 | # ifdef CONFIG_GENERIC_IRQ_EFFECTIVE_AFF_MASK | 371 | # ifdef CONFIG_GENERIC_IRQ_EFFECTIVE_AFF_MASK |
434 | proc_create_data("effective_affinity", 0444, desc->dir, | 372 | proc_create_single_data("effective_affinity", 0444, desc->dir, |
435 | &irq_effective_aff_proc_fops, irqp); | 373 | irq_effective_aff_proc_show, irqp); |
436 | proc_create_data("effective_affinity_list", 0444, desc->dir, | 374 | proc_create_single_data("effective_affinity_list", 0444, desc->dir, |
437 | &irq_effective_aff_list_proc_fops, irqp); | 375 | irq_effective_aff_list_proc_show, irqp); |
438 | # endif | 376 | # endif |
439 | #endif | 377 | #endif |
440 | proc_create_data("spurious", 0444, desc->dir, | 378 | proc_create_single_data("spurious", 0444, desc->dir, |
441 | &irq_spurious_proc_fops, (void *)(long)irq); | 379 | irq_spurious_proc_show, (void *)(long)irq); |
442 | 380 | ||
443 | out_unlock: | 381 | out_unlock: |
444 | mutex_unlock(®ister_lock); | 382 | mutex_unlock(®ister_lock); |
diff --git a/kernel/locking/lockdep_proc.c b/kernel/locking/lockdep_proc.c index ad69bbc9bd28..3dd980dfba2d 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) |
@@ -355,18 +331,6 @@ static int lockdep_stats_show(struct seq_file *m, void *v) | |||
355 | return 0; | 331 | return 0; |
356 | } | 332 | } |
357 | 333 | ||
358 | static int lockdep_stats_open(struct inode *inode, struct file *file) | ||
359 | { | ||
360 | return single_open(file, lockdep_stats_show, NULL); | ||
361 | } | ||
362 | |||
363 | static const struct file_operations proc_lockdep_stats_operations = { | ||
364 | .open = lockdep_stats_open, | ||
365 | .read = seq_read, | ||
366 | .llseek = seq_lseek, | ||
367 | .release = single_release, | ||
368 | }; | ||
369 | |||
370 | #ifdef CONFIG_LOCK_STAT | 334 | #ifdef CONFIG_LOCK_STAT |
371 | 335 | ||
372 | struct lock_stat_data { | 336 | struct lock_stat_data { |
@@ -682,14 +646,11 @@ static const struct file_operations proc_lock_stat_operations = { | |||
682 | 646 | ||
683 | static int __init lockdep_proc_init(void) | 647 | static int __init lockdep_proc_init(void) |
684 | { | 648 | { |
685 | proc_create("lockdep", S_IRUSR, NULL, &proc_lockdep_operations); | 649 | proc_create_seq("lockdep", S_IRUSR, NULL, &lockdep_ops); |
686 | #ifdef CONFIG_PROVE_LOCKING | 650 | #ifdef CONFIG_PROVE_LOCKING |
687 | proc_create("lockdep_chains", S_IRUSR, NULL, | 651 | proc_create_seq("lockdep_chains", S_IRUSR, NULL, &lockdep_chains_ops); |
688 | &proc_lockdep_chains_operations); | ||
689 | #endif | 652 | #endif |
690 | proc_create("lockdep_stats", S_IRUSR, NULL, | 653 | proc_create_single("lockdep_stats", S_IRUSR, NULL, lockdep_stats_show); |
691 | &proc_lockdep_stats_operations); | ||
692 | |||
693 | #ifdef CONFIG_LOCK_STAT | 654 | #ifdef CONFIG_LOCK_STAT |
694 | proc_create("lock_stat", S_IRUSR | S_IWUSR, NULL, | 655 | proc_create("lock_stat", S_IRUSR | S_IWUSR, NULL, |
695 | &proc_lock_stat_operations); | 656 | &proc_lock_stat_operations); |
diff --git a/kernel/resource.c b/kernel/resource.c index 2af6c03858b9..b589dda910b3 100644 --- a/kernel/resource.c +++ b/kernel/resource.c | |||
@@ -87,7 +87,7 @@ enum { MAX_IORES_LEVEL = 5 }; | |||
87 | static void *r_start(struct seq_file *m, loff_t *pos) | 87 | static void *r_start(struct seq_file *m, loff_t *pos) |
88 | __acquires(resource_lock) | 88 | __acquires(resource_lock) |
89 | { | 89 | { |
90 | struct resource *p = m->private; | 90 | struct resource *p = PDE_DATA(file_inode(m->file)); |
91 | loff_t l = 0; | 91 | loff_t l = 0; |
92 | read_lock(&resource_lock); | 92 | read_lock(&resource_lock); |
93 | for (p = p->child; p && l < *pos; p = r_next(m, p, &l)) | 93 | for (p = p->child; p && l < *pos; p = r_next(m, p, &l)) |
@@ -103,7 +103,7 @@ static void r_stop(struct seq_file *m, void *v) | |||
103 | 103 | ||
104 | static int r_show(struct seq_file *m, void *v) | 104 | static int r_show(struct seq_file *m, void *v) |
105 | { | 105 | { |
106 | struct resource *root = m->private; | 106 | struct resource *root = PDE_DATA(file_inode(m->file)); |
107 | struct resource *r = v, *p; | 107 | struct resource *r = v, *p; |
108 | unsigned long long start, end; | 108 | unsigned long long start, end; |
109 | int width = root->end < 0x10000 ? 4 : 8; | 109 | int width = root->end < 0x10000 ? 4 : 8; |
@@ -135,44 +135,11 @@ static const struct seq_operations resource_op = { | |||
135 | .show = r_show, | 135 | .show = r_show, |
136 | }; | 136 | }; |
137 | 137 | ||
138 | static int ioports_open(struct inode *inode, struct file *file) | ||
139 | { | ||
140 | int res = seq_open(file, &resource_op); | ||
141 | if (!res) { | ||
142 | struct seq_file *m = file->private_data; | ||
143 | m->private = &ioport_resource; | ||
144 | } | ||
145 | return res; | ||
146 | } | ||
147 | |||
148 | static int iomem_open(struct inode *inode, struct file *file) | ||
149 | { | ||
150 | int res = seq_open(file, &resource_op); | ||
151 | if (!res) { | ||
152 | struct seq_file *m = file->private_data; | ||
153 | m->private = &iomem_resource; | ||
154 | } | ||
155 | return res; | ||
156 | } | ||
157 | |||
158 | static const struct file_operations proc_ioports_operations = { | ||
159 | .open = ioports_open, | ||
160 | .read = seq_read, | ||
161 | .llseek = seq_lseek, | ||
162 | .release = seq_release, | ||
163 | }; | ||
164 | |||
165 | static const struct file_operations proc_iomem_operations = { | ||
166 | .open = iomem_open, | ||
167 | .read = seq_read, | ||
168 | .llseek = seq_lseek, | ||
169 | .release = seq_release, | ||
170 | }; | ||
171 | |||
172 | static int __init ioresources_init(void) | 138 | static int __init ioresources_init(void) |
173 | { | 139 | { |
174 | proc_create("ioports", 0, NULL, &proc_ioports_operations); | 140 | proc_create_seq_data("ioports", 0, NULL, &resource_op, |
175 | proc_create("iomem", 0, NULL, &proc_iomem_operations); | 141 | &ioport_resource); |
142 | proc_create_seq_data("iomem", 0, NULL, &resource_op, &iomem_resource); | ||
176 | return 0; | 143 | return 0; |
177 | } | 144 | } |
178 | __initcall(ioresources_init); | 145 | __initcall(ioresources_init); |
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/kernel/time/timer_list.c b/kernel/time/timer_list.c index 0ed768b56c60..675c4e9563a9 100644 --- a/kernel/time/timer_list.c +++ b/kernel/time/timer_list.c | |||
@@ -372,24 +372,12 @@ static const struct seq_operations timer_list_sops = { | |||
372 | .show = timer_list_show, | 372 | .show = timer_list_show, |
373 | }; | 373 | }; |
374 | 374 | ||
375 | static int timer_list_open(struct inode *inode, struct file *filp) | ||
376 | { | ||
377 | return seq_open_private(filp, &timer_list_sops, | ||
378 | sizeof(struct timer_list_iter)); | ||
379 | } | ||
380 | |||
381 | static const struct file_operations timer_list_fops = { | ||
382 | .open = timer_list_open, | ||
383 | .read = seq_read, | ||
384 | .llseek = seq_lseek, | ||
385 | .release = seq_release_private, | ||
386 | }; | ||
387 | |||
388 | static int __init init_timer_list_procfs(void) | 375 | static int __init init_timer_list_procfs(void) |
389 | { | 376 | { |
390 | struct proc_dir_entry *pe; | 377 | struct proc_dir_entry *pe; |
391 | 378 | ||
392 | pe = proc_create("timer_list", 0400, NULL, &timer_list_fops); | 379 | pe = proc_create_seq_private("timer_list", 0400, NULL, &timer_list_sops, |
380 | sizeof(struct timer_list_iter), NULL); | ||
393 | if (!pe) | 381 | if (!pe) |
394 | return -ENOMEM; | 382 | return -ENOMEM; |
395 | return 0; | 383 | return 0; |
diff --git a/mm/vmalloc.c b/mm/vmalloc.c index ebff729cc956..63a5f502da08 100644 --- a/mm/vmalloc.c +++ b/mm/vmalloc.c | |||
@@ -2751,25 +2751,14 @@ static const struct seq_operations vmalloc_op = { | |||
2751 | .show = s_show, | 2751 | .show = s_show, |
2752 | }; | 2752 | }; |
2753 | 2753 | ||
2754 | static int vmalloc_open(struct inode *inode, struct file *file) | 2754 | static int __init proc_vmalloc_init(void) |
2755 | { | 2755 | { |
2756 | if (IS_ENABLED(CONFIG_NUMA)) | 2756 | if (IS_ENABLED(CONFIG_NUMA)) |
2757 | return seq_open_private(file, &vmalloc_op, | 2757 | proc_create_seq_private("vmallocinfo", S_IRUSR, NULL, |
2758 | nr_node_ids * sizeof(unsigned int)); | 2758 | &vmalloc_op, |
2759 | nr_node_ids * sizeof(unsigned int), NULL); | ||
2759 | else | 2760 | else |
2760 | return seq_open(file, &vmalloc_op); | 2761 | proc_create_seq("vmallocinfo", S_IRUSR, NULL, &vmalloc_op); |
2761 | } | ||
2762 | |||
2763 | static const struct file_operations proc_vmalloc_operations = { | ||
2764 | .open = vmalloc_open, | ||
2765 | .read = seq_read, | ||
2766 | .llseek = seq_lseek, | ||
2767 | .release = seq_release_private, | ||
2768 | }; | ||
2769 | |||
2770 | static int __init proc_vmalloc_init(void) | ||
2771 | { | ||
2772 | proc_create("vmallocinfo", S_IRUSR, NULL, &proc_vmalloc_operations); | ||
2773 | return 0; | 2762 | return 0; |
2774 | } | 2763 | } |
2775 | module_init(proc_vmalloc_init); | 2764 | 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/8021q/vlanproc.c b/net/8021q/vlanproc.c index a627a5db2125..d36e8c4b7f56 100644 --- a/net/8021q/vlanproc.c +++ b/net/8021q/vlanproc.c | |||
@@ -73,35 +73,6 @@ static const struct seq_operations vlan_seq_ops = { | |||
73 | .show = vlan_seq_show, | 73 | .show = vlan_seq_show, |
74 | }; | 74 | }; |
75 | 75 | ||
76 | static int vlan_seq_open(struct inode *inode, struct file *file) | ||
77 | { | ||
78 | return seq_open_net(inode, file, &vlan_seq_ops, | ||
79 | sizeof(struct seq_net_private)); | ||
80 | } | ||
81 | |||
82 | static const struct file_operations vlan_fops = { | ||
83 | .open = vlan_seq_open, | ||
84 | .read = seq_read, | ||
85 | .llseek = seq_lseek, | ||
86 | .release = seq_release_net, | ||
87 | }; | ||
88 | |||
89 | /* | ||
90 | * /proc/net/vlan/<device> file and inode operations | ||
91 | */ | ||
92 | |||
93 | static int vlandev_seq_open(struct inode *inode, struct file *file) | ||
94 | { | ||
95 | return single_open(file, vlandev_seq_show, PDE_DATA(inode)); | ||
96 | } | ||
97 | |||
98 | static const struct file_operations vlandev_fops = { | ||
99 | .open = vlandev_seq_open, | ||
100 | .read = seq_read, | ||
101 | .llseek = seq_lseek, | ||
102 | .release = single_release, | ||
103 | }; | ||
104 | |||
105 | /* | 76 | /* |
106 | * Proc filesystem directory entries. | 77 | * Proc filesystem directory entries. |
107 | */ | 78 | */ |
@@ -148,8 +119,9 @@ int __net_init vlan_proc_init(struct net *net) | |||
148 | if (!vn->proc_vlan_dir) | 119 | if (!vn->proc_vlan_dir) |
149 | goto err; | 120 | goto err; |
150 | 121 | ||
151 | vn->proc_vlan_conf = proc_create(name_conf, S_IFREG | 0600, | 122 | vn->proc_vlan_conf = proc_create_net(name_conf, S_IFREG | 0600, |
152 | vn->proc_vlan_dir, &vlan_fops); | 123 | vn->proc_vlan_dir, &vlan_seq_ops, |
124 | sizeof(struct seq_net_private)); | ||
153 | if (!vn->proc_vlan_conf) | 125 | if (!vn->proc_vlan_conf) |
154 | goto err; | 126 | goto err; |
155 | return 0; | 127 | return 0; |
@@ -171,9 +143,8 @@ int vlan_proc_add_dev(struct net_device *vlandev) | |||
171 | 143 | ||
172 | if (!strcmp(vlandev->name, name_conf)) | 144 | if (!strcmp(vlandev->name, name_conf)) |
173 | return -EINVAL; | 145 | return -EINVAL; |
174 | vlan->dent = | 146 | vlan->dent = proc_create_single_data(vlandev->name, S_IFREG | 0600, |
175 | proc_create_data(vlandev->name, S_IFREG | 0600, | 147 | vn->proc_vlan_dir, vlandev_seq_show, vlandev); |
176 | vn->proc_vlan_dir, &vlandev_fops, vlandev); | ||
177 | if (!vlan->dent) | 148 | if (!vlan->dent) |
178 | return -ENOBUFS; | 149 | return -ENOBUFS; |
179 | return 0; | 150 | return 0; |
diff --git a/net/appletalk/aarp.c b/net/appletalk/aarp.c index d4c1021e74e1..49a16cee2aae 100644 --- a/net/appletalk/aarp.c +++ b/net/appletalk/aarp.c | |||
@@ -907,11 +907,6 @@ void aarp_device_down(struct net_device *dev) | |||
907 | } | 907 | } |
908 | 908 | ||
909 | #ifdef CONFIG_PROC_FS | 909 | #ifdef CONFIG_PROC_FS |
910 | struct aarp_iter_state { | ||
911 | int bucket; | ||
912 | struct aarp_entry **table; | ||
913 | }; | ||
914 | |||
915 | /* | 910 | /* |
916 | * Get the aarp entry that is in the chain described | 911 | * Get the aarp entry that is in the chain described |
917 | * by the iterator. | 912 | * by the iterator. |
@@ -1033,25 +1028,12 @@ static int aarp_seq_show(struct seq_file *seq, void *v) | |||
1033 | return 0; | 1028 | return 0; |
1034 | } | 1029 | } |
1035 | 1030 | ||
1036 | static const struct seq_operations aarp_seq_ops = { | 1031 | const struct seq_operations aarp_seq_ops = { |
1037 | .start = aarp_seq_start, | 1032 | .start = aarp_seq_start, |
1038 | .next = aarp_seq_next, | 1033 | .next = aarp_seq_next, |
1039 | .stop = aarp_seq_stop, | 1034 | .stop = aarp_seq_stop, |
1040 | .show = aarp_seq_show, | 1035 | .show = aarp_seq_show, |
1041 | }; | 1036 | }; |
1042 | |||
1043 | static int aarp_seq_open(struct inode *inode, struct file *file) | ||
1044 | { | ||
1045 | return seq_open_private(file, &aarp_seq_ops, | ||
1046 | sizeof(struct aarp_iter_state)); | ||
1047 | } | ||
1048 | |||
1049 | const struct file_operations atalk_seq_arp_fops = { | ||
1050 | .open = aarp_seq_open, | ||
1051 | .read = seq_read, | ||
1052 | .llseek = seq_lseek, | ||
1053 | .release = seq_release_private, | ||
1054 | }; | ||
1055 | #endif | 1037 | #endif |
1056 | 1038 | ||
1057 | /* General module cleanup. Called from cleanup_module() in ddp.c. */ | 1039 | /* General module cleanup. Called from cleanup_module() in ddp.c. */ |
diff --git a/net/appletalk/atalk_proc.c b/net/appletalk/atalk_proc.c index 7214aea14cb3..8006295f8bd7 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,22 +221,23 @@ 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 | ||
275 | p = proc_create("arp", 0444, atalk_proc_dir, &atalk_seq_arp_fops); | 239 | p = proc_create_seq_private("arp", 0444, atalk_proc_dir, &aarp_seq_ops, |
240 | sizeof(struct aarp_iter_state), NULL); | ||
276 | if (!p) | 241 | if (!p) |
277 | goto out_arp; | 242 | goto out_arp; |
278 | 243 | ||
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/atm/clip.c b/net/atm/clip.c index f07dbc632222..66caa48a27c2 100644 --- a/net/atm/clip.c +++ b/net/atm/clip.c | |||
@@ -863,20 +863,6 @@ static const struct seq_operations arp_seq_ops = { | |||
863 | .stop = neigh_seq_stop, | 863 | .stop = neigh_seq_stop, |
864 | .show = clip_seq_show, | 864 | .show = clip_seq_show, |
865 | }; | 865 | }; |
866 | |||
867 | static int arp_seq_open(struct inode *inode, struct file *file) | ||
868 | { | ||
869 | return seq_open_net(inode, file, &arp_seq_ops, | ||
870 | sizeof(struct clip_seq_state)); | ||
871 | } | ||
872 | |||
873 | static const struct file_operations arp_seq_fops = { | ||
874 | .open = arp_seq_open, | ||
875 | .read = seq_read, | ||
876 | .llseek = seq_lseek, | ||
877 | .release = seq_release_net, | ||
878 | .owner = THIS_MODULE | ||
879 | }; | ||
880 | #endif | 866 | #endif |
881 | 867 | ||
882 | static void atm_clip_exit_noproc(void); | 868 | static void atm_clip_exit_noproc(void); |
@@ -893,7 +879,8 @@ static int __init atm_clip_init(void) | |||
893 | { | 879 | { |
894 | struct proc_dir_entry *p; | 880 | struct proc_dir_entry *p; |
895 | 881 | ||
896 | p = proc_create("arp", 0444, atm_proc_root, &arp_seq_fops); | 882 | p = proc_create_net("arp", 0444, atm_proc_root, &arp_seq_ops, |
883 | sizeof(struct clip_seq_state)); | ||
897 | if (!p) { | 884 | if (!p) { |
898 | pr_err("Unable to initialize /proc/net/atm/arp\n"); | 885 | pr_err("Unable to initialize /proc/net/atm/arp\n"); |
899 | atm_clip_exit_noproc(); | 886 | atm_clip_exit_noproc(); |
diff --git a/net/atm/lec.c b/net/atm/lec.c index 3138a869b5c0..5a95fcf6f9b6 100644 --- a/net/atm/lec.c +++ b/net/atm/lec.c | |||
@@ -990,18 +990,6 @@ static const struct seq_operations lec_seq_ops = { | |||
990 | .stop = lec_seq_stop, | 990 | .stop = lec_seq_stop, |
991 | .show = lec_seq_show, | 991 | .show = lec_seq_show, |
992 | }; | 992 | }; |
993 | |||
994 | static int lec_seq_open(struct inode *inode, struct file *file) | ||
995 | { | ||
996 | return seq_open_private(file, &lec_seq_ops, sizeof(struct lec_state)); | ||
997 | } | ||
998 | |||
999 | static const struct file_operations lec_seq_fops = { | ||
1000 | .open = lec_seq_open, | ||
1001 | .read = seq_read, | ||
1002 | .llseek = seq_lseek, | ||
1003 | .release = seq_release_private, | ||
1004 | }; | ||
1005 | #endif | 993 | #endif |
1006 | 994 | ||
1007 | static int lane_ioctl(struct socket *sock, unsigned int cmd, unsigned long arg) | 995 | static int lane_ioctl(struct socket *sock, unsigned int cmd, unsigned long arg) |
@@ -1047,7 +1035,8 @@ static int __init lane_module_init(void) | |||
1047 | #ifdef CONFIG_PROC_FS | 1035 | #ifdef CONFIG_PROC_FS |
1048 | struct proc_dir_entry *p; | 1036 | struct proc_dir_entry *p; |
1049 | 1037 | ||
1050 | p = proc_create("lec", 0444, atm_proc_root, &lec_seq_fops); | 1038 | p = proc_create_seq_private("lec", 0444, atm_proc_root, &lec_seq_ops, |
1039 | sizeof(struct lec_state), NULL); | ||
1051 | if (!p) { | 1040 | if (!p) { |
1052 | pr_err("Unable to initialize /proc/net/atm/lec\n"); | 1041 | pr_err("Unable to initialize /proc/net/atm/lec\n"); |
1053 | return -ENOMEM; | 1042 | return -ENOMEM; |
diff --git a/net/atm/proc.c b/net/atm/proc.c index 55410c00c7e2..0b0495a41bbe 100644 --- a/net/atm/proc.c +++ b/net/atm/proc.c | |||
@@ -68,7 +68,6 @@ static void atm_dev_info(struct seq_file *seq, const struct atm_dev *dev) | |||
68 | struct vcc_state { | 68 | struct vcc_state { |
69 | int bucket; | 69 | int bucket; |
70 | struct sock *sk; | 70 | struct sock *sk; |
71 | int family; | ||
72 | }; | 71 | }; |
73 | 72 | ||
74 | static inline int compare_family(struct sock *sk, int family) | 73 | static inline int compare_family(struct sock *sk, int family) |
@@ -106,23 +105,13 @@ out: | |||
106 | return (l < 0); | 105 | return (l < 0); |
107 | } | 106 | } |
108 | 107 | ||
109 | static inline void *vcc_walk(struct vcc_state *state, loff_t l) | 108 | static inline void *vcc_walk(struct seq_file *seq, loff_t l) |
110 | { | 109 | { |
111 | return __vcc_walk(&state->sk, state->family, &state->bucket, l) ? | 110 | struct vcc_state *state = seq->private; |
112 | state : NULL; | 111 | int family = (uintptr_t)(PDE_DATA(file_inode(seq->file))); |
113 | } | ||
114 | |||
115 | static int __vcc_seq_open(struct inode *inode, struct file *file, | ||
116 | int family, const struct seq_operations *ops) | ||
117 | { | ||
118 | struct vcc_state *state; | ||
119 | |||
120 | state = __seq_open_private(file, ops, sizeof(*state)); | ||
121 | if (state == NULL) | ||
122 | return -ENOMEM; | ||
123 | 112 | ||
124 | state->family = family; | 113 | return __vcc_walk(&state->sk, family, &state->bucket, l) ? |
125 | return 0; | 114 | state : NULL; |
126 | } | 115 | } |
127 | 116 | ||
128 | static void *vcc_seq_start(struct seq_file *seq, loff_t *pos) | 117 | static void *vcc_seq_start(struct seq_file *seq, loff_t *pos) |
@@ -133,7 +122,7 @@ static void *vcc_seq_start(struct seq_file *seq, loff_t *pos) | |||
133 | 122 | ||
134 | read_lock(&vcc_sklist_lock); | 123 | read_lock(&vcc_sklist_lock); |
135 | state->sk = SEQ_START_TOKEN; | 124 | state->sk = SEQ_START_TOKEN; |
136 | return left ? vcc_walk(state, left) : SEQ_START_TOKEN; | 125 | return left ? vcc_walk(seq, left) : SEQ_START_TOKEN; |
137 | } | 126 | } |
138 | 127 | ||
139 | static void vcc_seq_stop(struct seq_file *seq, void *v) | 128 | static void vcc_seq_stop(struct seq_file *seq, void *v) |
@@ -144,9 +133,7 @@ static void vcc_seq_stop(struct seq_file *seq, void *v) | |||
144 | 133 | ||
145 | static void *vcc_seq_next(struct seq_file *seq, void *v, loff_t *pos) | 134 | static void *vcc_seq_next(struct seq_file *seq, void *v, loff_t *pos) |
146 | { | 135 | { |
147 | struct vcc_state *state = seq->private; | 136 | v = vcc_walk(seq, 1); |
148 | |||
149 | v = vcc_walk(state, 1); | ||
150 | *pos += !!PTR_ERR(v); | 137 | *pos += !!PTR_ERR(v); |
151 | return v; | 138 | return v; |
152 | } | 139 | } |
@@ -257,18 +244,6 @@ static const struct seq_operations atm_dev_seq_ops = { | |||
257 | .show = atm_dev_seq_show, | 244 | .show = atm_dev_seq_show, |
258 | }; | 245 | }; |
259 | 246 | ||
260 | static int atm_dev_seq_open(struct inode *inode, struct file *file) | ||
261 | { | ||
262 | return seq_open(file, &atm_dev_seq_ops); | ||
263 | } | ||
264 | |||
265 | static const struct file_operations devices_seq_fops = { | ||
266 | .open = atm_dev_seq_open, | ||
267 | .read = seq_read, | ||
268 | .llseek = seq_lseek, | ||
269 | .release = seq_release, | ||
270 | }; | ||
271 | |||
272 | static int pvc_seq_show(struct seq_file *seq, void *v) | 247 | static int pvc_seq_show(struct seq_file *seq, void *v) |
273 | { | 248 | { |
274 | static char atm_pvc_banner[] = | 249 | static char atm_pvc_banner[] = |
@@ -292,18 +267,6 @@ static const struct seq_operations pvc_seq_ops = { | |||
292 | .show = pvc_seq_show, | 267 | .show = pvc_seq_show, |
293 | }; | 268 | }; |
294 | 269 | ||
295 | static int pvc_seq_open(struct inode *inode, struct file *file) | ||
296 | { | ||
297 | return __vcc_seq_open(inode, file, PF_ATMPVC, &pvc_seq_ops); | ||
298 | } | ||
299 | |||
300 | static const struct file_operations pvc_seq_fops = { | ||
301 | .open = pvc_seq_open, | ||
302 | .read = seq_read, | ||
303 | .llseek = seq_lseek, | ||
304 | .release = seq_release_private, | ||
305 | }; | ||
306 | |||
307 | static int vcc_seq_show(struct seq_file *seq, void *v) | 270 | static int vcc_seq_show(struct seq_file *seq, void *v) |
308 | { | 271 | { |
309 | if (v == SEQ_START_TOKEN) { | 272 | if (v == SEQ_START_TOKEN) { |
@@ -326,18 +289,6 @@ static const struct seq_operations vcc_seq_ops = { | |||
326 | .show = vcc_seq_show, | 289 | .show = vcc_seq_show, |
327 | }; | 290 | }; |
328 | 291 | ||
329 | static int vcc_seq_open(struct inode *inode, struct file *file) | ||
330 | { | ||
331 | return __vcc_seq_open(inode, file, 0, &vcc_seq_ops); | ||
332 | } | ||
333 | |||
334 | static const struct file_operations vcc_seq_fops = { | ||
335 | .open = vcc_seq_open, | ||
336 | .read = seq_read, | ||
337 | .llseek = seq_lseek, | ||
338 | .release = seq_release_private, | ||
339 | }; | ||
340 | |||
341 | static int svc_seq_show(struct seq_file *seq, void *v) | 292 | static int svc_seq_show(struct seq_file *seq, void *v) |
342 | { | 293 | { |
343 | static const char atm_svc_banner[] = | 294 | static const char atm_svc_banner[] = |
@@ -361,18 +312,6 @@ static const struct seq_operations svc_seq_ops = { | |||
361 | .show = svc_seq_show, | 312 | .show = svc_seq_show, |
362 | }; | 313 | }; |
363 | 314 | ||
364 | static int svc_seq_open(struct inode *inode, struct file *file) | ||
365 | { | ||
366 | return __vcc_seq_open(inode, file, PF_ATMSVC, &svc_seq_ops); | ||
367 | } | ||
368 | |||
369 | static const struct file_operations svc_seq_fops = { | ||
370 | .open = svc_seq_open, | ||
371 | .read = seq_read, | ||
372 | .llseek = seq_lseek, | ||
373 | .release = seq_release_private, | ||
374 | }; | ||
375 | |||
376 | static ssize_t proc_dev_atm_read(struct file *file, char __user *buf, | 315 | static ssize_t proc_dev_atm_read(struct file *file, char __user *buf, |
377 | size_t count, loff_t *pos) | 316 | size_t count, loff_t *pos) |
378 | { | 317 | { |
@@ -440,58 +379,22 @@ void atm_proc_dev_deregister(struct atm_dev *dev) | |||
440 | kfree(dev->proc_name); | 379 | kfree(dev->proc_name); |
441 | } | 380 | } |
442 | 381 | ||
443 | static struct atm_proc_entry { | ||
444 | char *name; | ||
445 | const struct file_operations *proc_fops; | ||
446 | struct proc_dir_entry *dirent; | ||
447 | } atm_proc_ents[] = { | ||
448 | { .name = "devices", .proc_fops = &devices_seq_fops }, | ||
449 | { .name = "pvc", .proc_fops = &pvc_seq_fops }, | ||
450 | { .name = "svc", .proc_fops = &svc_seq_fops }, | ||
451 | { .name = "vc", .proc_fops = &vcc_seq_fops }, | ||
452 | { .name = NULL, .proc_fops = NULL } | ||
453 | }; | ||
454 | |||
455 | static void atm_proc_dirs_remove(void) | ||
456 | { | ||
457 | static struct atm_proc_entry *e; | ||
458 | |||
459 | for (e = atm_proc_ents; e->name; e++) { | ||
460 | if (e->dirent) | ||
461 | remove_proc_entry(e->name, atm_proc_root); | ||
462 | } | ||
463 | remove_proc_entry("atm", init_net.proc_net); | ||
464 | } | ||
465 | |||
466 | int __init atm_proc_init(void) | 382 | int __init atm_proc_init(void) |
467 | { | 383 | { |
468 | static struct atm_proc_entry *e; | ||
469 | int ret; | ||
470 | |||
471 | atm_proc_root = proc_net_mkdir(&init_net, "atm", init_net.proc_net); | 384 | atm_proc_root = proc_net_mkdir(&init_net, "atm", init_net.proc_net); |
472 | if (!atm_proc_root) | 385 | if (!atm_proc_root) |
473 | goto err_out; | 386 | return -ENOMEM; |
474 | for (e = atm_proc_ents; e->name; e++) { | 387 | proc_create_seq("devices", 0444, atm_proc_root, &atm_dev_seq_ops); |
475 | struct proc_dir_entry *dirent; | 388 | proc_create_seq_private("pvc", 0444, atm_proc_root, &pvc_seq_ops, |
476 | 389 | sizeof(struct vcc_state), (void *)(uintptr_t)PF_ATMPVC); | |
477 | dirent = proc_create(e->name, 0444, | 390 | proc_create_seq_private("svc", 0444, atm_proc_root, &svc_seq_ops, |
478 | atm_proc_root, e->proc_fops); | 391 | sizeof(struct vcc_state), (void *)(uintptr_t)PF_ATMSVC); |
479 | if (!dirent) | 392 | proc_create_seq_private("vc", 0444, atm_proc_root, &vcc_seq_ops, |
480 | goto err_out_remove; | 393 | sizeof(struct vcc_state), NULL); |
481 | e->dirent = dirent; | 394 | return 0; |
482 | } | ||
483 | ret = 0; | ||
484 | out: | ||
485 | return ret; | ||
486 | |||
487 | err_out_remove: | ||
488 | atm_proc_dirs_remove(); | ||
489 | err_out: | ||
490 | ret = -ENOMEM; | ||
491 | goto out; | ||
492 | } | 395 | } |
493 | 396 | ||
494 | void atm_proc_exit(void) | 397 | void atm_proc_exit(void) |
495 | { | 398 | { |
496 | atm_proc_dirs_remove(); | 399 | remove_proc_subtree("atm", init_net.proc_net); |
497 | } | 400 | } |
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/bluetooth/af_bluetooth.c b/net/bluetooth/af_bluetooth.c index 84d92a077834..3264e1873219 100644 --- a/net/bluetooth/af_bluetooth.c +++ b/net/bluetooth/af_bluetooth.c | |||
@@ -605,15 +605,10 @@ int bt_sock_wait_ready(struct sock *sk, unsigned long flags) | |||
605 | EXPORT_SYMBOL(bt_sock_wait_ready); | 605 | EXPORT_SYMBOL(bt_sock_wait_ready); |
606 | 606 | ||
607 | #ifdef CONFIG_PROC_FS | 607 | #ifdef CONFIG_PROC_FS |
608 | struct bt_seq_state { | ||
609 | struct bt_sock_list *l; | ||
610 | }; | ||
611 | |||
612 | static void *bt_seq_start(struct seq_file *seq, loff_t *pos) | 608 | static void *bt_seq_start(struct seq_file *seq, loff_t *pos) |
613 | __acquires(seq->private->l->lock) | 609 | __acquires(seq->private->l->lock) |
614 | { | 610 | { |
615 | struct bt_seq_state *s = seq->private; | 611 | struct bt_sock_list *l = PDE_DATA(file_inode(seq->file)); |
616 | struct bt_sock_list *l = s->l; | ||
617 | 612 | ||
618 | read_lock(&l->lock); | 613 | read_lock(&l->lock); |
619 | return seq_hlist_start_head(&l->head, *pos); | 614 | return seq_hlist_start_head(&l->head, *pos); |
@@ -621,8 +616,7 @@ static void *bt_seq_start(struct seq_file *seq, loff_t *pos) | |||
621 | 616 | ||
622 | static void *bt_seq_next(struct seq_file *seq, void *v, loff_t *pos) | 617 | static void *bt_seq_next(struct seq_file *seq, void *v, loff_t *pos) |
623 | { | 618 | { |
624 | struct bt_seq_state *s = seq->private; | 619 | struct bt_sock_list *l = PDE_DATA(file_inode(seq->file)); |
625 | struct bt_sock_list *l = s->l; | ||
626 | 620 | ||
627 | return seq_hlist_next(v, &l->head, pos); | 621 | return seq_hlist_next(v, &l->head, pos); |
628 | } | 622 | } |
@@ -630,16 +624,14 @@ static void *bt_seq_next(struct seq_file *seq, void *v, loff_t *pos) | |||
630 | static void bt_seq_stop(struct seq_file *seq, void *v) | 624 | static void bt_seq_stop(struct seq_file *seq, void *v) |
631 | __releases(seq->private->l->lock) | 625 | __releases(seq->private->l->lock) |
632 | { | 626 | { |
633 | struct bt_seq_state *s = seq->private; | 627 | struct bt_sock_list *l = PDE_DATA(file_inode(seq->file)); |
634 | struct bt_sock_list *l = s->l; | ||
635 | 628 | ||
636 | read_unlock(&l->lock); | 629 | read_unlock(&l->lock); |
637 | } | 630 | } |
638 | 631 | ||
639 | static int bt_seq_show(struct seq_file *seq, void *v) | 632 | static int bt_seq_show(struct seq_file *seq, void *v) |
640 | { | 633 | { |
641 | struct bt_seq_state *s = seq->private; | 634 | struct bt_sock_list *l = PDE_DATA(file_inode(seq->file)); |
642 | struct bt_sock_list *l = s->l; | ||
643 | 635 | ||
644 | if (v == SEQ_START_TOKEN) { | 636 | if (v == SEQ_START_TOKEN) { |
645 | seq_puts(seq ,"sk RefCnt Rmem Wmem User Inode Parent"); | 637 | seq_puts(seq ,"sk RefCnt Rmem Wmem User Inode Parent"); |
@@ -681,35 +673,13 @@ static const struct seq_operations bt_seq_ops = { | |||
681 | .show = bt_seq_show, | 673 | .show = bt_seq_show, |
682 | }; | 674 | }; |
683 | 675 | ||
684 | static int bt_seq_open(struct inode *inode, struct file *file) | ||
685 | { | ||
686 | struct bt_sock_list *sk_list; | ||
687 | struct bt_seq_state *s; | ||
688 | |||
689 | sk_list = PDE_DATA(inode); | ||
690 | s = __seq_open_private(file, &bt_seq_ops, | ||
691 | sizeof(struct bt_seq_state)); | ||
692 | if (!s) | ||
693 | return -ENOMEM; | ||
694 | |||
695 | s->l = sk_list; | ||
696 | return 0; | ||
697 | } | ||
698 | |||
699 | static const struct file_operations bt_fops = { | ||
700 | .open = bt_seq_open, | ||
701 | .read = seq_read, | ||
702 | .llseek = seq_lseek, | ||
703 | .release = seq_release_private | ||
704 | }; | ||
705 | |||
706 | int bt_procfs_init(struct net *net, const char *name, | 676 | int bt_procfs_init(struct net *net, const char *name, |
707 | struct bt_sock_list *sk_list, | 677 | struct bt_sock_list *sk_list, |
708 | int (* seq_show)(struct seq_file *, void *)) | 678 | int (* seq_show)(struct seq_file *, void *)) |
709 | { | 679 | { |
710 | sk_list->custom_seq_show = seq_show; | 680 | sk_list->custom_seq_show = seq_show; |
711 | 681 | ||
712 | if (!proc_create_data(name, 0, net->proc_net, &bt_fops, sk_list)) | 682 | if (!proc_create_seq_data(name, 0, net->proc_net, &bt_seq_ops, sk_list)) |
713 | return -ENOMEM; | 683 | return -ENOMEM; |
714 | return 0; | 684 | return 0; |
715 | } | 685 | } |
diff --git a/net/bluetooth/cmtp/capi.c b/net/bluetooth/cmtp/capi.c index 426a92f02db4..eb41556002e3 100644 --- a/net/bluetooth/cmtp/capi.c +++ b/net/bluetooth/cmtp/capi.c | |||
@@ -521,18 +521,6 @@ static int cmtp_proc_show(struct seq_file *m, void *v) | |||
521 | return 0; | 521 | return 0; |
522 | } | 522 | } |
523 | 523 | ||
524 | static int cmtp_proc_open(struct inode *inode, struct file *file) | ||
525 | { | ||
526 | return single_open(file, cmtp_proc_show, PDE_DATA(inode)); | ||
527 | } | ||
528 | |||
529 | static const struct file_operations cmtp_proc_fops = { | ||
530 | .open = cmtp_proc_open, | ||
531 | .read = seq_read, | ||
532 | .llseek = seq_lseek, | ||
533 | .release = single_release, | ||
534 | }; | ||
535 | |||
536 | int cmtp_attach_device(struct cmtp_session *session) | 524 | int cmtp_attach_device(struct cmtp_session *session) |
537 | { | 525 | { |
538 | unsigned char buf[4]; | 526 | unsigned char buf[4]; |
@@ -571,7 +559,7 @@ int cmtp_attach_device(struct cmtp_session *session) | |||
571 | session->ctrl.send_message = cmtp_send_message; | 559 | session->ctrl.send_message = cmtp_send_message; |
572 | 560 | ||
573 | session->ctrl.procinfo = cmtp_procinfo; | 561 | session->ctrl.procinfo = cmtp_procinfo; |
574 | session->ctrl.proc_fops = &cmtp_proc_fops; | 562 | session->ctrl.proc_show = cmtp_proc_show; |
575 | 563 | ||
576 | if (attach_capi_ctr(&session->ctrl) < 0) { | 564 | if (attach_capi_ctr(&session->ctrl) < 0) { |
577 | BT_ERR("Can't attach new controller"); | 565 | BT_ERR("Can't attach new controller"); |
diff --git a/net/can/bcm.c b/net/can/bcm.c index ac5e5e34fee3..6ad89f49b341 100644 --- a/net/can/bcm.c +++ b/net/can/bcm.c | |||
@@ -239,18 +239,6 @@ static int bcm_proc_show(struct seq_file *m, void *v) | |||
239 | seq_putc(m, '\n'); | 239 | seq_putc(m, '\n'); |
240 | return 0; | 240 | return 0; |
241 | } | 241 | } |
242 | |||
243 | static int bcm_proc_open(struct inode *inode, struct file *file) | ||
244 | { | ||
245 | return single_open_net(inode, file, bcm_proc_show); | ||
246 | } | ||
247 | |||
248 | static const struct file_operations bcm_proc_fops = { | ||
249 | .open = bcm_proc_open, | ||
250 | .read = seq_read, | ||
251 | .llseek = seq_lseek, | ||
252 | .release = single_release, | ||
253 | }; | ||
254 | #endif /* CONFIG_PROC_FS */ | 242 | #endif /* CONFIG_PROC_FS */ |
255 | 243 | ||
256 | /* | 244 | /* |
@@ -1606,9 +1594,9 @@ static int bcm_connect(struct socket *sock, struct sockaddr *uaddr, int len, | |||
1606 | if (net->can.bcmproc_dir) { | 1594 | if (net->can.bcmproc_dir) { |
1607 | /* unique socket address as filename */ | 1595 | /* unique socket address as filename */ |
1608 | sprintf(bo->procname, "%lu", sock_i_ino(sk)); | 1596 | sprintf(bo->procname, "%lu", sock_i_ino(sk)); |
1609 | bo->bcm_proc_read = proc_create_data(bo->procname, 0644, | 1597 | bo->bcm_proc_read = proc_create_net_single(bo->procname, 0644, |
1610 | net->can.bcmproc_dir, | 1598 | net->can.bcmproc_dir, |
1611 | &bcm_proc_fops, sk); | 1599 | bcm_proc_show, sk); |
1612 | if (!bo->bcm_proc_read) { | 1600 | if (!bo->bcm_proc_read) { |
1613 | ret = -ENOMEM; | 1601 | ret = -ENOMEM; |
1614 | goto fail; | 1602 | goto fail; |
diff --git a/net/can/proc.c b/net/can/proc.c index fdf704e9bb8c..70fea17bb04c 100644 --- a/net/can/proc.c +++ b/net/can/proc.c | |||
@@ -270,18 +270,6 @@ static int can_stats_proc_show(struct seq_file *m, void *v) | |||
270 | return 0; | 270 | return 0; |
271 | } | 271 | } |
272 | 272 | ||
273 | static int can_stats_proc_open(struct inode *inode, struct file *file) | ||
274 | { | ||
275 | return single_open_net(inode, file, can_stats_proc_show); | ||
276 | } | ||
277 | |||
278 | static const struct file_operations can_stats_proc_fops = { | ||
279 | .open = can_stats_proc_open, | ||
280 | .read = seq_read, | ||
281 | .llseek = seq_lseek, | ||
282 | .release = single_release, | ||
283 | }; | ||
284 | |||
285 | static int can_reset_stats_proc_show(struct seq_file *m, void *v) | 273 | static int can_reset_stats_proc_show(struct seq_file *m, void *v) |
286 | { | 274 | { |
287 | struct net *net = m->private; | 275 | struct net *net = m->private; |
@@ -303,36 +291,12 @@ static int can_reset_stats_proc_show(struct seq_file *m, void *v) | |||
303 | return 0; | 291 | return 0; |
304 | } | 292 | } |
305 | 293 | ||
306 | static int can_reset_stats_proc_open(struct inode *inode, struct file *file) | ||
307 | { | ||
308 | return single_open_net(inode, file, can_reset_stats_proc_show); | ||
309 | } | ||
310 | |||
311 | static const struct file_operations can_reset_stats_proc_fops = { | ||
312 | .open = can_reset_stats_proc_open, | ||
313 | .read = seq_read, | ||
314 | .llseek = seq_lseek, | ||
315 | .release = single_release, | ||
316 | }; | ||
317 | |||
318 | static int can_version_proc_show(struct seq_file *m, void *v) | 294 | static int can_version_proc_show(struct seq_file *m, void *v) |
319 | { | 295 | { |
320 | seq_printf(m, "%s\n", CAN_VERSION_STRING); | 296 | seq_printf(m, "%s\n", CAN_VERSION_STRING); |
321 | return 0; | 297 | return 0; |
322 | } | 298 | } |
323 | 299 | ||
324 | static int can_version_proc_open(struct inode *inode, struct file *file) | ||
325 | { | ||
326 | return single_open_net(inode, file, can_version_proc_show); | ||
327 | } | ||
328 | |||
329 | static const struct file_operations can_version_proc_fops = { | ||
330 | .open = can_version_proc_open, | ||
331 | .read = seq_read, | ||
332 | .llseek = seq_lseek, | ||
333 | .release = single_release, | ||
334 | }; | ||
335 | |||
336 | static inline void can_rcvlist_proc_show_one(struct seq_file *m, int idx, | 300 | static inline void can_rcvlist_proc_show_one(struct seq_file *m, int idx, |
337 | struct net_device *dev, | 301 | struct net_device *dev, |
338 | struct can_dev_rcv_lists *d) | 302 | struct can_dev_rcv_lists *d) |
@@ -373,18 +337,6 @@ static int can_rcvlist_proc_show(struct seq_file *m, void *v) | |||
373 | return 0; | 337 | return 0; |
374 | } | 338 | } |
375 | 339 | ||
376 | static int can_rcvlist_proc_open(struct inode *inode, struct file *file) | ||
377 | { | ||
378 | return single_open_net(inode, file, can_rcvlist_proc_show); | ||
379 | } | ||
380 | |||
381 | static const struct file_operations can_rcvlist_proc_fops = { | ||
382 | .open = can_rcvlist_proc_open, | ||
383 | .read = seq_read, | ||
384 | .llseek = seq_lseek, | ||
385 | .release = single_release, | ||
386 | }; | ||
387 | |||
388 | static inline void can_rcvlist_proc_show_array(struct seq_file *m, | 340 | static inline void can_rcvlist_proc_show_array(struct seq_file *m, |
389 | struct net_device *dev, | 341 | struct net_device *dev, |
390 | struct hlist_head *rcv_array, | 342 | struct hlist_head *rcv_array, |
@@ -440,19 +392,6 @@ static int can_rcvlist_sff_proc_show(struct seq_file *m, void *v) | |||
440 | return 0; | 392 | return 0; |
441 | } | 393 | } |
442 | 394 | ||
443 | static int can_rcvlist_sff_proc_open(struct inode *inode, struct file *file) | ||
444 | { | ||
445 | return single_open_net(inode, file, can_rcvlist_sff_proc_show); | ||
446 | } | ||
447 | |||
448 | static const struct file_operations can_rcvlist_sff_proc_fops = { | ||
449 | .open = can_rcvlist_sff_proc_open, | ||
450 | .read = seq_read, | ||
451 | .llseek = seq_lseek, | ||
452 | .release = single_release, | ||
453 | }; | ||
454 | |||
455 | |||
456 | static int can_rcvlist_eff_proc_show(struct seq_file *m, void *v) | 395 | static int can_rcvlist_eff_proc_show(struct seq_file *m, void *v) |
457 | { | 396 | { |
458 | struct net_device *dev; | 397 | struct net_device *dev; |
@@ -483,18 +422,6 @@ static int can_rcvlist_eff_proc_show(struct seq_file *m, void *v) | |||
483 | return 0; | 422 | return 0; |
484 | } | 423 | } |
485 | 424 | ||
486 | static int can_rcvlist_eff_proc_open(struct inode *inode, struct file *file) | ||
487 | { | ||
488 | return single_open_net(inode, file, can_rcvlist_eff_proc_show); | ||
489 | } | ||
490 | |||
491 | static const struct file_operations can_rcvlist_eff_proc_fops = { | ||
492 | .open = can_rcvlist_eff_proc_open, | ||
493 | .read = seq_read, | ||
494 | .llseek = seq_lseek, | ||
495 | .release = single_release, | ||
496 | }; | ||
497 | |||
498 | /* | 425 | /* |
499 | * can_init_proc - create main CAN proc directory and procfs entries | 426 | * can_init_proc - create main CAN proc directory and procfs entries |
500 | */ | 427 | */ |
@@ -510,37 +437,29 @@ void can_init_proc(struct net *net) | |||
510 | } | 437 | } |
511 | 438 | ||
512 | /* own procfs entries from the AF_CAN core */ | 439 | /* own procfs entries from the AF_CAN core */ |
513 | net->can.pde_version = proc_create(CAN_PROC_VERSION, 0644, | 440 | net->can.pde_version = proc_create_net_single(CAN_PROC_VERSION, 0644, |
514 | net->can.proc_dir, | 441 | net->can.proc_dir, can_version_proc_show, NULL); |
515 | &can_version_proc_fops); | 442 | net->can.pde_stats = proc_create_net_single(CAN_PROC_STATS, 0644, |
516 | net->can.pde_stats = proc_create(CAN_PROC_STATS, 0644, | 443 | net->can.proc_dir, can_stats_proc_show, NULL); |
517 | net->can.proc_dir, | 444 | net->can.pde_reset_stats = proc_create_net_single(CAN_PROC_RESET_STATS, |
518 | &can_stats_proc_fops); | 445 | 0644, net->can.proc_dir, can_reset_stats_proc_show, |
519 | net->can.pde_reset_stats = proc_create(CAN_PROC_RESET_STATS, 0644, | 446 | NULL); |
520 | net->can.proc_dir, | 447 | net->can.pde_rcvlist_err = proc_create_net_single(CAN_PROC_RCVLIST_ERR, |
521 | &can_reset_stats_proc_fops); | 448 | 0644, net->can.proc_dir, can_rcvlist_proc_show, |
522 | net->can.pde_rcvlist_err = proc_create_data(CAN_PROC_RCVLIST_ERR, 0644, | 449 | (void *)RX_ERR); |
523 | net->can.proc_dir, | 450 | net->can.pde_rcvlist_all = proc_create_net_single(CAN_PROC_RCVLIST_ALL, |
524 | &can_rcvlist_proc_fops, | 451 | 0644, net->can.proc_dir, can_rcvlist_proc_show, |
525 | (void *)RX_ERR); | 452 | (void *)RX_ALL); |
526 | net->can.pde_rcvlist_all = proc_create_data(CAN_PROC_RCVLIST_ALL, 0644, | 453 | net->can.pde_rcvlist_fil = proc_create_net_single(CAN_PROC_RCVLIST_FIL, |
527 | net->can.proc_dir, | 454 | 0644, net->can.proc_dir, can_rcvlist_proc_show, |
528 | &can_rcvlist_proc_fops, | 455 | (void *)RX_FIL); |
529 | (void *)RX_ALL); | 456 | net->can.pde_rcvlist_inv = proc_create_net_single(CAN_PROC_RCVLIST_INV, |
530 | net->can.pde_rcvlist_fil = proc_create_data(CAN_PROC_RCVLIST_FIL, 0644, | 457 | 0644, net->can.proc_dir, can_rcvlist_proc_show, |
531 | net->can.proc_dir, | 458 | (void *)RX_INV); |
532 | &can_rcvlist_proc_fops, | 459 | net->can.pde_rcvlist_eff = proc_create_net_single(CAN_PROC_RCVLIST_EFF, |
533 | (void *)RX_FIL); | 460 | 0644, net->can.proc_dir, can_rcvlist_eff_proc_show, NULL); |
534 | net->can.pde_rcvlist_inv = proc_create_data(CAN_PROC_RCVLIST_INV, 0644, | 461 | net->can.pde_rcvlist_sff = proc_create_net_single(CAN_PROC_RCVLIST_SFF, |
535 | net->can.proc_dir, | 462 | 0644, net->can.proc_dir, can_rcvlist_sff_proc_show, NULL); |
536 | &can_rcvlist_proc_fops, | ||
537 | (void *)RX_INV); | ||
538 | net->can.pde_rcvlist_eff = proc_create(CAN_PROC_RCVLIST_EFF, 0644, | ||
539 | net->can.proc_dir, | ||
540 | &can_rcvlist_eff_proc_fops); | ||
541 | net->can.pde_rcvlist_sff = proc_create(CAN_PROC_RCVLIST_SFF, 0644, | ||
542 | net->can.proc_dir, | ||
543 | &can_rcvlist_sff_proc_fops); | ||
544 | } | 463 | } |
545 | 464 | ||
546 | /* | 465 | /* |
diff --git a/net/core/neighbour.c b/net/core/neighbour.c index ce519861be59..1fb43bff417d 100644 --- a/net/core/neighbour.c +++ b/net/core/neighbour.c | |||
@@ -59,7 +59,7 @@ static int pneigh_ifdown_and_unlock(struct neigh_table *tbl, | |||
59 | struct net_device *dev); | 59 | struct net_device *dev); |
60 | 60 | ||
61 | #ifdef CONFIG_PROC_FS | 61 | #ifdef CONFIG_PROC_FS |
62 | static const struct file_operations neigh_stat_seq_fops; | 62 | static const struct seq_operations neigh_stat_seq_ops; |
63 | #endif | 63 | #endif |
64 | 64 | ||
65 | /* | 65 | /* |
@@ -1558,8 +1558,8 @@ void neigh_table_init(int index, struct neigh_table *tbl) | |||
1558 | panic("cannot create neighbour cache statistics"); | 1558 | panic("cannot create neighbour cache statistics"); |
1559 | 1559 | ||
1560 | #ifdef CONFIG_PROC_FS | 1560 | #ifdef CONFIG_PROC_FS |
1561 | if (!proc_create_data(tbl->id, 0, init_net.proc_net_stat, | 1561 | if (!proc_create_seq_data(tbl->id, 0, init_net.proc_net_stat, |
1562 | &neigh_stat_seq_fops, tbl)) | 1562 | &neigh_stat_seq_ops, tbl)) |
1563 | panic("cannot create neighbour proc dir entry"); | 1563 | panic("cannot create neighbour proc dir entry"); |
1564 | #endif | 1564 | #endif |
1565 | 1565 | ||
@@ -2786,7 +2786,7 @@ EXPORT_SYMBOL(neigh_seq_stop); | |||
2786 | 2786 | ||
2787 | static void *neigh_stat_seq_start(struct seq_file *seq, loff_t *pos) | 2787 | static void *neigh_stat_seq_start(struct seq_file *seq, loff_t *pos) |
2788 | { | 2788 | { |
2789 | struct neigh_table *tbl = seq->private; | 2789 | struct neigh_table *tbl = PDE_DATA(file_inode(seq->file)); |
2790 | int cpu; | 2790 | int cpu; |
2791 | 2791 | ||
2792 | if (*pos == 0) | 2792 | if (*pos == 0) |
@@ -2803,7 +2803,7 @@ static void *neigh_stat_seq_start(struct seq_file *seq, loff_t *pos) | |||
2803 | 2803 | ||
2804 | static void *neigh_stat_seq_next(struct seq_file *seq, void *v, loff_t *pos) | 2804 | static void *neigh_stat_seq_next(struct seq_file *seq, void *v, loff_t *pos) |
2805 | { | 2805 | { |
2806 | struct neigh_table *tbl = seq->private; | 2806 | struct neigh_table *tbl = PDE_DATA(file_inode(seq->file)); |
2807 | int cpu; | 2807 | int cpu; |
2808 | 2808 | ||
2809 | for (cpu = *pos; cpu < nr_cpu_ids; ++cpu) { | 2809 | for (cpu = *pos; cpu < nr_cpu_ids; ++cpu) { |
@@ -2822,7 +2822,7 @@ static void neigh_stat_seq_stop(struct seq_file *seq, void *v) | |||
2822 | 2822 | ||
2823 | static int neigh_stat_seq_show(struct seq_file *seq, void *v) | 2823 | static int neigh_stat_seq_show(struct seq_file *seq, void *v) |
2824 | { | 2824 | { |
2825 | struct neigh_table *tbl = seq->private; | 2825 | struct neigh_table *tbl = PDE_DATA(file_inode(seq->file)); |
2826 | struct neigh_statistics *st = v; | 2826 | struct neigh_statistics *st = v; |
2827 | 2827 | ||
2828 | if (v == SEQ_START_TOKEN) { | 2828 | if (v == SEQ_START_TOKEN) { |
@@ -2861,25 +2861,6 @@ static const struct seq_operations neigh_stat_seq_ops = { | |||
2861 | .stop = neigh_stat_seq_stop, | 2861 | .stop = neigh_stat_seq_stop, |
2862 | .show = neigh_stat_seq_show, | 2862 | .show = neigh_stat_seq_show, |
2863 | }; | 2863 | }; |
2864 | |||
2865 | static int neigh_stat_seq_open(struct inode *inode, struct file *file) | ||
2866 | { | ||
2867 | int ret = seq_open(file, &neigh_stat_seq_ops); | ||
2868 | |||
2869 | if (!ret) { | ||
2870 | struct seq_file *sf = file->private_data; | ||
2871 | sf->private = PDE_DATA(inode); | ||
2872 | } | ||
2873 | return ret; | ||
2874 | }; | ||
2875 | |||
2876 | static const struct file_operations neigh_stat_seq_fops = { | ||
2877 | .open = neigh_stat_seq_open, | ||
2878 | .read = seq_read, | ||
2879 | .llseek = seq_lseek, | ||
2880 | .release = seq_release, | ||
2881 | }; | ||
2882 | |||
2883 | #endif /* CONFIG_PROC_FS */ | 2864 | #endif /* CONFIG_PROC_FS */ |
2884 | 2865 | ||
2885 | static inline size_t neigh_nlmsg_size(void) | 2866 | static inline size_t neigh_nlmsg_size(void) |
diff --git a/net/core/net-procfs.c b/net/core/net-procfs.c index 9737302907b1..63881f72ef71 100644 --- a/net/core/net-procfs.c +++ b/net/core/net-procfs.c | |||
@@ -175,19 +175,6 @@ static const struct seq_operations dev_seq_ops = { | |||
175 | .show = dev_seq_show, | 175 | .show = dev_seq_show, |
176 | }; | 176 | }; |
177 | 177 | ||
178 | static int dev_seq_open(struct inode *inode, struct file *file) | ||
179 | { | ||
180 | return seq_open_net(inode, file, &dev_seq_ops, | ||
181 | sizeof(struct seq_net_private)); | ||
182 | } | ||
183 | |||
184 | static const struct file_operations dev_seq_fops = { | ||
185 | .open = dev_seq_open, | ||
186 | .read = seq_read, | ||
187 | .llseek = seq_lseek, | ||
188 | .release = seq_release_net, | ||
189 | }; | ||
190 | |||
191 | static const struct seq_operations softnet_seq_ops = { | 178 | static const struct seq_operations softnet_seq_ops = { |
192 | .start = softnet_seq_start, | 179 | .start = softnet_seq_start, |
193 | .next = softnet_seq_next, | 180 | .next = softnet_seq_next, |
@@ -195,18 +182,6 @@ static const struct seq_operations softnet_seq_ops = { | |||
195 | .show = softnet_seq_show, | 182 | .show = softnet_seq_show, |
196 | }; | 183 | }; |
197 | 184 | ||
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) | 185 | static void *ptype_get_idx(loff_t pos) |
211 | { | 186 | { |
212 | struct packet_type *pt = NULL; | 187 | struct packet_type *pt = NULL; |
@@ -297,30 +272,18 @@ static const struct seq_operations ptype_seq_ops = { | |||
297 | .show = ptype_seq_show, | 272 | .show = ptype_seq_show, |
298 | }; | 273 | }; |
299 | 274 | ||
300 | static int ptype_seq_open(struct inode *inode, struct file *file) | ||
301 | { | ||
302 | return seq_open_net(inode, file, &ptype_seq_ops, | ||
303 | sizeof(struct seq_net_private)); | ||
304 | } | ||
305 | |||
306 | static const struct file_operations ptype_seq_fops = { | ||
307 | .open = ptype_seq_open, | ||
308 | .read = seq_read, | ||
309 | .llseek = seq_lseek, | ||
310 | .release = seq_release_net, | ||
311 | }; | ||
312 | |||
313 | |||
314 | static int __net_init dev_proc_net_init(struct net *net) | 275 | static int __net_init dev_proc_net_init(struct net *net) |
315 | { | 276 | { |
316 | int rc = -ENOMEM; | 277 | int rc = -ENOMEM; |
317 | 278 | ||
318 | if (!proc_create("dev", 0444, net->proc_net, &dev_seq_fops)) | 279 | if (!proc_create_net("dev", 0444, net->proc_net, &dev_seq_ops, |
280 | sizeof(struct seq_net_private))) | ||
319 | goto out; | 281 | goto out; |
320 | if (!proc_create("softnet_stat", 0444, net->proc_net, | 282 | if (!proc_create_seq("softnet_stat", 0444, net->proc_net, |
321 | &softnet_seq_fops)) | 283 | &softnet_seq_ops)) |
322 | goto out_dev; | 284 | goto out_dev; |
323 | if (!proc_create("ptype", 0444, net->proc_net, &ptype_seq_fops)) | 285 | if (!proc_create_net("ptype", 0444, net->proc_net, &ptype_seq_ops, |
286 | sizeof(struct seq_net_private))) | ||
324 | goto out_softnet; | 287 | goto out_softnet; |
325 | 288 | ||
326 | if (wext_proc_init(net)) | 289 | if (wext_proc_init(net)) |
@@ -377,22 +340,10 @@ static const struct seq_operations dev_mc_seq_ops = { | |||
377 | .show = dev_mc_seq_show, | 340 | .show = dev_mc_seq_show, |
378 | }; | 341 | }; |
379 | 342 | ||
380 | static int dev_mc_seq_open(struct inode *inode, struct file *file) | ||
381 | { | ||
382 | return seq_open_net(inode, file, &dev_mc_seq_ops, | ||
383 | sizeof(struct seq_net_private)); | ||
384 | } | ||
385 | |||
386 | static const struct file_operations dev_mc_seq_fops = { | ||
387 | .open = dev_mc_seq_open, | ||
388 | .read = seq_read, | ||
389 | .llseek = seq_lseek, | ||
390 | .release = seq_release_net, | ||
391 | }; | ||
392 | |||
393 | static int __net_init dev_mc_net_init(struct net *net) | 343 | static int __net_init dev_mc_net_init(struct net *net) |
394 | { | 344 | { |
395 | if (!proc_create("dev_mcast", 0, net->proc_net, &dev_mc_seq_fops)) | 345 | if (!proc_create_net("dev_mcast", 0, net->proc_net, &dev_mc_seq_ops, |
346 | sizeof(struct seq_net_private))) | ||
396 | return -ENOMEM; | 347 | return -ENOMEM; |
397 | return 0; | 348 | return 0; |
398 | } | 349 | } |
diff --git a/net/core/sock.c b/net/core/sock.c index 3b6d02854e57..815770333d91 100644 --- a/net/core/sock.c +++ b/net/core/sock.c | |||
@@ -3439,22 +3439,10 @@ static const struct seq_operations proto_seq_ops = { | |||
3439 | .show = proto_seq_show, | 3439 | .show = proto_seq_show, |
3440 | }; | 3440 | }; |
3441 | 3441 | ||
3442 | static int proto_seq_open(struct inode *inode, struct file *file) | ||
3443 | { | ||
3444 | return seq_open_net(inode, file, &proto_seq_ops, | ||
3445 | sizeof(struct seq_net_private)); | ||
3446 | } | ||
3447 | |||
3448 | static const struct file_operations proto_seq_fops = { | ||
3449 | .open = proto_seq_open, | ||
3450 | .read = seq_read, | ||
3451 | .llseek = seq_lseek, | ||
3452 | .release = seq_release_net, | ||
3453 | }; | ||
3454 | |||
3455 | static __net_init int proto_init_net(struct net *net) | 3442 | static __net_init int proto_init_net(struct net *net) |
3456 | { | 3443 | { |
3457 | if (!proc_create("protocols", 0444, net->proc_net, &proto_seq_fops)) | 3444 | if (!proc_create_net("protocols", 0444, net->proc_net, &proto_seq_ops, |
3445 | sizeof(struct seq_net_private))) | ||
3458 | return -ENOMEM; | 3446 | return -ENOMEM; |
3459 | 3447 | ||
3460 | return 0; | 3448 | return 0; |
diff --git a/net/decnet/af_decnet.c b/net/decnet/af_decnet.c index 32751602767f..7d6ff983ba2c 100644 --- a/net/decnet/af_decnet.c +++ b/net/decnet/af_decnet.c | |||
@@ -2314,19 +2314,6 @@ static const struct seq_operations dn_socket_seq_ops = { | |||
2314 | .stop = dn_socket_seq_stop, | 2314 | .stop = dn_socket_seq_stop, |
2315 | .show = dn_socket_seq_show, | 2315 | .show = dn_socket_seq_show, |
2316 | }; | 2316 | }; |
2317 | |||
2318 | static int dn_socket_seq_open(struct inode *inode, struct file *file) | ||
2319 | { | ||
2320 | return seq_open_private(file, &dn_socket_seq_ops, | ||
2321 | sizeof(struct dn_iter_state)); | ||
2322 | } | ||
2323 | |||
2324 | static const struct file_operations dn_socket_seq_fops = { | ||
2325 | .open = dn_socket_seq_open, | ||
2326 | .read = seq_read, | ||
2327 | .llseek = seq_lseek, | ||
2328 | .release = seq_release_private, | ||
2329 | }; | ||
2330 | #endif | 2317 | #endif |
2331 | 2318 | ||
2332 | static const struct net_proto_family dn_family_ops = { | 2319 | static const struct net_proto_family dn_family_ops = { |
@@ -2383,7 +2370,9 @@ static int __init decnet_init(void) | |||
2383 | dev_add_pack(&dn_dix_packet_type); | 2370 | dev_add_pack(&dn_dix_packet_type); |
2384 | register_netdevice_notifier(&dn_dev_notifier); | 2371 | register_netdevice_notifier(&dn_dev_notifier); |
2385 | 2372 | ||
2386 | proc_create("decnet", 0444, init_net.proc_net, &dn_socket_seq_fops); | 2373 | proc_create_seq_private("decnet", 0444, init_net.proc_net, |
2374 | &dn_socket_seq_ops, sizeof(struct dn_iter_state), | ||
2375 | NULL); | ||
2387 | dn_register_sysctl(); | 2376 | dn_register_sysctl(); |
2388 | out: | 2377 | out: |
2389 | return rc; | 2378 | return rc; |
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/decnet/dn_neigh.c b/net/decnet/dn_neigh.c index 13156165afa3..94b306f6d551 100644 --- a/net/decnet/dn_neigh.c +++ b/net/decnet/dn_neigh.c | |||
@@ -589,27 +589,13 @@ static const struct seq_operations dn_neigh_seq_ops = { | |||
589 | .stop = neigh_seq_stop, | 589 | .stop = neigh_seq_stop, |
590 | .show = dn_neigh_seq_show, | 590 | .show = dn_neigh_seq_show, |
591 | }; | 591 | }; |
592 | |||
593 | static int dn_neigh_seq_open(struct inode *inode, struct file *file) | ||
594 | { | ||
595 | return seq_open_net(inode, file, &dn_neigh_seq_ops, | ||
596 | sizeof(struct neigh_seq_state)); | ||
597 | } | ||
598 | |||
599 | static const struct file_operations dn_neigh_seq_fops = { | ||
600 | .open = dn_neigh_seq_open, | ||
601 | .read = seq_read, | ||
602 | .llseek = seq_lseek, | ||
603 | .release = seq_release_net, | ||
604 | }; | ||
605 | |||
606 | #endif | 592 | #endif |
607 | 593 | ||
608 | void __init dn_neigh_init(void) | 594 | void __init dn_neigh_init(void) |
609 | { | 595 | { |
610 | neigh_table_init(NEIGH_DN_TABLE, &dn_neigh_table); | 596 | neigh_table_init(NEIGH_DN_TABLE, &dn_neigh_table); |
611 | proc_create("decnet_neigh", 0444, init_net.proc_net, | 597 | proc_create_net("decnet_neigh", 0444, init_net.proc_net, |
612 | &dn_neigh_seq_fops); | 598 | &dn_neigh_seq_ops, sizeof(struct neigh_seq_state)); |
613 | } | 599 | } |
614 | 600 | ||
615 | void __exit dn_neigh_cleanup(void) | 601 | void __exit dn_neigh_cleanup(void) |
diff --git a/net/decnet/dn_route.c b/net/decnet/dn_route.c index eca0cc6b761f..e74765024d88 100644 --- a/net/decnet/dn_route.c +++ b/net/decnet/dn_route.c | |||
@@ -1852,20 +1852,6 @@ static const struct seq_operations dn_rt_cache_seq_ops = { | |||
1852 | .stop = dn_rt_cache_seq_stop, | 1852 | .stop = dn_rt_cache_seq_stop, |
1853 | .show = dn_rt_cache_seq_show, | 1853 | .show = dn_rt_cache_seq_show, |
1854 | }; | 1854 | }; |
1855 | |||
1856 | static int dn_rt_cache_seq_open(struct inode *inode, struct file *file) | ||
1857 | { | ||
1858 | return seq_open_private(file, &dn_rt_cache_seq_ops, | ||
1859 | sizeof(struct dn_rt_cache_iter_state)); | ||
1860 | } | ||
1861 | |||
1862 | static const struct file_operations dn_rt_cache_seq_fops = { | ||
1863 | .open = dn_rt_cache_seq_open, | ||
1864 | .read = seq_read, | ||
1865 | .llseek = seq_lseek, | ||
1866 | .release = seq_release_private, | ||
1867 | }; | ||
1868 | |||
1869 | #endif /* CONFIG_PROC_FS */ | 1855 | #endif /* CONFIG_PROC_FS */ |
1870 | 1856 | ||
1871 | void __init dn_route_init(void) | 1857 | void __init dn_route_init(void) |
@@ -1918,8 +1904,9 @@ void __init dn_route_init(void) | |||
1918 | 1904 | ||
1919 | dn_dst_ops.gc_thresh = (dn_rt_hash_mask + 1); | 1905 | dn_dst_ops.gc_thresh = (dn_rt_hash_mask + 1); |
1920 | 1906 | ||
1921 | proc_create("decnet_cache", 0444, init_net.proc_net, | 1907 | proc_create_seq_private("decnet_cache", 0444, init_net.proc_net, |
1922 | &dn_rt_cache_seq_fops); | 1908 | &dn_rt_cache_seq_ops, |
1909 | sizeof(struct dn_rt_cache_iter_state), NULL); | ||
1923 | 1910 | ||
1924 | #ifdef CONFIG_DECNET_ROUTER | 1911 | #ifdef CONFIG_DECNET_ROUTER |
1925 | rtnl_register_module(THIS_MODULE, PF_DECnet, RTM_GETROUTE, | 1912 | rtnl_register_module(THIS_MODULE, PF_DECnet, RTM_GETROUTE, |
diff --git a/net/ipv4/arp.c b/net/ipv4/arp.c index bf6c2d4d4fdc..e90c89ef8c08 100644 --- a/net/ipv4/arp.c +++ b/net/ipv4/arp.c | |||
@@ -1418,23 +1418,12 @@ static const struct seq_operations arp_seq_ops = { | |||
1418 | .show = arp_seq_show, | 1418 | .show = arp_seq_show, |
1419 | }; | 1419 | }; |
1420 | 1420 | ||
1421 | static int arp_seq_open(struct inode *inode, struct file *file) | 1421 | /* ------------------------------------------------------------------------ */ |
1422 | { | ||
1423 | return seq_open_net(inode, file, &arp_seq_ops, | ||
1424 | sizeof(struct neigh_seq_state)); | ||
1425 | } | ||
1426 | |||
1427 | static const struct file_operations arp_seq_fops = { | ||
1428 | .open = arp_seq_open, | ||
1429 | .read = seq_read, | ||
1430 | .llseek = seq_lseek, | ||
1431 | .release = seq_release_net, | ||
1432 | }; | ||
1433 | |||
1434 | 1422 | ||
1435 | static int __net_init arp_net_init(struct net *net) | 1423 | static int __net_init arp_net_init(struct net *net) |
1436 | { | 1424 | { |
1437 | if (!proc_create("arp", 0444, net->proc_net, &arp_seq_fops)) | 1425 | if (!proc_create_net("arp", 0444, net->proc_net, &arp_seq_ops, |
1426 | sizeof(struct neigh_seq_state))) | ||
1438 | return -ENOMEM; | 1427 | return -ENOMEM; |
1439 | return 0; | 1428 | return 0; |
1440 | } | 1429 | } |
diff --git a/net/ipv4/fib_trie.c b/net/ipv4/fib_trie.c index 3dcffd3ce98c..99c23a0cb8ca 100644 --- a/net/ipv4/fib_trie.c +++ b/net/ipv4/fib_trie.c | |||
@@ -2348,18 +2348,6 @@ static int fib_triestat_seq_show(struct seq_file *seq, void *v) | |||
2348 | return 0; | 2348 | return 0; |
2349 | } | 2349 | } |
2350 | 2350 | ||
2351 | static int fib_triestat_seq_open(struct inode *inode, struct file *file) | ||
2352 | { | ||
2353 | return single_open_net(inode, file, fib_triestat_seq_show); | ||
2354 | } | ||
2355 | |||
2356 | static const struct file_operations fib_triestat_fops = { | ||
2357 | .open = fib_triestat_seq_open, | ||
2358 | .read = seq_read, | ||
2359 | .llseek = seq_lseek, | ||
2360 | .release = single_release_net, | ||
2361 | }; | ||
2362 | |||
2363 | static struct key_vector *fib_trie_get_idx(struct seq_file *seq, loff_t pos) | 2351 | static struct key_vector *fib_trie_get_idx(struct seq_file *seq, loff_t pos) |
2364 | { | 2352 | { |
2365 | struct fib_trie_iter *iter = seq->private; | 2353 | struct fib_trie_iter *iter = seq->private; |
@@ -2533,19 +2521,6 @@ static const struct seq_operations fib_trie_seq_ops = { | |||
2533 | .show = fib_trie_seq_show, | 2521 | .show = fib_trie_seq_show, |
2534 | }; | 2522 | }; |
2535 | 2523 | ||
2536 | static int fib_trie_seq_open(struct inode *inode, struct file *file) | ||
2537 | { | ||
2538 | return seq_open_net(inode, file, &fib_trie_seq_ops, | ||
2539 | sizeof(struct fib_trie_iter)); | ||
2540 | } | ||
2541 | |||
2542 | static const struct file_operations fib_trie_fops = { | ||
2543 | .open = fib_trie_seq_open, | ||
2544 | .read = seq_read, | ||
2545 | .llseek = seq_lseek, | ||
2546 | .release = seq_release_net, | ||
2547 | }; | ||
2548 | |||
2549 | struct fib_route_iter { | 2524 | struct fib_route_iter { |
2550 | struct seq_net_private p; | 2525 | struct seq_net_private p; |
2551 | struct fib_table *main_tb; | 2526 | struct fib_table *main_tb; |
@@ -2726,29 +2701,18 @@ static const struct seq_operations fib_route_seq_ops = { | |||
2726 | .show = fib_route_seq_show, | 2701 | .show = fib_route_seq_show, |
2727 | }; | 2702 | }; |
2728 | 2703 | ||
2729 | static int fib_route_seq_open(struct inode *inode, struct file *file) | ||
2730 | { | ||
2731 | return seq_open_net(inode, file, &fib_route_seq_ops, | ||
2732 | sizeof(struct fib_route_iter)); | ||
2733 | } | ||
2734 | |||
2735 | static const struct file_operations fib_route_fops = { | ||
2736 | .open = fib_route_seq_open, | ||
2737 | .read = seq_read, | ||
2738 | .llseek = seq_lseek, | ||
2739 | .release = seq_release_net, | ||
2740 | }; | ||
2741 | |||
2742 | int __net_init fib_proc_init(struct net *net) | 2704 | int __net_init fib_proc_init(struct net *net) |
2743 | { | 2705 | { |
2744 | if (!proc_create("fib_trie", 0444, net->proc_net, &fib_trie_fops)) | 2706 | if (!proc_create_net("fib_trie", 0444, net->proc_net, &fib_trie_seq_ops, |
2707 | sizeof(struct fib_trie_iter))) | ||
2745 | goto out1; | 2708 | goto out1; |
2746 | 2709 | ||
2747 | if (!proc_create("fib_triestat", 0444, net->proc_net, | 2710 | if (!proc_create_net_single("fib_triestat", 0444, net->proc_net, |
2748 | &fib_triestat_fops)) | 2711 | fib_triestat_seq_show, NULL)) |
2749 | goto out2; | 2712 | goto out2; |
2750 | 2713 | ||
2751 | if (!proc_create("route", 0444, net->proc_net, &fib_route_fops)) | 2714 | if (!proc_create_net("route", 0444, net->proc_net, &fib_route_seq_ops, |
2715 | sizeof(struct fib_route_iter))) | ||
2752 | goto out3; | 2716 | goto out3; |
2753 | 2717 | ||
2754 | return 0; | 2718 | return 0; |
diff --git a/net/ipv4/igmp.c b/net/ipv4/igmp.c index b26a81a7de42..85b617b655bc 100644 --- a/net/ipv4/igmp.c +++ b/net/ipv4/igmp.c | |||
@@ -2829,19 +2829,6 @@ static const struct seq_operations igmp_mc_seq_ops = { | |||
2829 | .show = igmp_mc_seq_show, | 2829 | .show = igmp_mc_seq_show, |
2830 | }; | 2830 | }; |
2831 | 2831 | ||
2832 | static int igmp_mc_seq_open(struct inode *inode, struct file *file) | ||
2833 | { | ||
2834 | return seq_open_net(inode, file, &igmp_mc_seq_ops, | ||
2835 | sizeof(struct igmp_mc_iter_state)); | ||
2836 | } | ||
2837 | |||
2838 | static const struct file_operations igmp_mc_seq_fops = { | ||
2839 | .open = igmp_mc_seq_open, | ||
2840 | .read = seq_read, | ||
2841 | .llseek = seq_lseek, | ||
2842 | .release = seq_release_net, | ||
2843 | }; | ||
2844 | |||
2845 | struct igmp_mcf_iter_state { | 2832 | struct igmp_mcf_iter_state { |
2846 | struct seq_net_private p; | 2833 | struct seq_net_private p; |
2847 | struct net_device *dev; | 2834 | struct net_device *dev; |
@@ -2975,29 +2962,17 @@ static const struct seq_operations igmp_mcf_seq_ops = { | |||
2975 | .show = igmp_mcf_seq_show, | 2962 | .show = igmp_mcf_seq_show, |
2976 | }; | 2963 | }; |
2977 | 2964 | ||
2978 | static int igmp_mcf_seq_open(struct inode *inode, struct file *file) | ||
2979 | { | ||
2980 | return seq_open_net(inode, file, &igmp_mcf_seq_ops, | ||
2981 | sizeof(struct igmp_mcf_iter_state)); | ||
2982 | } | ||
2983 | |||
2984 | static const struct file_operations igmp_mcf_seq_fops = { | ||
2985 | .open = igmp_mcf_seq_open, | ||
2986 | .read = seq_read, | ||
2987 | .llseek = seq_lseek, | ||
2988 | .release = seq_release_net, | ||
2989 | }; | ||
2990 | |||
2991 | static int __net_init igmp_net_init(struct net *net) | 2965 | static int __net_init igmp_net_init(struct net *net) |
2992 | { | 2966 | { |
2993 | struct proc_dir_entry *pde; | 2967 | struct proc_dir_entry *pde; |
2994 | int err; | 2968 | int err; |
2995 | 2969 | ||
2996 | pde = proc_create("igmp", 0444, net->proc_net, &igmp_mc_seq_fops); | 2970 | pde = proc_create_net("igmp", 0444, net->proc_net, &igmp_mc_seq_ops, |
2971 | sizeof(struct igmp_mc_iter_state)); | ||
2997 | if (!pde) | 2972 | if (!pde) |
2998 | goto out_igmp; | 2973 | goto out_igmp; |
2999 | pde = proc_create("mcfilter", 0444, net->proc_net, | 2974 | pde = proc_create_net("mcfilter", 0444, net->proc_net, |
3000 | &igmp_mcf_seq_fops); | 2975 | &igmp_mcf_seq_ops, sizeof(struct igmp_mcf_iter_state)); |
3001 | if (!pde) | 2976 | if (!pde) |
3002 | goto out_mcfilter; | 2977 | goto out_mcfilter; |
3003 | err = inet_ctl_sock_create(&net->ipv4.mc_autojoin_sk, AF_INET, | 2978 | err = inet_ctl_sock_create(&net->ipv4.mc_autojoin_sk, AF_INET, |
diff --git a/net/ipv4/ipconfig.c b/net/ipv4/ipconfig.c index 43f620feb1c4..bbcbcc113d19 100644 --- a/net/ipv4/ipconfig.c +++ b/net/ipv4/ipconfig.c | |||
@@ -1282,18 +1282,6 @@ static int pnp_seq_show(struct seq_file *seq, void *v) | |||
1282 | &ic_servaddr); | 1282 | &ic_servaddr); |
1283 | return 0; | 1283 | return 0; |
1284 | } | 1284 | } |
1285 | |||
1286 | static int pnp_seq_open(struct inode *indoe, struct file *file) | ||
1287 | { | ||
1288 | return single_open(file, pnp_seq_show, NULL); | ||
1289 | } | ||
1290 | |||
1291 | static const struct file_operations pnp_seq_fops = { | ||
1292 | .open = pnp_seq_open, | ||
1293 | .read = seq_read, | ||
1294 | .llseek = seq_lseek, | ||
1295 | .release = single_release, | ||
1296 | }; | ||
1297 | #endif /* CONFIG_PROC_FS */ | 1285 | #endif /* CONFIG_PROC_FS */ |
1298 | 1286 | ||
1299 | /* | 1287 | /* |
@@ -1369,7 +1357,7 @@ static int __init ip_auto_config(void) | |||
1369 | unsigned int i; | 1357 | unsigned int i; |
1370 | 1358 | ||
1371 | #ifdef CONFIG_PROC_FS | 1359 | #ifdef CONFIG_PROC_FS |
1372 | proc_create("pnp", 0444, init_net.proc_net, &pnp_seq_fops); | 1360 | proc_create_single("pnp", 0444, init_net.proc_net, pnp_seq_show); |
1373 | #endif /* CONFIG_PROC_FS */ | 1361 | #endif /* CONFIG_PROC_FS */ |
1374 | 1362 | ||
1375 | if (!ic_enable) | 1363 | if (!ic_enable) |
diff --git a/net/ipv4/ipmr.c b/net/ipv4/ipmr.c index 2fb4de3f7f66..37c4f885ff7b 100644 --- a/net/ipv4/ipmr.c +++ b/net/ipv4/ipmr.c | |||
@@ -2828,19 +2828,6 @@ static const struct seq_operations ipmr_vif_seq_ops = { | |||
2828 | .show = ipmr_vif_seq_show, | 2828 | .show = ipmr_vif_seq_show, |
2829 | }; | 2829 | }; |
2830 | 2830 | ||
2831 | static int ipmr_vif_open(struct inode *inode, struct file *file) | ||
2832 | { | ||
2833 | return seq_open_net(inode, file, &ipmr_vif_seq_ops, | ||
2834 | sizeof(struct mr_vif_iter)); | ||
2835 | } | ||
2836 | |||
2837 | static const struct file_operations ipmr_vif_fops = { | ||
2838 | .open = ipmr_vif_open, | ||
2839 | .read = seq_read, | ||
2840 | .llseek = seq_lseek, | ||
2841 | .release = seq_release_net, | ||
2842 | }; | ||
2843 | |||
2844 | static void *ipmr_mfc_seq_start(struct seq_file *seq, loff_t *pos) | 2831 | static void *ipmr_mfc_seq_start(struct seq_file *seq, loff_t *pos) |
2845 | { | 2832 | { |
2846 | struct net *net = seq_file_net(seq); | 2833 | struct net *net = seq_file_net(seq); |
@@ -2900,19 +2887,6 @@ static const struct seq_operations ipmr_mfc_seq_ops = { | |||
2900 | .stop = mr_mfc_seq_stop, | 2887 | .stop = mr_mfc_seq_stop, |
2901 | .show = ipmr_mfc_seq_show, | 2888 | .show = ipmr_mfc_seq_show, |
2902 | }; | 2889 | }; |
2903 | |||
2904 | static int ipmr_mfc_open(struct inode *inode, struct file *file) | ||
2905 | { | ||
2906 | return seq_open_net(inode, file, &ipmr_mfc_seq_ops, | ||
2907 | sizeof(struct mr_mfc_iter)); | ||
2908 | } | ||
2909 | |||
2910 | static const struct file_operations ipmr_mfc_fops = { | ||
2911 | .open = ipmr_mfc_open, | ||
2912 | .read = seq_read, | ||
2913 | .llseek = seq_lseek, | ||
2914 | .release = seq_release_net, | ||
2915 | }; | ||
2916 | #endif | 2890 | #endif |
2917 | 2891 | ||
2918 | #ifdef CONFIG_IP_PIMSM_V2 | 2892 | #ifdef CONFIG_IP_PIMSM_V2 |
@@ -2977,9 +2951,11 @@ static int __net_init ipmr_net_init(struct net *net) | |||
2977 | 2951 | ||
2978 | #ifdef CONFIG_PROC_FS | 2952 | #ifdef CONFIG_PROC_FS |
2979 | err = -ENOMEM; | 2953 | err = -ENOMEM; |
2980 | if (!proc_create("ip_mr_vif", 0, net->proc_net, &ipmr_vif_fops)) | 2954 | if (!proc_create_net("ip_mr_vif", 0, net->proc_net, &ipmr_vif_seq_ops, |
2955 | sizeof(struct mr_vif_iter))) | ||
2981 | goto proc_vif_fail; | 2956 | goto proc_vif_fail; |
2982 | if (!proc_create("ip_mr_cache", 0, net->proc_net, &ipmr_mfc_fops)) | 2957 | if (!proc_create_net("ip_mr_cache", 0, net->proc_net, &ipmr_mfc_seq_ops, |
2958 | sizeof(struct mr_mfc_iter))) | ||
2983 | goto proc_cache_fail; | 2959 | goto proc_cache_fail; |
2984 | #endif | 2960 | #endif |
2985 | return 0; | 2961 | return 0; |
diff --git a/net/ipv4/ping.c b/net/ipv4/ping.c index 56a010622f70..2ed64bca54e3 100644 --- a/net/ipv4/ping.c +++ b/net/ipv4/ping.c | |||
@@ -1150,58 +1150,24 @@ static int ping_v4_seq_show(struct seq_file *seq, void *v) | |||
1150 | return 0; | 1150 | return 0; |
1151 | } | 1151 | } |
1152 | 1152 | ||
1153 | static int ping_seq_open(struct inode *inode, struct file *file) | 1153 | static const struct seq_operations ping_v4_seq_ops = { |
1154 | { | 1154 | .start = ping_v4_seq_start, |
1155 | struct ping_seq_afinfo *afinfo = PDE_DATA(inode); | 1155 | .show = ping_v4_seq_show, |
1156 | return seq_open_net(inode, file, &afinfo->seq_ops, | 1156 | .next = ping_seq_next, |
1157 | sizeof(struct ping_iter_state)); | 1157 | .stop = ping_seq_stop, |
1158 | } | ||
1159 | |||
1160 | const struct file_operations ping_seq_fops = { | ||
1161 | .open = ping_seq_open, | ||
1162 | .read = seq_read, | ||
1163 | .llseek = seq_lseek, | ||
1164 | .release = seq_release_net, | ||
1165 | }; | ||
1166 | EXPORT_SYMBOL_GPL(ping_seq_fops); | ||
1167 | |||
1168 | static struct ping_seq_afinfo ping_v4_seq_afinfo = { | ||
1169 | .name = "icmp", | ||
1170 | .family = AF_INET, | ||
1171 | .seq_fops = &ping_seq_fops, | ||
1172 | .seq_ops = { | ||
1173 | .start = ping_v4_seq_start, | ||
1174 | .show = ping_v4_seq_show, | ||
1175 | .next = ping_seq_next, | ||
1176 | .stop = ping_seq_stop, | ||
1177 | }, | ||
1178 | }; | 1158 | }; |
1179 | 1159 | ||
1180 | int ping_proc_register(struct net *net, struct ping_seq_afinfo *afinfo) | 1160 | static int __net_init ping_v4_proc_init_net(struct net *net) |
1181 | { | 1161 | { |
1182 | struct proc_dir_entry *p; | 1162 | if (!proc_create_net("icmp", 0444, net->proc_net, &ping_v4_seq_ops, |
1183 | p = proc_create_data(afinfo->name, 0444, net->proc_net, | 1163 | sizeof(struct ping_iter_state))) |
1184 | afinfo->seq_fops, afinfo); | ||
1185 | if (!p) | ||
1186 | return -ENOMEM; | 1164 | return -ENOMEM; |
1187 | return 0; | 1165 | return 0; |
1188 | } | 1166 | } |
1189 | EXPORT_SYMBOL_GPL(ping_proc_register); | ||
1190 | |||
1191 | void ping_proc_unregister(struct net *net, struct ping_seq_afinfo *afinfo) | ||
1192 | { | ||
1193 | remove_proc_entry(afinfo->name, net->proc_net); | ||
1194 | } | ||
1195 | EXPORT_SYMBOL_GPL(ping_proc_unregister); | ||
1196 | |||
1197 | static int __net_init ping_v4_proc_init_net(struct net *net) | ||
1198 | { | ||
1199 | return ping_proc_register(net, &ping_v4_seq_afinfo); | ||
1200 | } | ||
1201 | 1167 | ||
1202 | static void __net_exit ping_v4_proc_exit_net(struct net *net) | 1168 | static void __net_exit ping_v4_proc_exit_net(struct net *net) |
1203 | { | 1169 | { |
1204 | ping_proc_unregister(net, &ping_v4_seq_afinfo); | 1170 | remove_proc_entry("icmp", net->proc_net); |
1205 | } | 1171 | } |
1206 | 1172 | ||
1207 | static struct pernet_operations ping_v4_net_ops = { | 1173 | static struct pernet_operations ping_v4_net_ops = { |
diff --git a/net/ipv4/proc.c b/net/ipv4/proc.c index a058de677e94..573e43c8ed87 100644 --- a/net/ipv4/proc.c +++ b/net/ipv4/proc.c | |||
@@ -77,18 +77,6 @@ static int sockstat_seq_show(struct seq_file *seq, void *v) | |||
77 | return 0; | 77 | return 0; |
78 | } | 78 | } |
79 | 79 | ||
80 | static int sockstat_seq_open(struct inode *inode, struct file *file) | ||
81 | { | ||
82 | return single_open_net(inode, file, sockstat_seq_show); | ||
83 | } | ||
84 | |||
85 | static const struct file_operations sockstat_seq_fops = { | ||
86 | .open = sockstat_seq_open, | ||
87 | .read = seq_read, | ||
88 | .llseek = seq_lseek, | ||
89 | .release = single_release_net, | ||
90 | }; | ||
91 | |||
92 | /* snmp items */ | 80 | /* snmp items */ |
93 | static const struct snmp_mib snmp4_ipstats_list[] = { | 81 | static const struct snmp_mib snmp4_ipstats_list[] = { |
94 | SNMP_MIB_ITEM("InReceives", IPSTATS_MIB_INPKTS), | 82 | SNMP_MIB_ITEM("InReceives", IPSTATS_MIB_INPKTS), |
@@ -460,20 +448,6 @@ static int snmp_seq_show(struct seq_file *seq, void *v) | |||
460 | return 0; | 448 | return 0; |
461 | } | 449 | } |
462 | 450 | ||
463 | static int snmp_seq_open(struct inode *inode, struct file *file) | ||
464 | { | ||
465 | return single_open_net(inode, file, snmp_seq_show); | ||
466 | } | ||
467 | |||
468 | static const struct file_operations snmp_seq_fops = { | ||
469 | .open = snmp_seq_open, | ||
470 | .read = seq_read, | ||
471 | .llseek = seq_lseek, | ||
472 | .release = single_release_net, | ||
473 | }; | ||
474 | |||
475 | |||
476 | |||
477 | /* | 451 | /* |
478 | * Output /proc/net/netstat | 452 | * Output /proc/net/netstat |
479 | */ | 453 | */ |
@@ -507,26 +481,16 @@ static int netstat_seq_show(struct seq_file *seq, void *v) | |||
507 | return 0; | 481 | return 0; |
508 | } | 482 | } |
509 | 483 | ||
510 | static int netstat_seq_open(struct inode *inode, struct file *file) | ||
511 | { | ||
512 | return single_open_net(inode, file, netstat_seq_show); | ||
513 | } | ||
514 | |||
515 | static const struct file_operations netstat_seq_fops = { | ||
516 | .open = netstat_seq_open, | ||
517 | .read = seq_read, | ||
518 | .llseek = seq_lseek, | ||
519 | .release = single_release_net, | ||
520 | }; | ||
521 | |||
522 | static __net_init int ip_proc_init_net(struct net *net) | 484 | static __net_init int ip_proc_init_net(struct net *net) |
523 | { | 485 | { |
524 | if (!proc_create("sockstat", 0444, net->proc_net, | 486 | if (!proc_create_net_single("sockstat", 0444, net->proc_net, |
525 | &sockstat_seq_fops)) | 487 | sockstat_seq_show, NULL)) |
526 | goto out_sockstat; | 488 | goto out_sockstat; |
527 | if (!proc_create("netstat", 0444, net->proc_net, &netstat_seq_fops)) | 489 | if (!proc_create_net_single("netstat", 0444, net->proc_net, |
490 | netstat_seq_show, NULL)) | ||
528 | goto out_netstat; | 491 | goto out_netstat; |
529 | if (!proc_create("snmp", 0444, net->proc_net, &snmp_seq_fops)) | 492 | if (!proc_create_net_single("snmp", 0444, net->proc_net, snmp_seq_show, |
493 | NULL)) | ||
530 | goto out_snmp; | 494 | goto out_snmp; |
531 | 495 | ||
532 | return 0; | 496 | return 0; |
diff --git a/net/ipv4/raw.c b/net/ipv4/raw.c index 1b4d3355624a..abb3c9490c55 100644 --- a/net/ipv4/raw.c +++ b/net/ipv4/raw.c | |||
@@ -1003,11 +1003,12 @@ struct proto raw_prot = { | |||
1003 | static struct sock *raw_get_first(struct seq_file *seq) | 1003 | static struct sock *raw_get_first(struct seq_file *seq) |
1004 | { | 1004 | { |
1005 | struct sock *sk; | 1005 | struct sock *sk; |
1006 | struct raw_hashinfo *h = PDE_DATA(file_inode(seq->file)); | ||
1006 | struct raw_iter_state *state = raw_seq_private(seq); | 1007 | struct raw_iter_state *state = raw_seq_private(seq); |
1007 | 1008 | ||
1008 | for (state->bucket = 0; state->bucket < RAW_HTABLE_SIZE; | 1009 | for (state->bucket = 0; state->bucket < RAW_HTABLE_SIZE; |
1009 | ++state->bucket) { | 1010 | ++state->bucket) { |
1010 | sk_for_each(sk, &state->h->ht[state->bucket]) | 1011 | sk_for_each(sk, &h->ht[state->bucket]) |
1011 | if (sock_net(sk) == seq_file_net(seq)) | 1012 | if (sock_net(sk) == seq_file_net(seq)) |
1012 | goto found; | 1013 | goto found; |
1013 | } | 1014 | } |
@@ -1018,6 +1019,7 @@ found: | |||
1018 | 1019 | ||
1019 | static struct sock *raw_get_next(struct seq_file *seq, struct sock *sk) | 1020 | static struct sock *raw_get_next(struct seq_file *seq, struct sock *sk) |
1020 | { | 1021 | { |
1022 | struct raw_hashinfo *h = PDE_DATA(file_inode(seq->file)); | ||
1021 | struct raw_iter_state *state = raw_seq_private(seq); | 1023 | struct raw_iter_state *state = raw_seq_private(seq); |
1022 | 1024 | ||
1023 | do { | 1025 | do { |
@@ -1027,7 +1029,7 @@ try_again: | |||
1027 | } while (sk && sock_net(sk) != seq_file_net(seq)); | 1029 | } while (sk && sock_net(sk) != seq_file_net(seq)); |
1028 | 1030 | ||
1029 | if (!sk && ++state->bucket < RAW_HTABLE_SIZE) { | 1031 | if (!sk && ++state->bucket < RAW_HTABLE_SIZE) { |
1030 | sk = sk_head(&state->h->ht[state->bucket]); | 1032 | sk = sk_head(&h->ht[state->bucket]); |
1031 | goto try_again; | 1033 | goto try_again; |
1032 | } | 1034 | } |
1033 | return sk; | 1035 | return sk; |
@@ -1045,9 +1047,9 @@ static struct sock *raw_get_idx(struct seq_file *seq, loff_t pos) | |||
1045 | 1047 | ||
1046 | void *raw_seq_start(struct seq_file *seq, loff_t *pos) | 1048 | void *raw_seq_start(struct seq_file *seq, loff_t *pos) |
1047 | { | 1049 | { |
1048 | struct raw_iter_state *state = raw_seq_private(seq); | 1050 | struct raw_hashinfo *h = PDE_DATA(file_inode(seq->file)); |
1049 | 1051 | ||
1050 | read_lock(&state->h->lock); | 1052 | read_lock(&h->lock); |
1051 | return *pos ? raw_get_idx(seq, *pos - 1) : SEQ_START_TOKEN; | 1053 | return *pos ? raw_get_idx(seq, *pos - 1) : SEQ_START_TOKEN; |
1052 | } | 1054 | } |
1053 | EXPORT_SYMBOL_GPL(raw_seq_start); | 1055 | EXPORT_SYMBOL_GPL(raw_seq_start); |
@@ -1067,9 +1069,9 @@ EXPORT_SYMBOL_GPL(raw_seq_next); | |||
1067 | 1069 | ||
1068 | void raw_seq_stop(struct seq_file *seq, void *v) | 1070 | void raw_seq_stop(struct seq_file *seq, void *v) |
1069 | { | 1071 | { |
1070 | struct raw_iter_state *state = raw_seq_private(seq); | 1072 | struct raw_hashinfo *h = PDE_DATA(file_inode(seq->file)); |
1071 | 1073 | ||
1072 | read_unlock(&state->h->lock); | 1074 | read_unlock(&h->lock); |
1073 | } | 1075 | } |
1074 | EXPORT_SYMBOL_GPL(raw_seq_stop); | 1076 | EXPORT_SYMBOL_GPL(raw_seq_stop); |
1075 | 1077 | ||
@@ -1110,37 +1112,10 @@ static const struct seq_operations raw_seq_ops = { | |||
1110 | .show = raw_seq_show, | 1112 | .show = raw_seq_show, |
1111 | }; | 1113 | }; |
1112 | 1114 | ||
1113 | int raw_seq_open(struct inode *ino, struct file *file, | ||
1114 | struct raw_hashinfo *h, const struct seq_operations *ops) | ||
1115 | { | ||
1116 | int err; | ||
1117 | struct raw_iter_state *i; | ||
1118 | |||
1119 | err = seq_open_net(ino, file, ops, sizeof(struct raw_iter_state)); | ||
1120 | if (err < 0) | ||
1121 | return err; | ||
1122 | |||
1123 | i = raw_seq_private((struct seq_file *)file->private_data); | ||
1124 | i->h = h; | ||
1125 | return 0; | ||
1126 | } | ||
1127 | EXPORT_SYMBOL_GPL(raw_seq_open); | ||
1128 | |||
1129 | static int raw_v4_seq_open(struct inode *inode, struct file *file) | ||
1130 | { | ||
1131 | return raw_seq_open(inode, file, &raw_v4_hashinfo, &raw_seq_ops); | ||
1132 | } | ||
1133 | |||
1134 | static const struct file_operations raw_seq_fops = { | ||
1135 | .open = raw_v4_seq_open, | ||
1136 | .read = seq_read, | ||
1137 | .llseek = seq_lseek, | ||
1138 | .release = seq_release_net, | ||
1139 | }; | ||
1140 | |||
1141 | static __net_init int raw_init_net(struct net *net) | 1115 | static __net_init int raw_init_net(struct net *net) |
1142 | { | 1116 | { |
1143 | if (!proc_create("raw", 0444, net->proc_net, &raw_seq_fops)) | 1117 | if (!proc_create_net_data("raw", 0444, net->proc_net, &raw_seq_ops, |
1118 | sizeof(struct raw_iter_state), &raw_v4_hashinfo)) | ||
1144 | return -ENOMEM; | 1119 | return -ENOMEM; |
1145 | 1120 | ||
1146 | return 0; | 1121 | return 0; |
diff --git a/net/ipv4/route.c b/net/ipv4/route.c index 2cfa1b518f8d..75fb8864be67 100644 --- a/net/ipv4/route.c +++ b/net/ipv4/route.c | |||
@@ -360,18 +360,6 @@ static int rt_acct_proc_show(struct seq_file *m, void *v) | |||
360 | kfree(dst); | 360 | kfree(dst); |
361 | return 0; | 361 | return 0; |
362 | } | 362 | } |
363 | |||
364 | static int rt_acct_proc_open(struct inode *inode, struct file *file) | ||
365 | { | ||
366 | return single_open(file, rt_acct_proc_show, NULL); | ||
367 | } | ||
368 | |||
369 | static const struct file_operations rt_acct_proc_fops = { | ||
370 | .open = rt_acct_proc_open, | ||
371 | .read = seq_read, | ||
372 | .llseek = seq_lseek, | ||
373 | .release = single_release, | ||
374 | }; | ||
375 | #endif | 363 | #endif |
376 | 364 | ||
377 | static int __net_init ip_rt_do_proc_init(struct net *net) | 365 | static int __net_init ip_rt_do_proc_init(struct net *net) |
@@ -389,7 +377,8 @@ static int __net_init ip_rt_do_proc_init(struct net *net) | |||
389 | goto err2; | 377 | goto err2; |
390 | 378 | ||
391 | #ifdef CONFIG_IP_ROUTE_CLASSID | 379 | #ifdef CONFIG_IP_ROUTE_CLASSID |
392 | pde = proc_create("rt_acct", 0, net->proc_net, &rt_acct_proc_fops); | 380 | pde = proc_create_single("rt_acct", 0, net->proc_net, |
381 | rt_acct_proc_show); | ||
393 | if (!pde) | 382 | if (!pde) |
394 | goto err3; | 383 | goto err3; |
395 | #endif | 384 | #endif |
diff --git a/net/ipv4/tcp_ipv4.c b/net/ipv4/tcp_ipv4.c index f70586b50838..2c970626b398 100644 --- a/net/ipv4/tcp_ipv4.c +++ b/net/ipv4/tcp_ipv4.c | |||
@@ -1961,6 +1961,7 @@ EXPORT_SYMBOL(tcp_v4_destroy_sock); | |||
1961 | */ | 1961 | */ |
1962 | static void *listening_get_next(struct seq_file *seq, void *cur) | 1962 | static void *listening_get_next(struct seq_file *seq, void *cur) |
1963 | { | 1963 | { |
1964 | struct tcp_seq_afinfo *afinfo = PDE_DATA(file_inode(seq->file)); | ||
1964 | struct tcp_iter_state *st = seq->private; | 1965 | struct tcp_iter_state *st = seq->private; |
1965 | struct net *net = seq_file_net(seq); | 1966 | struct net *net = seq_file_net(seq); |
1966 | struct inet_listen_hashbucket *ilb; | 1967 | struct inet_listen_hashbucket *ilb; |
@@ -1983,7 +1984,7 @@ get_sk: | |||
1983 | sk_for_each_from(sk) { | 1984 | sk_for_each_from(sk) { |
1984 | if (!net_eq(sock_net(sk), net)) | 1985 | if (!net_eq(sock_net(sk), net)) |
1985 | continue; | 1986 | continue; |
1986 | if (sk->sk_family == st->family) | 1987 | if (sk->sk_family == afinfo->family) |
1987 | return sk; | 1988 | return sk; |
1988 | } | 1989 | } |
1989 | spin_unlock(&ilb->lock); | 1990 | spin_unlock(&ilb->lock); |
@@ -2020,6 +2021,7 @@ static inline bool empty_bucket(const struct tcp_iter_state *st) | |||
2020 | */ | 2021 | */ |
2021 | static void *established_get_first(struct seq_file *seq) | 2022 | static void *established_get_first(struct seq_file *seq) |
2022 | { | 2023 | { |
2024 | struct tcp_seq_afinfo *afinfo = PDE_DATA(file_inode(seq->file)); | ||
2023 | struct tcp_iter_state *st = seq->private; | 2025 | struct tcp_iter_state *st = seq->private; |
2024 | struct net *net = seq_file_net(seq); | 2026 | struct net *net = seq_file_net(seq); |
2025 | void *rc = NULL; | 2027 | void *rc = NULL; |
@@ -2036,7 +2038,7 @@ static void *established_get_first(struct seq_file *seq) | |||
2036 | 2038 | ||
2037 | spin_lock_bh(lock); | 2039 | spin_lock_bh(lock); |
2038 | sk_nulls_for_each(sk, node, &tcp_hashinfo.ehash[st->bucket].chain) { | 2040 | sk_nulls_for_each(sk, node, &tcp_hashinfo.ehash[st->bucket].chain) { |
2039 | if (sk->sk_family != st->family || | 2041 | if (sk->sk_family != afinfo->family || |
2040 | !net_eq(sock_net(sk), net)) { | 2042 | !net_eq(sock_net(sk), net)) { |
2041 | continue; | 2043 | continue; |
2042 | } | 2044 | } |
@@ -2051,6 +2053,7 @@ out: | |||
2051 | 2053 | ||
2052 | static void *established_get_next(struct seq_file *seq, void *cur) | 2054 | static void *established_get_next(struct seq_file *seq, void *cur) |
2053 | { | 2055 | { |
2056 | struct tcp_seq_afinfo *afinfo = PDE_DATA(file_inode(seq->file)); | ||
2054 | struct sock *sk = cur; | 2057 | struct sock *sk = cur; |
2055 | struct hlist_nulls_node *node; | 2058 | struct hlist_nulls_node *node; |
2056 | struct tcp_iter_state *st = seq->private; | 2059 | struct tcp_iter_state *st = seq->private; |
@@ -2062,7 +2065,8 @@ static void *established_get_next(struct seq_file *seq, void *cur) | |||
2062 | sk = sk_nulls_next(sk); | 2065 | sk = sk_nulls_next(sk); |
2063 | 2066 | ||
2064 | sk_nulls_for_each_from(sk, node) { | 2067 | sk_nulls_for_each_from(sk, node) { |
2065 | if (sk->sk_family == st->family && net_eq(sock_net(sk), net)) | 2068 | if (sk->sk_family == afinfo->family && |
2069 | net_eq(sock_net(sk), net)) | ||
2066 | return sk; | 2070 | return sk; |
2067 | } | 2071 | } |
2068 | 2072 | ||
@@ -2135,7 +2139,7 @@ static void *tcp_seek_last_pos(struct seq_file *seq) | |||
2135 | return rc; | 2139 | return rc; |
2136 | } | 2140 | } |
2137 | 2141 | ||
2138 | static void *tcp_seq_start(struct seq_file *seq, loff_t *pos) | 2142 | void *tcp_seq_start(struct seq_file *seq, loff_t *pos) |
2139 | { | 2143 | { |
2140 | struct tcp_iter_state *st = seq->private; | 2144 | struct tcp_iter_state *st = seq->private; |
2141 | void *rc; | 2145 | void *rc; |
@@ -2156,8 +2160,9 @@ out: | |||
2156 | st->last_pos = *pos; | 2160 | st->last_pos = *pos; |
2157 | return rc; | 2161 | return rc; |
2158 | } | 2162 | } |
2163 | EXPORT_SYMBOL(tcp_seq_start); | ||
2159 | 2164 | ||
2160 | static void *tcp_seq_next(struct seq_file *seq, void *v, loff_t *pos) | 2165 | void *tcp_seq_next(struct seq_file *seq, void *v, loff_t *pos) |
2161 | { | 2166 | { |
2162 | struct tcp_iter_state *st = seq->private; | 2167 | struct tcp_iter_state *st = seq->private; |
2163 | void *rc = NULL; | 2168 | void *rc = NULL; |
@@ -2186,8 +2191,9 @@ out: | |||
2186 | st->last_pos = *pos; | 2191 | st->last_pos = *pos; |
2187 | return rc; | 2192 | return rc; |
2188 | } | 2193 | } |
2194 | EXPORT_SYMBOL(tcp_seq_next); | ||
2189 | 2195 | ||
2190 | static void tcp_seq_stop(struct seq_file *seq, void *v) | 2196 | void tcp_seq_stop(struct seq_file *seq, void *v) |
2191 | { | 2197 | { |
2192 | struct tcp_iter_state *st = seq->private; | 2198 | struct tcp_iter_state *st = seq->private; |
2193 | 2199 | ||
@@ -2202,47 +2208,7 @@ static void tcp_seq_stop(struct seq_file *seq, void *v) | |||
2202 | break; | 2208 | break; |
2203 | } | 2209 | } |
2204 | } | 2210 | } |
2205 | 2211 | EXPORT_SYMBOL(tcp_seq_stop); | |
2206 | int tcp_seq_open(struct inode *inode, struct file *file) | ||
2207 | { | ||
2208 | struct tcp_seq_afinfo *afinfo = PDE_DATA(inode); | ||
2209 | struct tcp_iter_state *s; | ||
2210 | int err; | ||
2211 | |||
2212 | err = seq_open_net(inode, file, &afinfo->seq_ops, | ||
2213 | sizeof(struct tcp_iter_state)); | ||
2214 | if (err < 0) | ||
2215 | return err; | ||
2216 | |||
2217 | s = ((struct seq_file *)file->private_data)->private; | ||
2218 | s->family = afinfo->family; | ||
2219 | s->last_pos = 0; | ||
2220 | return 0; | ||
2221 | } | ||
2222 | EXPORT_SYMBOL(tcp_seq_open); | ||
2223 | |||
2224 | int tcp_proc_register(struct net *net, struct tcp_seq_afinfo *afinfo) | ||
2225 | { | ||
2226 | int rc = 0; | ||
2227 | struct proc_dir_entry *p; | ||
2228 | |||
2229 | afinfo->seq_ops.start = tcp_seq_start; | ||
2230 | afinfo->seq_ops.next = tcp_seq_next; | ||
2231 | afinfo->seq_ops.stop = tcp_seq_stop; | ||
2232 | |||
2233 | p = proc_create_data(afinfo->name, 0444, net->proc_net, | ||
2234 | afinfo->seq_fops, afinfo); | ||
2235 | if (!p) | ||
2236 | rc = -ENOMEM; | ||
2237 | return rc; | ||
2238 | } | ||
2239 | EXPORT_SYMBOL(tcp_proc_register); | ||
2240 | |||
2241 | void tcp_proc_unregister(struct net *net, struct tcp_seq_afinfo *afinfo) | ||
2242 | { | ||
2243 | remove_proc_entry(afinfo->name, net->proc_net); | ||
2244 | } | ||
2245 | EXPORT_SYMBOL(tcp_proc_unregister); | ||
2246 | 2212 | ||
2247 | static void get_openreq4(const struct request_sock *req, | 2213 | static void get_openreq4(const struct request_sock *req, |
2248 | struct seq_file *f, int i) | 2214 | struct seq_file *f, int i) |
@@ -2377,30 +2343,28 @@ out: | |||
2377 | return 0; | 2343 | return 0; |
2378 | } | 2344 | } |
2379 | 2345 | ||
2380 | static const struct file_operations tcp_afinfo_seq_fops = { | 2346 | static const struct seq_operations tcp4_seq_ops = { |
2381 | .open = tcp_seq_open, | 2347 | .show = tcp4_seq_show, |
2382 | .read = seq_read, | 2348 | .start = tcp_seq_start, |
2383 | .llseek = seq_lseek, | 2349 | .next = tcp_seq_next, |
2384 | .release = seq_release_net | 2350 | .stop = tcp_seq_stop, |
2385 | }; | 2351 | }; |
2386 | 2352 | ||
2387 | static struct tcp_seq_afinfo tcp4_seq_afinfo = { | 2353 | static struct tcp_seq_afinfo tcp4_seq_afinfo = { |
2388 | .name = "tcp", | ||
2389 | .family = AF_INET, | 2354 | .family = AF_INET, |
2390 | .seq_fops = &tcp_afinfo_seq_fops, | ||
2391 | .seq_ops = { | ||
2392 | .show = tcp4_seq_show, | ||
2393 | }, | ||
2394 | }; | 2355 | }; |
2395 | 2356 | ||
2396 | static int __net_init tcp4_proc_init_net(struct net *net) | 2357 | static int __net_init tcp4_proc_init_net(struct net *net) |
2397 | { | 2358 | { |
2398 | return tcp_proc_register(net, &tcp4_seq_afinfo); | 2359 | if (!proc_create_net_data("tcp", 0444, net->proc_net, &tcp4_seq_ops, |
2360 | sizeof(struct tcp_iter_state), &tcp4_seq_afinfo)) | ||
2361 | return -ENOMEM; | ||
2362 | return 0; | ||
2399 | } | 2363 | } |
2400 | 2364 | ||
2401 | static void __net_exit tcp4_proc_exit_net(struct net *net) | 2365 | static void __net_exit tcp4_proc_exit_net(struct net *net) |
2402 | { | 2366 | { |
2403 | tcp_proc_unregister(net, &tcp4_seq_afinfo); | 2367 | remove_proc_entry("tcp", net->proc_net); |
2404 | } | 2368 | } |
2405 | 2369 | ||
2406 | static struct pernet_operations tcp4_net_ops = { | 2370 | static struct pernet_operations tcp4_net_ops = { |
diff --git a/net/ipv4/udp.c b/net/ipv4/udp.c index b61a770884fa..051a43ff3fb8 100644 --- a/net/ipv4/udp.c +++ b/net/ipv4/udp.c | |||
@@ -2582,12 +2582,13 @@ EXPORT_SYMBOL(udp_prot); | |||
2582 | static struct sock *udp_get_first(struct seq_file *seq, int start) | 2582 | static struct sock *udp_get_first(struct seq_file *seq, int start) |
2583 | { | 2583 | { |
2584 | struct sock *sk; | 2584 | struct sock *sk; |
2585 | struct udp_seq_afinfo *afinfo = PDE_DATA(file_inode(seq->file)); | ||
2585 | struct udp_iter_state *state = seq->private; | 2586 | struct udp_iter_state *state = seq->private; |
2586 | struct net *net = seq_file_net(seq); | 2587 | struct net *net = seq_file_net(seq); |
2587 | 2588 | ||
2588 | for (state->bucket = start; state->bucket <= state->udp_table->mask; | 2589 | for (state->bucket = start; state->bucket <= afinfo->udp_table->mask; |
2589 | ++state->bucket) { | 2590 | ++state->bucket) { |
2590 | struct udp_hslot *hslot = &state->udp_table->hash[state->bucket]; | 2591 | struct udp_hslot *hslot = &afinfo->udp_table->hash[state->bucket]; |
2591 | 2592 | ||
2592 | if (hlist_empty(&hslot->head)) | 2593 | if (hlist_empty(&hslot->head)) |
2593 | continue; | 2594 | continue; |
@@ -2596,7 +2597,7 @@ static struct sock *udp_get_first(struct seq_file *seq, int start) | |||
2596 | sk_for_each(sk, &hslot->head) { | 2597 | sk_for_each(sk, &hslot->head) { |
2597 | if (!net_eq(sock_net(sk), net)) | 2598 | if (!net_eq(sock_net(sk), net)) |
2598 | continue; | 2599 | continue; |
2599 | if (sk->sk_family == state->family) | 2600 | if (sk->sk_family == afinfo->family) |
2600 | goto found; | 2601 | goto found; |
2601 | } | 2602 | } |
2602 | spin_unlock_bh(&hslot->lock); | 2603 | spin_unlock_bh(&hslot->lock); |
@@ -2608,16 +2609,17 @@ found: | |||
2608 | 2609 | ||
2609 | static struct sock *udp_get_next(struct seq_file *seq, struct sock *sk) | 2610 | static struct sock *udp_get_next(struct seq_file *seq, struct sock *sk) |
2610 | { | 2611 | { |
2612 | struct udp_seq_afinfo *afinfo = PDE_DATA(file_inode(seq->file)); | ||
2611 | struct udp_iter_state *state = seq->private; | 2613 | struct udp_iter_state *state = seq->private; |
2612 | struct net *net = seq_file_net(seq); | 2614 | struct net *net = seq_file_net(seq); |
2613 | 2615 | ||
2614 | do { | 2616 | do { |
2615 | sk = sk_next(sk); | 2617 | sk = sk_next(sk); |
2616 | } while (sk && (!net_eq(sock_net(sk), net) || sk->sk_family != state->family)); | 2618 | } while (sk && (!net_eq(sock_net(sk), net) || sk->sk_family != afinfo->family)); |
2617 | 2619 | ||
2618 | if (!sk) { | 2620 | if (!sk) { |
2619 | if (state->bucket <= state->udp_table->mask) | 2621 | if (state->bucket <= afinfo->udp_table->mask) |
2620 | spin_unlock_bh(&state->udp_table->hash[state->bucket].lock); | 2622 | spin_unlock_bh(&afinfo->udp_table->hash[state->bucket].lock); |
2621 | return udp_get_first(seq, state->bucket + 1); | 2623 | return udp_get_first(seq, state->bucket + 1); |
2622 | } | 2624 | } |
2623 | return sk; | 2625 | return sk; |
@@ -2633,15 +2635,16 @@ static struct sock *udp_get_idx(struct seq_file *seq, loff_t pos) | |||
2633 | return pos ? NULL : sk; | 2635 | return pos ? NULL : sk; |
2634 | } | 2636 | } |
2635 | 2637 | ||
2636 | static void *udp_seq_start(struct seq_file *seq, loff_t *pos) | 2638 | void *udp_seq_start(struct seq_file *seq, loff_t *pos) |
2637 | { | 2639 | { |
2638 | struct udp_iter_state *state = seq->private; | 2640 | struct udp_iter_state *state = seq->private; |
2639 | state->bucket = MAX_UDP_PORTS; | 2641 | state->bucket = MAX_UDP_PORTS; |
2640 | 2642 | ||
2641 | return *pos ? udp_get_idx(seq, *pos-1) : SEQ_START_TOKEN; | 2643 | return *pos ? udp_get_idx(seq, *pos-1) : SEQ_START_TOKEN; |
2642 | } | 2644 | } |
2645 | EXPORT_SYMBOL(udp_seq_start); | ||
2643 | 2646 | ||
2644 | static void *udp_seq_next(struct seq_file *seq, void *v, loff_t *pos) | 2647 | void *udp_seq_next(struct seq_file *seq, void *v, loff_t *pos) |
2645 | { | 2648 | { |
2646 | struct sock *sk; | 2649 | struct sock *sk; |
2647 | 2650 | ||
@@ -2653,56 +2656,17 @@ static void *udp_seq_next(struct seq_file *seq, void *v, loff_t *pos) | |||
2653 | ++*pos; | 2656 | ++*pos; |
2654 | return sk; | 2657 | return sk; |
2655 | } | 2658 | } |
2659 | EXPORT_SYMBOL(udp_seq_next); | ||
2656 | 2660 | ||
2657 | static void udp_seq_stop(struct seq_file *seq, void *v) | 2661 | void udp_seq_stop(struct seq_file *seq, void *v) |
2658 | { | 2662 | { |
2663 | struct udp_seq_afinfo *afinfo = PDE_DATA(file_inode(seq->file)); | ||
2659 | struct udp_iter_state *state = seq->private; | 2664 | struct udp_iter_state *state = seq->private; |
2660 | 2665 | ||
2661 | if (state->bucket <= state->udp_table->mask) | 2666 | if (state->bucket <= afinfo->udp_table->mask) |
2662 | spin_unlock_bh(&state->udp_table->hash[state->bucket].lock); | 2667 | spin_unlock_bh(&afinfo->udp_table->hash[state->bucket].lock); |
2663 | } | 2668 | } |
2664 | 2669 | EXPORT_SYMBOL(udp_seq_stop); | |
2665 | int udp_seq_open(struct inode *inode, struct file *file) | ||
2666 | { | ||
2667 | struct udp_seq_afinfo *afinfo = PDE_DATA(inode); | ||
2668 | struct udp_iter_state *s; | ||
2669 | int err; | ||
2670 | |||
2671 | err = seq_open_net(inode, file, &afinfo->seq_ops, | ||
2672 | sizeof(struct udp_iter_state)); | ||
2673 | if (err < 0) | ||
2674 | return err; | ||
2675 | |||
2676 | s = ((struct seq_file *)file->private_data)->private; | ||
2677 | s->family = afinfo->family; | ||
2678 | s->udp_table = afinfo->udp_table; | ||
2679 | return err; | ||
2680 | } | ||
2681 | EXPORT_SYMBOL(udp_seq_open); | ||
2682 | |||
2683 | /* ------------------------------------------------------------------------ */ | ||
2684 | int udp_proc_register(struct net *net, struct udp_seq_afinfo *afinfo) | ||
2685 | { | ||
2686 | struct proc_dir_entry *p; | ||
2687 | int rc = 0; | ||
2688 | |||
2689 | afinfo->seq_ops.start = udp_seq_start; | ||
2690 | afinfo->seq_ops.next = udp_seq_next; | ||
2691 | afinfo->seq_ops.stop = udp_seq_stop; | ||
2692 | |||
2693 | p = proc_create_data(afinfo->name, 0444, net->proc_net, | ||
2694 | afinfo->seq_fops, afinfo); | ||
2695 | if (!p) | ||
2696 | rc = -ENOMEM; | ||
2697 | return rc; | ||
2698 | } | ||
2699 | EXPORT_SYMBOL(udp_proc_register); | ||
2700 | |||
2701 | void udp_proc_unregister(struct net *net, struct udp_seq_afinfo *afinfo) | ||
2702 | { | ||
2703 | remove_proc_entry(afinfo->name, net->proc_net); | ||
2704 | } | ||
2705 | EXPORT_SYMBOL(udp_proc_unregister); | ||
2706 | 2670 | ||
2707 | /* ------------------------------------------------------------------------ */ | 2671 | /* ------------------------------------------------------------------------ */ |
2708 | static void udp4_format_sock(struct sock *sp, struct seq_file *f, | 2672 | static void udp4_format_sock(struct sock *sp, struct seq_file *f, |
@@ -2742,32 +2706,30 @@ int udp4_seq_show(struct seq_file *seq, void *v) | |||
2742 | return 0; | 2706 | return 0; |
2743 | } | 2707 | } |
2744 | 2708 | ||
2745 | static const struct file_operations udp_afinfo_seq_fops = { | 2709 | const struct seq_operations udp_seq_ops = { |
2746 | .open = udp_seq_open, | 2710 | .start = udp_seq_start, |
2747 | .read = seq_read, | 2711 | .next = udp_seq_next, |
2748 | .llseek = seq_lseek, | 2712 | .stop = udp_seq_stop, |
2749 | .release = seq_release_net | 2713 | .show = udp4_seq_show, |
2750 | }; | 2714 | }; |
2715 | EXPORT_SYMBOL(udp_seq_ops); | ||
2751 | 2716 | ||
2752 | /* ------------------------------------------------------------------------ */ | ||
2753 | static struct udp_seq_afinfo udp4_seq_afinfo = { | 2717 | static struct udp_seq_afinfo udp4_seq_afinfo = { |
2754 | .name = "udp", | ||
2755 | .family = AF_INET, | 2718 | .family = AF_INET, |
2756 | .udp_table = &udp_table, | 2719 | .udp_table = &udp_table, |
2757 | .seq_fops = &udp_afinfo_seq_fops, | ||
2758 | .seq_ops = { | ||
2759 | .show = udp4_seq_show, | ||
2760 | }, | ||
2761 | }; | 2720 | }; |
2762 | 2721 | ||
2763 | static int __net_init udp4_proc_init_net(struct net *net) | 2722 | static int __net_init udp4_proc_init_net(struct net *net) |
2764 | { | 2723 | { |
2765 | return udp_proc_register(net, &udp4_seq_afinfo); | 2724 | if (!proc_create_net_data("udp", 0444, net->proc_net, &udp_seq_ops, |
2725 | sizeof(struct udp_iter_state), &udp4_seq_afinfo)) | ||
2726 | return -ENOMEM; | ||
2727 | return 0; | ||
2766 | } | 2728 | } |
2767 | 2729 | ||
2768 | static void __net_exit udp4_proc_exit_net(struct net *net) | 2730 | static void __net_exit udp4_proc_exit_net(struct net *net) |
2769 | { | 2731 | { |
2770 | udp_proc_unregister(net, &udp4_seq_afinfo); | 2732 | remove_proc_entry("udp", net->proc_net); |
2771 | } | 2733 | } |
2772 | 2734 | ||
2773 | static struct pernet_operations udp4_net_ops = { | 2735 | static struct pernet_operations udp4_net_ops = { |
diff --git a/net/ipv4/udplite.c b/net/ipv4/udplite.c index f96614e9b9a5..8545457752fb 100644 --- a/net/ipv4/udplite.c +++ b/net/ipv4/udplite.c | |||
@@ -14,6 +14,7 @@ | |||
14 | #define pr_fmt(fmt) "UDPLite: " fmt | 14 | #define pr_fmt(fmt) "UDPLite: " fmt |
15 | 15 | ||
16 | #include <linux/export.h> | 16 | #include <linux/export.h> |
17 | #include <linux/proc_fs.h> | ||
17 | #include "udp_impl.h" | 18 | #include "udp_impl.h" |
18 | 19 | ||
19 | struct udp_table udplite_table __read_mostly; | 20 | struct udp_table udplite_table __read_mostly; |
@@ -73,32 +74,22 @@ static struct inet_protosw udplite4_protosw = { | |||
73 | }; | 74 | }; |
74 | 75 | ||
75 | #ifdef CONFIG_PROC_FS | 76 | #ifdef CONFIG_PROC_FS |
76 | |||
77 | static const struct file_operations udplite_afinfo_seq_fops = { | ||
78 | .open = udp_seq_open, | ||
79 | .read = seq_read, | ||
80 | .llseek = seq_lseek, | ||
81 | .release = seq_release_net | ||
82 | }; | ||
83 | |||
84 | static struct udp_seq_afinfo udplite4_seq_afinfo = { | 77 | static struct udp_seq_afinfo udplite4_seq_afinfo = { |
85 | .name = "udplite", | ||
86 | .family = AF_INET, | 78 | .family = AF_INET, |
87 | .udp_table = &udplite_table, | 79 | .udp_table = &udplite_table, |
88 | .seq_fops = &udplite_afinfo_seq_fops, | ||
89 | .seq_ops = { | ||
90 | .show = udp4_seq_show, | ||
91 | }, | ||
92 | }; | 80 | }; |
93 | 81 | ||
94 | static int __net_init udplite4_proc_init_net(struct net *net) | 82 | static int __net_init udplite4_proc_init_net(struct net *net) |
95 | { | 83 | { |
96 | return udp_proc_register(net, &udplite4_seq_afinfo); | 84 | if (!proc_create_net_data("udplite", 0444, net->proc_net, &udp_seq_ops, |
85 | sizeof(struct udp_iter_state), &udplite4_seq_afinfo)) | ||
86 | return -ENOMEM; | ||
87 | return 0; | ||
97 | } | 88 | } |
98 | 89 | ||
99 | static void __net_exit udplite4_proc_exit_net(struct net *net) | 90 | static void __net_exit udplite4_proc_exit_net(struct net *net) |
100 | { | 91 | { |
101 | udp_proc_unregister(net, &udplite4_seq_afinfo); | 92 | remove_proc_entry("udplite", net->proc_net); |
102 | } | 93 | } |
103 | 94 | ||
104 | static struct pernet_operations udplite4_net_ops = { | 95 | static struct pernet_operations udplite4_net_ops = { |
diff --git a/net/ipv6/addrconf.c b/net/ipv6/addrconf.c index 78cef00c9596..1b5ea3379d9b 100644 --- a/net/ipv6/addrconf.c +++ b/net/ipv6/addrconf.c | |||
@@ -4254,22 +4254,10 @@ static const struct seq_operations if6_seq_ops = { | |||
4254 | .stop = if6_seq_stop, | 4254 | .stop = if6_seq_stop, |
4255 | }; | 4255 | }; |
4256 | 4256 | ||
4257 | static int if6_seq_open(struct inode *inode, struct file *file) | ||
4258 | { | ||
4259 | return seq_open_net(inode, file, &if6_seq_ops, | ||
4260 | sizeof(struct if6_iter_state)); | ||
4261 | } | ||
4262 | |||
4263 | static const struct file_operations if6_fops = { | ||
4264 | .open = if6_seq_open, | ||
4265 | .read = seq_read, | ||
4266 | .llseek = seq_lseek, | ||
4267 | .release = seq_release_net, | ||
4268 | }; | ||
4269 | |||
4270 | static int __net_init if6_proc_net_init(struct net *net) | 4257 | static int __net_init if6_proc_net_init(struct net *net) |
4271 | { | 4258 | { |
4272 | if (!proc_create("if_inet6", 0444, net->proc_net, &if6_fops)) | 4259 | if (!proc_create_net("if_inet6", 0444, net->proc_net, &if6_seq_ops, |
4260 | sizeof(struct if6_iter_state))) | ||
4273 | return -ENOMEM; | 4261 | return -ENOMEM; |
4274 | return 0; | 4262 | return 0; |
4275 | } | 4263 | } |
diff --git a/net/ipv6/anycast.c b/net/ipv6/anycast.c index bbcabbba9bd8..ebeaf47d5c8d 100644 --- a/net/ipv6/anycast.c +++ b/net/ipv6/anycast.c | |||
@@ -529,22 +529,10 @@ static const struct seq_operations ac6_seq_ops = { | |||
529 | .show = ac6_seq_show, | 529 | .show = ac6_seq_show, |
530 | }; | 530 | }; |
531 | 531 | ||
532 | static int ac6_seq_open(struct inode *inode, struct file *file) | ||
533 | { | ||
534 | return seq_open_net(inode, file, &ac6_seq_ops, | ||
535 | sizeof(struct ac6_iter_state)); | ||
536 | } | ||
537 | |||
538 | static const struct file_operations ac6_seq_fops = { | ||
539 | .open = ac6_seq_open, | ||
540 | .read = seq_read, | ||
541 | .llseek = seq_lseek, | ||
542 | .release = seq_release_net, | ||
543 | }; | ||
544 | |||
545 | int __net_init ac6_proc_init(struct net *net) | 532 | int __net_init ac6_proc_init(struct net *net) |
546 | { | 533 | { |
547 | if (!proc_create("anycast6", 0444, net->proc_net, &ac6_seq_fops)) | 534 | if (!proc_create_net("anycast6", 0444, net->proc_net, &ac6_seq_ops, |
535 | sizeof(struct ac6_iter_state))) | ||
548 | return -ENOMEM; | 536 | return -ENOMEM; |
549 | 537 | ||
550 | return 0; | 538 | return 0; |
diff --git a/net/ipv6/ip6_fib.c b/net/ipv6/ip6_fib.c index deab2db6692e..01372dd74e38 100644 --- a/net/ipv6/ip6_fib.c +++ b/net/ipv6/ip6_fib.c | |||
@@ -2209,15 +2209,6 @@ void fib6_gc_cleanup(void) | |||
2209 | } | 2209 | } |
2210 | 2210 | ||
2211 | #ifdef CONFIG_PROC_FS | 2211 | #ifdef CONFIG_PROC_FS |
2212 | |||
2213 | struct ipv6_route_iter { | ||
2214 | struct seq_net_private p; | ||
2215 | struct fib6_walker w; | ||
2216 | loff_t skip; | ||
2217 | struct fib6_table *tbl; | ||
2218 | int sernum; | ||
2219 | }; | ||
2220 | |||
2221 | static int ipv6_route_seq_show(struct seq_file *seq, void *v) | 2212 | static int ipv6_route_seq_show(struct seq_file *seq, void *v) |
2222 | { | 2213 | { |
2223 | struct rt6_info *rt = v; | 2214 | struct rt6_info *rt = v; |
@@ -2383,17 +2374,10 @@ static void ipv6_route_seq_stop(struct seq_file *seq, void *v) | |||
2383 | rcu_read_unlock_bh(); | 2374 | rcu_read_unlock_bh(); |
2384 | } | 2375 | } |
2385 | 2376 | ||
2386 | static const struct seq_operations ipv6_route_seq_ops = { | 2377 | const struct seq_operations ipv6_route_seq_ops = { |
2387 | .start = ipv6_route_seq_start, | 2378 | .start = ipv6_route_seq_start, |
2388 | .next = ipv6_route_seq_next, | 2379 | .next = ipv6_route_seq_next, |
2389 | .stop = ipv6_route_seq_stop, | 2380 | .stop = ipv6_route_seq_stop, |
2390 | .show = ipv6_route_seq_show | 2381 | .show = ipv6_route_seq_show |
2391 | }; | 2382 | }; |
2392 | |||
2393 | int ipv6_route_open(struct inode *inode, struct file *file) | ||
2394 | { | ||
2395 | return seq_open_net(inode, file, &ipv6_route_seq_ops, | ||
2396 | sizeof(struct ipv6_route_iter)); | ||
2397 | } | ||
2398 | |||
2399 | #endif /* CONFIG_PROC_FS */ | 2383 | #endif /* CONFIG_PROC_FS */ |
diff --git a/net/ipv6/ip6_flowlabel.c b/net/ipv6/ip6_flowlabel.c index c05c4e82a7ca..3eee7637bdfe 100644 --- a/net/ipv6/ip6_flowlabel.c +++ b/net/ipv6/ip6_flowlabel.c | |||
@@ -754,6 +754,10 @@ static struct ip6_flowlabel *ip6fl_get_idx(struct seq_file *seq, loff_t pos) | |||
754 | static void *ip6fl_seq_start(struct seq_file *seq, loff_t *pos) | 754 | static void *ip6fl_seq_start(struct seq_file *seq, loff_t *pos) |
755 | __acquires(RCU) | 755 | __acquires(RCU) |
756 | { | 756 | { |
757 | struct ip6fl_iter_state *state = ip6fl_seq_private(seq); | ||
758 | |||
759 | state->pid_ns = proc_pid_ns(file_inode(seq->file)); | ||
760 | |||
757 | rcu_read_lock_bh(); | 761 | rcu_read_lock_bh(); |
758 | return *pos ? ip6fl_get_idx(seq, *pos - 1) : SEQ_START_TOKEN; | 762 | return *pos ? ip6fl_get_idx(seq, *pos - 1) : SEQ_START_TOKEN; |
759 | } | 763 | } |
@@ -808,44 +812,10 @@ static const struct seq_operations ip6fl_seq_ops = { | |||
808 | .show = ip6fl_seq_show, | 812 | .show = ip6fl_seq_show, |
809 | }; | 813 | }; |
810 | 814 | ||
811 | static int ip6fl_seq_open(struct inode *inode, struct file *file) | ||
812 | { | ||
813 | struct seq_file *seq; | ||
814 | struct ip6fl_iter_state *state; | ||
815 | int err; | ||
816 | |||
817 | err = seq_open_net(inode, file, &ip6fl_seq_ops, | ||
818 | sizeof(struct ip6fl_iter_state)); | ||
819 | |||
820 | if (!err) { | ||
821 | seq = file->private_data; | ||
822 | state = ip6fl_seq_private(seq); | ||
823 | rcu_read_lock(); | ||
824 | state->pid_ns = get_pid_ns(task_active_pid_ns(current)); | ||
825 | rcu_read_unlock(); | ||
826 | } | ||
827 | return err; | ||
828 | } | ||
829 | |||
830 | static int ip6fl_seq_release(struct inode *inode, struct file *file) | ||
831 | { | ||
832 | struct seq_file *seq = file->private_data; | ||
833 | struct ip6fl_iter_state *state = ip6fl_seq_private(seq); | ||
834 | put_pid_ns(state->pid_ns); | ||
835 | return seq_release_net(inode, file); | ||
836 | } | ||
837 | |||
838 | static const struct file_operations ip6fl_seq_fops = { | ||
839 | .open = ip6fl_seq_open, | ||
840 | .read = seq_read, | ||
841 | .llseek = seq_lseek, | ||
842 | .release = ip6fl_seq_release, | ||
843 | }; | ||
844 | |||
845 | static int __net_init ip6_flowlabel_proc_init(struct net *net) | 815 | static int __net_init ip6_flowlabel_proc_init(struct net *net) |
846 | { | 816 | { |
847 | if (!proc_create("ip6_flowlabel", 0444, net->proc_net, | 817 | if (!proc_create_net("ip6_flowlabel", 0444, net->proc_net, |
848 | &ip6fl_seq_fops)) | 818 | &ip6fl_seq_ops, sizeof(struct ip6fl_iter_state))) |
849 | return -ENOMEM; | 819 | return -ENOMEM; |
850 | return 0; | 820 | return 0; |
851 | } | 821 | } |
diff --git a/net/ipv6/ip6mr.c b/net/ipv6/ip6mr.c index 298fd8b6ed17..4a15529d33eb 100644 --- a/net/ipv6/ip6mr.c +++ b/net/ipv6/ip6mr.c | |||
@@ -439,19 +439,6 @@ static const struct seq_operations ip6mr_vif_seq_ops = { | |||
439 | .show = ip6mr_vif_seq_show, | 439 | .show = ip6mr_vif_seq_show, |
440 | }; | 440 | }; |
441 | 441 | ||
442 | static int ip6mr_vif_open(struct inode *inode, struct file *file) | ||
443 | { | ||
444 | return seq_open_net(inode, file, &ip6mr_vif_seq_ops, | ||
445 | sizeof(struct mr_vif_iter)); | ||
446 | } | ||
447 | |||
448 | static const struct file_operations ip6mr_vif_fops = { | ||
449 | .open = ip6mr_vif_open, | ||
450 | .read = seq_read, | ||
451 | .llseek = seq_lseek, | ||
452 | .release = seq_release_net, | ||
453 | }; | ||
454 | |||
455 | static void *ipmr_mfc_seq_start(struct seq_file *seq, loff_t *pos) | 442 | static void *ipmr_mfc_seq_start(struct seq_file *seq, loff_t *pos) |
456 | { | 443 | { |
457 | struct net *net = seq_file_net(seq); | 444 | struct net *net = seq_file_net(seq); |
@@ -512,19 +499,6 @@ static const struct seq_operations ipmr_mfc_seq_ops = { | |||
512 | .stop = mr_mfc_seq_stop, | 499 | .stop = mr_mfc_seq_stop, |
513 | .show = ipmr_mfc_seq_show, | 500 | .show = ipmr_mfc_seq_show, |
514 | }; | 501 | }; |
515 | |||
516 | static int ipmr_mfc_open(struct inode *inode, struct file *file) | ||
517 | { | ||
518 | return seq_open_net(inode, file, &ipmr_mfc_seq_ops, | ||
519 | sizeof(struct mr_mfc_iter)); | ||
520 | } | ||
521 | |||
522 | static const struct file_operations ip6mr_mfc_fops = { | ||
523 | .open = ipmr_mfc_open, | ||
524 | .read = seq_read, | ||
525 | .llseek = seq_lseek, | ||
526 | .release = seq_release_net, | ||
527 | }; | ||
528 | #endif | 502 | #endif |
529 | 503 | ||
530 | #ifdef CONFIG_IPV6_PIMSM_V2 | 504 | #ifdef CONFIG_IPV6_PIMSM_V2 |
@@ -1316,9 +1290,11 @@ static int __net_init ip6mr_net_init(struct net *net) | |||
1316 | 1290 | ||
1317 | #ifdef CONFIG_PROC_FS | 1291 | #ifdef CONFIG_PROC_FS |
1318 | err = -ENOMEM; | 1292 | err = -ENOMEM; |
1319 | if (!proc_create("ip6_mr_vif", 0, net->proc_net, &ip6mr_vif_fops)) | 1293 | if (!proc_create_net("ip6_mr_vif", 0, net->proc_net, &ip6mr_vif_seq_ops, |
1294 | sizeof(struct mr_vif_iter))) | ||
1320 | goto proc_vif_fail; | 1295 | goto proc_vif_fail; |
1321 | if (!proc_create("ip6_mr_cache", 0, net->proc_net, &ip6mr_mfc_fops)) | 1296 | if (!proc_create_net("ip6_mr_cache", 0, net->proc_net, &ipmr_mfc_seq_ops, |
1297 | sizeof(struct mr_mfc_iter))) | ||
1322 | goto proc_cache_fail; | 1298 | goto proc_cache_fail; |
1323 | #endif | 1299 | #endif |
1324 | 1300 | ||
diff --git a/net/ipv6/mcast.c b/net/ipv6/mcast.c index 793159d77d8a..975021df7c1c 100644 --- a/net/ipv6/mcast.c +++ b/net/ipv6/mcast.c | |||
@@ -2749,19 +2749,6 @@ static const struct seq_operations igmp6_mc_seq_ops = { | |||
2749 | .show = igmp6_mc_seq_show, | 2749 | .show = igmp6_mc_seq_show, |
2750 | }; | 2750 | }; |
2751 | 2751 | ||
2752 | static int igmp6_mc_seq_open(struct inode *inode, struct file *file) | ||
2753 | { | ||
2754 | return seq_open_net(inode, file, &igmp6_mc_seq_ops, | ||
2755 | sizeof(struct igmp6_mc_iter_state)); | ||
2756 | } | ||
2757 | |||
2758 | static const struct file_operations igmp6_mc_seq_fops = { | ||
2759 | .open = igmp6_mc_seq_open, | ||
2760 | .read = seq_read, | ||
2761 | .llseek = seq_lseek, | ||
2762 | .release = seq_release_net, | ||
2763 | }; | ||
2764 | |||
2765 | struct igmp6_mcf_iter_state { | 2752 | struct igmp6_mcf_iter_state { |
2766 | struct seq_net_private p; | 2753 | struct seq_net_private p; |
2767 | struct net_device *dev; | 2754 | struct net_device *dev; |
@@ -2903,28 +2890,17 @@ static const struct seq_operations igmp6_mcf_seq_ops = { | |||
2903 | .show = igmp6_mcf_seq_show, | 2890 | .show = igmp6_mcf_seq_show, |
2904 | }; | 2891 | }; |
2905 | 2892 | ||
2906 | static int igmp6_mcf_seq_open(struct inode *inode, struct file *file) | ||
2907 | { | ||
2908 | return seq_open_net(inode, file, &igmp6_mcf_seq_ops, | ||
2909 | sizeof(struct igmp6_mcf_iter_state)); | ||
2910 | } | ||
2911 | |||
2912 | static const struct file_operations igmp6_mcf_seq_fops = { | ||
2913 | .open = igmp6_mcf_seq_open, | ||
2914 | .read = seq_read, | ||
2915 | .llseek = seq_lseek, | ||
2916 | .release = seq_release_net, | ||
2917 | }; | ||
2918 | |||
2919 | static int __net_init igmp6_proc_init(struct net *net) | 2893 | static int __net_init igmp6_proc_init(struct net *net) |
2920 | { | 2894 | { |
2921 | int err; | 2895 | int err; |
2922 | 2896 | ||
2923 | err = -ENOMEM; | 2897 | err = -ENOMEM; |
2924 | if (!proc_create("igmp6", 0444, net->proc_net, &igmp6_mc_seq_fops)) | 2898 | if (!proc_create_net("igmp6", 0444, net->proc_net, &igmp6_mc_seq_ops, |
2899 | sizeof(struct igmp6_mc_iter_state))) | ||
2925 | goto out; | 2900 | goto out; |
2926 | if (!proc_create("mcfilter6", 0444, net->proc_net, | 2901 | if (!proc_create_net("mcfilter6", 0444, net->proc_net, |
2927 | &igmp6_mcf_seq_fops)) | 2902 | &igmp6_mcf_seq_ops, |
2903 | sizeof(struct igmp6_mcf_iter_state))) | ||
2928 | goto out_proc_net_igmp6; | 2904 | goto out_proc_net_igmp6; |
2929 | 2905 | ||
2930 | err = 0; | 2906 | err = 0; |
diff --git a/net/ipv6/ping.c b/net/ipv6/ping.c index 746eeae7f581..96f56bf49a30 100644 --- a/net/ipv6/ping.c +++ b/net/ipv6/ping.c | |||
@@ -24,6 +24,7 @@ | |||
24 | #include <net/protocol.h> | 24 | #include <net/protocol.h> |
25 | #include <net/udp.h> | 25 | #include <net/udp.h> |
26 | #include <net/transp_v6.h> | 26 | #include <net/transp_v6.h> |
27 | #include <linux/proc_fs.h> | ||
27 | #include <net/ping.h> | 28 | #include <net/ping.h> |
28 | 29 | ||
29 | /* Compatibility glue so we can support IPv6 when it's compiled as a module */ | 30 | /* Compatibility glue so we can support IPv6 when it's compiled as a module */ |
@@ -215,26 +216,24 @@ static int ping_v6_seq_show(struct seq_file *seq, void *v) | |||
215 | return 0; | 216 | return 0; |
216 | } | 217 | } |
217 | 218 | ||
218 | static struct ping_seq_afinfo ping_v6_seq_afinfo = { | 219 | static const struct seq_operations ping_v6_seq_ops = { |
219 | .name = "icmp6", | 220 | .start = ping_v6_seq_start, |
220 | .family = AF_INET6, | 221 | .show = ping_v6_seq_show, |
221 | .seq_fops = &ping_seq_fops, | 222 | .next = ping_seq_next, |
222 | .seq_ops = { | 223 | .stop = ping_seq_stop, |
223 | .start = ping_v6_seq_start, | ||
224 | .show = ping_v6_seq_show, | ||
225 | .next = ping_seq_next, | ||
226 | .stop = ping_seq_stop, | ||
227 | }, | ||
228 | }; | 224 | }; |
229 | 225 | ||
230 | static int __net_init ping_v6_proc_init_net(struct net *net) | 226 | static int __net_init ping_v6_proc_init_net(struct net *net) |
231 | { | 227 | { |
232 | return ping_proc_register(net, &ping_v6_seq_afinfo); | 228 | if (!proc_create_net("icmp6", 0444, net->proc_net, &ping_v6_seq_ops, |
229 | sizeof(struct ping_iter_state))) | ||
230 | return -ENOMEM; | ||
231 | return 0; | ||
233 | } | 232 | } |
234 | 233 | ||
235 | static void __net_init ping_v6_proc_exit_net(struct net *net) | 234 | static void __net_init ping_v6_proc_exit_net(struct net *net) |
236 | { | 235 | { |
237 | return ping_proc_unregister(net, &ping_v6_seq_afinfo); | 236 | remove_proc_entry("icmp6", net->proc_net); |
238 | } | 237 | } |
239 | 238 | ||
240 | static struct pernet_operations ping_v6_net_ops = { | 239 | static struct pernet_operations ping_v6_net_ops = { |
diff --git a/net/ipv6/proc.c b/net/ipv6/proc.c index a85f7e0b14b1..2356b4af7309 100644 --- a/net/ipv6/proc.c +++ b/net/ipv6/proc.c | |||
@@ -53,18 +53,6 @@ static int sockstat6_seq_show(struct seq_file *seq, void *v) | |||
53 | return 0; | 53 | return 0; |
54 | } | 54 | } |
55 | 55 | ||
56 | static int sockstat6_seq_open(struct inode *inode, struct file *file) | ||
57 | { | ||
58 | return single_open_net(inode, file, sockstat6_seq_show); | ||
59 | } | ||
60 | |||
61 | static const struct file_operations sockstat6_seq_fops = { | ||
62 | .open = sockstat6_seq_open, | ||
63 | .read = seq_read, | ||
64 | .llseek = seq_lseek, | ||
65 | .release = single_release_net, | ||
66 | }; | ||
67 | |||
68 | static const struct snmp_mib snmp6_ipstats_list[] = { | 56 | static const struct snmp_mib snmp6_ipstats_list[] = { |
69 | /* ipv6 mib according to RFC 2465 */ | 57 | /* ipv6 mib according to RFC 2465 */ |
70 | SNMP_MIB_ITEM("Ip6InReceives", IPSTATS_MIB_INPKTS), | 58 | SNMP_MIB_ITEM("Ip6InReceives", IPSTATS_MIB_INPKTS), |
@@ -242,18 +230,6 @@ static int snmp6_seq_show(struct seq_file *seq, void *v) | |||
242 | return 0; | 230 | return 0; |
243 | } | 231 | } |
244 | 232 | ||
245 | static int snmp6_seq_open(struct inode *inode, struct file *file) | ||
246 | { | ||
247 | return single_open_net(inode, file, snmp6_seq_show); | ||
248 | } | ||
249 | |||
250 | static const struct file_operations snmp6_seq_fops = { | ||
251 | .open = snmp6_seq_open, | ||
252 | .read = seq_read, | ||
253 | .llseek = seq_lseek, | ||
254 | .release = single_release_net, | ||
255 | }; | ||
256 | |||
257 | static int snmp6_dev_seq_show(struct seq_file *seq, void *v) | 233 | static int snmp6_dev_seq_show(struct seq_file *seq, void *v) |
258 | { | 234 | { |
259 | struct inet6_dev *idev = (struct inet6_dev *)seq->private; | 235 | struct inet6_dev *idev = (struct inet6_dev *)seq->private; |
@@ -267,18 +243,6 @@ static int snmp6_dev_seq_show(struct seq_file *seq, void *v) | |||
267 | return 0; | 243 | return 0; |
268 | } | 244 | } |
269 | 245 | ||
270 | static int snmp6_dev_seq_open(struct inode *inode, struct file *file) | ||
271 | { | ||
272 | return single_open(file, snmp6_dev_seq_show, PDE_DATA(inode)); | ||
273 | } | ||
274 | |||
275 | static const struct file_operations snmp6_dev_seq_fops = { | ||
276 | .open = snmp6_dev_seq_open, | ||
277 | .read = seq_read, | ||
278 | .llseek = seq_lseek, | ||
279 | .release = single_release, | ||
280 | }; | ||
281 | |||
282 | int snmp6_register_dev(struct inet6_dev *idev) | 246 | int snmp6_register_dev(struct inet6_dev *idev) |
283 | { | 247 | { |
284 | struct proc_dir_entry *p; | 248 | struct proc_dir_entry *p; |
@@ -291,9 +255,8 @@ int snmp6_register_dev(struct inet6_dev *idev) | |||
291 | if (!net->mib.proc_net_devsnmp6) | 255 | if (!net->mib.proc_net_devsnmp6) |
292 | return -ENOENT; | 256 | return -ENOENT; |
293 | 257 | ||
294 | p = proc_create_data(idev->dev->name, 0444, | 258 | p = proc_create_single_data(idev->dev->name, 0444, |
295 | net->mib.proc_net_devsnmp6, | 259 | net->mib.proc_net_devsnmp6, snmp6_dev_seq_show, idev); |
296 | &snmp6_dev_seq_fops, idev); | ||
297 | if (!p) | 260 | if (!p) |
298 | return -ENOMEM; | 261 | return -ENOMEM; |
299 | 262 | ||
@@ -315,11 +278,12 @@ int snmp6_unregister_dev(struct inet6_dev *idev) | |||
315 | 278 | ||
316 | static int __net_init ipv6_proc_init_net(struct net *net) | 279 | static int __net_init ipv6_proc_init_net(struct net *net) |
317 | { | 280 | { |
318 | if (!proc_create("sockstat6", 0444, net->proc_net, | 281 | if (!proc_create_net_single("sockstat6", 0444, net->proc_net, |
319 | &sockstat6_seq_fops)) | 282 | sockstat6_seq_show, NULL)) |
320 | return -ENOMEM; | 283 | return -ENOMEM; |
321 | 284 | ||
322 | if (!proc_create("snmp6", 0444, net->proc_net, &snmp6_seq_fops)) | 285 | if (!proc_create_net_single("snmp6", 0444, net->proc_net, |
286 | snmp6_seq_show, NULL)) | ||
323 | goto proc_snmp6_fail; | 287 | goto proc_snmp6_fail; |
324 | 288 | ||
325 | net->mib.proc_net_devsnmp6 = proc_mkdir("dev_snmp6", net->proc_net); | 289 | net->mib.proc_net_devsnmp6 = proc_mkdir("dev_snmp6", net->proc_net); |
diff --git a/net/ipv6/raw.c b/net/ipv6/raw.c index 5eb9b08947ed..afc307c89d1a 100644 --- a/net/ipv6/raw.c +++ b/net/ipv6/raw.c | |||
@@ -1304,21 +1304,10 @@ static const struct seq_operations raw6_seq_ops = { | |||
1304 | .show = raw6_seq_show, | 1304 | .show = raw6_seq_show, |
1305 | }; | 1305 | }; |
1306 | 1306 | ||
1307 | static int raw6_seq_open(struct inode *inode, struct file *file) | ||
1308 | { | ||
1309 | return raw_seq_open(inode, file, &raw_v6_hashinfo, &raw6_seq_ops); | ||
1310 | } | ||
1311 | |||
1312 | static const struct file_operations raw6_seq_fops = { | ||
1313 | .open = raw6_seq_open, | ||
1314 | .read = seq_read, | ||
1315 | .llseek = seq_lseek, | ||
1316 | .release = seq_release_net, | ||
1317 | }; | ||
1318 | |||
1319 | static int __net_init raw6_init_net(struct net *net) | 1307 | static int __net_init raw6_init_net(struct net *net) |
1320 | { | 1308 | { |
1321 | if (!proc_create("raw6", 0444, net->proc_net, &raw6_seq_fops)) | 1309 | if (!proc_create_net_data("raw6", 0444, net->proc_net, &raw6_seq_ops, |
1310 | sizeof(struct raw_iter_state), &raw_v6_hashinfo)) | ||
1322 | return -ENOMEM; | 1311 | return -ENOMEM; |
1323 | 1312 | ||
1324 | return 0; | 1313 | return 0; |
diff --git a/net/ipv6/route.c b/net/ipv6/route.c index f4d61736c41a..a6598762d2c1 100644 --- a/net/ipv6/route.c +++ b/net/ipv6/route.c | |||
@@ -4862,14 +4862,6 @@ static int ip6_route_dev_notify(struct notifier_block *this, | |||
4862 | */ | 4862 | */ |
4863 | 4863 | ||
4864 | #ifdef CONFIG_PROC_FS | 4864 | #ifdef CONFIG_PROC_FS |
4865 | |||
4866 | static const struct file_operations ipv6_route_proc_fops = { | ||
4867 | .open = ipv6_route_open, | ||
4868 | .read = seq_read, | ||
4869 | .llseek = seq_lseek, | ||
4870 | .release = seq_release_net, | ||
4871 | }; | ||
4872 | |||
4873 | static int rt6_stats_seq_show(struct seq_file *seq, void *v) | 4865 | static int rt6_stats_seq_show(struct seq_file *seq, void *v) |
4874 | { | 4866 | { |
4875 | struct net *net = (struct net *)seq->private; | 4867 | struct net *net = (struct net *)seq->private; |
@@ -4884,18 +4876,6 @@ static int rt6_stats_seq_show(struct seq_file *seq, void *v) | |||
4884 | 4876 | ||
4885 | return 0; | 4877 | return 0; |
4886 | } | 4878 | } |
4887 | |||
4888 | static int rt6_stats_seq_open(struct inode *inode, struct file *file) | ||
4889 | { | ||
4890 | return single_open_net(inode, file, rt6_stats_seq_show); | ||
4891 | } | ||
4892 | |||
4893 | static const struct file_operations rt6_stats_seq_fops = { | ||
4894 | .open = rt6_stats_seq_open, | ||
4895 | .read = seq_read, | ||
4896 | .llseek = seq_lseek, | ||
4897 | .release = single_release_net, | ||
4898 | }; | ||
4899 | #endif /* CONFIG_PROC_FS */ | 4879 | #endif /* CONFIG_PROC_FS */ |
4900 | 4880 | ||
4901 | #ifdef CONFIG_SYSCTL | 4881 | #ifdef CONFIG_SYSCTL |
@@ -5100,8 +5080,10 @@ static void __net_exit ip6_route_net_exit(struct net *net) | |||
5100 | static int __net_init ip6_route_net_init_late(struct net *net) | 5080 | static int __net_init ip6_route_net_init_late(struct net *net) |
5101 | { | 5081 | { |
5102 | #ifdef CONFIG_PROC_FS | 5082 | #ifdef CONFIG_PROC_FS |
5103 | proc_create("ipv6_route", 0, net->proc_net, &ipv6_route_proc_fops); | 5083 | proc_create_net("ipv6_route", 0, net->proc_net, &ipv6_route_seq_ops, |
5104 | proc_create("rt6_stats", 0444, net->proc_net, &rt6_stats_seq_fops); | 5084 | sizeof(struct ipv6_route_iter)); |
5085 | proc_create_net_single("rt6_stats", 0444, net->proc_net, | ||
5086 | rt6_stats_seq_show, NULL); | ||
5105 | #endif | 5087 | #endif |
5106 | return 0; | 5088 | return 0; |
5107 | } | 5089 | } |
diff --git a/net/ipv6/tcp_ipv6.c b/net/ipv6/tcp_ipv6.c index 6d664d83cd16..d2ce66b23430 100644 --- a/net/ipv6/tcp_ipv6.c +++ b/net/ipv6/tcp_ipv6.c | |||
@@ -1909,30 +1909,28 @@ out: | |||
1909 | return 0; | 1909 | return 0; |
1910 | } | 1910 | } |
1911 | 1911 | ||
1912 | static const struct file_operations tcp6_afinfo_seq_fops = { | 1912 | static const struct seq_operations tcp6_seq_ops = { |
1913 | .open = tcp_seq_open, | 1913 | .show = tcp6_seq_show, |
1914 | .read = seq_read, | 1914 | .start = tcp_seq_start, |
1915 | .llseek = seq_lseek, | 1915 | .next = tcp_seq_next, |
1916 | .release = seq_release_net | 1916 | .stop = tcp_seq_stop, |
1917 | }; | 1917 | }; |
1918 | 1918 | ||
1919 | static struct tcp_seq_afinfo tcp6_seq_afinfo = { | 1919 | static struct tcp_seq_afinfo tcp6_seq_afinfo = { |
1920 | .name = "tcp6", | ||
1921 | .family = AF_INET6, | 1920 | .family = AF_INET6, |
1922 | .seq_fops = &tcp6_afinfo_seq_fops, | ||
1923 | .seq_ops = { | ||
1924 | .show = tcp6_seq_show, | ||
1925 | }, | ||
1926 | }; | 1921 | }; |
1927 | 1922 | ||
1928 | int __net_init tcp6_proc_init(struct net *net) | 1923 | int __net_init tcp6_proc_init(struct net *net) |
1929 | { | 1924 | { |
1930 | return tcp_proc_register(net, &tcp6_seq_afinfo); | 1925 | if (!proc_create_net_data("tcp6", 0444, net->proc_net, &tcp6_seq_ops, |
1926 | sizeof(struct tcp_iter_state), &tcp6_seq_afinfo)) | ||
1927 | return -ENOMEM; | ||
1928 | return 0; | ||
1931 | } | 1929 | } |
1932 | 1930 | ||
1933 | void tcp6_proc_exit(struct net *net) | 1931 | void tcp6_proc_exit(struct net *net) |
1934 | { | 1932 | { |
1935 | tcp_proc_unregister(net, &tcp6_seq_afinfo); | 1933 | remove_proc_entry("tcp6", net->proc_net); |
1936 | } | 1934 | } |
1937 | #endif | 1935 | #endif |
1938 | 1936 | ||
diff --git a/net/ipv6/udp.c b/net/ipv6/udp.c index ea0730028e5d..00e2112da26d 100644 --- a/net/ipv6/udp.c +++ b/net/ipv6/udp.c | |||
@@ -1480,31 +1480,30 @@ int udp6_seq_show(struct seq_file *seq, void *v) | |||
1480 | return 0; | 1480 | return 0; |
1481 | } | 1481 | } |
1482 | 1482 | ||
1483 | static const struct file_operations udp6_afinfo_seq_fops = { | 1483 | const struct seq_operations udp6_seq_ops = { |
1484 | .open = udp_seq_open, | 1484 | .start = udp_seq_start, |
1485 | .read = seq_read, | 1485 | .next = udp_seq_next, |
1486 | .llseek = seq_lseek, | 1486 | .stop = udp_seq_stop, |
1487 | .release = seq_release_net | 1487 | .show = udp6_seq_show, |
1488 | }; | 1488 | }; |
1489 | EXPORT_SYMBOL(udp6_seq_ops); | ||
1489 | 1490 | ||
1490 | static struct udp_seq_afinfo udp6_seq_afinfo = { | 1491 | static struct udp_seq_afinfo udp6_seq_afinfo = { |
1491 | .name = "udp6", | ||
1492 | .family = AF_INET6, | 1492 | .family = AF_INET6, |
1493 | .udp_table = &udp_table, | 1493 | .udp_table = &udp_table, |
1494 | .seq_fops = &udp6_afinfo_seq_fops, | ||
1495 | .seq_ops = { | ||
1496 | .show = udp6_seq_show, | ||
1497 | }, | ||
1498 | }; | 1494 | }; |
1499 | 1495 | ||
1500 | int __net_init udp6_proc_init(struct net *net) | 1496 | int __net_init udp6_proc_init(struct net *net) |
1501 | { | 1497 | { |
1502 | return udp_proc_register(net, &udp6_seq_afinfo); | 1498 | if (!proc_create_net_data("udp6", 0444, net->proc_net, &udp6_seq_ops, |
1499 | sizeof(struct udp_iter_state), &udp6_seq_afinfo)) | ||
1500 | return -ENOMEM; | ||
1501 | return 0; | ||
1503 | } | 1502 | } |
1504 | 1503 | ||
1505 | void udp6_proc_exit(struct net *net) | 1504 | void udp6_proc_exit(struct net *net) |
1506 | { | 1505 | { |
1507 | udp_proc_unregister(net, &udp6_seq_afinfo); | 1506 | remove_proc_entry("udp6", net->proc_net); |
1508 | } | 1507 | } |
1509 | #endif /* CONFIG_PROC_FS */ | 1508 | #endif /* CONFIG_PROC_FS */ |
1510 | 1509 | ||
diff --git a/net/ipv6/udplite.c b/net/ipv6/udplite.c index 14ae32bb1f3d..5000ad6878e6 100644 --- a/net/ipv6/udplite.c +++ b/net/ipv6/udplite.c | |||
@@ -12,6 +12,7 @@ | |||
12 | * 2 of the License, or (at your option) any later version. | 12 | * 2 of the License, or (at your option) any later version. |
13 | */ | 13 | */ |
14 | #include <linux/export.h> | 14 | #include <linux/export.h> |
15 | #include <linux/proc_fs.h> | ||
15 | #include "udp_impl.h" | 16 | #include "udp_impl.h" |
16 | 17 | ||
17 | static int udplitev6_rcv(struct sk_buff *skb) | 18 | static int udplitev6_rcv(struct sk_buff *skb) |
@@ -92,32 +93,23 @@ void udplitev6_exit(void) | |||
92 | } | 93 | } |
93 | 94 | ||
94 | #ifdef CONFIG_PROC_FS | 95 | #ifdef CONFIG_PROC_FS |
95 | |||
96 | static const struct file_operations udplite6_afinfo_seq_fops = { | ||
97 | .open = udp_seq_open, | ||
98 | .read = seq_read, | ||
99 | .llseek = seq_lseek, | ||
100 | .release = seq_release_net | ||
101 | }; | ||
102 | |||
103 | static struct udp_seq_afinfo udplite6_seq_afinfo = { | 96 | static struct udp_seq_afinfo udplite6_seq_afinfo = { |
104 | .name = "udplite6", | ||
105 | .family = AF_INET6, | 97 | .family = AF_INET6, |
106 | .udp_table = &udplite_table, | 98 | .udp_table = &udplite_table, |
107 | .seq_fops = &udplite6_afinfo_seq_fops, | ||
108 | .seq_ops = { | ||
109 | .show = udp6_seq_show, | ||
110 | }, | ||
111 | }; | 99 | }; |
112 | 100 | ||
113 | static int __net_init udplite6_proc_init_net(struct net *net) | 101 | static int __net_init udplite6_proc_init_net(struct net *net) |
114 | { | 102 | { |
115 | return udp_proc_register(net, &udplite6_seq_afinfo); | 103 | if (!proc_create_net_data("udplite6", 0444, net->proc_net, |
104 | &udp6_seq_ops, sizeof(struct udp_iter_state), | ||
105 | &udplite6_seq_afinfo)) | ||
106 | return -ENOMEM; | ||
107 | return 0; | ||
116 | } | 108 | } |
117 | 109 | ||
118 | static void __net_exit udplite6_proc_exit_net(struct net *net) | 110 | static void __net_exit udplite6_proc_exit_net(struct net *net) |
119 | { | 111 | { |
120 | udp_proc_unregister(net, &udplite6_seq_afinfo); | 112 | remove_proc_entry("udplite6", net->proc_net); |
121 | } | 113 | } |
122 | 114 | ||
123 | static struct pernet_operations udplite6_net_ops = { | 115 | static struct pernet_operations udplite6_net_ops = { |
diff --git a/net/kcm/kcmproc.c b/net/kcm/kcmproc.c index 1fac92543094..370da2f80e3c 100644 --- a/net/kcm/kcmproc.c +++ b/net/kcm/kcmproc.c | |||
@@ -15,12 +15,6 @@ | |||
15 | #include <net/tcp.h> | 15 | #include <net/tcp.h> |
16 | 16 | ||
17 | #ifdef CONFIG_PROC_FS | 17 | #ifdef CONFIG_PROC_FS |
18 | struct kcm_seq_muxinfo { | ||
19 | char *name; | ||
20 | const struct file_operations *seq_fops; | ||
21 | const struct seq_operations seq_ops; | ||
22 | }; | ||
23 | |||
24 | static struct kcm_mux *kcm_get_first(struct seq_file *seq) | 18 | static struct kcm_mux *kcm_get_first(struct seq_file *seq) |
25 | { | 19 | { |
26 | struct net *net = seq_file_net(seq); | 20 | struct net *net = seq_file_net(seq); |
@@ -86,14 +80,6 @@ struct kcm_proc_mux_state { | |||
86 | int idx; | 80 | int idx; |
87 | }; | 81 | }; |
88 | 82 | ||
89 | static int kcm_seq_open(struct inode *inode, struct file *file) | ||
90 | { | ||
91 | struct kcm_seq_muxinfo *muxinfo = PDE_DATA(inode); | ||
92 | |||
93 | return seq_open_net(inode, file, &muxinfo->seq_ops, | ||
94 | sizeof(struct kcm_proc_mux_state)); | ||
95 | } | ||
96 | |||
97 | static void kcm_format_mux_header(struct seq_file *seq) | 83 | static void kcm_format_mux_header(struct seq_file *seq) |
98 | { | 84 | { |
99 | struct net *net = seq_file_net(seq); | 85 | struct net *net = seq_file_net(seq); |
@@ -246,44 +232,13 @@ static int kcm_seq_show(struct seq_file *seq, void *v) | |||
246 | return 0; | 232 | return 0; |
247 | } | 233 | } |
248 | 234 | ||
249 | static const struct file_operations kcm_seq_fops = { | 235 | static const struct seq_operations kcm_seq_ops = { |
250 | .open = kcm_seq_open, | 236 | .show = kcm_seq_show, |
251 | .read = seq_read, | 237 | .start = kcm_seq_start, |
252 | .llseek = seq_lseek, | 238 | .next = kcm_seq_next, |
253 | .release = seq_release_net, | 239 | .stop = kcm_seq_stop, |
254 | }; | 240 | }; |
255 | 241 | ||
256 | static struct kcm_seq_muxinfo kcm_seq_muxinfo = { | ||
257 | .name = "kcm", | ||
258 | .seq_fops = &kcm_seq_fops, | ||
259 | .seq_ops = { | ||
260 | .show = kcm_seq_show, | ||
261 | .start = kcm_seq_start, | ||
262 | .next = kcm_seq_next, | ||
263 | .stop = kcm_seq_stop, | ||
264 | } | ||
265 | }; | ||
266 | |||
267 | static int kcm_proc_register(struct net *net, struct kcm_seq_muxinfo *muxinfo) | ||
268 | { | ||
269 | struct proc_dir_entry *p; | ||
270 | int rc = 0; | ||
271 | |||
272 | p = proc_create_data(muxinfo->name, 0444, net->proc_net, | ||
273 | muxinfo->seq_fops, muxinfo); | ||
274 | if (!p) | ||
275 | rc = -ENOMEM; | ||
276 | return rc; | ||
277 | } | ||
278 | EXPORT_SYMBOL(kcm_proc_register); | ||
279 | |||
280 | static void kcm_proc_unregister(struct net *net, | ||
281 | struct kcm_seq_muxinfo *muxinfo) | ||
282 | { | ||
283 | remove_proc_entry(muxinfo->name, net->proc_net); | ||
284 | } | ||
285 | EXPORT_SYMBOL(kcm_proc_unregister); | ||
286 | |||
287 | static int kcm_stats_seq_show(struct seq_file *seq, void *v) | 242 | static int kcm_stats_seq_show(struct seq_file *seq, void *v) |
288 | { | 243 | { |
289 | struct kcm_psock_stats psock_stats; | 244 | struct kcm_psock_stats psock_stats; |
@@ -390,30 +345,14 @@ static int kcm_stats_seq_show(struct seq_file *seq, void *v) | |||
390 | return 0; | 345 | return 0; |
391 | } | 346 | } |
392 | 347 | ||
393 | static int kcm_stats_seq_open(struct inode *inode, struct file *file) | ||
394 | { | ||
395 | return single_open_net(inode, file, kcm_stats_seq_show); | ||
396 | } | ||
397 | |||
398 | static const struct file_operations kcm_stats_seq_fops = { | ||
399 | .open = kcm_stats_seq_open, | ||
400 | .read = seq_read, | ||
401 | .llseek = seq_lseek, | ||
402 | .release = single_release_net, | ||
403 | }; | ||
404 | |||
405 | static int kcm_proc_init_net(struct net *net) | 348 | static int kcm_proc_init_net(struct net *net) |
406 | { | 349 | { |
407 | int err; | 350 | if (!proc_create_net_single("kcm_stats", 0444, net->proc_net, |
408 | 351 | kcm_stats_seq_show, NULL)) | |
409 | if (!proc_create("kcm_stats", 0444, net->proc_net, | ||
410 | &kcm_stats_seq_fops)) { | ||
411 | err = -ENOMEM; | ||
412 | goto out_kcm_stats; | 352 | goto out_kcm_stats; |
413 | } | ||
414 | 353 | ||
415 | err = kcm_proc_register(net, &kcm_seq_muxinfo); | 354 | if (!proc_create_net("kcm", 0444, net->proc_net, &kcm_seq_ops, |
416 | if (err) | 355 | sizeof(struct kcm_proc_mux_state))) |
417 | goto out_kcm; | 356 | goto out_kcm; |
418 | 357 | ||
419 | return 0; | 358 | return 0; |
@@ -421,12 +360,12 @@ static int kcm_proc_init_net(struct net *net) | |||
421 | out_kcm: | 360 | out_kcm: |
422 | remove_proc_entry("kcm_stats", net->proc_net); | 361 | remove_proc_entry("kcm_stats", net->proc_net); |
423 | out_kcm_stats: | 362 | out_kcm_stats: |
424 | return err; | 363 | return -ENOMEM; |
425 | } | 364 | } |
426 | 365 | ||
427 | static void kcm_proc_exit_net(struct net *net) | 366 | static void kcm_proc_exit_net(struct net *net) |
428 | { | 367 | { |
429 | kcm_proc_unregister(net, &kcm_seq_muxinfo); | 368 | remove_proc_entry("kcm", net->proc_net); |
430 | remove_proc_entry("kcm_stats", net->proc_net); | 369 | remove_proc_entry("kcm_stats", net->proc_net); |
431 | } | 370 | } |
432 | 371 | ||
diff --git a/net/key/af_key.c b/net/key/af_key.c index e62e52e8f141..5e1d2946ffbf 100644 --- a/net/key/af_key.c +++ b/net/key/af_key.c | |||
@@ -3812,24 +3812,12 @@ static const struct seq_operations pfkey_seq_ops = { | |||
3812 | .show = pfkey_seq_show, | 3812 | .show = pfkey_seq_show, |
3813 | }; | 3813 | }; |
3814 | 3814 | ||
3815 | static int pfkey_seq_open(struct inode *inode, struct file *file) | ||
3816 | { | ||
3817 | return seq_open_net(inode, file, &pfkey_seq_ops, | ||
3818 | sizeof(struct seq_net_private)); | ||
3819 | } | ||
3820 | |||
3821 | static const struct file_operations pfkey_proc_ops = { | ||
3822 | .open = pfkey_seq_open, | ||
3823 | .read = seq_read, | ||
3824 | .llseek = seq_lseek, | ||
3825 | .release = seq_release_net, | ||
3826 | }; | ||
3827 | |||
3828 | static int __net_init pfkey_init_proc(struct net *net) | 3815 | static int __net_init pfkey_init_proc(struct net *net) |
3829 | { | 3816 | { |
3830 | struct proc_dir_entry *e; | 3817 | struct proc_dir_entry *e; |
3831 | 3818 | ||
3832 | e = proc_create("pfkey", 0, net->proc_net, &pfkey_proc_ops); | 3819 | e = proc_create_net("pfkey", 0, net->proc_net, &pfkey_seq_ops, |
3820 | sizeof(struct seq_net_private)); | ||
3833 | if (e == NULL) | 3821 | if (e == NULL) |
3834 | return -ENOMEM; | 3822 | return -ENOMEM; |
3835 | 3823 | ||
diff --git a/net/l2tp/l2tp_ppp.c b/net/l2tp/l2tp_ppp.c index 1fd9e145076a..830469766c1f 100644 --- a/net/l2tp/l2tp_ppp.c +++ b/net/l2tp/l2tp_ppp.c | |||
@@ -1742,24 +1742,6 @@ static const struct seq_operations pppol2tp_seq_ops = { | |||
1742 | .stop = pppol2tp_seq_stop, | 1742 | .stop = pppol2tp_seq_stop, |
1743 | .show = pppol2tp_seq_show, | 1743 | .show = pppol2tp_seq_show, |
1744 | }; | 1744 | }; |
1745 | |||
1746 | /* Called when our /proc file is opened. We allocate data for use when | ||
1747 | * iterating our tunnel / session contexts and store it in the private | ||
1748 | * data of the seq_file. | ||
1749 | */ | ||
1750 | static int pppol2tp_proc_open(struct inode *inode, struct file *file) | ||
1751 | { | ||
1752 | return seq_open_net(inode, file, &pppol2tp_seq_ops, | ||
1753 | sizeof(struct pppol2tp_seq_data)); | ||
1754 | } | ||
1755 | |||
1756 | static const struct file_operations pppol2tp_proc_fops = { | ||
1757 | .open = pppol2tp_proc_open, | ||
1758 | .read = seq_read, | ||
1759 | .llseek = seq_lseek, | ||
1760 | .release = seq_release_net, | ||
1761 | }; | ||
1762 | |||
1763 | #endif /* CONFIG_PROC_FS */ | 1745 | #endif /* CONFIG_PROC_FS */ |
1764 | 1746 | ||
1765 | /***************************************************************************** | 1747 | /***************************************************************************** |
@@ -1771,8 +1753,8 @@ static __net_init int pppol2tp_init_net(struct net *net) | |||
1771 | struct proc_dir_entry *pde; | 1753 | struct proc_dir_entry *pde; |
1772 | int err = 0; | 1754 | int err = 0; |
1773 | 1755 | ||
1774 | pde = proc_create("pppol2tp", 0444, net->proc_net, | 1756 | pde = proc_create_net("pppol2tp", 0444, net->proc_net, |
1775 | &pppol2tp_proc_fops); | 1757 | &pppol2tp_seq_ops, sizeof(struct pppol2tp_seq_data)); |
1776 | if (!pde) { | 1758 | if (!pde) { |
1777 | err = -ENOMEM; | 1759 | err = -ENOMEM; |
1778 | goto out; | 1760 | goto out; |
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/netfilter/ipvs/ip_vs_app.c b/net/netfilter/ipvs/ip_vs_app.c index 1c98c907bc63..c3db074fc1f7 100644 --- a/net/netfilter/ipvs/ip_vs_app.c +++ b/net/netfilter/ipvs/ip_vs_app.c | |||
@@ -587,25 +587,13 @@ static const struct seq_operations ip_vs_app_seq_ops = { | |||
587 | .stop = ip_vs_app_seq_stop, | 587 | .stop = ip_vs_app_seq_stop, |
588 | .show = ip_vs_app_seq_show, | 588 | .show = ip_vs_app_seq_show, |
589 | }; | 589 | }; |
590 | |||
591 | static int ip_vs_app_open(struct inode *inode, struct file *file) | ||
592 | { | ||
593 | return seq_open_net(inode, file, &ip_vs_app_seq_ops, | ||
594 | sizeof(struct seq_net_private)); | ||
595 | } | ||
596 | |||
597 | static const struct file_operations ip_vs_app_fops = { | ||
598 | .open = ip_vs_app_open, | ||
599 | .read = seq_read, | ||
600 | .llseek = seq_lseek, | ||
601 | .release = seq_release_net, | ||
602 | }; | ||
603 | #endif | 590 | #endif |
604 | 591 | ||
605 | int __net_init ip_vs_app_net_init(struct netns_ipvs *ipvs) | 592 | int __net_init ip_vs_app_net_init(struct netns_ipvs *ipvs) |
606 | { | 593 | { |
607 | INIT_LIST_HEAD(&ipvs->app_list); | 594 | INIT_LIST_HEAD(&ipvs->app_list); |
608 | proc_create("ip_vs_app", 0, ipvs->net->proc_net, &ip_vs_app_fops); | 595 | proc_create_net("ip_vs_app", 0, ipvs->net->proc_net, &ip_vs_app_seq_ops, |
596 | sizeof(struct seq_net_private)); | ||
609 | return 0; | 597 | return 0; |
610 | } | 598 | } |
611 | 599 | ||
diff --git a/net/netfilter/ipvs/ip_vs_conn.c b/net/netfilter/ipvs/ip_vs_conn.c index 75de46576f51..61c3a389da89 100644 --- a/net/netfilter/ipvs/ip_vs_conn.c +++ b/net/netfilter/ipvs/ip_vs_conn.c | |||
@@ -1131,19 +1131,6 @@ static const struct seq_operations ip_vs_conn_seq_ops = { | |||
1131 | .show = ip_vs_conn_seq_show, | 1131 | .show = ip_vs_conn_seq_show, |
1132 | }; | 1132 | }; |
1133 | 1133 | ||
1134 | static int ip_vs_conn_open(struct inode *inode, struct file *file) | ||
1135 | { | ||
1136 | return seq_open_net(inode, file, &ip_vs_conn_seq_ops, | ||
1137 | sizeof(struct ip_vs_iter_state)); | ||
1138 | } | ||
1139 | |||
1140 | static const struct file_operations ip_vs_conn_fops = { | ||
1141 | .open = ip_vs_conn_open, | ||
1142 | .read = seq_read, | ||
1143 | .llseek = seq_lseek, | ||
1144 | .release = seq_release_net, | ||
1145 | }; | ||
1146 | |||
1147 | static const char *ip_vs_origin_name(unsigned int flags) | 1134 | static const char *ip_vs_origin_name(unsigned int flags) |
1148 | { | 1135 | { |
1149 | if (flags & IP_VS_CONN_F_SYNC) | 1136 | if (flags & IP_VS_CONN_F_SYNC) |
@@ -1207,20 +1194,6 @@ static const struct seq_operations ip_vs_conn_sync_seq_ops = { | |||
1207 | .stop = ip_vs_conn_seq_stop, | 1194 | .stop = ip_vs_conn_seq_stop, |
1208 | .show = ip_vs_conn_sync_seq_show, | 1195 | .show = ip_vs_conn_sync_seq_show, |
1209 | }; | 1196 | }; |
1210 | |||
1211 | static int ip_vs_conn_sync_open(struct inode *inode, struct file *file) | ||
1212 | { | ||
1213 | return seq_open_net(inode, file, &ip_vs_conn_sync_seq_ops, | ||
1214 | sizeof(struct ip_vs_iter_state)); | ||
1215 | } | ||
1216 | |||
1217 | static const struct file_operations ip_vs_conn_sync_fops = { | ||
1218 | .open = ip_vs_conn_sync_open, | ||
1219 | .read = seq_read, | ||
1220 | .llseek = seq_lseek, | ||
1221 | .release = seq_release_net, | ||
1222 | }; | ||
1223 | |||
1224 | #endif | 1197 | #endif |
1225 | 1198 | ||
1226 | 1199 | ||
@@ -1380,9 +1353,11 @@ int __net_init ip_vs_conn_net_init(struct netns_ipvs *ipvs) | |||
1380 | { | 1353 | { |
1381 | atomic_set(&ipvs->conn_count, 0); | 1354 | atomic_set(&ipvs->conn_count, 0); |
1382 | 1355 | ||
1383 | proc_create("ip_vs_conn", 0, ipvs->net->proc_net, &ip_vs_conn_fops); | 1356 | proc_create_net("ip_vs_conn", 0, ipvs->net->proc_net, |
1384 | proc_create("ip_vs_conn_sync", 0, ipvs->net->proc_net, | 1357 | &ip_vs_conn_seq_ops, sizeof(struct ip_vs_iter_state)); |
1385 | &ip_vs_conn_sync_fops); | 1358 | proc_create_net("ip_vs_conn_sync", 0, ipvs->net->proc_net, |
1359 | &ip_vs_conn_sync_seq_ops, | ||
1360 | sizeof(struct ip_vs_iter_state)); | ||
1386 | return 0; | 1361 | return 0; |
1387 | } | 1362 | } |
1388 | 1363 | ||
diff --git a/net/netfilter/ipvs/ip_vs_ctl.c b/net/netfilter/ipvs/ip_vs_ctl.c index 3ecca0616d8c..141b1509c948 100644 --- a/net/netfilter/ipvs/ip_vs_ctl.c +++ b/net/netfilter/ipvs/ip_vs_ctl.c | |||
@@ -2109,19 +2109,6 @@ static const struct seq_operations ip_vs_info_seq_ops = { | |||
2109 | .show = ip_vs_info_seq_show, | 2109 | .show = ip_vs_info_seq_show, |
2110 | }; | 2110 | }; |
2111 | 2111 | ||
2112 | static int ip_vs_info_open(struct inode *inode, struct file *file) | ||
2113 | { | ||
2114 | return seq_open_net(inode, file, &ip_vs_info_seq_ops, | ||
2115 | sizeof(struct ip_vs_iter)); | ||
2116 | } | ||
2117 | |||
2118 | static const struct file_operations ip_vs_info_fops = { | ||
2119 | .open = ip_vs_info_open, | ||
2120 | .read = seq_read, | ||
2121 | .llseek = seq_lseek, | ||
2122 | .release = seq_release_net, | ||
2123 | }; | ||
2124 | |||
2125 | static int ip_vs_stats_show(struct seq_file *seq, void *v) | 2112 | static int ip_vs_stats_show(struct seq_file *seq, void *v) |
2126 | { | 2113 | { |
2127 | struct net *net = seq_file_single_net(seq); | 2114 | struct net *net = seq_file_single_net(seq); |
@@ -2154,18 +2141,6 @@ static int ip_vs_stats_show(struct seq_file *seq, void *v) | |||
2154 | return 0; | 2141 | return 0; |
2155 | } | 2142 | } |
2156 | 2143 | ||
2157 | static int ip_vs_stats_seq_open(struct inode *inode, struct file *file) | ||
2158 | { | ||
2159 | return single_open_net(inode, file, ip_vs_stats_show); | ||
2160 | } | ||
2161 | |||
2162 | static const struct file_operations ip_vs_stats_fops = { | ||
2163 | .open = ip_vs_stats_seq_open, | ||
2164 | .read = seq_read, | ||
2165 | .llseek = seq_lseek, | ||
2166 | .release = single_release_net, | ||
2167 | }; | ||
2168 | |||
2169 | static int ip_vs_stats_percpu_show(struct seq_file *seq, void *v) | 2144 | static int ip_vs_stats_percpu_show(struct seq_file *seq, void *v) |
2170 | { | 2145 | { |
2171 | struct net *net = seq_file_single_net(seq); | 2146 | struct net *net = seq_file_single_net(seq); |
@@ -2221,18 +2196,6 @@ static int ip_vs_stats_percpu_show(struct seq_file *seq, void *v) | |||
2221 | 2196 | ||
2222 | return 0; | 2197 | return 0; |
2223 | } | 2198 | } |
2224 | |||
2225 | static int ip_vs_stats_percpu_seq_open(struct inode *inode, struct file *file) | ||
2226 | { | ||
2227 | return single_open_net(inode, file, ip_vs_stats_percpu_show); | ||
2228 | } | ||
2229 | |||
2230 | static const struct file_operations ip_vs_stats_percpu_fops = { | ||
2231 | .open = ip_vs_stats_percpu_seq_open, | ||
2232 | .read = seq_read, | ||
2233 | .llseek = seq_lseek, | ||
2234 | .release = single_release_net, | ||
2235 | }; | ||
2236 | #endif | 2199 | #endif |
2237 | 2200 | ||
2238 | /* | 2201 | /* |
@@ -4039,10 +4002,12 @@ int __net_init ip_vs_control_net_init(struct netns_ipvs *ipvs) | |||
4039 | 4002 | ||
4040 | spin_lock_init(&ipvs->tot_stats.lock); | 4003 | spin_lock_init(&ipvs->tot_stats.lock); |
4041 | 4004 | ||
4042 | proc_create("ip_vs", 0, ipvs->net->proc_net, &ip_vs_info_fops); | 4005 | proc_create_net("ip_vs", 0, ipvs->net->proc_net, &ip_vs_info_seq_ops, |
4043 | proc_create("ip_vs_stats", 0, ipvs->net->proc_net, &ip_vs_stats_fops); | 4006 | sizeof(struct ip_vs_iter)); |
4044 | proc_create("ip_vs_stats_percpu", 0, ipvs->net->proc_net, | 4007 | proc_create_net_single("ip_vs_stats", 0, ipvs->net->proc_net, |
4045 | &ip_vs_stats_percpu_fops); | 4008 | ip_vs_stats_show, NULL); |
4009 | proc_create_net_single("ip_vs_stats_percpu", 0, ipvs->net->proc_net, | ||
4010 | ip_vs_stats_percpu_show, NULL); | ||
4046 | 4011 | ||
4047 | if (ip_vs_control_net_init_sysctl(ipvs)) | 4012 | if (ip_vs_control_net_init_sysctl(ipvs)) |
4048 | goto err; | 4013 | goto err; |
diff --git a/net/netfilter/nf_conntrack_expect.c b/net/netfilter/nf_conntrack_expect.c index 4b2b3d53acfc..853b23206bb7 100644 --- a/net/netfilter/nf_conntrack_expect.c +++ b/net/netfilter/nf_conntrack_expect.c | |||
@@ -644,19 +644,6 @@ static const struct seq_operations exp_seq_ops = { | |||
644 | .stop = exp_seq_stop, | 644 | .stop = exp_seq_stop, |
645 | .show = exp_seq_show | 645 | .show = exp_seq_show |
646 | }; | 646 | }; |
647 | |||
648 | static int exp_open(struct inode *inode, struct file *file) | ||
649 | { | ||
650 | return seq_open_net(inode, file, &exp_seq_ops, | ||
651 | sizeof(struct ct_expect_iter_state)); | ||
652 | } | ||
653 | |||
654 | static const struct file_operations exp_file_ops = { | ||
655 | .open = exp_open, | ||
656 | .read = seq_read, | ||
657 | .llseek = seq_lseek, | ||
658 | .release = seq_release_net, | ||
659 | }; | ||
660 | #endif /* CONFIG_NF_CONNTRACK_PROCFS */ | 647 | #endif /* CONFIG_NF_CONNTRACK_PROCFS */ |
661 | 648 | ||
662 | static int exp_proc_init(struct net *net) | 649 | static int exp_proc_init(struct net *net) |
@@ -666,8 +653,8 @@ static int exp_proc_init(struct net *net) | |||
666 | kuid_t root_uid; | 653 | kuid_t root_uid; |
667 | kgid_t root_gid; | 654 | kgid_t root_gid; |
668 | 655 | ||
669 | proc = proc_create("nf_conntrack_expect", 0440, net->proc_net, | 656 | proc = proc_create_net("nf_conntrack_expect", 0440, net->proc_net, |
670 | &exp_file_ops); | 657 | &exp_seq_ops, sizeof(struct ct_expect_iter_state)); |
671 | if (!proc) | 658 | if (!proc) |
672 | return -ENOMEM; | 659 | return -ENOMEM; |
673 | 660 | ||
diff --git a/net/netfilter/nf_conntrack_standalone.c b/net/netfilter/nf_conntrack_standalone.c index 037fec54c850..b642c0b2495c 100644 --- a/net/netfilter/nf_conntrack_standalone.c +++ b/net/netfilter/nf_conntrack_standalone.c | |||
@@ -375,19 +375,6 @@ static const struct seq_operations ct_seq_ops = { | |||
375 | .show = ct_seq_show | 375 | .show = ct_seq_show |
376 | }; | 376 | }; |
377 | 377 | ||
378 | static int ct_open(struct inode *inode, struct file *file) | ||
379 | { | ||
380 | return seq_open_net(inode, file, &ct_seq_ops, | ||
381 | sizeof(struct ct_iter_state)); | ||
382 | } | ||
383 | |||
384 | static const struct file_operations ct_file_ops = { | ||
385 | .open = ct_open, | ||
386 | .read = seq_read, | ||
387 | .llseek = seq_lseek, | ||
388 | .release = seq_release_net, | ||
389 | }; | ||
390 | |||
391 | static void *ct_cpu_seq_start(struct seq_file *seq, loff_t *pos) | 378 | static void *ct_cpu_seq_start(struct seq_file *seq, loff_t *pos) |
392 | { | 379 | { |
393 | struct net *net = seq_file_net(seq); | 380 | struct net *net = seq_file_net(seq); |
@@ -467,26 +454,14 @@ static const struct seq_operations ct_cpu_seq_ops = { | |||
467 | .show = ct_cpu_seq_show, | 454 | .show = ct_cpu_seq_show, |
468 | }; | 455 | }; |
469 | 456 | ||
470 | static int ct_cpu_seq_open(struct inode *inode, struct file *file) | ||
471 | { | ||
472 | return seq_open_net(inode, file, &ct_cpu_seq_ops, | ||
473 | sizeof(struct seq_net_private)); | ||
474 | } | ||
475 | |||
476 | static const struct file_operations ct_cpu_seq_fops = { | ||
477 | .open = ct_cpu_seq_open, | ||
478 | .read = seq_read, | ||
479 | .llseek = seq_lseek, | ||
480 | .release = seq_release_net, | ||
481 | }; | ||
482 | |||
483 | static int nf_conntrack_standalone_init_proc(struct net *net) | 457 | static int nf_conntrack_standalone_init_proc(struct net *net) |
484 | { | 458 | { |
485 | struct proc_dir_entry *pde; | 459 | struct proc_dir_entry *pde; |
486 | kuid_t root_uid; | 460 | kuid_t root_uid; |
487 | kgid_t root_gid; | 461 | kgid_t root_gid; |
488 | 462 | ||
489 | pde = proc_create("nf_conntrack", 0440, net->proc_net, &ct_file_ops); | 463 | pde = proc_create_net("nf_conntrack", 0440, net->proc_net, &ct_seq_ops, |
464 | sizeof(struct ct_iter_state)); | ||
490 | if (!pde) | 465 | if (!pde) |
491 | goto out_nf_conntrack; | 466 | goto out_nf_conntrack; |
492 | 467 | ||
@@ -495,8 +470,8 @@ static int nf_conntrack_standalone_init_proc(struct net *net) | |||
495 | if (uid_valid(root_uid) && gid_valid(root_gid)) | 470 | if (uid_valid(root_uid) && gid_valid(root_gid)) |
496 | proc_set_user(pde, root_uid, root_gid); | 471 | proc_set_user(pde, root_uid, root_gid); |
497 | 472 | ||
498 | pde = proc_create("nf_conntrack", 0444, net->proc_net_stat, | 473 | pde = proc_create_net("nf_conntrack", 0444, net->proc_net_stat, |
499 | &ct_cpu_seq_fops); | 474 | &ct_cpu_seq_ops, sizeof(struct seq_net_private)); |
500 | if (!pde) | 475 | if (!pde) |
501 | goto out_stat_nf_conntrack; | 476 | goto out_stat_nf_conntrack; |
502 | return 0; | 477 | return 0; |
diff --git a/net/netfilter/nf_log.c b/net/netfilter/nf_log.c index 6d0357817cda..426457047578 100644 --- a/net/netfilter/nf_log.c +++ b/net/netfilter/nf_log.c | |||
@@ -394,21 +394,6 @@ static const struct seq_operations nflog_seq_ops = { | |||
394 | .stop = seq_stop, | 394 | .stop = seq_stop, |
395 | .show = seq_show, | 395 | .show = seq_show, |
396 | }; | 396 | }; |
397 | |||
398 | static int nflog_open(struct inode *inode, struct file *file) | ||
399 | { | ||
400 | return seq_open_net(inode, file, &nflog_seq_ops, | ||
401 | sizeof(struct seq_net_private)); | ||
402 | } | ||
403 | |||
404 | static const struct file_operations nflog_file_ops = { | ||
405 | .open = nflog_open, | ||
406 | .read = seq_read, | ||
407 | .llseek = seq_lseek, | ||
408 | .release = seq_release_net, | ||
409 | }; | ||
410 | |||
411 | |||
412 | #endif /* PROC_FS */ | 397 | #endif /* PROC_FS */ |
413 | 398 | ||
414 | #ifdef CONFIG_SYSCTL | 399 | #ifdef CONFIG_SYSCTL |
@@ -549,8 +534,8 @@ static int __net_init nf_log_net_init(struct net *net) | |||
549 | int ret = -ENOMEM; | 534 | int ret = -ENOMEM; |
550 | 535 | ||
551 | #ifdef CONFIG_PROC_FS | 536 | #ifdef CONFIG_PROC_FS |
552 | if (!proc_create("nf_log", 0444, | 537 | if (!proc_create_net("nf_log", 0444, net->nf.proc_netfilter, |
553 | net->nf.proc_netfilter, &nflog_file_ops)) | 538 | &nflog_seq_ops, sizeof(struct seq_net_private))) |
554 | return ret; | 539 | return ret; |
555 | #endif | 540 | #endif |
556 | ret = netfilter_log_sysctl_init(net); | 541 | ret = netfilter_log_sysctl_init(net); |
diff --git a/net/netfilter/nf_synproxy_core.c b/net/netfilter/nf_synproxy_core.c index 6039b350abbe..8ff4d22f10b2 100644 --- a/net/netfilter/nf_synproxy_core.c +++ b/net/netfilter/nf_synproxy_core.c | |||
@@ -310,23 +310,10 @@ static const struct seq_operations synproxy_cpu_seq_ops = { | |||
310 | .show = synproxy_cpu_seq_show, | 310 | .show = synproxy_cpu_seq_show, |
311 | }; | 311 | }; |
312 | 312 | ||
313 | static int synproxy_cpu_seq_open(struct inode *inode, struct file *file) | ||
314 | { | ||
315 | return seq_open_net(inode, file, &synproxy_cpu_seq_ops, | ||
316 | sizeof(struct seq_net_private)); | ||
317 | } | ||
318 | |||
319 | static const struct file_operations synproxy_cpu_seq_fops = { | ||
320 | .open = synproxy_cpu_seq_open, | ||
321 | .read = seq_read, | ||
322 | .llseek = seq_lseek, | ||
323 | .release = seq_release_net, | ||
324 | }; | ||
325 | |||
326 | static int __net_init synproxy_proc_init(struct net *net) | 313 | static int __net_init synproxy_proc_init(struct net *net) |
327 | { | 314 | { |
328 | if (!proc_create("synproxy", 0444, net->proc_net_stat, | 315 | if (!proc_create_net("synproxy", 0444, net->proc_net_stat, |
329 | &synproxy_cpu_seq_fops)) | 316 | &synproxy_cpu_seq_ops, sizeof(struct seq_net_private))) |
330 | return -ENOMEM; | 317 | return -ENOMEM; |
331 | return 0; | 318 | return 0; |
332 | } | 319 | } |
diff --git a/net/netfilter/nfnetlink_log.c b/net/netfilter/nfnetlink_log.c index 7b46aa4c478d..c14822b9729f 100644 --- a/net/netfilter/nfnetlink_log.c +++ b/net/netfilter/nfnetlink_log.c | |||
@@ -1046,20 +1046,6 @@ static const struct seq_operations nful_seq_ops = { | |||
1046 | .stop = seq_stop, | 1046 | .stop = seq_stop, |
1047 | .show = seq_show, | 1047 | .show = seq_show, |
1048 | }; | 1048 | }; |
1049 | |||
1050 | static int nful_open(struct inode *inode, struct file *file) | ||
1051 | { | ||
1052 | return seq_open_net(inode, file, &nful_seq_ops, | ||
1053 | sizeof(struct iter_state)); | ||
1054 | } | ||
1055 | |||
1056 | static const struct file_operations nful_file_ops = { | ||
1057 | .open = nful_open, | ||
1058 | .read = seq_read, | ||
1059 | .llseek = seq_lseek, | ||
1060 | .release = seq_release_net, | ||
1061 | }; | ||
1062 | |||
1063 | #endif /* PROC_FS */ | 1049 | #endif /* PROC_FS */ |
1064 | 1050 | ||
1065 | static int __net_init nfnl_log_net_init(struct net *net) | 1051 | static int __net_init nfnl_log_net_init(struct net *net) |
@@ -1077,8 +1063,8 @@ static int __net_init nfnl_log_net_init(struct net *net) | |||
1077 | spin_lock_init(&log->instances_lock); | 1063 | spin_lock_init(&log->instances_lock); |
1078 | 1064 | ||
1079 | #ifdef CONFIG_PROC_FS | 1065 | #ifdef CONFIG_PROC_FS |
1080 | proc = proc_create("nfnetlink_log", 0440, | 1066 | proc = proc_create_net("nfnetlink_log", 0440, net->nf.proc_netfilter, |
1081 | net->nf.proc_netfilter, &nful_file_ops); | 1067 | &nful_seq_ops, sizeof(struct iter_state)); |
1082 | if (!proc) | 1068 | if (!proc) |
1083 | return -ENOMEM; | 1069 | return -ENOMEM; |
1084 | 1070 | ||
diff --git a/net/netfilter/nfnetlink_queue.c b/net/netfilter/nfnetlink_queue.c index 74a04638ef03..494a9ab35cb6 100644 --- a/net/netfilter/nfnetlink_queue.c +++ b/net/netfilter/nfnetlink_queue.c | |||
@@ -1469,20 +1469,6 @@ static const struct seq_operations nfqnl_seq_ops = { | |||
1469 | .stop = seq_stop, | 1469 | .stop = seq_stop, |
1470 | .show = seq_show, | 1470 | .show = seq_show, |
1471 | }; | 1471 | }; |
1472 | |||
1473 | static int nfqnl_open(struct inode *inode, struct file *file) | ||
1474 | { | ||
1475 | return seq_open_net(inode, file, &nfqnl_seq_ops, | ||
1476 | sizeof(struct iter_state)); | ||
1477 | } | ||
1478 | |||
1479 | static const struct file_operations nfqnl_file_ops = { | ||
1480 | .open = nfqnl_open, | ||
1481 | .read = seq_read, | ||
1482 | .llseek = seq_lseek, | ||
1483 | .release = seq_release_net, | ||
1484 | }; | ||
1485 | |||
1486 | #endif /* PROC_FS */ | 1472 | #endif /* PROC_FS */ |
1487 | 1473 | ||
1488 | static int __net_init nfnl_queue_net_init(struct net *net) | 1474 | static int __net_init nfnl_queue_net_init(struct net *net) |
@@ -1496,8 +1482,8 @@ static int __net_init nfnl_queue_net_init(struct net *net) | |||
1496 | spin_lock_init(&q->instances_lock); | 1482 | spin_lock_init(&q->instances_lock); |
1497 | 1483 | ||
1498 | #ifdef CONFIG_PROC_FS | 1484 | #ifdef CONFIG_PROC_FS |
1499 | if (!proc_create("nfnetlink_queue", 0440, | 1485 | if (!proc_create_net("nfnetlink_queue", 0440, net->nf.proc_netfilter, |
1500 | net->nf.proc_netfilter, &nfqnl_file_ops)) | 1486 | &nfqnl_seq_ops, sizeof(struct iter_state))) |
1501 | return -ENOMEM; | 1487 | return -ENOMEM; |
1502 | #endif | 1488 | #endif |
1503 | nf_register_queue_handler(net, &nfqh); | 1489 | nf_register_queue_handler(net, &nfqh); |
diff --git a/net/netfilter/x_tables.c b/net/netfilter/x_tables.c index cb7cb300c3bc..55cb4d197184 100644 --- a/net/netfilter/x_tables.c +++ b/net/netfilter/x_tables.c | |||
@@ -1495,15 +1495,10 @@ void *xt_unregister_table(struct xt_table *table) | |||
1495 | EXPORT_SYMBOL_GPL(xt_unregister_table); | 1495 | EXPORT_SYMBOL_GPL(xt_unregister_table); |
1496 | 1496 | ||
1497 | #ifdef CONFIG_PROC_FS | 1497 | #ifdef CONFIG_PROC_FS |
1498 | struct xt_names_priv { | ||
1499 | struct seq_net_private p; | ||
1500 | u_int8_t af; | ||
1501 | }; | ||
1502 | static void *xt_table_seq_start(struct seq_file *seq, loff_t *pos) | 1498 | static void *xt_table_seq_start(struct seq_file *seq, loff_t *pos) |
1503 | { | 1499 | { |
1504 | struct xt_names_priv *priv = seq->private; | ||
1505 | struct net *net = seq_file_net(seq); | 1500 | struct net *net = seq_file_net(seq); |
1506 | u_int8_t af = priv->af; | 1501 | u_int8_t af = (unsigned long)PDE_DATA(file_inode(seq->file)); |
1507 | 1502 | ||
1508 | mutex_lock(&xt[af].mutex); | 1503 | mutex_lock(&xt[af].mutex); |
1509 | return seq_list_start(&net->xt.tables[af], *pos); | 1504 | return seq_list_start(&net->xt.tables[af], *pos); |
@@ -1511,17 +1506,15 @@ static void *xt_table_seq_start(struct seq_file *seq, loff_t *pos) | |||
1511 | 1506 | ||
1512 | static void *xt_table_seq_next(struct seq_file *seq, void *v, loff_t *pos) | 1507 | static void *xt_table_seq_next(struct seq_file *seq, void *v, loff_t *pos) |
1513 | { | 1508 | { |
1514 | struct xt_names_priv *priv = seq->private; | ||
1515 | struct net *net = seq_file_net(seq); | 1509 | struct net *net = seq_file_net(seq); |
1516 | u_int8_t af = priv->af; | 1510 | u_int8_t af = (unsigned long)PDE_DATA(file_inode(seq->file)); |
1517 | 1511 | ||
1518 | return seq_list_next(v, &net->xt.tables[af], pos); | 1512 | return seq_list_next(v, &net->xt.tables[af], pos); |
1519 | } | 1513 | } |
1520 | 1514 | ||
1521 | static void xt_table_seq_stop(struct seq_file *seq, void *v) | 1515 | static void xt_table_seq_stop(struct seq_file *seq, void *v) |
1522 | { | 1516 | { |
1523 | struct xt_names_priv *priv = seq->private; | 1517 | u_int8_t af = (unsigned long)PDE_DATA(file_inode(seq->file)); |
1524 | u_int8_t af = priv->af; | ||
1525 | 1518 | ||
1526 | mutex_unlock(&xt[af].mutex); | 1519 | mutex_unlock(&xt[af].mutex); |
1527 | } | 1520 | } |
@@ -1542,34 +1535,13 @@ static const struct seq_operations xt_table_seq_ops = { | |||
1542 | .show = xt_table_seq_show, | 1535 | .show = xt_table_seq_show, |
1543 | }; | 1536 | }; |
1544 | 1537 | ||
1545 | static int xt_table_open(struct inode *inode, struct file *file) | ||
1546 | { | ||
1547 | int ret; | ||
1548 | struct xt_names_priv *priv; | ||
1549 | |||
1550 | ret = seq_open_net(inode, file, &xt_table_seq_ops, | ||
1551 | sizeof(struct xt_names_priv)); | ||
1552 | if (!ret) { | ||
1553 | priv = ((struct seq_file *)file->private_data)->private; | ||
1554 | priv->af = (unsigned long)PDE_DATA(inode); | ||
1555 | } | ||
1556 | return ret; | ||
1557 | } | ||
1558 | |||
1559 | static const struct file_operations xt_table_ops = { | ||
1560 | .open = xt_table_open, | ||
1561 | .read = seq_read, | ||
1562 | .llseek = seq_lseek, | ||
1563 | .release = seq_release_net, | ||
1564 | }; | ||
1565 | |||
1566 | /* | 1538 | /* |
1567 | * Traverse state for ip{,6}_{tables,matches} for helping crossing | 1539 | * Traverse state for ip{,6}_{tables,matches} for helping crossing |
1568 | * the multi-AF mutexes. | 1540 | * the multi-AF mutexes. |
1569 | */ | 1541 | */ |
1570 | struct nf_mttg_trav { | 1542 | struct nf_mttg_trav { |
1571 | struct list_head *head, *curr; | 1543 | struct list_head *head, *curr; |
1572 | uint8_t class, nfproto; | 1544 | uint8_t class; |
1573 | }; | 1545 | }; |
1574 | 1546 | ||
1575 | enum { | 1547 | enum { |
@@ -1586,6 +1558,7 @@ static void *xt_mttg_seq_next(struct seq_file *seq, void *v, loff_t *ppos, | |||
1586 | [MTTG_TRAV_NFP_UNSPEC] = MTTG_TRAV_NFP_SPEC, | 1558 | [MTTG_TRAV_NFP_UNSPEC] = MTTG_TRAV_NFP_SPEC, |
1587 | [MTTG_TRAV_NFP_SPEC] = MTTG_TRAV_DONE, | 1559 | [MTTG_TRAV_NFP_SPEC] = MTTG_TRAV_DONE, |
1588 | }; | 1560 | }; |
1561 | uint8_t nfproto = (unsigned long)PDE_DATA(file_inode(seq->file)); | ||
1589 | struct nf_mttg_trav *trav = seq->private; | 1562 | struct nf_mttg_trav *trav = seq->private; |
1590 | 1563 | ||
1591 | switch (trav->class) { | 1564 | switch (trav->class) { |
@@ -1600,9 +1573,9 @@ static void *xt_mttg_seq_next(struct seq_file *seq, void *v, loff_t *ppos, | |||
1600 | if (trav->curr != trav->head) | 1573 | if (trav->curr != trav->head) |
1601 | break; | 1574 | break; |
1602 | mutex_unlock(&xt[NFPROTO_UNSPEC].mutex); | 1575 | mutex_unlock(&xt[NFPROTO_UNSPEC].mutex); |
1603 | mutex_lock(&xt[trav->nfproto].mutex); | 1576 | mutex_lock(&xt[nfproto].mutex); |
1604 | trav->head = trav->curr = is_target ? | 1577 | trav->head = trav->curr = is_target ? |
1605 | &xt[trav->nfproto].target : &xt[trav->nfproto].match; | 1578 | &xt[nfproto].target : &xt[nfproto].match; |
1606 | trav->class = next_class[trav->class]; | 1579 | trav->class = next_class[trav->class]; |
1607 | break; | 1580 | break; |
1608 | case MTTG_TRAV_NFP_SPEC: | 1581 | case MTTG_TRAV_NFP_SPEC: |
@@ -1634,6 +1607,7 @@ static void *xt_mttg_seq_start(struct seq_file *seq, loff_t *pos, | |||
1634 | 1607 | ||
1635 | static void xt_mttg_seq_stop(struct seq_file *seq, void *v) | 1608 | static void xt_mttg_seq_stop(struct seq_file *seq, void *v) |
1636 | { | 1609 | { |
1610 | uint8_t nfproto = (unsigned long)PDE_DATA(file_inode(seq->file)); | ||
1637 | struct nf_mttg_trav *trav = seq->private; | 1611 | struct nf_mttg_trav *trav = seq->private; |
1638 | 1612 | ||
1639 | switch (trav->class) { | 1613 | switch (trav->class) { |
@@ -1641,7 +1615,7 @@ static void xt_mttg_seq_stop(struct seq_file *seq, void *v) | |||
1641 | mutex_unlock(&xt[NFPROTO_UNSPEC].mutex); | 1615 | mutex_unlock(&xt[NFPROTO_UNSPEC].mutex); |
1642 | break; | 1616 | break; |
1643 | case MTTG_TRAV_NFP_SPEC: | 1617 | case MTTG_TRAV_NFP_SPEC: |
1644 | mutex_unlock(&xt[trav->nfproto].mutex); | 1618 | mutex_unlock(&xt[nfproto].mutex); |
1645 | break; | 1619 | break; |
1646 | } | 1620 | } |
1647 | } | 1621 | } |
@@ -1680,24 +1654,6 @@ static const struct seq_operations xt_match_seq_ops = { | |||
1680 | .show = xt_match_seq_show, | 1654 | .show = xt_match_seq_show, |
1681 | }; | 1655 | }; |
1682 | 1656 | ||
1683 | static int xt_match_open(struct inode *inode, struct file *file) | ||
1684 | { | ||
1685 | struct nf_mttg_trav *trav; | ||
1686 | trav = __seq_open_private(file, &xt_match_seq_ops, sizeof(*trav)); | ||
1687 | if (!trav) | ||
1688 | return -ENOMEM; | ||
1689 | |||
1690 | trav->nfproto = (unsigned long)PDE_DATA(inode); | ||
1691 | return 0; | ||
1692 | } | ||
1693 | |||
1694 | static const struct file_operations xt_match_ops = { | ||
1695 | .open = xt_match_open, | ||
1696 | .read = seq_read, | ||
1697 | .llseek = seq_lseek, | ||
1698 | .release = seq_release_private, | ||
1699 | }; | ||
1700 | |||
1701 | static void *xt_target_seq_start(struct seq_file *seq, loff_t *pos) | 1657 | static void *xt_target_seq_start(struct seq_file *seq, loff_t *pos) |
1702 | { | 1658 | { |
1703 | return xt_mttg_seq_start(seq, pos, true); | 1659 | return xt_mttg_seq_start(seq, pos, true); |
@@ -1732,24 +1688,6 @@ static const struct seq_operations xt_target_seq_ops = { | |||
1732 | .show = xt_target_seq_show, | 1688 | .show = xt_target_seq_show, |
1733 | }; | 1689 | }; |
1734 | 1690 | ||
1735 | static int xt_target_open(struct inode *inode, struct file *file) | ||
1736 | { | ||
1737 | struct nf_mttg_trav *trav; | ||
1738 | trav = __seq_open_private(file, &xt_target_seq_ops, sizeof(*trav)); | ||
1739 | if (!trav) | ||
1740 | return -ENOMEM; | ||
1741 | |||
1742 | trav->nfproto = (unsigned long)PDE_DATA(inode); | ||
1743 | return 0; | ||
1744 | } | ||
1745 | |||
1746 | static const struct file_operations xt_target_ops = { | ||
1747 | .open = xt_target_open, | ||
1748 | .read = seq_read, | ||
1749 | .llseek = seq_lseek, | ||
1750 | .release = seq_release_private, | ||
1751 | }; | ||
1752 | |||
1753 | #define FORMAT_TABLES "_tables_names" | 1691 | #define FORMAT_TABLES "_tables_names" |
1754 | #define FORMAT_MATCHES "_tables_matches" | 1692 | #define FORMAT_MATCHES "_tables_matches" |
1755 | #define FORMAT_TARGETS "_tables_targets" | 1693 | #define FORMAT_TARGETS "_tables_targets" |
@@ -1813,8 +1751,9 @@ int xt_proto_init(struct net *net, u_int8_t af) | |||
1813 | 1751 | ||
1814 | strlcpy(buf, xt_prefix[af], sizeof(buf)); | 1752 | strlcpy(buf, xt_prefix[af], sizeof(buf)); |
1815 | strlcat(buf, FORMAT_TABLES, sizeof(buf)); | 1753 | strlcat(buf, FORMAT_TABLES, sizeof(buf)); |
1816 | proc = proc_create_data(buf, 0440, net->proc_net, &xt_table_ops, | 1754 | proc = proc_create_net_data(buf, 0440, net->proc_net, &xt_table_seq_ops, |
1817 | (void *)(unsigned long)af); | 1755 | sizeof(struct seq_net_private), |
1756 | (void *)(unsigned long)af); | ||
1818 | if (!proc) | 1757 | if (!proc) |
1819 | goto out; | 1758 | goto out; |
1820 | if (uid_valid(root_uid) && gid_valid(root_gid)) | 1759 | if (uid_valid(root_uid) && gid_valid(root_gid)) |
@@ -1822,8 +1761,9 @@ int xt_proto_init(struct net *net, u_int8_t af) | |||
1822 | 1761 | ||
1823 | strlcpy(buf, xt_prefix[af], sizeof(buf)); | 1762 | strlcpy(buf, xt_prefix[af], sizeof(buf)); |
1824 | strlcat(buf, FORMAT_MATCHES, sizeof(buf)); | 1763 | strlcat(buf, FORMAT_MATCHES, sizeof(buf)); |
1825 | proc = proc_create_data(buf, 0440, net->proc_net, &xt_match_ops, | 1764 | proc = proc_create_seq_private(buf, 0440, net->proc_net, |
1826 | (void *)(unsigned long)af); | 1765 | &xt_match_seq_ops, sizeof(struct nf_mttg_trav), |
1766 | (void *)(unsigned long)af); | ||
1827 | if (!proc) | 1767 | if (!proc) |
1828 | goto out_remove_tables; | 1768 | goto out_remove_tables; |
1829 | if (uid_valid(root_uid) && gid_valid(root_gid)) | 1769 | if (uid_valid(root_uid) && gid_valid(root_gid)) |
@@ -1831,8 +1771,9 @@ int xt_proto_init(struct net *net, u_int8_t af) | |||
1831 | 1771 | ||
1832 | strlcpy(buf, xt_prefix[af], sizeof(buf)); | 1772 | strlcpy(buf, xt_prefix[af], sizeof(buf)); |
1833 | strlcat(buf, FORMAT_TARGETS, sizeof(buf)); | 1773 | strlcat(buf, FORMAT_TARGETS, sizeof(buf)); |
1834 | proc = proc_create_data(buf, 0440, net->proc_net, &xt_target_ops, | 1774 | proc = proc_create_seq_private(buf, 0440, net->proc_net, |
1835 | (void *)(unsigned long)af); | 1775 | &xt_target_seq_ops, sizeof(struct nf_mttg_trav), |
1776 | (void *)(unsigned long)af); | ||
1836 | if (!proc) | 1777 | if (!proc) |
1837 | goto out_remove_matches; | 1778 | goto out_remove_matches; |
1838 | if (uid_valid(root_uid) && gid_valid(root_gid)) | 1779 | if (uid_valid(root_uid) && gid_valid(root_gid)) |
diff --git a/net/netfilter/xt_hashlimit.c b/net/netfilter/xt_hashlimit.c index 0cd73567e7ff..9b16402f29af 100644 --- a/net/netfilter/xt_hashlimit.c +++ b/net/netfilter/xt_hashlimit.c | |||
@@ -57,9 +57,9 @@ static inline struct hashlimit_net *hashlimit_pernet(struct net *net) | |||
57 | } | 57 | } |
58 | 58 | ||
59 | /* need to declare this at the top */ | 59 | /* need to declare this at the top */ |
60 | static const struct file_operations dl_file_ops_v2; | 60 | static const struct seq_operations dl_seq_ops_v2; |
61 | static const struct file_operations dl_file_ops_v1; | 61 | static const struct seq_operations dl_seq_ops_v1; |
62 | static const struct file_operations dl_file_ops; | 62 | static const struct seq_operations dl_seq_ops; |
63 | 63 | ||
64 | /* hash table crap */ | 64 | /* hash table crap */ |
65 | struct dsthash_dst { | 65 | struct dsthash_dst { |
@@ -272,7 +272,7 @@ static int htable_create(struct net *net, struct hashlimit_cfg3 *cfg, | |||
272 | { | 272 | { |
273 | struct hashlimit_net *hashlimit_net = hashlimit_pernet(net); | 273 | struct hashlimit_net *hashlimit_net = hashlimit_pernet(net); |
274 | struct xt_hashlimit_htable *hinfo; | 274 | struct xt_hashlimit_htable *hinfo; |
275 | const struct file_operations *fops; | 275 | const struct seq_operations *ops; |
276 | unsigned int size, i; | 276 | unsigned int size, i; |
277 | int ret; | 277 | int ret; |
278 | 278 | ||
@@ -321,19 +321,19 @@ static int htable_create(struct net *net, struct hashlimit_cfg3 *cfg, | |||
321 | 321 | ||
322 | switch (revision) { | 322 | switch (revision) { |
323 | case 1: | 323 | case 1: |
324 | fops = &dl_file_ops_v1; | 324 | ops = &dl_seq_ops_v1; |
325 | break; | 325 | break; |
326 | case 2: | 326 | case 2: |
327 | fops = &dl_file_ops_v2; | 327 | ops = &dl_seq_ops_v2; |
328 | break; | 328 | break; |
329 | default: | 329 | default: |
330 | fops = &dl_file_ops; | 330 | ops = &dl_seq_ops; |
331 | } | 331 | } |
332 | 332 | ||
333 | hinfo->pde = proc_create_data(name, 0, | 333 | hinfo->pde = proc_create_seq_data(name, 0, |
334 | (family == NFPROTO_IPV4) ? | 334 | (family == NFPROTO_IPV4) ? |
335 | hashlimit_net->ipt_hashlimit : hashlimit_net->ip6t_hashlimit, | 335 | hashlimit_net->ipt_hashlimit : hashlimit_net->ip6t_hashlimit, |
336 | fops, hinfo); | 336 | ops, hinfo); |
337 | if (hinfo->pde == NULL) { | 337 | if (hinfo->pde == NULL) { |
338 | kfree(hinfo->name); | 338 | kfree(hinfo->name); |
339 | vfree(hinfo); | 339 | vfree(hinfo); |
@@ -1057,7 +1057,7 @@ static struct xt_match hashlimit_mt_reg[] __read_mostly = { | |||
1057 | static void *dl_seq_start(struct seq_file *s, loff_t *pos) | 1057 | static void *dl_seq_start(struct seq_file *s, loff_t *pos) |
1058 | __acquires(htable->lock) | 1058 | __acquires(htable->lock) |
1059 | { | 1059 | { |
1060 | struct xt_hashlimit_htable *htable = s->private; | 1060 | struct xt_hashlimit_htable *htable = PDE_DATA(file_inode(s->private)); |
1061 | unsigned int *bucket; | 1061 | unsigned int *bucket; |
1062 | 1062 | ||
1063 | spin_lock_bh(&htable->lock); | 1063 | spin_lock_bh(&htable->lock); |
@@ -1074,7 +1074,7 @@ static void *dl_seq_start(struct seq_file *s, loff_t *pos) | |||
1074 | 1074 | ||
1075 | static void *dl_seq_next(struct seq_file *s, void *v, loff_t *pos) | 1075 | static void *dl_seq_next(struct seq_file *s, void *v, loff_t *pos) |
1076 | { | 1076 | { |
1077 | struct xt_hashlimit_htable *htable = s->private; | 1077 | struct xt_hashlimit_htable *htable = PDE_DATA(file_inode(s->private)); |
1078 | unsigned int *bucket = v; | 1078 | unsigned int *bucket = v; |
1079 | 1079 | ||
1080 | *pos = ++(*bucket); | 1080 | *pos = ++(*bucket); |
@@ -1088,7 +1088,7 @@ static void *dl_seq_next(struct seq_file *s, void *v, loff_t *pos) | |||
1088 | static void dl_seq_stop(struct seq_file *s, void *v) | 1088 | static void dl_seq_stop(struct seq_file *s, void *v) |
1089 | __releases(htable->lock) | 1089 | __releases(htable->lock) |
1090 | { | 1090 | { |
1091 | struct xt_hashlimit_htable *htable = s->private; | 1091 | struct xt_hashlimit_htable *htable = PDE_DATA(file_inode(s->private)); |
1092 | unsigned int *bucket = v; | 1092 | unsigned int *bucket = v; |
1093 | 1093 | ||
1094 | if (!IS_ERR(bucket)) | 1094 | if (!IS_ERR(bucket)) |
@@ -1130,7 +1130,7 @@ static void dl_seq_print(struct dsthash_ent *ent, u_int8_t family, | |||
1130 | static int dl_seq_real_show_v2(struct dsthash_ent *ent, u_int8_t family, | 1130 | static int dl_seq_real_show_v2(struct dsthash_ent *ent, u_int8_t family, |
1131 | struct seq_file *s) | 1131 | struct seq_file *s) |
1132 | { | 1132 | { |
1133 | const struct xt_hashlimit_htable *ht = s->private; | 1133 | struct xt_hashlimit_htable *ht = PDE_DATA(file_inode(s->private)); |
1134 | 1134 | ||
1135 | spin_lock(&ent->lock); | 1135 | spin_lock(&ent->lock); |
1136 | /* recalculate to show accurate numbers */ | 1136 | /* recalculate to show accurate numbers */ |
@@ -1145,7 +1145,7 @@ static int dl_seq_real_show_v2(struct dsthash_ent *ent, u_int8_t family, | |||
1145 | static int dl_seq_real_show_v1(struct dsthash_ent *ent, u_int8_t family, | 1145 | static int dl_seq_real_show_v1(struct dsthash_ent *ent, u_int8_t family, |
1146 | struct seq_file *s) | 1146 | struct seq_file *s) |
1147 | { | 1147 | { |
1148 | const struct xt_hashlimit_htable *ht = s->private; | 1148 | struct xt_hashlimit_htable *ht = PDE_DATA(file_inode(s->private)); |
1149 | 1149 | ||
1150 | spin_lock(&ent->lock); | 1150 | spin_lock(&ent->lock); |
1151 | /* recalculate to show accurate numbers */ | 1151 | /* recalculate to show accurate numbers */ |
@@ -1160,7 +1160,7 @@ static int dl_seq_real_show_v1(struct dsthash_ent *ent, u_int8_t family, | |||
1160 | static int dl_seq_real_show(struct dsthash_ent *ent, u_int8_t family, | 1160 | static int dl_seq_real_show(struct dsthash_ent *ent, u_int8_t family, |
1161 | struct seq_file *s) | 1161 | struct seq_file *s) |
1162 | { | 1162 | { |
1163 | const struct xt_hashlimit_htable *ht = s->private; | 1163 | struct xt_hashlimit_htable *ht = PDE_DATA(file_inode(s->private)); |
1164 | 1164 | ||
1165 | spin_lock(&ent->lock); | 1165 | spin_lock(&ent->lock); |
1166 | /* recalculate to show accurate numbers */ | 1166 | /* recalculate to show accurate numbers */ |
@@ -1174,7 +1174,7 @@ static int dl_seq_real_show(struct dsthash_ent *ent, u_int8_t family, | |||
1174 | 1174 | ||
1175 | static int dl_seq_show_v2(struct seq_file *s, void *v) | 1175 | static int dl_seq_show_v2(struct seq_file *s, void *v) |
1176 | { | 1176 | { |
1177 | struct xt_hashlimit_htable *htable = s->private; | 1177 | struct xt_hashlimit_htable *htable = PDE_DATA(file_inode(s->private)); |
1178 | unsigned int *bucket = (unsigned int *)v; | 1178 | unsigned int *bucket = (unsigned int *)v; |
1179 | struct dsthash_ent *ent; | 1179 | struct dsthash_ent *ent; |
1180 | 1180 | ||
@@ -1188,7 +1188,7 @@ static int dl_seq_show_v2(struct seq_file *s, void *v) | |||
1188 | 1188 | ||
1189 | static int dl_seq_show_v1(struct seq_file *s, void *v) | 1189 | static int dl_seq_show_v1(struct seq_file *s, void *v) |
1190 | { | 1190 | { |
1191 | struct xt_hashlimit_htable *htable = s->private; | 1191 | struct xt_hashlimit_htable *htable = PDE_DATA(file_inode(s->private)); |
1192 | unsigned int *bucket = v; | 1192 | unsigned int *bucket = v; |
1193 | struct dsthash_ent *ent; | 1193 | struct dsthash_ent *ent; |
1194 | 1194 | ||
@@ -1202,7 +1202,7 @@ static int dl_seq_show_v1(struct seq_file *s, void *v) | |||
1202 | 1202 | ||
1203 | static int dl_seq_show(struct seq_file *s, void *v) | 1203 | static int dl_seq_show(struct seq_file *s, void *v) |
1204 | { | 1204 | { |
1205 | struct xt_hashlimit_htable *htable = s->private; | 1205 | struct xt_hashlimit_htable *htable = PDE_DATA(file_inode(s->private)); |
1206 | unsigned int *bucket = v; | 1206 | unsigned int *bucket = v; |
1207 | struct dsthash_ent *ent; | 1207 | struct dsthash_ent *ent; |
1208 | 1208 | ||
@@ -1235,62 +1235,6 @@ static const struct seq_operations dl_seq_ops = { | |||
1235 | .show = dl_seq_show | 1235 | .show = dl_seq_show |
1236 | }; | 1236 | }; |
1237 | 1237 | ||
1238 | static int dl_proc_open_v2(struct inode *inode, struct file *file) | ||
1239 | { | ||
1240 | int ret = seq_open(file, &dl_seq_ops_v2); | ||
1241 | |||
1242 | if (!ret) { | ||
1243 | struct seq_file *sf = file->private_data; | ||
1244 | |||
1245 | sf->private = PDE_DATA(inode); | ||
1246 | } | ||
1247 | return ret; | ||
1248 | } | ||
1249 | |||
1250 | static int dl_proc_open_v1(struct inode *inode, struct file *file) | ||
1251 | { | ||
1252 | int ret = seq_open(file, &dl_seq_ops_v1); | ||
1253 | |||
1254 | if (!ret) { | ||
1255 | struct seq_file *sf = file->private_data; | ||
1256 | sf->private = PDE_DATA(inode); | ||
1257 | } | ||
1258 | return ret; | ||
1259 | } | ||
1260 | |||
1261 | static int dl_proc_open(struct inode *inode, struct file *file) | ||
1262 | { | ||
1263 | int ret = seq_open(file, &dl_seq_ops); | ||
1264 | |||
1265 | if (!ret) { | ||
1266 | struct seq_file *sf = file->private_data; | ||
1267 | |||
1268 | sf->private = PDE_DATA(inode); | ||
1269 | } | ||
1270 | return ret; | ||
1271 | } | ||
1272 | |||
1273 | static const struct file_operations dl_file_ops_v2 = { | ||
1274 | .open = dl_proc_open_v2, | ||
1275 | .read = seq_read, | ||
1276 | .llseek = seq_lseek, | ||
1277 | .release = seq_release | ||
1278 | }; | ||
1279 | |||
1280 | static const struct file_operations dl_file_ops_v1 = { | ||
1281 | .open = dl_proc_open_v1, | ||
1282 | .read = seq_read, | ||
1283 | .llseek = seq_lseek, | ||
1284 | .release = seq_release | ||
1285 | }; | ||
1286 | |||
1287 | static const struct file_operations dl_file_ops = { | ||
1288 | .open = dl_proc_open, | ||
1289 | .read = seq_read, | ||
1290 | .llseek = seq_lseek, | ||
1291 | .release = seq_release | ||
1292 | }; | ||
1293 | |||
1294 | static int __net_init hashlimit_proc_net_init(struct net *net) | 1238 | static int __net_init hashlimit_proc_net_init(struct net *net) |
1295 | { | 1239 | { |
1296 | struct hashlimit_net *hashlimit_net = hashlimit_pernet(net); | 1240 | struct hashlimit_net *hashlimit_net = hashlimit_pernet(net); |
diff --git a/net/netlink/af_netlink.c b/net/netlink/af_netlink.c index 2e2dd88fc79f..393573a99a5a 100644 --- a/net/netlink/af_netlink.c +++ b/net/netlink/af_netlink.c | |||
@@ -2635,21 +2635,6 @@ static const struct seq_operations netlink_seq_ops = { | |||
2635 | .stop = netlink_seq_stop, | 2635 | .stop = netlink_seq_stop, |
2636 | .show = netlink_seq_show, | 2636 | .show = netlink_seq_show, |
2637 | }; | 2637 | }; |
2638 | |||
2639 | |||
2640 | static int netlink_seq_open(struct inode *inode, struct file *file) | ||
2641 | { | ||
2642 | return seq_open_net(inode, file, &netlink_seq_ops, | ||
2643 | sizeof(struct nl_seq_iter)); | ||
2644 | } | ||
2645 | |||
2646 | static const struct file_operations netlink_seq_fops = { | ||
2647 | .open = netlink_seq_open, | ||
2648 | .read = seq_read, | ||
2649 | .llseek = seq_lseek, | ||
2650 | .release = seq_release_net, | ||
2651 | }; | ||
2652 | |||
2653 | #endif | 2638 | #endif |
2654 | 2639 | ||
2655 | int netlink_register_notifier(struct notifier_block *nb) | 2640 | int netlink_register_notifier(struct notifier_block *nb) |
@@ -2694,7 +2679,8 @@ static const struct net_proto_family netlink_family_ops = { | |||
2694 | static int __net_init netlink_net_init(struct net *net) | 2679 | static int __net_init netlink_net_init(struct net *net) |
2695 | { | 2680 | { |
2696 | #ifdef CONFIG_PROC_FS | 2681 | #ifdef CONFIG_PROC_FS |
2697 | if (!proc_create("netlink", 0, net->proc_net, &netlink_seq_fops)) | 2682 | if (!proc_create_net("netlink", 0, net->proc_net, &netlink_seq_ops, |
2683 | sizeof(struct nl_seq_iter))) | ||
2698 | return -ENOMEM; | 2684 | return -ENOMEM; |
2699 | #endif | 2685 | #endif |
2700 | return 0; | 2686 | return 0; |
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/packet/af_packet.c b/net/packet/af_packet.c index acb7b86574cd..f9cdd27a7f6f 100644 --- a/net/packet/af_packet.c +++ b/net/packet/af_packet.c | |||
@@ -4556,20 +4556,6 @@ static const struct seq_operations packet_seq_ops = { | |||
4556 | .stop = packet_seq_stop, | 4556 | .stop = packet_seq_stop, |
4557 | .show = packet_seq_show, | 4557 | .show = packet_seq_show, |
4558 | }; | 4558 | }; |
4559 | |||
4560 | static int packet_seq_open(struct inode *inode, struct file *file) | ||
4561 | { | ||
4562 | return seq_open_net(inode, file, &packet_seq_ops, | ||
4563 | sizeof(struct seq_net_private)); | ||
4564 | } | ||
4565 | |||
4566 | static const struct file_operations packet_seq_fops = { | ||
4567 | .open = packet_seq_open, | ||
4568 | .read = seq_read, | ||
4569 | .llseek = seq_lseek, | ||
4570 | .release = seq_release_net, | ||
4571 | }; | ||
4572 | |||
4573 | #endif | 4559 | #endif |
4574 | 4560 | ||
4575 | static int __net_init packet_net_init(struct net *net) | 4561 | static int __net_init packet_net_init(struct net *net) |
@@ -4577,7 +4563,8 @@ static int __net_init packet_net_init(struct net *net) | |||
4577 | mutex_init(&net->packet.sklist_lock); | 4563 | mutex_init(&net->packet.sklist_lock); |
4578 | INIT_HLIST_HEAD(&net->packet.sklist); | 4564 | INIT_HLIST_HEAD(&net->packet.sklist); |
4579 | 4565 | ||
4580 | if (!proc_create("packet", 0, net->proc_net, &packet_seq_fops)) | 4566 | if (!proc_create_net("packet", 0, net->proc_net, &packet_seq_ops, |
4567 | sizeof(struct seq_net_private))) | ||
4581 | return -ENOMEM; | 4568 | return -ENOMEM; |
4582 | 4569 | ||
4583 | return 0; | 4570 | return 0; |
diff --git a/net/phonet/pn_dev.c b/net/phonet/pn_dev.c index 77787512fc32..6cb4f602ab71 100644 --- a/net/phonet/pn_dev.c +++ b/net/phonet/pn_dev.c | |||
@@ -320,7 +320,8 @@ static int __net_init phonet_init_net(struct net *net) | |||
320 | { | 320 | { |
321 | struct phonet_net *pnn = phonet_pernet(net); | 321 | struct phonet_net *pnn = phonet_pernet(net); |
322 | 322 | ||
323 | if (!proc_create("phonet", 0, net->proc_net, &pn_sock_seq_fops)) | 323 | if (!proc_create_net("phonet", 0, net->proc_net, &pn_sock_seq_ops, |
324 | sizeof(struct seq_net_private))) | ||
324 | return -ENOMEM; | 325 | return -ENOMEM; |
325 | 326 | ||
326 | INIT_LIST_HEAD(&pnn->pndevs.list); | 327 | INIT_LIST_HEAD(&pnn->pndevs.list); |
@@ -351,7 +352,8 @@ int __init phonet_device_init(void) | |||
351 | if (err) | 352 | if (err) |
352 | return err; | 353 | return err; |
353 | 354 | ||
354 | proc_create("pnresource", 0, init_net.proc_net, &pn_res_seq_fops); | 355 | proc_create_net("pnresource", 0, init_net.proc_net, &pn_res_seq_ops, |
356 | sizeof(struct seq_net_private)); | ||
355 | register_netdevice_notifier(&phonet_device_notifier); | 357 | register_netdevice_notifier(&phonet_device_notifier); |
356 | err = phonet_netlink_register(); | 358 | err = phonet_netlink_register(); |
357 | if (err) | 359 | if (err) |
diff --git a/net/phonet/socket.c b/net/phonet/socket.c index f9b40e6a18a5..30187990257f 100644 --- a/net/phonet/socket.c +++ b/net/phonet/socket.c | |||
@@ -620,25 +620,12 @@ static int pn_sock_seq_show(struct seq_file *seq, void *v) | |||
620 | return 0; | 620 | return 0; |
621 | } | 621 | } |
622 | 622 | ||
623 | static const struct seq_operations pn_sock_seq_ops = { | 623 | const struct seq_operations pn_sock_seq_ops = { |
624 | .start = pn_sock_seq_start, | 624 | .start = pn_sock_seq_start, |
625 | .next = pn_sock_seq_next, | 625 | .next = pn_sock_seq_next, |
626 | .stop = pn_sock_seq_stop, | 626 | .stop = pn_sock_seq_stop, |
627 | .show = pn_sock_seq_show, | 627 | .show = pn_sock_seq_show, |
628 | }; | 628 | }; |
629 | |||
630 | static int pn_sock_open(struct inode *inode, struct file *file) | ||
631 | { | ||
632 | return seq_open_net(inode, file, &pn_sock_seq_ops, | ||
633 | sizeof(struct seq_net_private)); | ||
634 | } | ||
635 | |||
636 | const struct file_operations pn_sock_seq_fops = { | ||
637 | .open = pn_sock_open, | ||
638 | .read = seq_read, | ||
639 | .llseek = seq_lseek, | ||
640 | .release = seq_release_net, | ||
641 | }; | ||
642 | #endif | 629 | #endif |
643 | 630 | ||
644 | static struct { | 631 | static struct { |
@@ -802,23 +789,10 @@ static int pn_res_seq_show(struct seq_file *seq, void *v) | |||
802 | return 0; | 789 | return 0; |
803 | } | 790 | } |
804 | 791 | ||
805 | static const struct seq_operations pn_res_seq_ops = { | 792 | const struct seq_operations pn_res_seq_ops = { |
806 | .start = pn_res_seq_start, | 793 | .start = pn_res_seq_start, |
807 | .next = pn_res_seq_next, | 794 | .next = pn_res_seq_next, |
808 | .stop = pn_res_seq_stop, | 795 | .stop = pn_res_seq_stop, |
809 | .show = pn_res_seq_show, | 796 | .show = pn_res_seq_show, |
810 | }; | 797 | }; |
811 | |||
812 | static int pn_res_open(struct inode *inode, struct file *file) | ||
813 | { | ||
814 | return seq_open_net(inode, file, &pn_res_seq_ops, | ||
815 | sizeof(struct seq_net_private)); | ||
816 | } | ||
817 | |||
818 | const struct file_operations pn_res_seq_fops = { | ||
819 | .open = pn_res_open, | ||
820 | .read = seq_read, | ||
821 | .llseek = seq_lseek, | ||
822 | .release = seq_release_net, | ||
823 | }; | ||
824 | #endif | 798 | #endif |
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/rxrpc/ar-internal.h b/net/rxrpc/ar-internal.h index 19975d2ca9a2..29923ec2189c 100644 --- a/net/rxrpc/ar-internal.h +++ b/net/rxrpc/ar-internal.h | |||
@@ -1051,8 +1051,8 @@ void __rxrpc_queue_peer_error(struct rxrpc_peer *); | |||
1051 | /* | 1051 | /* |
1052 | * proc.c | 1052 | * proc.c |
1053 | */ | 1053 | */ |
1054 | extern const struct file_operations rxrpc_call_seq_fops; | 1054 | extern const struct seq_operations rxrpc_call_seq_ops; |
1055 | extern const struct file_operations rxrpc_connection_seq_fops; | 1055 | extern const struct seq_operations rxrpc_connection_seq_ops; |
1056 | 1056 | ||
1057 | /* | 1057 | /* |
1058 | * recvmsg.c | 1058 | * recvmsg.c |
diff --git a/net/rxrpc/net_ns.c b/net/rxrpc/net_ns.c index c7a023fb22d0..5d6a773db973 100644 --- a/net/rxrpc/net_ns.c +++ b/net/rxrpc/net_ns.c | |||
@@ -97,8 +97,11 @@ static __net_init int rxrpc_init_net(struct net *net) | |||
97 | if (!rxnet->proc_net) | 97 | if (!rxnet->proc_net) |
98 | goto err_proc; | 98 | goto err_proc; |
99 | 99 | ||
100 | proc_create("calls", 0444, rxnet->proc_net, &rxrpc_call_seq_fops); | 100 | proc_create_net("calls", 0444, rxnet->proc_net, &rxrpc_call_seq_ops, |
101 | proc_create("conns", 0444, rxnet->proc_net, &rxrpc_connection_seq_fops); | 101 | sizeof(struct seq_net_private)); |
102 | proc_create_net("conns", 0444, rxnet->proc_net, | ||
103 | &rxrpc_connection_seq_ops, | ||
104 | sizeof(struct seq_net_private)); | ||
102 | return 0; | 105 | return 0; |
103 | 106 | ||
104 | err_proc: | 107 | err_proc: |
diff --git a/net/rxrpc/proc.c b/net/rxrpc/proc.c index 7e45db058823..d9fca8c4bcdc 100644 --- a/net/rxrpc/proc.c +++ b/net/rxrpc/proc.c | |||
@@ -115,26 +115,13 @@ static int rxrpc_call_seq_show(struct seq_file *seq, void *v) | |||
115 | return 0; | 115 | return 0; |
116 | } | 116 | } |
117 | 117 | ||
118 | static const struct seq_operations rxrpc_call_seq_ops = { | 118 | const struct seq_operations rxrpc_call_seq_ops = { |
119 | .start = rxrpc_call_seq_start, | 119 | .start = rxrpc_call_seq_start, |
120 | .next = rxrpc_call_seq_next, | 120 | .next = rxrpc_call_seq_next, |
121 | .stop = rxrpc_call_seq_stop, | 121 | .stop = rxrpc_call_seq_stop, |
122 | .show = rxrpc_call_seq_show, | 122 | .show = rxrpc_call_seq_show, |
123 | }; | 123 | }; |
124 | 124 | ||
125 | static int rxrpc_call_seq_open(struct inode *inode, struct file *file) | ||
126 | { | ||
127 | return seq_open_net(inode, file, &rxrpc_call_seq_ops, | ||
128 | sizeof(struct seq_net_private)); | ||
129 | } | ||
130 | |||
131 | const struct file_operations rxrpc_call_seq_fops = { | ||
132 | .open = rxrpc_call_seq_open, | ||
133 | .read = seq_read, | ||
134 | .llseek = seq_lseek, | ||
135 | .release = seq_release, | ||
136 | }; | ||
137 | |||
138 | /* | 125 | /* |
139 | * generate a list of extant virtual connections in /proc/net/rxrpc_conns | 126 | * generate a list of extant virtual connections in /proc/net/rxrpc_conns |
140 | */ | 127 | */ |
@@ -207,23 +194,9 @@ print: | |||
207 | return 0; | 194 | return 0; |
208 | } | 195 | } |
209 | 196 | ||
210 | static const struct seq_operations rxrpc_connection_seq_ops = { | 197 | const struct seq_operations rxrpc_connection_seq_ops = { |
211 | .start = rxrpc_connection_seq_start, | 198 | .start = rxrpc_connection_seq_start, |
212 | .next = rxrpc_connection_seq_next, | 199 | .next = rxrpc_connection_seq_next, |
213 | .stop = rxrpc_connection_seq_stop, | 200 | .stop = rxrpc_connection_seq_stop, |
214 | .show = rxrpc_connection_seq_show, | 201 | .show = rxrpc_connection_seq_show, |
215 | }; | 202 | }; |
216 | |||
217 | |||
218 | static int rxrpc_connection_seq_open(struct inode *inode, struct file *file) | ||
219 | { | ||
220 | return seq_open_net(inode, file, &rxrpc_connection_seq_ops, | ||
221 | sizeof(struct seq_net_private)); | ||
222 | } | ||
223 | |||
224 | const struct file_operations rxrpc_connection_seq_fops = { | ||
225 | .open = rxrpc_connection_seq_open, | ||
226 | .read = seq_read, | ||
227 | .llseek = seq_lseek, | ||
228 | .release = seq_release, | ||
229 | }; | ||
diff --git a/net/sched/sch_api.c b/net/sched/sch_api.c index 106dae7e4818..54eca685420f 100644 --- a/net/sched/sch_api.c +++ b/net/sched/sch_api.c | |||
@@ -2092,23 +2092,11 @@ static int psched_show(struct seq_file *seq, void *v) | |||
2092 | return 0; | 2092 | return 0; |
2093 | } | 2093 | } |
2094 | 2094 | ||
2095 | static int psched_open(struct inode *inode, struct file *file) | ||
2096 | { | ||
2097 | return single_open(file, psched_show, NULL); | ||
2098 | } | ||
2099 | |||
2100 | static const struct file_operations psched_fops = { | ||
2101 | .open = psched_open, | ||
2102 | .read = seq_read, | ||
2103 | .llseek = seq_lseek, | ||
2104 | .release = single_release, | ||
2105 | }; | ||
2106 | |||
2107 | static int __net_init psched_net_init(struct net *net) | 2095 | static int __net_init psched_net_init(struct net *net) |
2108 | { | 2096 | { |
2109 | struct proc_dir_entry *e; | 2097 | struct proc_dir_entry *e; |
2110 | 2098 | ||
2111 | e = proc_create("psched", 0, net->proc_net, &psched_fops); | 2099 | e = proc_create_single("psched", 0, net->proc_net, psched_show); |
2112 | if (e == NULL) | 2100 | if (e == NULL) |
2113 | return -ENOMEM; | 2101 | return -ENOMEM; |
2114 | 2102 | ||
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/sctp/proc.c b/net/sctp/proc.c index 1d9ccc6dab2b..ef5c9a82d4e8 100644 --- a/net/sctp/proc.c +++ b/net/sctp/proc.c | |||
@@ -88,19 +88,6 @@ static int sctp_snmp_seq_show(struct seq_file *seq, void *v) | |||
88 | return 0; | 88 | return 0; |
89 | } | 89 | } |
90 | 90 | ||
91 | /* Initialize the seq file operations for 'snmp' object. */ | ||
92 | static int sctp_snmp_seq_open(struct inode *inode, struct file *file) | ||
93 | { | ||
94 | return single_open_net(inode, file, sctp_snmp_seq_show); | ||
95 | } | ||
96 | |||
97 | static const struct file_operations sctp_snmp_seq_fops = { | ||
98 | .open = sctp_snmp_seq_open, | ||
99 | .read = seq_read, | ||
100 | .llseek = seq_lseek, | ||
101 | .release = single_release_net, | ||
102 | }; | ||
103 | |||
104 | /* Dump local addresses of an association/endpoint. */ | 91 | /* Dump local addresses of an association/endpoint. */ |
105 | static void sctp_seq_dump_local_addrs(struct seq_file *seq, struct sctp_ep_common *epb) | 92 | static void sctp_seq_dump_local_addrs(struct seq_file *seq, struct sctp_ep_common *epb) |
106 | { | 93 | { |
@@ -225,21 +212,6 @@ static const struct seq_operations sctp_eps_ops = { | |||
225 | .show = sctp_eps_seq_show, | 212 | .show = sctp_eps_seq_show, |
226 | }; | 213 | }; |
227 | 214 | ||
228 | |||
229 | /* Initialize the seq file operations for 'eps' object. */ | ||
230 | static int sctp_eps_seq_open(struct inode *inode, struct file *file) | ||
231 | { | ||
232 | return seq_open_net(inode, file, &sctp_eps_ops, | ||
233 | sizeof(struct seq_net_private)); | ||
234 | } | ||
235 | |||
236 | static const struct file_operations sctp_eps_seq_fops = { | ||
237 | .open = sctp_eps_seq_open, | ||
238 | .read = seq_read, | ||
239 | .llseek = seq_lseek, | ||
240 | .release = seq_release_net, | ||
241 | }; | ||
242 | |||
243 | struct sctp_ht_iter { | 215 | struct sctp_ht_iter { |
244 | struct seq_net_private p; | 216 | struct seq_net_private p; |
245 | struct rhashtable_iter hti; | 217 | struct rhashtable_iter hti; |
@@ -338,20 +310,6 @@ static const struct seq_operations sctp_assoc_ops = { | |||
338 | .show = sctp_assocs_seq_show, | 310 | .show = sctp_assocs_seq_show, |
339 | }; | 311 | }; |
340 | 312 | ||
341 | /* Initialize the seq file operations for 'assocs' object. */ | ||
342 | static int sctp_assocs_seq_open(struct inode *inode, struct file *file) | ||
343 | { | ||
344 | return seq_open_net(inode, file, &sctp_assoc_ops, | ||
345 | sizeof(struct sctp_ht_iter)); | ||
346 | } | ||
347 | |||
348 | static const struct file_operations sctp_assocs_seq_fops = { | ||
349 | .open = sctp_assocs_seq_open, | ||
350 | .read = seq_read, | ||
351 | .llseek = seq_lseek, | ||
352 | .release = seq_release_net, | ||
353 | }; | ||
354 | |||
355 | static int sctp_remaddr_seq_show(struct seq_file *seq, void *v) | 313 | static int sctp_remaddr_seq_show(struct seq_file *seq, void *v) |
356 | { | 314 | { |
357 | struct sctp_association *assoc; | 315 | struct sctp_association *assoc; |
@@ -431,36 +389,23 @@ static const struct seq_operations sctp_remaddr_ops = { | |||
431 | .show = sctp_remaddr_seq_show, | 389 | .show = sctp_remaddr_seq_show, |
432 | }; | 390 | }; |
433 | 391 | ||
434 | static int sctp_remaddr_seq_open(struct inode *inode, struct file *file) | ||
435 | { | ||
436 | return seq_open_net(inode, file, &sctp_remaddr_ops, | ||
437 | sizeof(struct sctp_ht_iter)); | ||
438 | } | ||
439 | |||
440 | static const struct file_operations sctp_remaddr_seq_fops = { | ||
441 | .open = sctp_remaddr_seq_open, | ||
442 | .read = seq_read, | ||
443 | .llseek = seq_lseek, | ||
444 | .release = seq_release_net, | ||
445 | }; | ||
446 | |||
447 | /* Set up the proc fs entry for the SCTP protocol. */ | 392 | /* Set up the proc fs entry for the SCTP protocol. */ |
448 | int __net_init sctp_proc_init(struct net *net) | 393 | int __net_init sctp_proc_init(struct net *net) |
449 | { | 394 | { |
450 | net->sctp.proc_net_sctp = proc_net_mkdir(net, "sctp", net->proc_net); | 395 | net->sctp.proc_net_sctp = proc_net_mkdir(net, "sctp", net->proc_net); |
451 | if (!net->sctp.proc_net_sctp) | 396 | if (!net->sctp.proc_net_sctp) |
452 | return -ENOMEM; | 397 | return -ENOMEM; |
453 | if (!proc_create("snmp", 0444, net->sctp.proc_net_sctp, | 398 | if (!proc_create_net_single("snmp", 0444, net->sctp.proc_net_sctp, |
454 | &sctp_snmp_seq_fops)) | 399 | sctp_snmp_seq_show, NULL)) |
455 | goto cleanup; | 400 | goto cleanup; |
456 | if (!proc_create("eps", 0444, net->sctp.proc_net_sctp, | 401 | if (!proc_create_net("eps", 0444, net->sctp.proc_net_sctp, |
457 | &sctp_eps_seq_fops)) | 402 | &sctp_eps_ops, sizeof(struct seq_net_private))) |
458 | goto cleanup; | 403 | goto cleanup; |
459 | if (!proc_create("assocs", 0444, net->sctp.proc_net_sctp, | 404 | if (!proc_create_net("assocs", 0444, net->sctp.proc_net_sctp, |
460 | &sctp_assocs_seq_fops)) | 405 | &sctp_assoc_ops, sizeof(struct sctp_ht_iter))) |
461 | goto cleanup; | 406 | goto cleanup; |
462 | if (!proc_create("remaddr", 0444, net->sctp.proc_net_sctp, | 407 | if (!proc_create_net("remaddr", 0444, net->sctp.proc_net_sctp, |
463 | &sctp_remaddr_seq_fops)) | 408 | &sctp_remaddr_ops, sizeof(struct sctp_ht_iter))) |
464 | goto cleanup; | 409 | goto cleanup; |
465 | return 0; | 410 | return 0; |
466 | 411 | ||
diff --git a/net/unix/af_unix.c b/net/unix/af_unix.c index 68bb70a62afe..e5473c03d667 100644 --- a/net/unix/af_unix.c +++ b/net/unix/af_unix.c | |||
@@ -2852,20 +2852,6 @@ static const struct seq_operations unix_seq_ops = { | |||
2852 | .stop = unix_seq_stop, | 2852 | .stop = unix_seq_stop, |
2853 | .show = unix_seq_show, | 2853 | .show = unix_seq_show, |
2854 | }; | 2854 | }; |
2855 | |||
2856 | static int unix_seq_open(struct inode *inode, struct file *file) | ||
2857 | { | ||
2858 | return seq_open_net(inode, file, &unix_seq_ops, | ||
2859 | sizeof(struct seq_net_private)); | ||
2860 | } | ||
2861 | |||
2862 | static const struct file_operations unix_seq_fops = { | ||
2863 | .open = unix_seq_open, | ||
2864 | .read = seq_read, | ||
2865 | .llseek = seq_lseek, | ||
2866 | .release = seq_release_net, | ||
2867 | }; | ||
2868 | |||
2869 | #endif | 2855 | #endif |
2870 | 2856 | ||
2871 | static const struct net_proto_family unix_family_ops = { | 2857 | static const struct net_proto_family unix_family_ops = { |
@@ -2884,7 +2870,8 @@ static int __net_init unix_net_init(struct net *net) | |||
2884 | goto out; | 2870 | goto out; |
2885 | 2871 | ||
2886 | #ifdef CONFIG_PROC_FS | 2872 | #ifdef CONFIG_PROC_FS |
2887 | if (!proc_create("unix", 0, net->proc_net, &unix_seq_fops)) { | 2873 | if (!proc_create_net("unix", 0, net->proc_net, &unix_seq_ops, |
2874 | sizeof(struct seq_net_private))) { | ||
2888 | unix_sysctl_unregister(net); | 2875 | unix_sysctl_unregister(net); |
2889 | goto out; | 2876 | goto out; |
2890 | } | 2877 | } |
diff --git a/net/wireless/wext-proc.c b/net/wireless/wext-proc.c index b4c464594a5e..cadcf8613af2 100644 --- a/net/wireless/wext-proc.c +++ b/net/wireless/wext-proc.c | |||
@@ -126,24 +126,11 @@ static const struct seq_operations wireless_seq_ops = { | |||
126 | .show = wireless_dev_seq_show, | 126 | .show = wireless_dev_seq_show, |
127 | }; | 127 | }; |
128 | 128 | ||
129 | static int seq_open_wireless(struct inode *inode, struct file *file) | ||
130 | { | ||
131 | return seq_open_net(inode, file, &wireless_seq_ops, | ||
132 | sizeof(struct seq_net_private)); | ||
133 | } | ||
134 | |||
135 | static const struct file_operations wireless_seq_fops = { | ||
136 | .open = seq_open_wireless, | ||
137 | .read = seq_read, | ||
138 | .llseek = seq_lseek, | ||
139 | .release = seq_release_net, | ||
140 | }; | ||
141 | |||
142 | int __net_init wext_proc_init(struct net *net) | 129 | int __net_init wext_proc_init(struct net *net) |
143 | { | 130 | { |
144 | /* Create /proc/net/wireless entry */ | 131 | /* Create /proc/net/wireless entry */ |
145 | if (!proc_create("wireless", 0444, net->proc_net, | 132 | if (!proc_create_net("wireless", 0444, net->proc_net, |
146 | &wireless_seq_fops)) | 133 | &wireless_seq_ops, sizeof(struct seq_net_private))) |
147 | return -ENOMEM; | 134 | return -ENOMEM; |
148 | 135 | ||
149 | return 0; | 136 | return 0; |
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/net/xfrm/xfrm_proc.c b/net/xfrm/xfrm_proc.c index ed06903cd84d..178318d2e120 100644 --- a/net/xfrm/xfrm_proc.c +++ b/net/xfrm/xfrm_proc.c | |||
@@ -65,22 +65,10 @@ static int xfrm_statistics_seq_show(struct seq_file *seq, void *v) | |||
65 | return 0; | 65 | return 0; |
66 | } | 66 | } |
67 | 67 | ||
68 | static int xfrm_statistics_seq_open(struct inode *inode, struct file *file) | ||
69 | { | ||
70 | return single_open_net(inode, file, xfrm_statistics_seq_show); | ||
71 | } | ||
72 | |||
73 | static const struct file_operations xfrm_statistics_seq_fops = { | ||
74 | .open = xfrm_statistics_seq_open, | ||
75 | .read = seq_read, | ||
76 | .llseek = seq_lseek, | ||
77 | .release = single_release_net, | ||
78 | }; | ||
79 | |||
80 | int __net_init xfrm_proc_init(struct net *net) | 68 | int __net_init xfrm_proc_init(struct net *net) |
81 | { | 69 | { |
82 | if (!proc_create("xfrm_stat", 0444, net->proc_net, | 70 | if (!proc_create_net_single("xfrm_stat", 0444, net->proc_net, |
83 | &xfrm_statistics_seq_fops)) | 71 | xfrm_statistics_seq_show, NULL)) |
84 | return -ENOMEM; | 72 | return -ENOMEM; |
85 | return 0; | 73 | return 0; |
86 | } | 74 | } |
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 | { |