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>
This commit is contained in:
@@ -214,30 +214,6 @@ static const struct seq_operations llc_seq_core_ops = {
|
||||
.show = llc_seq_core_show,
|
||||
};
|
||||
|
||||
static int llc_seq_socket_open(struct inode *inode, struct file *file)
|
||||
{
|
||||
return seq_open(file, &llc_seq_socket_ops);
|
||||
}
|
||||
|
||||
static int llc_seq_core_open(struct inode *inode, struct file *file)
|
||||
{
|
||||
return seq_open(file, &llc_seq_core_ops);
|
||||
}
|
||||
|
||||
static const struct file_operations llc_seq_socket_fops = {
|
||||
.open = llc_seq_socket_open,
|
||||
.read = seq_read,
|
||||
.llseek = seq_lseek,
|
||||
.release = seq_release,
|
||||
};
|
||||
|
||||
static const struct file_operations llc_seq_core_fops = {
|
||||
.open = llc_seq_core_open,
|
||||
.read = seq_read,
|
||||
.llseek = seq_lseek,
|
||||
.release = seq_release,
|
||||
};
|
||||
|
||||
static struct proc_dir_entry *llc_proc_dir;
|
||||
|
||||
int __init llc_proc_init(void)
|
||||
@@ -249,11 +225,11 @@ int __init llc_proc_init(void)
|
||||
if (!llc_proc_dir)
|
||||
goto out;
|
||||
|
||||
p = proc_create("socket", 0444, llc_proc_dir, &llc_seq_socket_fops);
|
||||
p = proc_create_seq("socket", 0444, llc_proc_dir, &llc_seq_socket_ops);
|
||||
if (!p)
|
||||
goto out_socket;
|
||||
|
||||
p = proc_create("core", 0444, llc_proc_dir, &llc_seq_core_fops);
|
||||
p = proc_create_seq("core", 0444, llc_proc_dir, &llc_seq_core_ops);
|
||||
if (!p)
|
||||
goto out_core;
|
||||
|
||||
|
Reference in New Issue
Block a user