Skip to content

Commit 1d7f6b3

Browse files
ChenXiaoSongchucklever
authored andcommitted
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>
1 parent 9beeaab commit 1d7f6b3

1 file changed

Lines changed: 2 additions & 12 deletions

File tree

fs/nfsd/nfs4state.c

Lines changed: 2 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -2490,7 +2490,7 @@ static const char *cb_state2str(int state)
24902490

24912491
static int client_info_show(struct seq_file *m, void *v)
24922492
{
2493-
struct inode *inode = m->private;
2493+
struct inode *inode = file_inode(m->file);
24942494
struct nfs4_client *clp;
24952495
u64 clid;
24962496

@@ -2530,17 +2530,7 @@ static int client_info_show(struct seq_file *m, void *v)
25302530
return 0;
25312531
}
25322532

2533-
static int client_info_open(struct inode *inode, struct file *file)
2534-
{
2535-
return single_open(file, client_info_show, inode);
2536-
}
2537-
2538-
static const struct file_operations client_info_fops = {
2539-
.open = client_info_open,
2540-
.read = seq_read,
2541-
.llseek = seq_lseek,
2542-
.release = single_release,
2543-
};
2533+
DEFINE_SHOW_ATTRIBUTE(client_info);
25442534

25452535
static void *states_start(struct seq_file *s, loff_t *pos)
25462536
__acquires(&clp->cl_lock)

0 commit comments

Comments
 (0)