diff options
author | Christoph Hellwig <hch@lst.de> | 2018-04-24 11:05:17 -0400 |
---|---|---|
committer | Christoph Hellwig <hch@lst.de> | 2018-05-16 01:23:35 -0400 |
commit | 44414d82cfe0f68cb59d0a42f599ccd893ae0032 (patch) | |
tree | f89c89cf2f7c919c22bcf3dac566c89eac6d2ff4 /mm/vmalloc.c | |
parent | fddda2b7b521185f3aa018f9559eb33b0aee53a9 (diff) |
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/vmalloc.c')
-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 = { | |||
2751 | .show = s_show, | 2751 | .show = s_show, |
2752 | }; | 2752 | }; |
2753 | 2753 | ||
2754 | static int vmalloc_open(struct inode *inode, struct file *file) | ||
2755 | { | ||
2756 | return seq_open_private(file, &vmalloc_op, | ||
2757 | nr_node_ids * sizeof(unsigned int)); | ||
2758 | } | ||
2759 | |||
2760 | static const struct file_operations proc_vmalloc_operations = { | ||
2761 | .open = vmalloc_open, | ||
2762 | .read = seq_read, | ||
2763 | .llseek = seq_lseek, | ||
2764 | .release = seq_release_private, | ||
2765 | }; | ||
2766 | |||
2767 | static int __init proc_vmalloc_init(void) | 2754 | static int __init proc_vmalloc_init(void) |
2768 | { | 2755 | { |
2769 | if (IS_ENABLED(CONFIG_NUMA)) | 2756 | if (IS_ENABLED(CONFIG_NUMA)) |
2770 | proc_create("vmallocinfo", S_IRUSR, NULL, | 2757 | proc_create_seq_private("vmallocinfo", S_IRUSR, NULL, |
2771 | &proc_vmalloc_operations); | 2758 | &vmalloc_op, |
2759 | nr_node_ids * sizeof(unsigned int), NULL); | ||
2772 | else | 2760 | else |
2773 | proc_create_seq("vmallocinfo", S_IRUSR, NULL, &vmalloc_op); | 2761 | proc_create_seq("vmallocinfo", S_IRUSR, NULL, &vmalloc_op); |
2774 | return 0; | 2762 | return 0; |