proc: introduce proc_create_single{,_data}
Variants of proc_create{,_data} that directly take a seq_file show
callback 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:
@@ -208,19 +208,6 @@ static int fake_ide_media_proc_show(struct seq_file *m, void *v)
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int fake_ide_media_proc_open(struct inode *inode, struct file *file)
|
||||
{
|
||||
return single_open(file, fake_ide_media_proc_show, NULL);
|
||||
}
|
||||
|
||||
static const struct file_operations fake_ide_media_proc_fops = {
|
||||
.owner = THIS_MODULE,
|
||||
.open = fake_ide_media_proc_open,
|
||||
.read = seq_read,
|
||||
.llseek = seq_lseek,
|
||||
.release = single_release,
|
||||
};
|
||||
|
||||
static void make_ide_entries(const char *dev_name)
|
||||
{
|
||||
struct proc_dir_entry *dir, *ent;
|
||||
@@ -231,7 +218,8 @@ static void make_ide_entries(const char *dev_name)
|
||||
dir = proc_mkdir(dev_name, proc_ide);
|
||||
if(!dir) return;
|
||||
|
||||
ent = proc_create("media", S_IRUGO, dir, &fake_ide_media_proc_fops);
|
||||
ent = proc_create_single("media", S_IRUGO, dir,
|
||||
fake_ide_media_proc_show);
|
||||
if(!ent) return;
|
||||
snprintf(name, sizeof(name), "ide0/%s", dev_name);
|
||||
proc_symlink(dev_name, proc_ide_root, name);
|
||||
|
||||
Reference in New Issue
Block a user