Talk About Network

Google


Register and Login
Nick
Password
Register create new account Sign up is FREE and you can post replies, new topics, bookmark posts and more!
Recover lost password


Programming > C > Kernel modules ...
Latest [ Topics | Posts ] Archive Post A New Topic Post a Reply
<< Topic < Post Post 1 of 2 Topic 25452 of 27670
Post > Topic >>

Kernel modules syntaxes

by InuY4sha <inuY4sha@[EMAIL PROTECTED] > Apr 9, 2008 at 04:08 AM

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!
 




 2 Posts in Topic:
Kernel modules syntaxes
InuY4sha <inuY4sha@[EM  2008-04-09 04:08:24 
Re: Kernel modules syntaxes
Antoninus Twink <nospa  2008-04-09 18:20:47 

Post A Reply:
  Go here to Signup

AddThis Feed Button


About - Advertising - Contact - Frequently Asked Questions - Privacy Policy - Terms of Use - Signup

Contact
tan12V112 Fri Oct 10 22:11:25 CDT 2008.