LinuxQuestions.org
Help answer threads with 0 replies.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Software
User Name
Password
Linux - Software This forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.

Notices


Reply
  Search this Thread
Old 10-17-2009, 10:36 PM   #1
jhwilliams
Senior Member
 
Registered: Apr 2007
Location: Portland, OR
Distribution: Debian, Android, LFS
Posts: 1,168

Rep: Reputation: 211Reputation: 211Reputation: 211
New for 2.6.31: net_device_ops structure. How do I set function pointers?


Hello,

In kernel 2.6.31 it appears that a bunch of the function pointers to net_device operations disappeared from the net_device structure, and were put into a new net_device_ops structure which is a const member of the new copy of net_device.

...If netdev_ops is declared const (and unitialized) in net_device, how am I supposed to do things like:

Code:
mynet_device->netdev_ops->ndo_open = my_drivers_open_function();
Thanks for any ideas!!
 
Old 10-19-2009, 02:17 AM   #2
jhwilliams
Senior Member
 
Registered: Apr 2007
Location: Portland, OR
Distribution: Debian, Android, LFS
Posts: 1,168

Original Poster
Rep: Reputation: 211Reputation: 211Reputation: 211
I was able to resolve this.

In the net_device struct (2.6.31+) the mew net_device_ops member is declared as:
Code:
const struct net_device_ops *netdev_ops;
As such, you can easily instantiate a net_device_ops struct with whatever function pointer assignments you desire, and then change the pointer reference to the new struct. Suppose that your net_device_opts struct is instantiated as "mynetdev_ops." The solution is:

Code:
mynet_dev->netdev_ops = &mynetdev_ops;
I felt silly having to reference this again, but this is relevant: http://blog.voidnish.com/?p=37

Last edited by jhwilliams; 10-19-2009 at 02:19 AM.
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Using C function pointers in C++ Hexstatic Programming 3 09-26-2006 05:58 PM
Matrix of function pointers kvtournh Programming 9 03-20-2006 04:38 AM
problem with function returning pointers ***func() mlaich Programming 5 01-19-2006 09:17 PM
Function pointers, calling, and templates The_Nerd Programming 2 10-09-2005 07:08 PM
Function pointers in C. Matir Programming 2 03-15-2005 03:10 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Software

All times are GMT -5. The time now is 09:57 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration