diff options
author | ChenXiaoSong <chenxiaosong2@huawei.com> | 2022-09-23 00:31:54 +0800 |
---|---|---|
committer | Chuck Lever <chuck.lever@oracle.com> | 2022-09-26 14:02:49 -0400 |
commit | 1d7f6b302b75ff7acb9eb3cab0c631b10cfa7542 (patch) | |
tree | 8c51783f8a4d368c2582580ef922c88f3ebfdcb1 /fs/nfsd | |
parent | 9beeaab8e05d353d709103cafa1941714b4d5d94 (diff) |
nfsd: use DEFINE_SHOW_ATTRIBUTE to define client_info_fops
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>
Diffstat (limited to 'fs/nfsd')
-rw-r--r-- | fs/nfsd/nfs4state.c | 14 |
1 files changed, 2 insertions, 12 deletions
diff --git a/fs/nfsd/nfs4state.c b/fs/nfsd/nfs4state.c index 56b50210da38..3d5eb00501a1 100644 --- a/fs/nfsd/nfs4state.c +++ b/fs/nfsd/nfs4state.c @@ -2490,7 +2490,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; @@ -2530,17 +2530,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) |