* [PATCH 09/15] [PKTGEN]: Use proc_create() to setup ->proc_fops first
@ 2008-02-28 10:57 Wang Chen
2008-02-28 22:12 ` David Miller
0 siblings, 1 reply; 2+ messages in thread
From: Wang Chen @ 2008-02-28 10:57 UTC (permalink / raw)
To: David S. Miller, NETDEV
Use proc_create() to make sure that ->proc_fops be setup before gluing
PDE to main tree.
Signed-off-by: Wang Chen <wangchen@cn.fujitsu.com>
---
net/core/pktgen.c | 10 ++++------
1 files changed, 4 insertions(+), 6 deletions(-)
diff --git a/net/core/pktgen.c b/net/core/pktgen.c
index bfcdfae..20e63b3 100644
--- a/net/core/pktgen.c
+++ b/net/core/pktgen.c
@@ -3570,14 +3570,14 @@ static int pktgen_add_device(struct pktgen_thread *t, const char *ifname)
if (err)
goto out1;
- pkt_dev->entry = create_proc_entry(ifname, 0600, pg_proc_dir);
+ pkt_dev->entry = proc_create(ifname, 0600,
+ pg_proc_dir, &pktgen_if_fops);
if (!pkt_dev->entry) {
printk(KERN_ERR "pktgen: cannot create %s/%s procfs entry.\n",
PG_PROC_DIR, ifname);
err = -EINVAL;
goto out2;
}
- pkt_dev->entry->proc_fops = &pktgen_if_fops;
pkt_dev->entry->data = pkt_dev;
#ifdef CONFIG_XFRM
pkt_dev->ipsmode = XFRM_MODE_TRANSPORT;
@@ -3628,7 +3628,7 @@ static int __init pktgen_create_thread(int cpu)
kthread_bind(p, cpu);
t->tsk = p;
- pe = create_proc_entry(t->tsk->comm, 0600, pg_proc_dir);
+ pe = proc_create(t->tsk->comm, 0600, pg_proc_dir, &pktgen_thread_fops);
if (!pe) {
printk(KERN_ERR "pktgen: cannot create %s/%s procfs entry.\n",
PG_PROC_DIR, t->tsk->comm);
@@ -3638,7 +3638,6 @@ static int __init pktgen_create_thread(int cpu)
return -EINVAL;
}
- pe->proc_fops = &pktgen_thread_fops;
pe->data = t;
wake_up_process(p);
@@ -3709,7 +3708,7 @@ static int __init pg_init(void)
return -ENODEV;
pg_proc_dir->owner = THIS_MODULE;
- pe = create_proc_entry(PGCTRL, 0600, pg_proc_dir);
+ pe = proc_create(PGCTRL, 0600, pg_proc_dir, &pktgen_fops);
if (pe == NULL) {
printk(KERN_ERR "pktgen: ERROR: cannot create %s "
"procfs entry.\n", PGCTRL);
@@ -3717,7 +3716,6 @@ static int __init pg_init(void)
return -EINVAL;
}
- pe->proc_fops = &pktgen_fops;
pe->data = NULL;
/* Register us to receive netdevice events */
--
WCN
^ permalink raw reply related [flat|nested] 2+ messages in thread* Re: [PATCH 09/15] [PKTGEN]: Use proc_create() to setup ->proc_fops first
2008-02-28 10:57 [PATCH 09/15] [PKTGEN]: Use proc_create() to setup ->proc_fops first Wang Chen
@ 2008-02-28 22:12 ` David Miller
0 siblings, 0 replies; 2+ messages in thread
From: David Miller @ 2008-02-28 22:12 UTC (permalink / raw)
To: wangchen; +Cc: netdev
From: Wang Chen <wangchen@cn.fujitsu.com>
Date: Thu, 28 Feb 2008 18:57:18 +0800
> Use proc_create() to make sure that ->proc_fops be setup before gluing
> PDE to main tree.
>
> Signed-off-by: Wang Chen <wangchen@cn.fujitsu.com>
Applied.
> @@ -3570,14 +3570,14 @@ static int pktgen_add_device(struct pktgen_thread *t, const char *ifname)
> if (err)
> goto out1;
>
> - pkt_dev->entry = create_proc_entry(ifname, 0600, pg_proc_dir);
> + pkt_dev->entry = proc_create(ifname, 0600,
> + pg_proc_dir, &pktgen_if_fops);
> if (!pkt_dev->entry) {
> printk(KERN_ERR "pktgen: cannot create %s/%s procfs entry.\n",
> PG_PROC_DIR, ifname);
> err = -EINVAL;
> goto out2;
> }
> - pkt_dev->entry->proc_fops = &pktgen_if_fops;
> pkt_dev->entry->data = pkt_dev;
> #ifdef CONFIG_XFRM
> pkt_dev->ipsmode = XFRM_MODE_TRANSPORT;
->data visibility issue
> @@ -3638,7 +3638,6 @@ static int __init pktgen_create_thread(int cpu)
> return -EINVAL;
> }
>
> - pe->proc_fops = &pktgen_thread_fops;
> pe->data = t;
>
> wake_up_process(p);
Likewise.
> @@ -3717,7 +3716,6 @@ static int __init pg_init(void)
> return -EINVAL;
> }
>
> - pe->proc_fops = &pktgen_fops;
> pe->data = NULL;
>
> /* Register us to receive netdevice events */
Superfluous assignment to NULL, can be deleted.
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2008-02-28 22:12 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-02-28 10:57 [PATCH 09/15] [PKTGEN]: Use proc_create() to setup ->proc_fops first Wang Chen
2008-02-28 22:12 ` David Miller
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).