Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 370124
b: refs/heads/master
c: e42270a
h: refs/heads/master
v: v3
  • Loading branch information
David Howells authored and Al Viro committed May 1, 2013
1 parent b606643 commit 3bf24ba
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 12 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 4a520d2769beb736ba2bd084b8293ce148a1a7ae
refs/heads/master: e42270a19e357d7808890bdbeb0cae97f2a2d234
29 changes: 18 additions & 11 deletions trunk/fs/reiserfs/procfs.c
Original file line number Diff line number Diff line change
Expand Up @@ -394,20 +394,24 @@ static int set_sb(struct super_block *sb, void *data)
return -ENOENT;
}

struct reiserfs_seq_private {
struct super_block *sb;
int (*show) (struct seq_file *, struct super_block *);
};

static void *r_start(struct seq_file *m, loff_t * pos)
{
struct proc_dir_entry *de = m->private;
struct super_block *s = de->parent->data;
struct reiserfs_seq_private *priv = m->private;
loff_t l = *pos;

if (l)
return NULL;

if (IS_ERR(sget(&reiserfs_fs_type, test_sb, set_sb, 0, s)))
if (IS_ERR(sget(&reiserfs_fs_type, test_sb, set_sb, 0, priv->sb)))
return NULL;

up_write(&s->s_umount);
return s;
up_write(&priv->sb->s_umount);
return priv->sb;
}

static void *r_next(struct seq_file *m, void *v, loff_t * pos)
Expand All @@ -426,9 +430,8 @@ static void r_stop(struct seq_file *m, void *v)

static int r_show(struct seq_file *m, void *v)
{
struct proc_dir_entry *de = m->private;
int (*show) (struct seq_file *, struct super_block *) = de->data;
return show(m, v);
struct reiserfs_seq_private *priv = m->private;
return priv->show(m, v);
}

static const struct seq_operations r_ops = {
Expand All @@ -440,11 +443,15 @@ static const struct seq_operations r_ops = {

static int r_open(struct inode *inode, struct file *file)
{
int ret = seq_open(file, &r_ops);
struct reiserfs_seq_private *priv;
int ret = seq_open_private(file, &r_ops,
sizeof(struct reiserfs_seq_private));

if (!ret) {
struct seq_file *m = file->private_data;
m->private = PDE(inode);
priv = m->private;
priv->sb = proc_get_parent_data(inode);
priv->show = PDE_DATA(inode);
}
return ret;
}
Expand All @@ -453,7 +460,7 @@ static const struct file_operations r_file_operations = {
.open = r_open,
.read = seq_read,
.llseek = seq_lseek,
.release = seq_release,
.release = seq_release_private,
.owner = THIS_MODULE,
};

Expand Down

0 comments on commit 3bf24ba

Please sign in to comment.