diff options
author | Oleg Nesterov <oleg@redhat.com> | 2014-10-09 15:25:45 -0700 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2014-10-09 22:25:49 -0400 |
commit | ce34fddb5bafb424a4aaa9f403feb7dbe776c7d1 (patch) | |
tree | d2931fcee82bea2a4e24b5478c7dbc7cbee96ef2 /fs/proc | |
parent | 557c2d8a73dc078817ba6949697ceb8c0f3f7362 (diff) | |
download | op-kernel-dev-ce34fddb5bafb424a4aaa9f403feb7dbe776c7d1.zip op-kernel-dev-ce34fddb5bafb424a4aaa9f403feb7dbe776c7d1.tar.gz |
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: 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>
Diffstat (limited to 'fs/proc')
-rw-r--r-- | fs/proc/task_nommu.c | 21 |
1 files changed, 7 insertions, 14 deletions
diff --git a/fs/proc/task_nommu.c b/fs/proc/task_nommu.c index 678455d..98c95d2 100644 --- a/fs/proc/task_nommu.c +++ b/fs/proc/task_nommu.c @@ -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) |