From 44414d82cfe0f68cb59d0a42f599ccd893ae0032 Mon Sep 17 00:00:00 2001 From: Christoph Hellwig Date: Tue, 24 Apr 2018 17:05:17 +0200 Subject: 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 --- net/appletalk/aarp.c | 20 +------------------- net/appletalk/atalk_proc.c | 3 ++- 2 files changed, 3 insertions(+), 20 deletions(-) (limited to 'net/appletalk') diff --git a/net/appletalk/aarp.c b/net/appletalk/aarp.c index d4c1021e74e1..49a16cee2aae 100644 --- a/net/appletalk/aarp.c +++ b/net/appletalk/aarp.c @@ -907,11 +907,6 @@ void aarp_device_down(struct net_device *dev) } #ifdef CONFIG_PROC_FS -struct aarp_iter_state { - int bucket; - struct aarp_entry **table; -}; - /* * Get the aarp entry that is in the chain described * by the iterator. @@ -1033,25 +1028,12 @@ static int aarp_seq_show(struct seq_file *seq, void *v) return 0; } -static const struct seq_operations aarp_seq_ops = { +const struct seq_operations aarp_seq_ops = { .start = aarp_seq_start, .next = aarp_seq_next, .stop = aarp_seq_stop, .show = aarp_seq_show, }; - -static int aarp_seq_open(struct inode *inode, struct file *file) -{ - return seq_open_private(file, &aarp_seq_ops, - sizeof(struct aarp_iter_state)); -} - -const struct file_operations atalk_seq_arp_fops = { - .open = aarp_seq_open, - .read = seq_read, - .llseek = seq_lseek, - .release = seq_release_private, -}; #endif /* General module cleanup. Called from cleanup_module() in ddp.c. */ diff --git a/net/appletalk/atalk_proc.c b/net/appletalk/atalk_proc.c index d456c702e725..8006295f8bd7 100644 --- a/net/appletalk/atalk_proc.c +++ b/net/appletalk/atalk_proc.c @@ -236,7 +236,8 @@ int __init atalk_proc_init(void) if (!p) goto out_socket; - p = proc_create("arp", 0444, atalk_proc_dir, &atalk_seq_arp_fops); + p = proc_create_seq_private("arp", 0444, atalk_proc_dir, &aarp_seq_ops, + sizeof(struct aarp_iter_state), NULL); if (!p) goto out_arp; -- cgit v1.2.3-59-g8ed1b