diff options
author | Rob Jones <rob.jones@codethink.co.uk> | 2014-10-09 18:25:09 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2014-10-09 22:25:47 -0400 |
commit | 1848cb5530d3bada86c7b54f4f8b053b2081eb00 (patch) | |
tree | a4536e9a60e9250695389a428a5e0be5b7078bd6 /fs/ocfs2/dlmglue.c | |
parent | f32883384846e1d4aa941c60dd8adb44093359c6 (diff) |
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>
Diffstat (limited to 'fs/ocfs2/dlmglue.c')
-rw-r--r-- | fs/ocfs2/dlmglue.c | 23 |
1 files changed, 5 insertions, 18 deletions
diff --git a/fs/ocfs2/dlmglue.c b/fs/ocfs2/dlmglue.c index 52cfe99ae056..21262f2b1654 100644 --- a/fs/ocfs2/dlmglue.c +++ b/fs/ocfs2/dlmglue.c | |||
@@ -2892,37 +2892,24 @@ static int ocfs2_dlm_debug_release(struct inode *inode, struct file *file) | |||
2892 | 2892 | ||
2893 | static int ocfs2_dlm_debug_open(struct inode *inode, struct file *file) | 2893 | static int ocfs2_dlm_debug_open(struct inode *inode, struct file *file) |
2894 | { | 2894 | { |
2895 | int ret; | ||
2896 | struct ocfs2_dlm_seq_priv *priv; | 2895 | struct ocfs2_dlm_seq_priv *priv; |
2897 | struct seq_file *seq; | ||
2898 | struct ocfs2_super *osb; | 2896 | struct ocfs2_super *osb; |
2899 | 2897 | ||
2900 | priv = kzalloc(sizeof(struct ocfs2_dlm_seq_priv), GFP_KERNEL); | 2898 | priv = __seq_open_private(file, &ocfs2_dlm_seq_ops, sizeof(*priv)); |
2901 | if (!priv) { | 2899 | if (!priv) { |
2902 | ret = -ENOMEM; | 2900 | mlog_errno(-ENOMEM); |
2903 | mlog_errno(ret); | 2901 | return -ENOMEM; |
2904 | goto out; | ||
2905 | } | 2902 | } |
2903 | |||
2906 | osb = inode->i_private; | 2904 | osb = inode->i_private; |
2907 | ocfs2_get_dlm_debug(osb->osb_dlm_debug); | 2905 | ocfs2_get_dlm_debug(osb->osb_dlm_debug); |
2908 | priv->p_dlm_debug = osb->osb_dlm_debug; | 2906 | priv->p_dlm_debug = osb->osb_dlm_debug; |
2909 | INIT_LIST_HEAD(&priv->p_iter_res.l_debug_list); | 2907 | INIT_LIST_HEAD(&priv->p_iter_res.l_debug_list); |
2910 | 2908 | ||
2911 | ret = seq_open(file, &ocfs2_dlm_seq_ops); | ||
2912 | if (ret) { | ||
2913 | kfree(priv); | ||
2914 | mlog_errno(ret); | ||
2915 | goto out; | ||
2916 | } | ||
2917 | |||
2918 | seq = file->private_data; | ||
2919 | seq->private = priv; | ||
2920 | |||
2921 | ocfs2_add_lockres_tracking(&priv->p_iter_res, | 2909 | ocfs2_add_lockres_tracking(&priv->p_iter_res, |
2922 | priv->p_dlm_debug); | 2910 | priv->p_dlm_debug); |
2923 | 2911 | ||
2924 | out: | 2912 | return 0; |
2925 | return ret; | ||
2926 | } | 2913 | } |
2927 | 2914 | ||
2928 | static const struct file_operations ocfs2_dlm_debug_fops = { | 2915 | static const struct file_operations ocfs2_dlm_debug_fops = { |