I'm trying to use the Linux Kernel Linked List implementation but I am unable to compile. I'm following these sources exactly with no results (http://www.roman10.net/linux-kernel-programminglinked-list/ and http://kernelnewbies.org/FAQ/LinkedLists)
The list.h Kernel Macro for LIST_HEAD_INIT is as follows:
#define LIST_HEAD_INIT(name) { &(name), &(name) }
struct Node {
int data;
struct list_head list;
};
struct Node mylinkedlist;
LIST_HEAD_INIT(&mylinkedlist.list);
void add(){
struct Node first;
first.data = 1;
first.list = LIST_HEAD_INIT(first.list);
list_add_tail(&first->list, &mylinkedlist.list);
return 0;
}
I keep getting: "error: expected identifier or '(' before '{'"
LIST_HEAD_INITis defined?