Palacios Public Git Repository

To checkout Palacios execute

  git clone http://v3vee.org/palacios/palacios.web/palacios.git
This will give you the master branch. You probably want the devel branch or one of the release branches. To switch to the devel branch, simply execute
  cd palacios
  git checkout --track -b devel origin/devel
The other branches are similar.


lots of fixes
[palacios.git] / palacios / include / palacios / vmm_list.h
index 95da489..f44933a 100644 (file)
@@ -1,13 +1,12 @@
-/* Stolen From Linux list implementation*/
-/* Modifications by Jack Lange <jarusl@cs.northwestern.edu> */
-/* (c) 2008, Jack Lange <jarusl@cs.northwestern.edu> */
-/* (c) 2008, The V3VEE Project <http://www.v3vee.org> */
+/* Stolen From Linux list implementation */
+/* 2008, Modifications by Jack Lange <jarusl@cs.northwestern.edu> */
+
 
 #ifndef _VMM_LIST_H
 #define _VMM_LIST_H
 
-// JRL FIXME
-// #ifdef __V3VEE__
+
+#ifdef __V3VEE__
 
 #include <palacios/vmm_string.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.
@@ -533,7 +564,7 @@ static inline void hlist_add_after(struct hlist_node *n,
             pos = n)
 
 
-// JRL FIXME
-//#endif // ! __V3VEE__
+
+#endif // ! __V3VEE__
 
 #endif