diff options
author | Christoph Hellwig <hch@lst.de> | 2018-05-15 09:57:23 -0400 |
---|---|---|
committer | Christoph Hellwig <hch@lst.de> | 2018-05-16 01:23:35 -0400 |
commit | 3f3942aca6da351a12543aa776467791b63b3a78 (patch) | |
tree | 31030e086ea36920e07078ea2289b9b72c0b2939 /net/8021q/vlanproc.c | |
parent | 44414d82cfe0f68cb59d0a42f599ccd893ae0032 (diff) |
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>
Diffstat (limited to 'net/8021q/vlanproc.c')
-rw-r--r-- | net/8021q/vlanproc.c | 21 |
1 files changed, 2 insertions, 19 deletions
diff --git a/net/8021q/vlanproc.c b/net/8021q/vlanproc.c index a627a5db2125..d3e3f0f2ec1c 100644 --- a/net/8021q/vlanproc.c +++ b/net/8021q/vlanproc.c | |||
@@ -87,22 +87,6 @@ static const struct file_operations vlan_fops = { | |||
87 | }; | 87 | }; |
88 | 88 | ||
89 | /* | 89 | /* |
90 | * /proc/net/vlan/<device> file and inode operations | ||
91 | */ | ||
92 | |||
93 | static int vlandev_seq_open(struct inode *inode, struct file *file) | ||
94 | { | ||
95 | return single_open(file, vlandev_seq_show, PDE_DATA(inode)); | ||
96 | } | ||
97 | |||
98 | static const struct file_operations vlandev_fops = { | ||
99 | .open = vlandev_seq_open, | ||
100 | .read = seq_read, | ||
101 | .llseek = seq_lseek, | ||
102 | .release = single_release, | ||
103 | }; | ||
104 | |||
105 | /* | ||
106 | * Proc filesystem directory entries. | 90 | * Proc filesystem directory entries. |
107 | */ | 91 | */ |
108 | 92 | ||
@@ -171,9 +155,8 @@ int vlan_proc_add_dev(struct net_device *vlandev) | |||
171 | 155 | ||
172 | if (!strcmp(vlandev->name, name_conf)) | 156 | if (!strcmp(vlandev->name, name_conf)) |
173 | return -EINVAL; | 157 | return -EINVAL; |
174 | vlan->dent = | 158 | vlan->dent = proc_create_single_data(vlandev->name, S_IFREG | 0600, |
175 | proc_create_data(vlandev->name, S_IFREG | 0600, | 159 | vn->proc_vlan_dir, vlandev_seq_show, vlandev); |
176 | vn->proc_vlan_dir, &vlandev_fops, vlandev); | ||
177 | if (!vlan->dent) | 160 | if (!vlan->dent) |
178 | return -ENOBUFS; | 161 | return -ENOBUFS; |
179 | return 0; | 162 | return 0; |