From: Cyrill Gorcunov <gorcunov@gmail.com>
To: Alexey Dobriyan <adobriyan@gmail.com>,
LiNext <linux-next@vger.kernel.org>
Cc: David Miller <davem@davemloft.net>,
Stephen Rothwell <sfr@canb.auug.org.au>,
Michal Ostrowski <mostrows@earthlink.net>,
NKML <netdev@vger.kernel.org>
Subject: [PATCH] net: pppoe - stop using proc internals
Date: Sun, 25 Jan 2009 15:02:43 +0300 [thread overview]
Message-ID: <20090125120243.GA29167@localhost> (raw)
Alexey Dobriyan pointed that using PDE_NET outside the
proc code is plain bogus (thanks Alexey!). Fix it.
Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org>
CC: Alexey Dobriyan <adobriyan@gmail.com>
CC: Michal Ostrowski <mostrows@earthlink.net>
---
Hope I didn't miss anything. Compile tested.
Please review.
drivers/net/pppoe.c | 34 ++++++----------------------------
1 file changed, 6 insertions(+), 28 deletions(-)
Index: linux-2.6.git/drivers/net/pppoe.c
===================================================================
--- linux-2.6.git.orig/drivers/net/pppoe.c
+++ linux-2.6.git/drivers/net/pppoe.c
@@ -1041,7 +1041,7 @@ out:
static void *pppoe_seq_start(struct seq_file *seq, loff_t *pos)
__acquires(pn->hash_lock)
{
- struct pppoe_net *pn = pppoe_pernet(seq->private);
+ struct pppoe_net *pn = pppoe_pernet(seq_file_net(seq));
loff_t l = *pos;
read_lock_bh(&pn->hash_lock);
@@ -1050,7 +1050,7 @@ static void *pppoe_seq_start(struct seq_
static void *pppoe_seq_next(struct seq_file *seq, void *v, loff_t *pos)
{
- struct pppoe_net *pn = pppoe_pernet(seq->private);
+ struct pppoe_net *pn = pppoe_pernet(seq_file_net(seq));
struct pppox_sock *po;
++*pos;
@@ -1078,7 +1078,7 @@ out:
static void pppoe_seq_stop(struct seq_file *seq, void *v)
__releases(pn->hash_lock)
{
- struct pppoe_net *pn = pppoe_pernet(seq->private);
+ struct pppoe_net *pn = pppoe_pernet(seq_file_net(seq));
read_unlock_bh(&pn->hash_lock);
}
@@ -1091,30 +1091,8 @@ static struct seq_operations pppoe_seq_o
static int pppoe_seq_open(struct inode *inode, struct file *file)
{
- struct seq_file *m;
- struct net *net;
- int err;
-
- err = seq_open(file, &pppoe_seq_ops);
- if (err)
- return err;
-
- m = file->private_data;
- net = maybe_get_net(PDE_NET(PDE(inode)));
- BUG_ON(!net);
- m->private = net;
-
- return err;
-}
-
-static int pppoe_seq_release(struct inode *inode, struct file *file)
-{
- struct seq_file *m;
-
- m = file->private_data;
- put_net((struct net*)m->private);
-
- return seq_release(inode, file);
+ return seq_open_net(inode, file, &pppoe_seq_ops,
+ sizeof(struct seq_net_private));
}
static const struct file_operations pppoe_seq_fops = {
@@ -1122,7 +1100,7 @@ static const struct file_operations pppo
.open = pppoe_seq_open,
.read = seq_read,
.llseek = seq_lseek,
- .release = pppoe_seq_release,
+ .release = seq_release_net,
};
#endif /* CONFIG_PROC_FS */
next reply other threads:[~2009-01-25 12:02 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-01-25 12:02 Cyrill Gorcunov [this message]
2009-01-27 5:11 ` [PATCH] net: pppoe - stop using proc internals David Miller
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20090125120243.GA29167@localhost \
--to=gorcunov@gmail.com \
--cc=adobriyan@gmail.com \
--cc=davem@davemloft.net \
--cc=linux-next@vger.kernel.org \
--cc=mostrows@earthlink.net \
--cc=netdev@vger.kernel.org \
--cc=sfr@canb.auug.org.au \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.