From: Wang Hai <wanghai38@huawei.com>
To: <chuck.lever@oracle.com>, <jlayton@kernel.org>,
<trond.myklebust@hammerspace.com>, <anna@kernel.org>,
<davem@davemloft.net>, <edumazet@google.com>, <kuba@kernel.org>,
<pabeni@redhat.com>
Cc: <wanghai38@huawei.com>, <linux-nfs@vger.kernel.org>,
<netdev@vger.kernel.org>, <linux-kernel@vger.kernel.org>
Subject: [PATCH -next] SUNRPC: use DEFINE_PROC_SHOW_ATTRIBUTE to define rpc_proc_fops
Date: Fri, 23 Sep 2022 16:35:02 +0800 [thread overview]
Message-ID: <20220923083502.8722-1-wanghai38@huawei.com> (raw)
Use DEFINE_PROC_SHOW_ATTRIBUTE helper macro to simplify the code.
Signed-off-by: Wang Hai <wanghai38@huawei.com>
---
net/sunrpc/stats.c | 15 +++------------
1 file changed, 3 insertions(+), 12 deletions(-)
diff --git a/net/sunrpc/stats.c b/net/sunrpc/stats.c
index 52908f9e6ea..7b4c42e56cf 100644
--- a/net/sunrpc/stats.c
+++ b/net/sunrpc/stats.c
@@ -34,7 +34,8 @@
/*
* Get RPC client stats
*/
-static int rpc_proc_show(struct seq_file *seq, void *v) {
+static int rpc_show(struct seq_file *seq, void *v)
+{
const struct rpc_stat *statp = seq->private;
const struct rpc_program *prog = statp->program;
unsigned int i, j;
@@ -64,17 +65,7 @@ static int rpc_proc_show(struct seq_file *seq, void *v) {
return 0;
}
-static int rpc_proc_open(struct inode *inode, struct file *file)
-{
- return single_open(file, rpc_proc_show, pde_data(inode));
-}
-
-static const struct proc_ops rpc_proc_ops = {
- .proc_open = rpc_proc_open,
- .proc_read = seq_read,
- .proc_lseek = seq_lseek,
- .proc_release = single_release,
-};
+DEFINE_PROC_SHOW_ATTRIBUTE(rpc);
/*
* Get RPC server stats
--
2.17.1
reply other threads:[~2022-09-23 8:06 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20220923083502.8722-1-wanghai38@huawei.com \
--to=wanghai38@huawei.com \
--cc=anna@kernel.org \
--cc=chuck.lever@oracle.com \
--cc=davem@davemloft.net \
--cc=edumazet@google.com \
--cc=jlayton@kernel.org \
--cc=kuba@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-nfs@vger.kernel.org \
--cc=netdev@vger.kernel.org \
--cc=pabeni@redhat.com \
--cc=trond.myklebust@hammerspace.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).