Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 133914
b: refs/heads/master
c: cbec660
h: refs/heads/master
v: v3
  • Loading branch information
Alexey Dobriyan authored and David S. Miller committed Jan 27, 2009
1 parent 8cf71cb commit c8b8bb1
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 44 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: 9a3b7a42bb2919a6282a96a5f4abe0f9be36c4b3
refs/heads/master: cbec6605cf0fd5080f03eb787c95c1ecd660421f
48 changes: 5 additions & 43 deletions trunk/drivers/net/pppol2tp.c
Original file line number Diff line number Diff line change
Expand Up @@ -2371,7 +2371,7 @@ static int pppol2tp_getsockopt(struct socket *sock, int level,
#include <linux/seq_file.h>

struct pppol2tp_seq_data {
struct net *seq_net; /* net of inode */
struct seq_net_private p;
struct pppol2tp_tunnel *tunnel; /* current tunnel */
struct pppol2tp_session *session; /* NULL means get first session in tunnel */
};
Expand Down Expand Up @@ -2436,7 +2436,7 @@ static void *pppol2tp_seq_start(struct seq_file *m, loff_t *offs)

BUG_ON(m->private == NULL);
pd = m->private;
pn = pppol2tp_pernet(pd->seq_net);
pn = pppol2tp_pernet(seq_file_net(m));

if (pd->tunnel == NULL) {
if (!list_empty(&pn->pppol2tp_tunnel_list))
Expand Down Expand Up @@ -2558,54 +2558,16 @@ static const struct seq_operations pppol2tp_seq_ops = {
*/
static int pppol2tp_proc_open(struct inode *inode, struct file *file)
{
struct seq_file *m;
struct pppol2tp_seq_data *pd;
struct net *net;
int ret = 0;

ret = seq_open(file, &pppol2tp_seq_ops);
if (ret < 0)
goto out;

m = file->private_data;

/* Allocate and fill our proc_data for access later */
ret = -ENOMEM;
m->private = kzalloc(sizeof(*pd), GFP_KERNEL);
if (m->private == NULL)
goto out;

pd = m->private;
net = maybe_get_net(PDE_NET(PDE(inode)));
BUG_ON(!net);
pd->seq_net = net;
return 0;

out:
return ret;
}

/* Called when /proc file access completes.
*/
static int pppol2tp_proc_release(struct inode *inode, struct file *file)
{
struct seq_file *m = (struct seq_file *)file->private_data;
struct pppol2tp_seq_data *pd = m->private;

put_net(pd->seq_net);

kfree(m->private);
m->private = NULL;

return seq_release(inode, file);
return seq_open_net(inode, file, &pppol2tp_seq_ops,
sizeof(struct pppol2tp_seq_data));
}

static const struct file_operations pppol2tp_proc_fops = {
.owner = THIS_MODULE,
.open = pppol2tp_proc_open,
.read = seq_read,
.llseek = seq_lseek,
.release = pppol2tp_proc_release,
.release = seq_release_net,
};

#endif /* CONFIG_PROC_FS */
Expand Down

0 comments on commit c8b8bb1

Please sign in to comment.