Commit ce34fddb authored by Oleg Nesterov's avatar Oleg Nesterov Committed by Linus Torvalds

fs/proc/task_nommu.c: change maps_open() to use __seq_open_private()

Cleanup and preparation. maps_open() can use __seq_open_private()
like proc_maps_open() does.

[akpm@linux-foundation.org: deuglify]
Signed-off-by: default avatarOleg 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: default avatarGreg Ungerer <gerg@uclinux.org>
Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
parent 557c2d8a
...@@ -269,20 +269,13 @@ static int maps_open(struct inode *inode, struct file *file, ...@@ -269,20 +269,13 @@ static int maps_open(struct inode *inode, struct file *file,
const struct seq_operations *ops) const struct seq_operations *ops)
{ {
struct proc_maps_private *priv; struct proc_maps_private *priv;
int ret = -ENOMEM;
priv = __seq_open_private(file, ops, sizeof(struct proc_maps_private));
priv = kzalloc(sizeof(*priv), GFP_KERNEL); if (!priv)
if (priv) { return -ENOMEM;
priv->pid = proc_pid(inode);
ret = seq_open(file, ops); priv->pid = proc_pid(inode);
if (!ret) { return 0;
struct seq_file *m = file->private_data;
m->private = priv;
} else {
kfree(priv);
}
}
return ret;
} }
static int pid_maps_open(struct inode *inode, struct file *file) static int pid_maps_open(struct inode *inode, struct file *file)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment