试图阅读iw_statistics但代码不起作用?

时间:2012-06-15 10:40:44

标签: linux wireless

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

1 个答案:

答案 0 :(得分:0)

你真的有意写吗

if (dev->wireless_handlers-get_wireless_stats(dev) !=NULL )

或者你的意思是

if (dev->wireless_handlers->get_wireless_stats(dev) !=NULL )