Skip to content

Commit

Permalink
fs/proc/task_nommu.c: change maps_open() to use __seq_open_private()
Browse files Browse the repository at this point in the history
Cleanup and preparation. maps_open() can use __seq_open_private()
like proc_maps_open() does.

[akpm@linux-foundation.org: deuglify]
Signed-off-by: Oleg Nesterov <oleg@redhat.com>
Cc: Kirill A. Shutemov <kirill.shutemov@linux.intel.com>
Cc: Cyrill Gorcunov <gorcunov@openvz.org>
Cc: "Eric W. Biederman" <ebiederm@xmission.com>
Acked-by: Greg Ungerer <gerg@uclinux.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
  • Loading branch information
Oleg Nesterov authored and Linus Torvalds committed Oct 10, 2014
1 parent 557c2d8 commit ce34fdd
Showing 1 changed file with 7 additions and 14 deletions.
21 changes: 7 additions & 14 deletions fs/proc/task_nommu.c
Original file line number Diff line number Diff line change
Expand Up @@ -269,20 +269,13 @@ static int maps_open(struct inode *inode, struct file *file,
const struct seq_operations *ops)
{
struct proc_maps_private *priv;
int ret = -ENOMEM;

priv = kzalloc(sizeof(*priv), GFP_KERNEL);
if (priv) {
priv->pid = proc_pid(inode);
ret = seq_open(file, ops);
if (!ret) {
struct seq_file *m = file->private_data;
m->private = priv;
} else {
kfree(priv);
}
}
return ret;

priv = __seq_open_private(file, ops, sizeof(struct proc_maps_private));
if (!priv)
return -ENOMEM;

priv->pid = proc_pid(inode);
return 0;
}

static int pid_maps_open(struct inode *inode, struct file *file)
Expand Down

0 comments on commit ce34fdd

Please sign in to comment.