X-Git-Url: http://v3vee.org/palacios/gitweb/gitweb.cgi?a=blobdiff_plain;f=palacios%2Finclude%2Fpalacios%2Fvmm_list.h;h=f1e878f5a616104e61fee4deb5c99ffe60dd08f3;hb=96241180a9bfdf5eb59082ce4cfd27a1a898181a;hp=0d5b907079e7d5d7941bd69ff615d033ec28ea56;hpb=5dba37e6d7ff831c2b2239851701a83d21956645;p=palacios.git diff --git a/palacios/include/palacios/vmm_list.h b/palacios/include/palacios/vmm_list.h index 0d5b907..f1e878f 100644 --- a/palacios/include/palacios/vmm_list.h +++ b/palacios/include/palacios/vmm_list.h @@ -247,6 +247,39 @@ static inline void list_splice_init(struct list_head *list, }) /** + * 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_next_entry -- get the struct for the next entry in a list + * @ptr: current list entry + * @type: type of the struct this is embedded in + * @member: name of the list struct within the struct + */ +#define list_next_entry(node, type, member) \ + ({ \ + type * next = NULL; \ + if ((node)->next != (node)) { \ + next = list_entry((node)->next, type, member); \ + } \ + next; \ + }) + + +/** * list_for_each - iterate over a list * @pos: the &struct list_head to use as a loop counter. * @head: the head for your list.