fs/ocfs2/dlmglue.c: use __seq_open_private() not seq_open()
Reduce boilerplate code by using seq_open_private() instead of seq_open() Signed-off-by: Rob Jones <rob.jones@codethink.co.uk> Cc: Joel Becker <jlbec@evilplan.org> Cc: Mark Fasheh <mfasheh@suse.com> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
This commit is contained in:
parent
f328833848
commit
1848cb5530
|
@ -2892,37 +2892,24 @@ static int ocfs2_dlm_debug_release(struct inode *inode, struct file *file)
|
||||||
|
|
||||||
static int ocfs2_dlm_debug_open(struct inode *inode, struct file *file)
|
static int ocfs2_dlm_debug_open(struct inode *inode, struct file *file)
|
||||||
{
|
{
|
||||||
int ret;
|
|
||||||
struct ocfs2_dlm_seq_priv *priv;
|
struct ocfs2_dlm_seq_priv *priv;
|
||||||
struct seq_file *seq;
|
|
||||||
struct ocfs2_super *osb;
|
struct ocfs2_super *osb;
|
||||||
|
|
||||||
priv = kzalloc(sizeof(struct ocfs2_dlm_seq_priv), GFP_KERNEL);
|
priv = __seq_open_private(file, &ocfs2_dlm_seq_ops, sizeof(*priv));
|
||||||
if (!priv) {
|
if (!priv) {
|
||||||
ret = -ENOMEM;
|
mlog_errno(-ENOMEM);
|
||||||
mlog_errno(ret);
|
return -ENOMEM;
|
||||||
goto out;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
osb = inode->i_private;
|
osb = inode->i_private;
|
||||||
ocfs2_get_dlm_debug(osb->osb_dlm_debug);
|
ocfs2_get_dlm_debug(osb->osb_dlm_debug);
|
||||||
priv->p_dlm_debug = osb->osb_dlm_debug;
|
priv->p_dlm_debug = osb->osb_dlm_debug;
|
||||||
INIT_LIST_HEAD(&priv->p_iter_res.l_debug_list);
|
INIT_LIST_HEAD(&priv->p_iter_res.l_debug_list);
|
||||||
|
|
||||||
ret = seq_open(file, &ocfs2_dlm_seq_ops);
|
|
||||||
if (ret) {
|
|
||||||
kfree(priv);
|
|
||||||
mlog_errno(ret);
|
|
||||||
goto out;
|
|
||||||
}
|
|
||||||
|
|
||||||
seq = file->private_data;
|
|
||||||
seq->private = priv;
|
|
||||||
|
|
||||||
ocfs2_add_lockres_tracking(&priv->p_iter_res,
|
ocfs2_add_lockres_tracking(&priv->p_iter_res,
|
||||||
priv->p_dlm_debug);
|
priv->p_dlm_debug);
|
||||||
|
|
||||||
out:
|
return 0;
|
||||||
return ret;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static const struct file_operations ocfs2_dlm_debug_fops = {
|
static const struct file_operations ocfs2_dlm_debug_fops = {
|
||||||
|
|
Loading…
Reference in New Issue