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 <[email protected]>
This commit is contained in:
Christoph Hellwig 2018-04-13 19:44:18 +02:00
commit fddda2b7b5
53 changed files with 151 additions and 925 deletions

View file

@ -1924,19 +1924,6 @@ static const struct seq_operations ax25_info_seqops = {
.stop = ax25_info_stop,
.show = ax25_info_show,
};
static int ax25_info_open(struct inode *inode, struct file *file)
{
return seq_open(file, &ax25_info_seqops);
}
static const struct file_operations ax25_info_fops = {
.open = ax25_info_open,
.read = seq_read,
.llseek = seq_lseek,
.release = seq_release,
};
#endif
static const struct net_proto_family ax25_family_ops = {
@ -1989,10 +1976,10 @@ static int __init ax25_init(void)
dev_add_pack(&ax25_packet_type);
register_netdevice_notifier(&ax25_dev_notifier);
proc_create("ax25_route", 0444, init_net.proc_net,
&ax25_route_fops);
proc_create("ax25", 0444, init_net.proc_net, &ax25_info_fops);
proc_create("ax25_calls", 0444, init_net.proc_net, &ax25_uid_fops);
proc_create_seq("ax25_route", 0444, init_net.proc_net, &ax25_rt_seqops);
proc_create_seq("ax25", 0444, init_net.proc_net, &ax25_info_seqops);
proc_create_seq("ax25_calls", 0444, init_net.proc_net,
&ax25_uid_seqops);
out:
return rc;
}

View file

@ -323,25 +323,12 @@ static int ax25_rt_seq_show(struct seq_file *seq, void *v)
return 0;
}
static const struct seq_operations ax25_rt_seqops = {
const struct seq_operations ax25_rt_seqops = {
.start = ax25_rt_seq_start,
.next = ax25_rt_seq_next,
.stop = ax25_rt_seq_stop,
.show = ax25_rt_seq_show,
};
static int ax25_rt_info_open(struct inode *inode, struct file *file)
{
return seq_open(file, &ax25_rt_seqops);
}
const struct file_operations ax25_route_fops = {
.open = ax25_rt_info_open,
.read = seq_read,
.llseek = seq_lseek,
.release = seq_release,
};
#endif
/*

View file

@ -181,25 +181,12 @@ static int ax25_uid_seq_show(struct seq_file *seq, void *v)
return 0;
}
static const struct seq_operations ax25_uid_seqops = {
const struct seq_operations ax25_uid_seqops = {
.start = ax25_uid_seq_start,
.next = ax25_uid_seq_next,
.stop = ax25_uid_seq_stop,
.show = ax25_uid_seq_show,
};
static int ax25_uid_info_open(struct inode *inode, struct file *file)
{
return seq_open(file, &ax25_uid_seqops);
}
const struct file_operations ax25_uid_fops = {
.open = ax25_uid_info_open,
.read = seq_read,
.llseek = seq_lseek,
.release = seq_release,
};
#endif
/*