LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Programming (https://www.linuxquestions.org/questions/programming-9/)
-   -   question on pointers to functions (https://www.linuxquestions.org/questions/programming-9/question-on-pointers-to-functions-100941/)

h/w 10-06-2003 04:15 PM

question on pointers to functions
 
as per <linux/netdevice.h> , there is this line:

Code:

struct net_device_stats* (*get_stats)(struct net_device *dev);
if im reading this right, it means:
"a ptr to a function 'get_stats' thats takes a ptr to the struct as argument and returns a ptr to the other struct"

if im wrong someone pls correct me.

provided im right, my question is - where is this function "get_stats" that is to be called, defined?

thanks in advance.

h/w 10-06-2003 04:36 PM

what am i trying to do?
im trying to get realtime stats from my wireless pcmcia card, something looking like the 'top' command.

if anybody has any suggestions on how to go about this ...

thanks.

kev82 10-06-2003 04:40 PM

to answer your first question

get_stats is a pointer to a function that takes a pointer to a struct net_device and returns a pointer to a struct net_device_stats

so get_stats is a variable that is being declared here.

h/w 10-06-2003 04:51 PM

thank you very much - dont know why i was thinking get_stats was a function there. stupid mistake. :)


All times are GMT -5. The time now is 11:56 AM.