Skip to content

Commit 04015e3

Browse files
author
Christoph Hellwig
committed
proc: don't detour through seq->private to get the inode
Signed-off-by: Christoph Hellwig <hch@lst.de>
1 parent 76f668b commit 04015e3

File tree

1 file changed

+6
-14
lines changed

1 file changed

+6
-14
lines changed

fs/proc/array.c

Lines changed: 6 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -677,20 +677,22 @@ get_children_pid(struct inode *inode, struct pid *pid_prev, loff_t pos)
677677

678678
static int children_seq_show(struct seq_file *seq, void *v)
679679
{
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)));
681683
return 0;
682684
}
683685

684686
static void *children_seq_start(struct seq_file *seq, loff_t *pos)
685687
{
686-
return get_children_pid(seq->private, NULL, *pos);
688+
return get_children_pid(file_inode(seq->file), NULL, *pos);
687689
}
688690

689691
static void *children_seq_next(struct seq_file *seq, void *v, loff_t *pos)
690692
{
691693
struct pid *pid;
692694

693-
pid = get_children_pid(seq->private, v, *pos + 1);
695+
pid = get_children_pid(file_inode(seq->file), v, *pos + 1);
694696
put_pid(v);
695697

696698
++*pos;
@@ -711,17 +713,7 @@ static const struct seq_operations children_seq_ops = {
711713

712714
static int children_seq_open(struct inode *inode, struct file *file)
713715
{
714-
struct seq_file *m;
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;
716+
return seq_open(file, &children_seq_ops);
725717
}
726718

727719
const struct file_operations proc_tid_children_operations = {

0 commit comments

Comments
 (0)