]> www.infradead.org Git - users/dwmw2/linux.git/commitdiff
nfsd: use DEFINE_SHOW_ATTRIBUTE to define client_info_fops
authorChenXiaoSong <chenxiaosong2@huawei.com>
Thu, 22 Sep 2022 16:31:54 +0000 (00:31 +0800)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Wed, 10 Apr 2024 14:19:18 +0000 (16:19 +0200)
[ Upstream commit 1d7f6b302b75ff7acb9eb3cab0c631b10cfa7542 ]

Use DEFINE_SHOW_ATTRIBUTE helper macro to simplify the code.

inode is converted from seq_file->file instead of seq_file->private in
client_info_show().

Signed-off-by: ChenXiaoSong <chenxiaosong2@huawei.com>
Signed-off-by: Chuck Lever <chuck.lever@oracle.com>
fs/nfsd/nfs4state.c

index 8cbb66b07d519840e28a1655378f119d1e3f476a..cc258f2988c733466319da33bd50ce128b4100de 100644 (file)
@@ -2503,7 +2503,7 @@ static const char *cb_state2str(int state)
 
 static int client_info_show(struct seq_file *m, void *v)
 {
-       struct inode *inode = m->private;
+       struct inode *inode = file_inode(m->file);
        struct nfs4_client *clp;
        u64 clid;
 
@@ -2543,17 +2543,7 @@ static int client_info_show(struct seq_file *m, void *v)
        return 0;
 }
 
-static int client_info_open(struct inode *inode, struct file *file)
-{
-       return single_open(file, client_info_show, inode);
-}
-
-static const struct file_operations client_info_fops = {
-       .open           = client_info_open,
-       .read           = seq_read,
-       .llseek         = seq_lseek,
-       .release        = single_release,
-};
+DEFINE_SHOW_ATTRIBUTE(client_info);
 
 static void *states_start(struct seq_file *s, loff_t *pos)
        __acquires(&clp->cl_lock)