我需要从 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,并且正在编写一个内核模块。我在这里做错了什么?