0
下面的代碼我想在kerenl模塊中創建一個鏈表,爲什麼我會得到下面的錯誤?內核鏈表初始化
error(in LIST_HEAD(root->list)): expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘->’ token
typedef struct
{
int a;
char* b;
struct list_head list;
}mystruct;
void add(mystruct* r)
{
mystruct* tmp = (mystruct*)vmalloc(sizeof(mystruct));
tmp->a = 110;
tmp->b = (char*)vmalloc(sizeof(char)*10);
list_add_tail(&(tmp->list),&(r->list));
}
int init_module(void)
{
mystruct *root;
LIST_HEAD(root->list);
add(root);
}