diff options
author | Christoph Hellwig <hch@lst.de> | 2018-05-16 01:21:53 -0400 |
---|---|---|
committer | Christoph Hellwig <hch@lst.de> | 2018-05-16 01:23:35 -0400 |
commit | 04015e3fa235eba28cc058c73d7d346c1bcffee8 (patch) | |
tree | 5b96ade259cf40a9795513f2be70787bdf013a63 /fs/proc/array.c | |
parent | 76f668be1e8e87d235fbd50037f50fdde948b46d (diff) |
proc: don't detour through seq->private to get the inode
Signed-off-by: Christoph Hellwig <hch@lst.de>
Diffstat (limited to 'fs/proc/array.c')
-rw-r--r-- | fs/proc/array.c | 20 |
1 files changed, 6 insertions, 14 deletions
diff --git a/fs/proc/array.c b/fs/proc/array.c index 911f66924d81..4a8e413bf59b 100644 --- a/fs/proc/array.c +++ b/fs/proc/array.c | |||
@@ -677,20 +677,22 @@ out: | |||
677 | 677 | ||
678 | static int children_seq_show(struct seq_file *seq, void *v) | 678 | static int children_seq_show(struct seq_file *seq, void *v) |
679 | { | 679 | { |
680 | seq_printf(seq, "%d ", pid_nr_ns(v, proc_pid_ns(seq->private))); | 680 | struct inode *inode = file_inode(seq->file); |
681 | |||
682 | seq_printf(seq, "%d ", pid_nr_ns(v, proc_pid_ns(inode))); | ||
681 | return 0; | 683 | return 0; |
682 | } | 684 | } |
683 | 685 | ||
684 | static void *children_seq_start(struct seq_file *seq, loff_t *pos) | 686 | static void *children_seq_start(struct seq_file *seq, loff_t *pos) |
685 | { | 687 | { |
686 | return get_children_pid(seq->private, NULL, *pos); | 688 | return get_children_pid(file_inode(seq->file), NULL, *pos); |
687 | } | 689 | } |
688 | 690 | ||
689 | static void *children_seq_next(struct seq_file *seq, void *v, loff_t *pos) | 691 | static void *children_seq_next(struct seq_file *seq, void *v, loff_t *pos) |
690 | { | 692 | { |
691 | struct pid *pid; | 693 | struct pid *pid; |
692 | 694 | ||
693 | pid = get_children_pid(seq->private, v, *pos + 1); | 695 | pid = get_children_pid(file_inode(seq->file), v, *pos + 1); |
694 | put_pid(v); | 696 | put_pid(v); |
695 | 697 | ||
696 | ++*pos; | 698 | ++*pos; |
@@ -711,17 +713,7 @@ static const struct seq_operations children_seq_ops = { | |||
711 | 713 | ||
712 | static int children_seq_open(struct inode *inode, struct file *file) | 714 | static int children_seq_open(struct inode *inode, struct file *file) |
713 | { | 715 | { |
714 | struct seq_file *m; | 716 | return seq_open(file, &children_seq_ops); |
715 | int ret; | ||
716 | |||
717 | ret = seq_open(file, &children_seq_ops); | ||
718 | if (ret) | ||
719 | return ret; | ||
720 | |||
721 | m = file->private_data; | ||
722 | m->private = inode; | ||
723 | |||
724 | return ret; | ||
725 | } | 717 | } |
726 | 718 | ||
727 | const struct file_operations proc_tid_children_operations = { | 719 | const struct file_operations proc_tid_children_operations = { |