diff options
author | Christoph Hellwig <hch@lst.de> | 2018-04-13 13:44:18 -0400 |
---|---|---|
committer | Christoph Hellwig <hch@lst.de> | 2018-05-16 01:23:35 -0400 |
commit | fddda2b7b521185f3aa018f9559eb33b0aee53a9 (patch) | |
tree | ece18b3d82822f8eaefd8b0afa2f93307e83b253 /net/core/net-procfs.c | |
parent | 7aed53d1dfd14d468e065212ce45068e2b50c1fa (diff) |
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>
Diffstat (limited to 'net/core/net-procfs.c')
-rw-r--r-- | net/core/net-procfs.c | 16 |
1 files changed, 2 insertions, 14 deletions
diff --git a/net/core/net-procfs.c b/net/core/net-procfs.c index 9737302907b1..c4e8ebe55e26 100644 --- a/net/core/net-procfs.c +++ b/net/core/net-procfs.c | |||
@@ -195,18 +195,6 @@ static const struct seq_operations softnet_seq_ops = { | |||
195 | .show = softnet_seq_show, | 195 | .show = softnet_seq_show, |
196 | }; | 196 | }; |
197 | 197 | ||
198 | static int softnet_seq_open(struct inode *inode, struct file *file) | ||
199 | { | ||
200 | return seq_open(file, &softnet_seq_ops); | ||
201 | } | ||
202 | |||
203 | static const struct file_operations softnet_seq_fops = { | ||
204 | .open = softnet_seq_open, | ||
205 | .read = seq_read, | ||
206 | .llseek = seq_lseek, | ||
207 | .release = seq_release, | ||
208 | }; | ||
209 | |||
210 | static void *ptype_get_idx(loff_t pos) | 198 | static void *ptype_get_idx(loff_t pos) |
211 | { | 199 | { |
212 | struct packet_type *pt = NULL; | 200 | struct packet_type *pt = NULL; |
@@ -317,8 +305,8 @@ static int __net_init dev_proc_net_init(struct net *net) | |||
317 | 305 | ||
318 | if (!proc_create("dev", 0444, net->proc_net, &dev_seq_fops)) | 306 | if (!proc_create("dev", 0444, net->proc_net, &dev_seq_fops)) |
319 | goto out; | 307 | goto out; |
320 | if (!proc_create("softnet_stat", 0444, net->proc_net, | 308 | if (!proc_create_seq("softnet_stat", 0444, net->proc_net, |
321 | &softnet_seq_fops)) | 309 | &softnet_seq_ops)) |
322 | goto out_dev; | 310 | goto out_dev; |
323 | if (!proc_create("ptype", 0444, net->proc_net, &ptype_seq_fops)) | 311 | if (!proc_create("ptype", 0444, net->proc_net, &ptype_seq_fops)) |
324 | goto out_softnet; | 312 | goto out_softnet; |