I
InuY4sha
Hi all,
I already asked about this line but now the question is slightly
different .. so I've got a module
"pippo.c" and within its code I've got the following lines:
00001 static int mynd_dev_init(struct net_device *dev);
00002 struct net_device my_device = { init: mynd_dev_init, };
.....
.....
00100 static int __init mynd_init(void){
00101 struct net_device *dev = &my_device;
00102 register_netdev(dev);
00103 }
00104 module_init(mynd_init);
I'm guessing, these instructions tell the kernel that when it
initializes "dev" (through the register_netdev function) it has to
use the mynd_dev_init function.
What I don't get is how the "dev" structure is then passed as the
input parameter to mynd_dev_init???
Again, I'm guessing this is implicitly done through the
"register_netdev" function, to which basically 2 information elements
are given as input parameters: the net_device structure and the
net_device initialization function (as a field of the net_device
structure itself).
Am I guessing right???
Thanks in advance,
Riccardo
Am I guessing right?
Thanks guys!
I already asked about this line but now the question is slightly
different .. so I've got a module
"pippo.c" and within its code I've got the following lines:
00001 static int mynd_dev_init(struct net_device *dev);
00002 struct net_device my_device = { init: mynd_dev_init, };
.....
.....
00100 static int __init mynd_init(void){
00101 struct net_device *dev = &my_device;
00102 register_netdev(dev);
00103 }
00104 module_init(mynd_init);
I'm guessing, these instructions tell the kernel that when it
initializes "dev" (through the register_netdev function) it has to
use the mynd_dev_init function.
What I don't get is how the "dev" structure is then passed as the
input parameter to mynd_dev_init???
Again, I'm guessing this is implicitly done through the
"register_netdev" function, to which basically 2 information elements
are given as input parameters: the net_device structure and the
net_device initialization function (as a field of the net_device
structure itself).
Am I guessing right???
Thanks in advance,
Riccardo
Am I guessing right?
Thanks guys!