diff options
author | Christoph Hellwig <hch@lst.de> | 2018-04-24 17:05:17 +0200 |
---|---|---|
committer | Christoph Hellwig <hch@lst.de> | 2018-05-16 07:23:35 +0200 |
commit | 44414d82cfe0f68cb59d0a42f599ccd893ae0032 (patch) | |
tree | f89c89cf2f7c919c22bcf3dac566c89eac6d2ff4 /mm | |
parent | fddda2b7b521185f3aa018f9559eb33b0aee53a9 (diff) | |
download | linux-44414d82cfe0f68cb59d0a42f599ccd893ae0032.tar.bz2 |
proc: introduce proc_create_seq_private
Variant of proc_create_data that directly take a struct seq_operations
argument + a private state size 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 'mm')
-rw-r--r-- | mm/vmalloc.c | 18 |
1 files changed, 3 insertions, 15 deletions
diff --git a/mm/vmalloc.c b/mm/vmalloc.c index bc43c7838778..63a5f502da08 100644 --- a/mm/vmalloc.c +++ b/mm/vmalloc.c @@ -2751,24 +2751,12 @@ static const struct seq_operations vmalloc_op = { .show = s_show, }; -static int vmalloc_open(struct inode *inode, struct file *file) -{ - return seq_open_private(file, &vmalloc_op, - nr_node_ids * sizeof(unsigned int)); -} - -static const struct file_operations proc_vmalloc_operations = { - .open = vmalloc_open, - .read = seq_read, - .llseek = seq_lseek, - .release = seq_release_private, -}; - static int __init proc_vmalloc_init(void) { if (IS_ENABLED(CONFIG_NUMA)) - proc_create("vmallocinfo", S_IRUSR, NULL, - &proc_vmalloc_operations); + proc_create_seq_private("vmallocinfo", S_IRUSR, NULL, + &vmalloc_op, + nr_node_ids * sizeof(unsigned int), NULL); else proc_create_seq("vmallocinfo", S_IRUSR, NULL, &vmalloc_op); return 0; |