nfsd: use DEFINE_SHOW_ATTRIBUTE to define client_info_fops
[ 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> Signed-off-by: Sasha Levin <sashal@kernel.org>
This commit is contained in:

committed by
Greg Kroah-Hartman

parent
615d761a6b
commit
443e648425
@@ -2503,7 +2503,7 @@ static const char *cb_state2str(int state)
|
|||||||
|
|
||||||
static int client_info_show(struct seq_file *m, void *v)
|
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;
|
struct nfs4_client *clp;
|
||||||
u64 clid;
|
u64 clid;
|
||||||
|
|
||||||
@@ -2543,17 +2543,7 @@ static int client_info_show(struct seq_file *m, void *v)
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int client_info_open(struct inode *inode, struct file *file)
|
DEFINE_SHOW_ATTRIBUTE(client_info);
|
||||||
{
|
|
||||||
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,
|
|
||||||
};
|
|
||||||
|
|
||||||
static void *states_start(struct seq_file *s, loff_t *pos)
|
static void *states_start(struct seq_file *s, loff_t *pos)
|
||||||
__acquires(&clp->cl_lock)
|
__acquires(&clp->cl_lock)
|
||||||
|
Reference in New Issue
Block a user