summaryrefslogtreecommitdiffstats
path: root/block/genhd.c
diff options
context:
space:
mode:
authorChristoph Hellwig <hch@lst.de>2018-04-13 13:44:18 -0400
committerChristoph Hellwig <hch@lst.de>2018-05-16 01:23:35 -0400
commitfddda2b7b521185f3aa018f9559eb33b0aee53a9 (patch)
treeece18b3d82822f8eaefd8b0afa2f93307e83b253 /block/genhd.c
parent7aed53d1dfd14d468e065212ce45068e2b50c1fa (diff)
proc: introduce proc_create_seq{,_data}
Variants of proc_create{,_data} that directly take a struct seq_operations argument and drastically reduces the boilerplate code in the callers. All trivial callers converted over. Signed-off-by: Christoph Hellwig <hch@lst.de>
Diffstat (limited to 'block/genhd.c')
-rw-r--r--block/genhd.c28
1 files changed, 2 insertions, 26 deletions
diff --git a/block/genhd.c b/block/genhd.c
index c4513fe1adda..6d7bc8958fda 100644
--- a/block/genhd.c
+++ b/block/genhd.c
@@ -1027,18 +1027,6 @@ static const struct seq_operations partitions_op = {
1027 .stop = disk_seqf_stop, 1027 .stop = disk_seqf_stop,
1028 .show = show_partition 1028 .show = show_partition
1029}; 1029};
1030
1031static int partitions_open(struct inode *inode, struct file *file)
1032{
1033 return seq_open(file, &partitions_op);
1034}
1035
1036static const struct file_operations proc_partitions_operations = {
1037 .open = partitions_open,
1038 .read = seq_read,
1039 .llseek = seq_lseek,
1040 .release = seq_release,
1041};
1042#endif 1030#endif
1043 1031
1044 1032
@@ -1377,22 +1365,10 @@ static const struct seq_operations diskstats_op = {
1377 .show = diskstats_show 1365 .show = diskstats_show
1378}; 1366};
1379 1367
1380static int diskstats_open(struct inode *inode, struct file *file)
1381{
1382 return seq_open(file, &diskstats_op);
1383}
1384
1385static const struct file_operations proc_diskstats_operations = {
1386 .open = diskstats_open,
1387 .read = seq_read,
1388 .llseek = seq_lseek,
1389 .release = seq_release,
1390};
1391
1392static int __init proc_genhd_init(void) 1368static int __init proc_genhd_init(void)
1393{ 1369{
1394 proc_create("diskstats", 0, NULL, &proc_diskstats_operations); 1370 proc_create_seq("diskstats", 0, NULL, &diskstats_op);
1395 proc_create("partitions", 0, NULL, &proc_partitions_operations); 1371 proc_create_seq("partitions", 0, NULL, &partitions_op);
1396 return 0; 1372 return 0;
1397} 1373}
1398module_init(proc_genhd_init); 1374module_init(proc_genhd_init);