struct net_device-没有名为“ dev”的成员-但它在那里

时间:2019-02-15 19:25:55

标签: linux-device-driver porting toolchain esxi

我正在尝试将以太网卡的驱动程序从Linux移植到ESXi。一切顺利,但有时我发现死胡同。像这样一个。

编译所引发的错误之一是结构net_device没有成员'dev'。此行触发错误:

static inline struct device *aq_nic_get_dev(struct aq_nic_s *self)
{
        // member ndev is of type struct net_device
        return self->ndev->dev.parent; // the compiles throws the error here
}

struct net_device在Linux标头netdevice.h中定义:

struct net_device
{

    /*
     * This is the first field of the "visible" part of this structure
     * (i.e. as seen by users in the "Space.c" file).  It is the name
     * the interface.
     */
#if defined(__VMKLNX__)
    char            name[VMK_DEVICE_NAME_MAX_LENGTH];
#else /* !defined(__VMKLNX__) */
    char            name[IFNAMSIZ];
#endif /* defined(__VMKLNX__) */
    /* device name hash chain */
    struct hlist_node   name_hlist;

    /*
     *  I/O specific fields
     *  FIXME: Merge these and struct ifmap into one
     */
    unsigned long       mem_end;    /* shared mem end   */
    unsigned long       mem_start;  /* shared mem start */
    unsigned long       base_addr;  /* device I/O address   */
    unsigned int        irq;        /* device IRQ number    */

    /*
     *  Some hardware also needs these fields, but they are not
     *  part of the usual set specified in Space.c.
     */

    unsigned char       if_port;    /* Selectable AUI, TP,..*/
    unsigned char       dma;        /* DMA channel      */

    unsigned long       state;

    struct net_device   *next;

    /* The device initialization function. Called only once. */
    int         (*init)(struct net_device *dev);

    // other stuff below ommited
}; 

我有什么想念的吗?还是因为工具链使用了旧版本的gcc和bnutils,所以对dev的调用语法可能已更改为过时了?

最好

弗朗西斯

0 个答案:

没有答案