我需要从iw_statistics结构中读取某些统计信息,这里是代码:
struct net_device *dev;
struct iw_statistics *wi_stats = NULL;
dev = first_net_device(&init_net);
while (dev)
{
if (strncmp(dev->name , "wlan",4)==0 )
{
if (dev->wireless_handlers-get_wireless_stats(dev) !=NULL ) // <--- here's where the code crashes.
{
wi_stats = dev-wireless_handlers->get_wireless_stats(dev);
printk(KERN_INFO "wi_stats = dev-wireless_handlers->get_wireless_stats(dev); worked!!! :D\n");
}
}
}
我正在研究linux内核2.6.35,我正在编写一个内核模块。我在这里做错了什么?
答案 0 :(得分:0)
你真的有意写吗
if (dev->wireless_handlers-get_wireless_stats(dev) !=NULL )
或者你的意思是
if (dev->wireless_handlers->get_wireless_stats(dev) !=NULL )