X-Git-Url: http://v3vee.org/palacios/gitweb/gitweb.cgi?a=blobdiff_plain;f=palacios%2Finclude%2Fpalacios%2Fvmm_list.h;h=22f447c9e5de81a4fd34bf945c2b3f14aae4eddc;hb=4931bc084ced4bcb172c7bcb197ab55b1c9bdf80;hp=4a6928731f8acc918bfb07633458970814c7fa93;hpb=4f7c3b759e3889870c5b5e7d09b3ffcc168e5632;p=palacios.git diff --git a/palacios/include/palacios/vmm_list.h b/palacios/include/palacios/vmm_list.h index 4a69287..22f447c 100644 --- a/palacios/include/palacios/vmm_list.h +++ b/palacios/include/palacios/vmm_list.h @@ -1,11 +1,29 @@ -/* Stolen From Linux list implementation*/ -/* Modifications by Jack Lange */ +/* Taken From Linux list implementation + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +*/ + +/* 2008, Modifications by Jack Lange */ + + #ifndef _VMM_LIST_H #define _VMM_LIST_H -// JRL FIXME -// #ifdef __V3VEE__ + +#ifdef __V3VEE__ #include @@ -18,7 +36,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 @@ -232,6 +250,53 @@ 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_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. @@ -531,7 +596,7 @@ static inline void hlist_add_after(struct hlist_node *n, pos = n) -// JRL FIXME -//#endif // ! __V3VEE__ + +#endif // ! __V3VEE__ #endif