diff options
author | Wang Chen <wangchen@cn.fujitsu.com> | 2008-02-28 17:11:49 -0500 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2008-02-28 17:11:49 -0500 |
commit | 25296d599ccc7e06af217329729e4d7154fa79a2 (patch) | |
tree | 1b39600bfbc12845ffb9d457462019aeff3e5d2b /net | |
parent | 46ecf0b994715589b9f5f620beca4d6aaaa02028 (diff) |
[PKTGEN]: Use proc_create() to setup ->proc_fops first
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>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net')
-rw-r--r-- | 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 bfcdfaebca5c..20e63b302ba6 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) | |||
3570 | if (err) | 3570 | if (err) |
3571 | goto out1; | 3571 | goto out1; |
3572 | 3572 | ||
3573 | pkt_dev->entry = create_proc_entry(ifname, 0600, pg_proc_dir); | 3573 | pkt_dev->entry = proc_create(ifname, 0600, |
3574 | pg_proc_dir, &pktgen_if_fops); | ||
3574 | if (!pkt_dev->entry) { | 3575 | if (!pkt_dev->entry) { |
3575 | printk(KERN_ERR "pktgen: cannot create %s/%s procfs entry.\n", | 3576 | printk(KERN_ERR "pktgen: cannot create %s/%s procfs entry.\n", |
3576 | PG_PROC_DIR, ifname); | 3577 | PG_PROC_DIR, ifname); |
3577 | err = -EINVAL; | 3578 | err = -EINVAL; |
3578 | goto out2; | 3579 | goto out2; |
3579 | } | 3580 | } |
3580 | pkt_dev->entry->proc_fops = &pktgen_if_fops; | ||
3581 | pkt_dev->entry->data = pkt_dev; | 3581 | pkt_dev->entry->data = pkt_dev; |
3582 | #ifdef CONFIG_XFRM | 3582 | #ifdef CONFIG_XFRM |
3583 | pkt_dev->ipsmode = XFRM_MODE_TRANSPORT; | 3583 | pkt_dev->ipsmode = XFRM_MODE_TRANSPORT; |
@@ -3628,7 +3628,7 @@ static int __init pktgen_create_thread(int cpu) | |||
3628 | kthread_bind(p, cpu); | 3628 | kthread_bind(p, cpu); |
3629 | t->tsk = p; | 3629 | t->tsk = p; |
3630 | 3630 | ||
3631 | pe = create_proc_entry(t->tsk->comm, 0600, pg_proc_dir); | 3631 | pe = proc_create(t->tsk->comm, 0600, pg_proc_dir, &pktgen_thread_fops); |
3632 | if (!pe) { | 3632 | if (!pe) { |
3633 | printk(KERN_ERR "pktgen: cannot create %s/%s procfs entry.\n", | 3633 | printk(KERN_ERR "pktgen: cannot create %s/%s procfs entry.\n", |
3634 | PG_PROC_DIR, t->tsk->comm); | 3634 | PG_PROC_DIR, t->tsk->comm); |
@@ -3638,7 +3638,6 @@ static int __init pktgen_create_thread(int cpu) | |||
3638 | return -EINVAL; | 3638 | return -EINVAL; |
3639 | } | 3639 | } |
3640 | 3640 | ||
3641 | pe->proc_fops = &pktgen_thread_fops; | ||
3642 | pe->data = t; | 3641 | pe->data = t; |
3643 | 3642 | ||
3644 | wake_up_process(p); | 3643 | wake_up_process(p); |
@@ -3709,7 +3708,7 @@ static int __init pg_init(void) | |||
3709 | return -ENODEV; | 3708 | return -ENODEV; |
3710 | pg_proc_dir->owner = THIS_MODULE; | 3709 | pg_proc_dir->owner = THIS_MODULE; |
3711 | 3710 | ||
3712 | pe = create_proc_entry(PGCTRL, 0600, pg_proc_dir); | 3711 | pe = proc_create(PGCTRL, 0600, pg_proc_dir, &pktgen_fops); |
3713 | if (pe == NULL) { | 3712 | if (pe == NULL) { |
3714 | printk(KERN_ERR "pktgen: ERROR: cannot create %s " | 3713 | printk(KERN_ERR "pktgen: ERROR: cannot create %s " |
3715 | "procfs entry.\n", PGCTRL); | 3714 | "procfs entry.\n", PGCTRL); |
@@ -3717,7 +3716,6 @@ static int __init pg_init(void) | |||
3717 | return -EINVAL; | 3716 | return -EINVAL; |
3718 | } | 3717 | } |
3719 | 3718 | ||
3720 | pe->proc_fops = &pktgen_fops; | ||
3721 | pe->data = NULL; | 3719 | pe->data = NULL; |
3722 | 3720 | ||
3723 | /* Register us to receive netdevice events */ | 3721 | /* Register us to receive netdevice events */ |