Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

proc: introduce proc_create_seq{,_data}

Variants of proc_create{,_data} that directly take a struct seq_operations
argument and drastically reduces the boilerplate code in the callers.

All trivial callers converted over.

Signed-off-by: Christoph Hellwig <hch@lst.de>

+151 -925
+1 -14
arch/ia64/hp/common/sba_iommu.c
··· 1942 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 1945 static void __init 1959 1946 ioc_proc_init(void) 1960 1947 { ··· 1951 1964 if (!dir) 1952 1965 return; 1953 1966 1954 - proc_create(ioc_list->name, 0, dir, &ioc_fops); 1967 + proc_create_seq(ioc_list->name, 0, dir, &ioc_seq_ops); 1955 1968 } 1956 1969 #endif 1957 1970
+1 -15
arch/ia64/kernel/perfmon.c
··· 5708 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 5712 * we come here as soon as local_cpu_data->pfm_syst_wide is set. this happens 5720 5713 * during pfm_enable() hence before pfm_start(). We cannot assume monitoring ··· 6530 6537 return 0; 6531 6538 } 6532 6539 6533 - static const struct file_operations pfm_proc_fops = { 6534 - .open = pfm_proc_open, 6535 - .read = seq_read, 6536 - .llseek = seq_lseek, 6537 - .release = seq_release, 6538 - }; 6539 - 6540 6540 int __init 6541 6541 pfm_init(void) 6542 6542 { ··· 6601 6615 /* 6602 6616 * create /proc/perfmon (mostly for debugging purposes) 6603 6617 */ 6604 - perfmon_dir = proc_create("perfmon", S_IRUGO, NULL, &pfm_proc_fops); 6618 + perfmon_dir = proc_create_seq("perfmon", S_IRUGO, NULL, &pfm_seq_ops); 6605 6619 if (perfmon_dir == NULL) { 6606 6620 printk(KERN_ERR "perfmon: cannot create /proc entry, perfmon disabled\n"); 6607 6621 pmu_conf = NULL;
+1 -13
arch/s390/kernel/sysinfo.c
··· 386 386 .show = service_level_show 387 387 }; 388 388 389 - static int service_level_open(struct inode *inode, struct file *file) 390 - { 391 - return seq_open(file, &service_level_seq_ops); 392 - } 393 - 394 - static const struct file_operations service_level_ops = { 395 - .open = service_level_open, 396 - .read = seq_read, 397 - .llseek = seq_lseek, 398 - .release = seq_release 399 - }; 400 - 401 389 static void service_level_vm_print(struct seq_file *m, 402 390 struct service_level *slr) 403 391 { ··· 408 420 409 421 static __init int create_proc_service_level(void) 410 422 { 411 - proc_create("service_levels", 0, NULL, &service_level_ops); 423 + proc_create_seq("service_levels", 0, NULL, &service_level_seq_ops); 412 424 if (MACHINE_IS_VM) 413 425 register_service_level(&service_level_vm); 414 426 return 0;
+2 -26
block/genhd.c
··· 1027 1027 .stop = disk_seqf_stop, 1028 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 1030 #endif 1043 1031 1044 1032 ··· 1365 1377 .show = diskstats_show 1366 1378 }; 1367 1379 1368 - static int diskstats_open(struct inode *inode, struct file *file) 1369 - { 1370 - return seq_open(file, &diskstats_op); 1371 - } 1372 - 1373 - static const struct file_operations proc_diskstats_operations = { 1374 - .open = diskstats_open, 1375 - .read = seq_read, 1376 - .llseek = seq_lseek, 1377 - .release = seq_release, 1378 - }; 1379 - 1380 1380 static int __init proc_genhd_init(void) 1381 1381 { 1382 - proc_create("diskstats", 0, NULL, &proc_diskstats_operations); 1383 - proc_create("partitions", 0, NULL, &proc_partitions_operations); 1382 + proc_create_seq("diskstats", 0, NULL, &diskstats_op); 1383 + proc_create_seq("partitions", 0, NULL, &partitions_op); 1384 1384 return 0; 1385 1385 } 1386 1386 module_init(proc_genhd_init);
+1 -13
crypto/proc.c
··· 94 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 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 102 void __exit crypto_exit_proc(void)
+1 -14
drivers/char/misc.c
··· 95 95 .stop = misc_seq_stop, 96 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 98 #endif 112 99 113 100 static int misc_open(struct inode *inode, struct file *file) ··· 269 282 int err; 270 283 struct proc_dir_entry *ret; 271 284 272 - ret = proc_create("misc", 0, NULL, &misc_proc_fops); 285 + ret = proc_create_seq("misc", 0, NULL, &misc_seq_ops); 273 286 misc_class = class_create(THIS_MODULE, "misc"); 274 287 err = PTR_ERR(misc_class); 275 288 if (IS_ERR(misc_class))
+5 -75
drivers/isdn/capi/kcapi_proc.c
··· 108 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 111 // /proc/capi/applications: 138 112 // applid l3cnt dblkcnt dblklen #ncci recvqueuelen 139 113 // /proc/capi/applstats: ··· 190 216 .show = applstats_show, 191 217 }; 192 218 193 - static int 194 - seq_applications_open(struct inode *inode, struct file *file) 195 - { 196 - return seq_open(file, &seq_applications_ops); 197 - } 198 - 199 - static int 200 - seq_applstats_open(struct inode *inode, struct file *file) 201 - { 202 - return seq_open(file, &seq_applstats_ops); 203 - } 204 - 205 - static const struct file_operations proc_applications_ops = { 206 - .owner = THIS_MODULE, 207 - .open = seq_applications_open, 208 - .read = seq_read, 209 - .llseek = seq_lseek, 210 - .release = seq_release, 211 - }; 212 - 213 - static const struct file_operations proc_applstats_ops = { 214 - .owner = THIS_MODULE, 215 - .open = seq_applstats_open, 216 - .read = seq_read, 217 - .llseek = seq_lseek, 218 - .release = seq_release, 219 - }; 220 - 221 219 // --------------------------------------------------------------------------- 222 220 223 221 static void *capi_driver_start(struct seq_file *seq, loff_t *pos) ··· 225 279 .show = capi_driver_show, 226 280 }; 227 281 228 - static int 229 - seq_capi_driver_open(struct inode *inode, struct file *file) 230 - { 231 - int err; 232 - err = seq_open(file, &seq_capi_driver_ops); 233 - return err; 234 - } 235 - 236 - static const struct file_operations proc_driver_ops = { 237 - .owner = THIS_MODULE, 238 - .open = seq_capi_driver_open, 239 - .read = seq_read, 240 - .llseek = seq_lseek, 241 - .release = seq_release, 242 - }; 243 - 244 282 // --------------------------------------------------------------------------- 245 283 246 284 void __init ··· 232 302 { 233 303 proc_mkdir("capi", NULL); 234 304 proc_mkdir("capi/controllers", NULL); 235 - proc_create("capi/controller", 0, NULL, &proc_controller_ops); 236 - proc_create("capi/contrstats", 0, NULL, &proc_contrstats_ops); 237 - proc_create("capi/applications", 0, NULL, &proc_applications_ops); 238 - proc_create("capi/applstats", 0, NULL, &proc_applstats_ops); 239 - proc_create("capi/driver", 0, NULL, &proc_driver_ops); 305 + proc_create_seq("capi/controller", 0, NULL, &seq_controller_ops); 306 + proc_create_seq("capi/contrstats", 0, NULL, &seq_contrstats_ops); 307 + proc_create_seq("capi/applications", 0, NULL, &seq_applications_ops); 308 + proc_create_seq("capi/applstats", 0, NULL, &seq_applstats_ops); 309 + proc_create_seq("capi/driver", 0, NULL, &seq_capi_driver_ops); 240 310 } 241 311 242 312 void __exit
+1 -15
drivers/net/hamradio/bpqether.c
··· 449 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 454 static const struct net_device_ops bpq_netdev_ops = { ··· 576 590 static int __init bpq_init_driver(void) 577 591 { 578 592 #ifdef CONFIG_PROC_FS 579 - if (!proc_create("bpqether", 0444, init_net.proc_net, &bpq_info_fops)) { 593 + if (!proc_create_seq("bpqether", 0444, init_net.proc_net, &bpq_seqops)) { 580 594 printk(KERN_ERR 581 595 "bpq: cannot create /proc/net/bpqether entry.\n"); 582 596 return -ENOENT;
+1 -16
drivers/net/hamradio/scc.c
··· 2084 2084 .stop = scc_net_seq_stop, 2085 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 2087 #endif /* CONFIG_PROC_FS */ 2103 2088 2104 2089 ··· 2107 2122 } 2108 2123 rtnl_unlock(); 2109 2124 2110 - proc_create("z8530drv", 0, init_net.proc_net, &scc_net_seq_fops); 2125 + proc_create_seq("z8530drv", 0, init_net.proc_net, &scc_net_seq_ops); 2111 2126 2112 2127 return 0; 2113 2128 }
+1 -15
drivers/net/hamradio/yam.c
··· 841 841 .stop = yam_seq_stop, 842 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 844 #endif 859 845 860 846 ··· 1154 1168 yam_timer.expires = jiffies + HZ / 100; 1155 1169 add_timer(&yam_timer); 1156 1170 1157 - proc_create("yam", 0444, init_net.proc_net, &yam_info_fops); 1171 + proc_create_seq("yam", 0444, init_net.proc_net, &yam_seqops); 1158 1172 return 0; 1159 1173 error: 1160 1174 while (--i >= 0) {
+2 -15
drivers/pci/proc.c
··· 435 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 438 static int __init pci_proc_init(void) 452 439 { 453 440 struct pci_dev *dev = NULL; 454 441 proc_bus_pci_dir = proc_mkdir("bus/pci", NULL); 455 - proc_create("devices", 0, proc_bus_pci_dir, 456 - &proc_bus_pci_dev_operations); 442 + proc_create_seq("devices", 0, proc_bus_pci_dir, 443 + &proc_bus_pci_devices_op); 457 444 proc_initialized = 1; 458 445 for_each_pci_dev(dev) 459 446 pci_proc_attach_device(dev);
+2 -15
drivers/s390/block/dasd_proc.c
··· 131 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 134 #ifdef CONFIG_DASD_PROFILE 148 135 static int dasd_stats_all_block_on(void) 149 136 { ··· 339 352 dasd_proc_root_entry = proc_mkdir("dasd", NULL); 340 353 if (!dasd_proc_root_entry) 341 354 goto out_nodasd; 342 - dasd_devices_entry = proc_create("devices", 355 + dasd_devices_entry = proc_create_seq("devices", 343 356 S_IFREG | S_IRUGO | S_IWUSR, 344 357 dasd_proc_root_entry, 345 - &dasd_devices_file_ops); 358 + &dasd_devices_seq_ops); 346 359 if (!dasd_devices_entry) 347 360 goto out_nodevices; 348 361 dasd_statistics_entry = proc_create("statistics",
+2 -17
drivers/s390/char/tape_proc.c
··· 105 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 109 * Initialize procfs stuff on startup 124 110 */ 125 111 void 126 112 tape_proc_init(void) 127 113 { 128 - tape_proc_devices = 129 - proc_create("tapedevices", S_IFREG | S_IRUGO | S_IWUSR, NULL, 130 - &tape_proc_ops); 114 + tape_proc_devices = proc_create_seq("tapedevices", 115 + S_IFREG | S_IRUGO | S_IWUSR, NULL, &tape_proc_seq); 131 116 if (tape_proc_devices == NULL) { 132 117 return; 133 118 }
+5 -40
drivers/staging/ipx/ipx_proc.c
··· 244 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 247 static struct proc_dir_entry *ipx_proc_dir; 284 248 285 249 int __init ipx_proc_init(void) ··· 255 291 256 292 if (!ipx_proc_dir) 257 293 goto out; 258 - p = proc_create("interface", S_IRUGO, 259 - ipx_proc_dir, &ipx_seq_interface_fops); 294 + p = proc_create_seq("interface", S_IRUGO, ipx_proc_dir, 295 + &ipx_seq_interface_ops); 260 296 if (!p) 261 297 goto out_interface; 262 298 263 - p = proc_create("route", S_IRUGO, ipx_proc_dir, &ipx_seq_route_fops); 299 + p = proc_create_seq("route", S_IRUGO, ipx_proc_dir, &ipx_seq_route_ops); 264 300 if (!p) 265 301 goto out_route; 266 302 267 - p = proc_create("socket", S_IRUGO, ipx_proc_dir, &ipx_seq_socket_fops); 303 + p = proc_create_seq("socket", S_IRUGO, ipx_proc_dir, 304 + &ipx_seq_socket_ops); 268 305 if (!p) 269 306 goto out_socket; 270 307
+1 -14
drivers/tty/tty_ldisc.c
··· 229 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 233 .start = tty_ldiscs_seq_start, 234 234 .next = tty_ldiscs_seq_next, 235 235 .stop = tty_ldiscs_seq_stop, 236 236 .show = tty_ldiscs_seq_show, 237 - }; 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 237 }; 251 238 252 239 /**
+1 -14
drivers/video/fbdev/core/fbmem.c
··· 713 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 717 * We hold a reference to the fb_info in file->private_data, 731 718 * but if the current registered fb has changed, we don't ··· 1864 1877 { 1865 1878 int ret; 1866 1879 1867 - if (!proc_create("fb", 0, NULL, &fb_proc_fops)) 1880 + if (!proc_create_seq("fb", 0, NULL, &proc_fb_seq_ops)) 1868 1881 return -ENOMEM; 1869 1882 1870 1883 ret = register_chrdev(FB_MAJOR, "fb", &fb_fops);
+2 -15
drivers/zorro/proc.c
··· 96 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 99 static struct proc_dir_entry *proc_bus_zorro_dir; 113 100 114 101 static int __init zorro_proc_attach_device(unsigned int slot) ··· 119 132 120 133 if (MACH_IS_AMIGA && AMIGAHW_PRESENT(ZORRO)) { 121 134 proc_bus_zorro_dir = proc_mkdir("bus/zorro", NULL); 122 - proc_create("devices", 0, proc_bus_zorro_dir, 123 - &zorro_devices_proc_fops); 135 + proc_create_seq("devices", 0, proc_bus_zorro_dir, 136 + &zorro_devices_seq_ops); 124 137 for (slot = 0; slot < zorro_num_autocon; slot++) 125 138 zorro_proc_attach_device(slot); 126 139 }
+2 -17
fs/cachefiles/proc.c
··· 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 88 * initialise the /proc/fs/cachefiles/ directory 104 89 */ 105 90 int __init cachefiles_proc_init(void) ··· 94 109 if (!proc_mkdir("fs/cachefiles", NULL)) 95 110 goto error_dir; 96 111 97 - if (!proc_create("fs/cachefiles/histogram", S_IFREG | 0444, NULL, 98 - &cachefiles_histogram_fops)) 112 + if (!proc_create_seq("fs/cachefiles/histogram", S_IFREG | 0444, NULL, 113 + &cachefiles_histogram_ops)) 99 114 goto error_histogram; 100 115 101 116 _leave(" = 0");
+1 -16
fs/fscache/histogram.c
··· 83 83 { 84 84 } 85 85 86 - static const struct seq_operations fscache_histogram_ops = { 86 + const struct seq_operations fscache_histogram_ops = { 87 87 .start = fscache_histogram_start, 88 88 .stop = fscache_histogram_stop, 89 89 .next = fscache_histogram_next, 90 90 .show = fscache_histogram_show, 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 91 };
+2 -1
fs/fscache/internal.h
··· 31 31 #include <linux/fscache-cache.h> 32 32 #include <trace/events/fscache.h> 33 33 #include <linux/sched.h> 34 + #include <linux/seq_file.h> 34 35 35 36 #define FSCACHE_MIN_THREADS 4 36 37 #define FSCACHE_MAX_THREADS 32 ··· 85 84 atomic_inc(&histogram[jif]); 86 85 } 87 86 88 - extern const struct file_operations fscache_histogram_fops; 87 + extern const struct seq_operations fscache_histogram_ops; 89 88 90 89 #else 91 90 #define fscache_hist(hist, start_jif) do {} while (0)
+2 -2
fs/fscache/proc.c
··· 32 32 #endif 33 33 34 34 #ifdef CONFIG_FSCACHE_HISTOGRAM 35 - if (!proc_create("fs/fscache/histogram", S_IFREG | 0444, NULL, 36 - &fscache_histogram_fops)) 35 + if (!proc_create_seq("fs/fscache/histogram", S_IFREG | 0444, NULL, 36 + &fscache_histogram_ops)) 37 37 goto error_histogram; 38 38 #endif 39 39
+1 -13
fs/proc/consoles.c
··· 91 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 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 97 return 0; 110 98 } 111 99 fs_initcall(proc_consoles_init);
+1 -13
fs/proc/devices.c
··· 51 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 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 57 return 0; 70 58 } 71 59 fs_initcall(proc_devices_init);
+30
fs/proc/generic.c
··· 25 25 #include <linux/spinlock.h> 26 26 #include <linux/completion.h> 27 27 #include <linux/uaccess.h> 28 + #include <linux/seq_file.h> 28 29 29 30 #include "internal.h" 30 31 ··· 555 554 return proc_create_data(name, mode, parent, proc_fops, NULL); 556 555 } 557 556 EXPORT_SYMBOL(proc_create); 557 + 558 + static int proc_seq_open(struct inode *inode, struct file *file) 559 + { 560 + struct proc_dir_entry *de = PDE(inode); 561 + 562 + return seq_open(file, de->seq_ops); 563 + } 564 + 565 + static const struct file_operations proc_seq_fops = { 566 + .open = proc_seq_open, 567 + .read = seq_read, 568 + .llseek = seq_lseek, 569 + .release = seq_release, 570 + }; 571 + 572 + struct proc_dir_entry *proc_create_seq_data(const char *name, umode_t mode, 573 + struct proc_dir_entry *parent, const struct seq_operations *ops, 574 + void *data) 575 + { 576 + struct proc_dir_entry *p; 577 + 578 + p = proc_create_reg(name, mode, &parent, data); 579 + if (!p) 580 + return NULL; 581 + p->proc_fops = &proc_seq_fops; 582 + p->seq_ops = ops; 583 + return proc_register(parent, p); 584 + } 585 + EXPORT_SYMBOL(proc_create_seq_data); 558 586 559 587 void proc_set_size(struct proc_dir_entry *de, loff_t size) 560 588 {
+1
fs/proc/internal.h
··· 44 44 struct completion *pde_unload_completion; 45 45 const struct inode_operations *proc_iops; 46 46 const struct file_operations *proc_fops; 47 + const struct seq_operations *seq_ops; 47 48 void *data; 48 49 unsigned int low_ino; 49 50 nlink_t nlink;
+1 -13
fs/proc/interrupts.c
··· 34 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 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 40 return 0; 53 41 } 54 42 fs_initcall(proc_interrupts_init);
+1 -13
fs/proc/nommu.c
··· 113 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 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 119 return 0; 132 120 } 133 121
+2 -14
fs/proc/proc_tty.c
··· 126 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 130 * This function is called by tty_register_driver() to handle 143 131 * registering the driver's /proc handler into /proc/tty/driver/<foo> ··· 174 186 * entry. 175 187 */ 176 188 proc_tty_driver = proc_mkdir_mode("tty/driver", S_IRUSR|S_IXUSR, NULL); 177 - proc_create("tty/ldiscs", 0, NULL, &tty_ldiscs_proc_fops); 178 - proc_create("tty/drivers", 0, NULL, &proc_tty_drivers_operations); 189 + proc_create_seq("tty/ldiscs", 0, NULL, &tty_ldiscs_seq_ops); 190 + proc_create_seq("tty/drivers", 0, NULL, &tty_drivers_op); 179 191 }
+9
include/linux/proc_fs.h
··· 9 9 #include <linux/fs.h> 10 10 11 11 struct proc_dir_entry; 12 + struct seq_operations; 12 13 13 14 #ifdef CONFIG_PROC_FS 14 15 ··· 24 23 extern struct proc_dir_entry *proc_mkdir_mode(const char *, umode_t, 25 24 struct proc_dir_entry *); 26 25 struct proc_dir_entry *proc_create_mount_point(const char *name); 26 + 27 + struct proc_dir_entry *proc_create_seq_data(const char *name, umode_t mode, 28 + struct proc_dir_entry *parent, const struct seq_operations *ops, 29 + void *data); 30 + #define proc_create_seq(name, mode, parent, ops) \ 31 + proc_create_seq_data(name, mode, parent, ops, NULL) 27 32 28 33 extern struct proc_dir_entry *proc_create_data(const char *, umode_t, 29 34 struct proc_dir_entry *, ··· 64 57 umode_t mode, struct proc_dir_entry *parent, void *data) { return NULL; } 65 58 static inline struct proc_dir_entry *proc_mkdir_mode(const char *name, 66 59 umode_t mode, struct proc_dir_entry *parent) { return NULL; } 60 + #define proc_create_seq_data(name, mode, parent, ops, data) ({NULL;}) 61 + #define proc_create_seq(name, mode, parent, ops) ({NULL;}) 67 62 #define proc_create(name, mode, parent, proc_fops) ({NULL;}) 68 63 #define proc_create_data(name, mode, parent, proc_fops, data) ({NULL;}) 69 64
+2 -1
include/linux/tty.h
··· 10 10 #include <linux/tty_ldisc.h> 11 11 #include <linux/mutex.h> 12 12 #include <linux/tty_flags.h> 13 + #include <linux/seq_file.h> 13 14 #include <uapi/linux/tty.h> 14 15 #include <linux/rwsem.h> 15 16 #include <linux/llist.h> ··· 536 535 extern struct tty_ldisc *tty_ldisc_ref_wait(struct tty_struct *); 537 536 extern void tty_ldisc_hangup(struct tty_struct *tty, bool reset); 538 537 extern int tty_ldisc_reinit(struct tty_struct *tty, int disc); 539 - extern const struct file_operations tty_ldiscs_proc_fops; 538 + extern const struct seq_operations tty_ldiscs_seq_ops; 540 539 541 540 extern void tty_wakeup(struct tty_struct *tty); 542 541 extern void tty_ldisc_flush(struct tty_struct *tty);
+3 -2
include/net/ax25.h
··· 15 15 #include <linux/refcount.h> 16 16 #include <net/neighbour.h> 17 17 #include <net/sock.h> 18 + #include <linux/seq_file.h> 18 19 19 20 #define AX25_T1CLAMPLO 1 20 21 #define AX25_T1CLAMPHI (30 * HZ) ··· 400 399 /* ax25_route.c */ 401 400 void ax25_rt_device_down(struct net_device *); 402 401 int ax25_rt_ioctl(unsigned int, void __user *); 403 - extern const struct file_operations ax25_route_fops; 402 + extern const struct seq_operations ax25_rt_seqops; 404 403 ax25_route *ax25_get_route(ax25_address *addr, struct net_device *dev); 405 404 int ax25_rt_autobind(ax25_cb *, ax25_address *); 406 405 struct sk_buff *ax25_rt_build_path(struct sk_buff *, ax25_address *, ··· 456 455 extern int ax25_uid_policy; 457 456 ax25_uid_assoc *ax25_findbyuid(kuid_t); 458 457 int __must_check ax25_uid_ioctl(int, struct sockaddr_ax25 *); 459 - extern const struct file_operations ax25_uid_fops; 458 + extern const struct seq_operations ax25_uid_seqops; 460 459 void ax25_uid_free(void); 461 460 462 461 /* sysctl_net_ax25.c */
+3 -2
include/net/netrom.h
··· 13 13 #include <linux/slab.h> 14 14 #include <net/sock.h> 15 15 #include <linux/refcount.h> 16 + #include <linux/seq_file.h> 16 17 17 18 #define NR_NETWORK_LEN 15 18 19 #define NR_TRANSPORT_LEN 5 ··· 217 216 int nr_rt_ioctl(unsigned int, void __user *); 218 217 void nr_link_failed(ax25_cb *, int); 219 218 int nr_route_frame(struct sk_buff *, ax25_cb *); 220 - extern const struct file_operations nr_nodes_fops; 221 - extern const struct file_operations nr_neigh_fops; 219 + extern const struct seq_operations nr_node_seqops; 220 + extern const struct seq_operations nr_neigh_seqops; 222 221 void nr_rt_free(void); 223 222 224 223 /* nr_subr.c */
+3 -3
include/net/rose.h
··· 200 200 201 201 /* rose_route.c */ 202 202 extern struct rose_neigh *rose_loopback_neigh; 203 - extern const struct file_operations rose_neigh_fops; 204 - extern const struct file_operations rose_nodes_fops; 205 - extern const struct file_operations rose_routes_fops; 203 + extern const struct seq_operations rose_neigh_seqops; 204 + extern const struct seq_operations rose_node_seqops; 205 + extern struct seq_operations rose_route_seqops; 206 206 207 207 void rose_add_loopback_neigh(void); 208 208 int __must_check rose_add_loopback_node(rose_address *);
+2 -27
kernel/locking/lockdep_proc.c
··· 101 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 104 #ifdef CONFIG_PROVE_LOCKING 117 105 static void *lc_start(struct seq_file *m, loff_t *pos) 118 106 { ··· 157 169 .next = lc_next, 158 170 .stop = lc_stop, 159 171 .show = lc_show, 160 - }; 161 - 162 - static int lockdep_chains_open(struct inode *inode, struct file *file) 163 - { 164 - return seq_open(file, &lockdep_chains_ops); 165 - } 166 - 167 - static const struct file_operations proc_lockdep_chains_operations = { 168 - .open = lockdep_chains_open, 169 - .read = seq_read, 170 - .llseek = seq_lseek, 171 - .release = seq_release, 172 172 }; 173 173 #endif /* CONFIG_PROVE_LOCKING */ 174 174 ··· 658 682 659 683 static int __init lockdep_proc_init(void) 660 684 { 661 - proc_create("lockdep", S_IRUSR, NULL, &proc_lockdep_operations); 685 + proc_create_seq("lockdep", S_IRUSR, NULL, &lockdep_ops); 662 686 #ifdef CONFIG_PROVE_LOCKING 663 - proc_create("lockdep_chains", S_IRUSR, NULL, 664 - &proc_lockdep_chains_operations); 687 + proc_create_seq("lockdep_chains", S_IRUSR, NULL, &lockdep_chains_ops); 665 688 #endif 666 689 proc_create("lockdep_stats", S_IRUSR, NULL, 667 690 &proc_lockdep_stats_operations);
+1 -27
kernel/sched/debug.c
··· 823 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 826 static int __init init_sched_debug_procfs(void) 850 827 { 851 - struct proc_dir_entry *pe; 852 - 853 - pe = proc_create("sched_debug", 0444, NULL, &sched_debug_fops); 854 - if (!pe) 828 + if (!proc_create_seq("sched_debug", 0444, NULL, &sched_debug_sops)) 855 829 return -ENOMEM; 856 830 return 0; 857 831 }
+1 -14
kernel/sched/stats.c
··· 120 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 123 static int __init proc_schedstat_init(void) 136 124 { 137 - proc_create("schedstat", 0, NULL, &proc_schedstat_operations); 138 - 125 + proc_create_seq("schedstat", 0, NULL, &schedstat_sops); 139 126 return 0; 140 127 } 141 128 subsys_initcall(proc_schedstat_init);
+6 -5
mm/vmalloc.c
··· 2753 2753 2754 2754 static int vmalloc_open(struct inode *inode, struct file *file) 2755 2755 { 2756 - if (IS_ENABLED(CONFIG_NUMA)) 2757 - return seq_open_private(file, &vmalloc_op, 2756 + return seq_open_private(file, &vmalloc_op, 2758 2757 nr_node_ids * sizeof(unsigned int)); 2759 - else 2760 - return seq_open(file, &vmalloc_op); 2761 2758 } 2762 2759 2763 2760 static const struct file_operations proc_vmalloc_operations = { ··· 2766 2769 2767 2770 static int __init proc_vmalloc_init(void) 2768 2771 { 2769 - proc_create("vmallocinfo", S_IRUSR, NULL, &proc_vmalloc_operations); 2772 + if (IS_ENABLED(CONFIG_NUMA)) 2773 + proc_create("vmallocinfo", S_IRUSR, NULL, 2774 + &proc_vmalloc_operations); 2775 + else 2776 + proc_create_seq("vmallocinfo", S_IRUSR, NULL, &vmalloc_op); 2770 2777 return 0; 2771 2778 } 2772 2779 module_init(proc_vmalloc_init);
+4 -52
mm/vmstat.c
··· 1516 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 1519 static const struct seq_operations pagetypeinfo_op = { 1532 1520 .start = frag_start, 1533 1521 .next = frag_next, 1534 1522 .stop = frag_stop, 1535 1523 .show = pagetypeinfo_show, 1536 - }; 1537 - 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 1524 }; 1549 1525 1550 1526 static bool is_zone_first_populated(pg_data_t *pgdat, struct zone *zone) ··· 1639 1663 .show = zoneinfo_show, 1640 1664 }; 1641 1665 1642 - static int zoneinfo_open(struct inode *inode, struct file *file) 1643 - { 1644 - return seq_open(file, &zoneinfo_op); 1645 - } 1646 - 1647 - static const struct file_operations zoneinfo_file_operations = { 1648 - .open = zoneinfo_open, 1649 - .read = seq_read, 1650 - .llseek = seq_lseek, 1651 - .release = seq_release, 1652 - }; 1653 - 1654 1666 enum writeback_stat_item { 1655 1667 NR_DIRTY_THRESHOLD, 1656 1668 NR_DIRTY_BG_THRESHOLD, ··· 1725 1761 .next = vmstat_next, 1726 1762 .stop = vmstat_stop, 1727 1763 .show = vmstat_show, 1728 - }; 1729 - 1730 - static int vmstat_open(struct inode *inode, struct file *file) 1731 - { 1732 - return seq_open(file, &vmstat_op); 1733 - } 1734 - 1735 - static const struct file_operations vmstat_file_operations = { 1736 - .open = vmstat_open, 1737 - .read = seq_read, 1738 - .llseek = seq_lseek, 1739 - .release = seq_release, 1740 1764 }; 1741 1765 #endif /* CONFIG_PROC_FS */ 1742 1766 ··· 1972 2020 start_shepherd_timer(); 1973 2021 #endif 1974 2022 #ifdef CONFIG_PROC_FS 1975 - proc_create("buddyinfo", 0444, NULL, &buddyinfo_file_operations); 1976 - proc_create("pagetypeinfo", 0444, NULL, &pagetypeinfo_file_operations); 1977 - proc_create("vmstat", 0444, NULL, &vmstat_file_operations); 1978 - proc_create("zoneinfo", 0444, NULL, &zoneinfo_file_operations); 2023 + proc_create_seq("buddyinfo", 0444, NULL, &fragmentation_op); 2024 + proc_create_seq("pagetypeinfo", 0444, NULL, &pagetypeinfo_op); 2025 + proc_create_seq("vmstat", 0444, NULL, &vmstat_op); 2026 + proc_create_seq("zoneinfo", 0444, NULL, &zoneinfo_op); 1979 2027 #endif 1980 2028 } 1981 2029
+6 -42
net/appletalk/atalk_proc.c
··· 210 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 213 static struct proc_dir_entry *atalk_proc_dir; 250 214 251 215 int __init atalk_proc_init(void) ··· 221 257 if (!atalk_proc_dir) 222 258 goto out; 223 259 224 - p = proc_create("interface", 0444, atalk_proc_dir, 225 - &atalk_seq_interface_fops); 260 + p = proc_create_seq("interface", 0444, atalk_proc_dir, 261 + &atalk_seq_interface_ops); 226 262 if (!p) 227 263 goto out_interface; 228 264 229 - p = proc_create("route", 0444, atalk_proc_dir, 230 - &atalk_seq_route_fops); 265 + p = proc_create_seq("route", 0444, atalk_proc_dir, 266 + &atalk_seq_route_ops); 231 267 if (!p) 232 268 goto out_route; 233 269 234 - p = proc_create("socket", 0444, atalk_proc_dir, 235 - &atalk_seq_socket_fops); 270 + p = proc_create_seq("socket", 0444, atalk_proc_dir, 271 + &atalk_seq_socket_ops); 236 272 if (!p) 237 273 goto out_socket; 238 274
+1 -13
net/atm/br2684.c
··· 818 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 821 extern struct proc_dir_entry *atm_proc_root; /* from proc.c */ 834 822 #endif /* CONFIG_PROC_FS */ 835 823 ··· 825 837 { 826 838 #ifdef CONFIG_PROC_FS 827 839 struct proc_dir_entry *p; 828 - p = proc_create("br2684", 0, atm_proc_root, &br2684_proc_ops); 840 + p = proc_create_seq("br2684", 0, atm_proc_root, &br2684_seq_ops); 829 841 if (p == NULL) 830 842 return -ENOMEM; 831 843 #endif
+4 -17
net/ax25/af_ax25.c
··· 1924 1924 .stop = ax25_info_stop, 1925 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 1927 #endif 1941 1928 1942 1929 static const struct net_proto_family ax25_family_ops = { ··· 1976 1989 dev_add_pack(&ax25_packet_type); 1977 1990 register_netdevice_notifier(&ax25_dev_notifier); 1978 1991 1979 - proc_create("ax25_route", 0444, init_net.proc_net, 1980 - &ax25_route_fops); 1981 - proc_create("ax25", 0444, init_net.proc_net, &ax25_info_fops); 1982 - proc_create("ax25_calls", 0444, init_net.proc_net, &ax25_uid_fops); 1992 + proc_create_seq("ax25_route", 0444, init_net.proc_net, &ax25_rt_seqops); 1993 + proc_create_seq("ax25", 0444, init_net.proc_net, &ax25_info_seqops); 1994 + proc_create_seq("ax25_calls", 0444, init_net.proc_net, 1995 + &ax25_uid_seqops); 1983 1996 out: 1984 1997 return rc; 1985 1998 }
+1 -14
net/ax25/ax25_route.c
··· 323 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 327 .start = ax25_rt_seq_start, 328 328 .next = ax25_rt_seq_next, 329 329 .stop = ax25_rt_seq_stop, 330 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 332 #endif 346 333 347 334 /*
+1 -14
net/ax25/ax25_uid.c
··· 181 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 185 .start = ax25_uid_seq_start, 186 186 .next = ax25_uid_seq_next, 187 187 .stop = ax25_uid_seq_stop, 188 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 190 #endif 204 191 205 192 /*
+2 -14
net/core/net-procfs.c
··· 195 195 .show = softnet_seq_show, 196 196 }; 197 197 198 - static int softnet_seq_open(struct inode *inode, struct file *file) 199 - { 200 - return seq_open(file, &softnet_seq_ops); 201 - } 202 - 203 - static const struct file_operations softnet_seq_fops = { 204 - .open = softnet_seq_open, 205 - .read = seq_read, 206 - .llseek = seq_lseek, 207 - .release = seq_release, 208 - }; 209 - 210 198 static void *ptype_get_idx(loff_t pos) 211 199 { 212 200 struct packet_type *pt = NULL; ··· 305 317 306 318 if (!proc_create("dev", 0444, net->proc_net, &dev_seq_fops)) 307 319 goto out; 308 - if (!proc_create("softnet_stat", 0444, net->proc_net, 309 - &softnet_seq_fops)) 320 + if (!proc_create_seq("softnet_stat", 0444, net->proc_net, 321 + &softnet_seq_ops)) 310 322 goto out_dev; 311 323 if (!proc_create("ptype", 0444, net->proc_net, &ptype_seq_fops)) 312 324 goto out_softnet;
+1 -14
net/decnet/dn_dev.c
··· 1382 1382 .stop = dn_dev_seq_stop, 1383 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 1385 #endif /* CONFIG_PROC_FS */ 1399 1386 1400 1387 static int addr[2]; ··· 1411 1424 rtnl_register_module(THIS_MODULE, PF_DECnet, RTM_GETADDR, 1412 1425 NULL, dn_nl_dump_ifaddr, 0); 1413 1426 1414 - proc_create("decnet_dev", 0444, init_net.proc_net, &dn_dev_seq_fops); 1427 + proc_create_seq("decnet_dev", 0444, init_net.proc_net, &dn_dev_seq_ops); 1415 1428 1416 1429 #ifdef CONFIG_SYSCTL 1417 1430 {
+2 -26
net/llc/llc_proc.c
··· 214 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 217 static struct proc_dir_entry *llc_proc_dir; 242 218 243 219 int __init llc_proc_init(void) ··· 225 249 if (!llc_proc_dir) 226 250 goto out; 227 251 228 - p = proc_create("socket", 0444, llc_proc_dir, &llc_seq_socket_fops); 252 + p = proc_create_seq("socket", 0444, llc_proc_dir, &llc_seq_socket_ops); 229 253 if (!p) 230 254 goto out_socket; 231 255 232 - p = proc_create("core", 0444, llc_proc_dir, &llc_seq_core_fops); 256 + p = proc_create_seq("core", 0444, llc_proc_dir, &llc_seq_core_ops); 233 257 if (!p) 234 258 goto out_core; 235 259
+3 -15
net/netrom/af_netrom.c
··· 1338 1338 .stop = nr_info_stop, 1339 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 1341 #endif /* CONFIG_PROC_FS */ 1354 1342 1355 1343 static const struct net_proto_family nr_family_ops = { ··· 1438 1450 1439 1451 nr_loopback_init(); 1440 1452 1441 - proc_create("nr", 0444, init_net.proc_net, &nr_info_fops); 1442 - proc_create("nr_neigh", 0444, init_net.proc_net, &nr_neigh_fops); 1443 - proc_create("nr_nodes", 0444, init_net.proc_net, &nr_nodes_fops); 1453 + proc_create_seq("nr", 0444, init_net.proc_net, &nr_info_seqops); 1454 + proc_create_seq("nr_neigh", 0444, init_net.proc_net, &nr_neigh_seqops); 1455 + proc_create_seq("nr_nodes", 0444, init_net.proc_net, &nr_node_seqops); 1444 1456 out: 1445 1457 return rc; 1446 1458 fail:
+2 -27
net/netrom/nr_route.c
··· 888 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 892 .start = nr_node_start, 893 893 .next = nr_node_next, 894 894 .stop = nr_node_stop, 895 895 .show = nr_node_show, 896 - }; 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 896 }; 909 897 910 898 static void *nr_neigh_start(struct seq_file *seq, loff_t *pos) ··· 942 954 return 0; 943 955 } 944 956 945 - static const struct seq_operations nr_neigh_seqops = { 957 + const struct seq_operations nr_neigh_seqops = { 946 958 .start = nr_neigh_start, 947 959 .next = nr_neigh_next, 948 960 .stop = nr_neigh_stop, 949 961 .show = nr_neigh_show, 950 962 }; 951 - 952 - static int nr_neigh_info_open(struct inode *inode, struct file *file) 953 - { 954 - return seq_open(file, &nr_neigh_seqops); 955 - } 956 - 957 - const struct file_operations nr_neigh_fops = { 958 - .open = nr_neigh_info_open, 959 - .read = seq_read, 960 - .llseek = seq_lseek, 961 - .release = seq_release, 962 - }; 963 - 964 963 #endif 965 964 966 965 /*
+7 -19
net/rose/af_rose.c
··· 1453 1453 .stop = rose_info_stop, 1454 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 1456 #endif /* CONFIG_PROC_FS */ 1469 1457 1470 1458 static const struct net_proto_family rose_family_ops = { ··· 1555 1567 1556 1568 rose_add_loopback_neigh(); 1557 1569 1558 - proc_create("rose", 0444, init_net.proc_net, &rose_info_fops); 1559 - proc_create("rose_neigh", 0444, init_net.proc_net, 1560 - &rose_neigh_fops); 1561 - proc_create("rose_nodes", 0444, init_net.proc_net, 1562 - &rose_nodes_fops); 1563 - proc_create("rose_routes", 0444, init_net.proc_net, 1564 - &rose_routes_fops); 1570 + proc_create_seq("rose", 0444, init_net.proc_net, &rose_info_seqops); 1571 + proc_create_seq("rose_neigh", 0444, init_net.proc_net, 1572 + &rose_neigh_seqops); 1573 + proc_create_seq("rose_nodes", 0444, init_net.proc_net, 1574 + &rose_node_seqops); 1575 + proc_create_seq("rose_routes", 0444, init_net.proc_net, 1576 + &rose_route_seqops); 1565 1577 out: 1566 1578 return rc; 1567 1579 fail:
+3 -41
net/rose/rose_route.c
··· 1143 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 1147 .start = rose_node_start, 1148 1148 .next = rose_node_next, 1149 1149 .stop = rose_node_stop, 1150 1150 .show = rose_node_show, 1151 - }; 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 1151 }; 1164 1152 1165 1153 static void *rose_neigh_start(struct seq_file *seq, loff_t *pos) ··· 1214 1226 } 1215 1227 1216 1228 1217 - static const struct seq_operations rose_neigh_seqops = { 1229 + const struct seq_operations rose_neigh_seqops = { 1218 1230 .start = rose_neigh_start, 1219 1231 .next = rose_neigh_next, 1220 1232 .stop = rose_neigh_stop, 1221 1233 .show = rose_neigh_show, 1222 1234 }; 1223 - 1224 - static int rose_neigh_open(struct inode *inode, struct file *file) 1225 - { 1226 - return seq_open(file, &rose_neigh_seqops); 1227 - } 1228 - 1229 - const struct file_operations rose_neigh_fops = { 1230 - .open = rose_neigh_open, 1231 - .read = seq_read, 1232 - .llseek = seq_lseek, 1233 - .release = seq_release, 1234 - }; 1235 - 1236 1235 1237 1236 static void *rose_route_start(struct seq_file *seq, loff_t *pos) 1238 1237 __acquires(rose_route_list_lock) ··· 1286 1311 return 0; 1287 1312 } 1288 1313 1289 - static const struct seq_operations rose_route_seqops = { 1314 + struct seq_operations rose_route_seqops = { 1290 1315 .start = rose_route_start, 1291 1316 .next = rose_route_next, 1292 1317 .stop = rose_route_stop, 1293 1318 .show = rose_route_show, 1294 1319 }; 1295 - 1296 - static int rose_route_open(struct inode *inode, struct file *file) 1297 - { 1298 - return seq_open(file, &rose_route_seqops); 1299 - } 1300 - 1301 - const struct file_operations rose_routes_fops = { 1302 - .open = rose_route_open, 1303 - .read = seq_read, 1304 - .llseek = seq_lseek, 1305 - .release = seq_release, 1306 - }; 1307 - 1308 1320 #endif /* CONFIG_PROC_FS */ 1309 1321 1310 1322 /*
+2 -14
net/sctp/objcnt.c
··· 108 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 111 /* Initialize the objcount in the proc filesystem. */ 124 112 void sctp_dbg_objcnt_init(struct net *net) 125 113 { 126 114 struct proc_dir_entry *ent; 127 115 128 - ent = proc_create("sctp_dbg_objcnt", 0, 129 - net->sctp.proc_net_sctp, &sctp_objcnt_ops); 116 + ent = proc_create_seq("sctp_dbg_objcnt", 0, 117 + net->sctp.proc_net_sctp, &sctp_objcnt_seq_ops); 130 118 if (!ent) 131 119 pr_warn("sctp_dbg_objcnt: Unable to create /proc entry.\n"); 132 120 }
+6 -42
net/x25/x25_proc.c
··· 171 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 174 int __init x25_proc_init(void) 211 175 { 212 176 if (!proc_mkdir("x25", init_net.proc_net)) 213 177 return -ENOMEM; 214 178 215 - if (!proc_create("x25/route", 0444, init_net.proc_net, 216 - &x25_seq_route_fops)) 179 + if (!proc_create_seq("x25/route", 0444, init_net.proc_net, 180 + &x25_seq_route_ops)) 217 181 goto out; 218 182 219 - if (!proc_create("x25/socket", 0444, init_net.proc_net, 220 - &x25_seq_socket_fops)) 183 + if (!proc_create_seq("x25/socket", 0444, init_net.proc_net, 184 + &x25_seq_socket_ops)) 221 185 goto out; 222 186 223 - if (!proc_create("x25/forward", 0444, init_net.proc_net, 224 - &x25_seq_forward_fops)) 187 + if (!proc_create_seq("x25/forward", 0444, init_net.proc_net, 188 + &x25_seq_forward_ops)) 225 189 goto out; 226 190 return 0; 227 191
+2 -32
security/keys/proc.c
··· 18 18 #include <asm/errno.h> 19 19 #include "internal.h" 20 20 21 - static int proc_keys_open(struct inode *inode, struct file *file); 22 21 static void *proc_keys_start(struct seq_file *p, loff_t *_pos); 23 22 static void *proc_keys_next(struct seq_file *p, void *v, loff_t *_pos); 24 23 static void proc_keys_stop(struct seq_file *p, void *v); ··· 30 31 .show = proc_keys_show, 31 32 }; 32 33 33 - static const struct file_operations proc_keys_fops = { 34 - .open = proc_keys_open, 35 - .read = seq_read, 36 - .llseek = seq_lseek, 37 - .release = seq_release, 38 - }; 39 - 40 - static int proc_key_users_open(struct inode *inode, struct file *file); 41 34 static void *proc_key_users_start(struct seq_file *p, loff_t *_pos); 42 35 static void *proc_key_users_next(struct seq_file *p, void *v, loff_t *_pos); 43 36 static void proc_key_users_stop(struct seq_file *p, void *v); ··· 42 51 .show = proc_key_users_show, 43 52 }; 44 53 45 - static const struct file_operations proc_key_users_fops = { 46 - .open = proc_key_users_open, 47 - .read = seq_read, 48 - .llseek = seq_lseek, 49 - .release = seq_release, 50 - }; 51 - 52 54 /* 53 55 * Declare the /proc files. 54 56 */ ··· 49 65 { 50 66 struct proc_dir_entry *p; 51 67 52 - p = proc_create("keys", 0, NULL, &proc_keys_fops); 68 + p = proc_create_seq("keys", 0, NULL, &proc_keys_ops); 53 69 if (!p) 54 70 panic("Cannot create /proc/keys\n"); 55 71 56 - p = proc_create("key-users", 0, NULL, &proc_key_users_fops); 72 + p = proc_create_seq("key-users", 0, NULL, &proc_key_users_ops); 57 73 if (!p) 58 74 panic("Cannot create /proc/key-users\n"); 59 75 ··· 78 94 n = rb_next(n); 79 95 } 80 96 return n; 81 - } 82 - 83 - static int proc_keys_open(struct inode *inode, struct file *file) 84 - { 85 - return seq_open(file, &proc_keys_ops); 86 97 } 87 98 88 99 static struct key *find_ge_key(struct seq_file *p, key_serial_t id) ··· 270 291 { 271 292 struct rb_node *n = rb_first(r); 272 293 return __key_user_next(user_ns, n); 273 - } 274 - 275 - /* 276 - * Implement "/proc/key-users" to provides a list of the key users and their 277 - * quotas. 278 - */ 279 - static int proc_key_users_open(struct inode *inode, struct file *file) 280 - { 281 - return seq_open(file, &proc_key_users_ops); 282 294 } 283 295 284 296 static void *proc_key_users_start(struct seq_file *p, loff_t *_pos)