X-Git-Url: http://v3vee.org/palacios/gitweb/gitweb.cgi?p=palacios.git;a=blobdiff_plain;f=palacios%2Finclude%2Fpalacios%2Fvmm_list.h;h=f44933af52685a406e65b8130e4e520d1ccde6bc;hp=9fc2e5c0aba7076eb5a1d8af10a27c4aedd6564f;hb=0121a4503305424096e2b5c5bd3b6c3af2d813e5;hpb=f4b074d9bf5c28dfd6e5fd616805ade2e9473b01 diff --git a/palacios/include/palacios/vmm_list.h b/palacios/include/palacios/vmm_list.h index 9fc2e5c..f44933a 100644 --- a/palacios/include/palacios/vmm_list.h +++ b/palacios/include/palacios/vmm_list.h @@ -1,7 +1,6 @@ /* Stolen From Linux list implementation */ -/* Modifications by Jack Lange */ -/* (c) 2008, Jack Lange */ -/* (c) 2008, The V3VEE Project */ +/* 2008, Modifications by Jack Lange */ + #ifndef _VMM_LIST_H #define _VMM_LIST_H @@ -20,7 +19,7 @@ (type *)( (char *)__mptr - offsetof(type,member) );}) -static inline void prefetch(const void *x) {;} +static inline void prefetch(const void *x) {const void * foo; foo = x;} /* * These are non-NULL pointers that will result in page faults @@ -234,6 +233,38 @@ static inline void list_splice_init(struct list_head *list, container_of(ptr, type, member) /** + * list_entry - get the struct for the tail entry + * @ptr: the list_head head pointer. + * @type: the type of the struct this is embedded in. + * @member: the name of the list_struct within the struct. + */ +#define list_tail_entry(head, type, member) ({ \ + type * tail = NULL; \ + if ((head)->prev != (head)) { \ + tail = list_entry((head)->prev, type, member); \ + } \ + tail; \ +}) + +/** + * list_first_entry - get the struct for the first entry + * @ptr: the list_head head pointer. + * @type: the type of the struct this is embedded in. + * @member: the name of the list_struct within the struct. + */ +#define list_first_entry(head, type, member) \ +({ \ + type * first = NULL; \ + if ((head)->next != (head)) { \ + first = list_entry((head)->next, type, member); \ + } \ + first; \ + }) + + + + +/** * list_for_each - iterate over a list * @pos: the &struct list_head to use as a loop counter. * @head: the head for your list.