[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Minios-devel] [UNIKRAFT PATCH 05/11] include/uk/list: adapt imported code for Unikraft



Signed-off-by: Yuri Volchkov <yuri.volchkov@xxxxxxxxx>
---
 include/uk/list.h | 63 ++++++++---------------------------------------
 1 file changed, 10 insertions(+), 53 deletions(-)

diff --git a/include/uk/list.h b/include/uk/list.h
index e7a4929..9822005 100644
--- a/include/uk/list.h
+++ b/include/uk/list.h
@@ -31,50 +31,8 @@
 #ifndef _LINUX_LIST_H_
 #define _LINUX_LIST_H_
 
-/* TODO: this code is just imported and needs modifications before it
- * can be used in Unikraft. For now proxy directly to the existing
- * implementation - "compat_list.h"
- */
-#if 0
-
-/*
- * Since LIST_HEAD conflicts with the linux definition we must include any
- * FreeBSD header which requires it here so it is resolved with the correct
- * definition prior to the undef.
- */
-#include <linux/types.h>
-
-#include <sys/param.h>
-#include <sys/kernel.h>
-#include <sys/queue.h>
-#include <sys/cpuset.h>
-#include <sys/jail.h>
-#include <sys/lock.h>
-#include <sys/mutex.h>
-#include <sys/proc.h>
-#include <sys/vnode.h>
-#include <sys/conf.h>
-#include <sys/socket.h>
-#include <sys/mbuf.h>
-
-#include <net/bpf.h>
-#include <net/if.h>
-#include <net/if_var.h>
-#include <net/if_types.h>
-#include <net/if_media.h>
-#include <net/vnet.h>
-
-#include <netinet/in.h>
-#include <netinet/in_pcb.h>
-#include <netinet/in_var.h>
-#include <netinet/tcp_lro.h>
-
-#include <netinet6/in6_var.h>
-#include <netinet6/nd6.h>
-
-#include <vm/vm.h>
-#include <vm/vm_object.h>
-#include <vm/pmap.h>
+#include <uk/arch/atomic.h>
+#include <stddef.h>
 
 #ifndef prefetch
 #define        prefetch(x)
@@ -119,7 +77,7 @@ static inline void
 __list_del(struct list_head *prev, struct list_head *next)
 {
        next->prev = prev;
-       WRITE_ONCE(prev->next, next);
+       UK_WRITE_ONCE(prev->next, next);
 }
 
 static inline void
@@ -171,7 +129,7 @@ list_del_init(struct list_head *entry)
        INIT_LIST_HEAD(entry);
 }
 
-#define        list_entry(ptr, type, field)    container_of(ptr, type, field)
+#define        list_entry(ptr, type, field)    __containerof(ptr, type, field)
 
 #define        list_first_entry(ptr, type, member) \
        list_entry((ptr)->next, type, member)
@@ -343,14 +301,14 @@ static inline int
 hlist_empty(const struct hlist_head *h)
 {
 
-       return !READ_ONCE(h->first);
+       return !UK_READ_ONCE(h->first);
 }
 
 static inline void
 hlist_del(struct hlist_node *n)
 {
 
-       WRITE_ONCE(*(n->pprev), n->next);
+       UK_WRITE_ONCE(*(n->pprev), n->next);
        if (n->next != NULL)
                n->next->pprev = n->pprev;
 }
@@ -372,7 +330,7 @@ hlist_add_head(struct hlist_node *n, struct hlist_head *h)
        n->next = h->first;
        if (h->first != NULL)
                h->first->pprev = &n->next;
-       WRITE_ONCE(h->first, n);
+       UK_WRITE_ONCE(h->first, n);
        n->pprev = &h->first;
 }
 
@@ -383,7 +341,7 @@ hlist_add_before(struct hlist_node *n, struct hlist_node 
*next)
        n->pprev = next->pprev;
        n->next = next;
        next->pprev = &n->next;
-       WRITE_ONCE(*(n->pprev), n);
+       UK_WRITE_ONCE(*(n->pprev), n);
 }
 
 static inline void
@@ -391,7 +349,7 @@ hlist_add_behind(struct hlist_node *n, struct hlist_node 
*prev)
 {
 
        n->next = prev->next;
-       WRITE_ONCE(prev->next, n);
+       UK_WRITE_ONCE(prev->next, n);
        n->pprev = &prev->next;
 
        if (n->next != NULL)
@@ -445,7 +403,7 @@ static inline int list_is_last(const struct list_head *list,
        return list->next == head;
 }
 
-#define        hlist_entry(ptr, type, field)   container_of(ptr, type, field)
+#define        hlist_entry(ptr, type, field)   __containerof(ptr, type, field)
 
 #define        hlist_for_each(p, head)                                         
\
        for (p = (head)->first; p; p = (p)->next)
@@ -477,7 +435,6 @@ static inline int list_is_last(const struct list_head *list,
 
 extern void list_sort(void *priv, struct list_head *head, int (*cmp)(void 
*priv,
     struct list_head *a, struct list_head *b));
-#endif /* end of imported disabled code */
 
 /* TODO: get rid of the old linked list implementation */
 #include <uk/compat_list.h>
-- 
2.19.2


_______________________________________________
Minios-devel mailing list
Minios-devel@xxxxxxxxxxxxxxxxxxxx
https://lists.xenproject.org/mailman/listinfo/minios-devel

 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.