1

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

4

1 回答 1

0

你真的是想写吗

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

还是你的意思

if (dev->wireless_handlers->get_wireless_stats(dev) !=NULL )
于 2012-06-15T14:28:59.980 回答