???????????????????????????????????????????????????????????????У???????????????????????????????????????????????????????????

??????????????????????????????????????????????????????????????ù?????????????????????????Ч????????????????????K&R????C????????????LKD3e????????????????????????????????и??????????????????????????????LKD3e?????????????????????????????????β??????

????1???????????

????<linux/list.h>
    ??????? 
    struct list_head {
      struct list_head *next??
      struct list_head  *prev;
    };
????????????????????????????????????????????????????????????????????????????????涼???????struct list_head???????????????????????????????????????????а????????????????С???????????????????????????struct list_head???????????????????????????????????????????????????struct list_head???????????????????????а???struct list_head??????????list_entry()???????struct list_head?????????????????
#define list_entry(ptr?? type?? member)
    container_of(ptr?? type?? member)

    #define container_of(ptr?? type?? member) ({         
    const typeof( ((type *)0)->member ) *__mptr = (ptr);   
    (type *)( (char *)__mptr - offsetof(type??member) );})
 
????LKD3e???????????C?????У???????????е??????????????????ABI??????????????????????????????????????????????????????????

????2?????????????

???????????????????????????????????????????????????????????????????ip???????????????????????????????????????????ip????????????????????????????????β??????????????????ip????????????4??__u32??С??????????????ipv6????????ipv6?????128bit??4*32?????128bit???????ipv4????????????0???????????????????v4????????

typedef unsigned int __u32
    struct ipstore{
    unsigned long time;
    __u32 addr[4];
    struct list_head list;
    };
    static LIST_HEAD(addr_list);
 
????????????????????addr_list???????LIST_HEAD????????????addr_list????????????

#define LIST_HEAD_INIT(name) { &(name)?? &(name) }

    #define LIST_HEAD(name)
        struct list_head name = LIST_HEAD_INIT(name)
 
????????????????????????????????????

struct ipstore *ist;
    ist = kmalloc(sizeof (*ist)?? GFP_ATOMIC);
    if(!ist)
    {
        printk("kmalloc failed. ");
        return -1;
    }
   
    ist->time = jiffies+time*HZ;
    ist->addr[0] = 0xc0a80101;//IP:192.168.1.1
    INIT_LIST_HEAD(&ist->list);


???????ist?????????????????????????ipstore????????struct list_head???list????????

????3????????????????????

static inline void list_add(struct list_head *new?? struct list_head *head)
    {  
        __list_add(new?? head?? head->next);
    }

????????????????????????????????

list_add(&ist->list?? &addr_list);

???????????????????

struct ipstore *ist;
    ist = kmalloc(sizeof (*ist)?? GFP_ATOMIC);
    if(!ist)
    {
        printk("kmalloc failed. ");
        return -1;
    }
   
    ist->time = jiffies+time*HZ;
    ist->addr[0] = 0xc0a80101;//IP:192.168.1.1
    INIT_LIST_HEAD(&ist->list);
    list_add(&ist->list?? &addr_list);

??????????????addr_list?????????μ???????