First declare foo struct foo { ... struct list_head list }; To initial list head LIST_HEAD(list); or struct list_head list; INIT_LIST_HEAD(&list); for further info, see <linux/list.h> -zhiwei --- Sridhar N <srin@symonds.net> wrote: > Hi, > I need a to use a singly-linked list in my program, > and since a > doubly-linked list is provided in linux/list.h, i > thought of using it. But i > don't know how to use it. I have a structure of > nodes that i want to link, > say > > struct foo { > int foo1; > int foo2; > char * foo3; > struct list_head list; > }; > > How do I add a new node or initialize it. Seeing > list.h didn't help me :-( > But why doesn't task_struct use it ? > > regards > Sridhar > > -- > Anyone can do any amount of work provided it isn't > the work he is supposed to > be doing > -- Murphy's Laws on Work > -- > Kernelnewbies: Help each other learn about the Linux > kernel. > Archive: > http://mail.nl.linux.org/kernelnewbies/ > FAQ: http://kernelnewbies.org/faq/ > __________________________________________________ Do You Yahoo!? Yahoo! Health - your guide to health and wellness http://health.yahoo.com -- Kernelnewbies: Help each other learn about the Linux kernel. Archive: http://mail.nl.linux.org/kernelnewbies/ FAQ: http://kernelnewbies.org/faq/