From: Jack Lange Date: Tue, 3 Feb 2009 21:34:20 +0000 (-0600) Subject: added list_tail_entry() accessor function X-Git-Url: http://v3vee.org/palacios/gitweb/gitweb.cgi?p=palacios.git;a=commitdiff_plain;h=5dba37e6d7ff831c2b2239851701a83d21956645 added list_tail_entry() accessor function --- diff --git a/palacios/include/palacios/vmm_list.h b/palacios/include/palacios/vmm_list.h index 0d8747e..0d5b907 100644 --- a/palacios/include/palacios/vmm_list.h +++ b/palacios/include/palacios/vmm_list.h @@ -233,6 +233,20 @@ 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_for_each - iterate over a list * @pos: the &struct list_head to use as a loop counter. * @head: the head for your list.