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:
Christoph Hellwig
2018-04-13 19:44:18 +02:00
parent 7aed53d1df
commit fddda2b7b5
53 changed files with 151 additions and 925 deletions

View File

@@ -84,21 +84,6 @@ static const struct seq_operations cachefiles_histogram_ops = {
.show = cachefiles_histogram_show,
};
/*
* open "/proc/fs/cachefiles/XXX" which provide statistics summaries
*/
static int cachefiles_histogram_open(struct inode *inode, struct file *file)
{
return seq_open(file, &cachefiles_histogram_ops);
}
static const struct file_operations cachefiles_histogram_fops = {
.open = cachefiles_histogram_open,
.read = seq_read,
.llseek = seq_lseek,
.release = seq_release,
};
/*
* initialise the /proc/fs/cachefiles/ directory
*/
@@ -109,8 +94,8 @@ int __init cachefiles_proc_init(void)
if (!proc_mkdir("fs/cachefiles", NULL))
goto error_dir;
if (!proc_create("fs/cachefiles/histogram", S_IFREG | 0444, NULL,
&cachefiles_histogram_fops))
if (!proc_create_seq("fs/cachefiles/histogram", S_IFREG | 0444, NULL,
&cachefiles_histogram_ops))
goto error_histogram;
_leave(" = 0");