]> xenbits.xensource.com Git - people/liuw/mini-os.git/commitdiff
prefix mini-os lists with minios_, drop QEMU_ prefix from QEMU_LIST_*
authorKeir Fraser <keir.fraser@citrix.com>
Fri, 8 Aug 2008 09:48:48 +0000 (10:48 +0100)
committerKeir Fraser <keir.fraser@citrix.com>
Fri, 8 Aug 2008 09:48:48 +0000 (10:48 +0100)
That permits to reduce the amount of difference with upstream.

Signed-off-by: Samuel Thibault <samuel.thibault@eu.citrix.com>
fs-front.c
include/fs.h
include/list.h
include/sched.h
include/semaphore.h
include/wait.h
include/waittypes.h
lib/xmalloc.c
sched.c

index c81f1a66c933d5d17bae82a74fb771ef60446534..1cecab0a142166d637fd6694ebcb0328460f02eb 100644 (file)
@@ -1170,7 +1170,7 @@ done:
     return 1;
 }
 
-static void add_export(struct list_head *exports, unsigned int domid)
+static void add_export(struct minios_list_head *exports, unsigned int domid)
 {
     char node[1024], **exports_list = NULL, *ret_msg;
     int j = 0;
@@ -1192,8 +1192,8 @@ static void add_export(struct list_head *exports, unsigned int domid)
             import->dom_id = domid;
             import->export_id = export_id;
             import->import_id = import_id++;
-            INIT_LIST_HEAD(&import->list);
-            list_add(&import->list, exports);
+            MINIOS_INIT_LIST_HEAD(&import->list);
+            minios_list_add(&import->list, exports);
         }
         free(exports_list[j]);
         j++;
@@ -1205,14 +1205,14 @@ static void add_export(struct list_head *exports, unsigned int domid)
 }
 
 #if 0
-static struct list_head* probe_exports(void)
+static struct minios_list_head* probe_exports(void)
 {
-    struct list_head *exports;
+    struct minios_list_head *exports;
     char **node_list = NULL, *msg = NULL;
     int i = 0;
 
-    exports = xmalloc(struct list_head);
-    INIT_LIST_HEAD(exports);
+    exports = xmalloc(struct minios_list_head);
+    MINIOS_INIT_LIST_HEAD(exports);
     
     msg = xenbus_ls(XBT_NIL, "/local/domain", &node_list);
     if(msg)
@@ -1237,19 +1237,19 @@ exit:
 }
 #endif
 
-LIST_HEAD(exports);
+MINIOS_LIST_HEAD(exports);
 
 void init_fs_frontend(void)
 {
-    struct list_head *entry;
+    struct minios_list_head *entry;
     struct fs_import *import = NULL;
     printk("Initing FS fronend(s).\n");
 
     //exports = probe_exports();
     add_export(&exports, 0);
-    list_for_each(entry, &exports)
+    minios_list_for_each(entry, &exports)
     {
-        import = list_entry(entry, struct fs_import, list);
+        import = minios_list_entry(entry, struct fs_import, list);
         printk("FS export [dom=%d, id=%d] found\n", 
                 import->dom_id, import->export_id);
         init_fs_import(import);
index cd8262e54db3c052fda960321189f06c6251867e..aa191358223a672e5909d1a73f779765eb2fe522 100644 (file)
@@ -13,7 +13,7 @@ struct fs_import
     domid_t dom_id;                 /* dom id of the exporting domain       */ 
     u16 export_id;                  /* export id (exporting dom specific)   */
     u16 import_id;                  /* import id (specific to this domain)  */ 
-    struct list_head list;          /* list of all imports                  */
+    struct minios_list_head list;   /* list of all imports                  */
     unsigned int nr_entries;        /* Number of entries in rings & request
                                        array                                */
     struct fsif_front_ring ring;    /* frontend ring (contains shared ring) */
index fbb1fa8cc07ae600d3c572a426df4a967fe3f451..a60ae234312f0f7b887614839ab9b082427ffffc 100644 (file)
  * using the generic single-entry routines.
  */
 
-struct list_head {
-       struct list_head *next, *prev;
+struct minios_list_head {
+       struct minios_list_head *next, *prev;
 };
 
-#define LIST_HEAD_INIT(name) { &(name), &(name) }
+#define MINIOS_LIST_HEAD_INIT(name) { &(name), &(name) }
 
-#define LIST_HEAD(name) \
-       struct list_head name = LIST_HEAD_INIT(name)
+#define MINIOS_LIST_HEAD(name) \
+       struct minios_list_head name = MINIOS_LIST_HEAD_INIT(name)
 
-#define INIT_LIST_HEAD(ptr) do { \
+#define MINIOS_INIT_LIST_HEAD(ptr) do { \
        (ptr)->next = (ptr); (ptr)->prev = (ptr); \
 } while (0)
 
-#define list_top(head, type, member)                                     \
+#define minios_list_top(head, type, member)                                      \
 ({                                                                       \
-       struct list_head *_head = (head);                                 \
-       list_empty(_head) ? NULL : list_entry(_head->next, type, member); \
+       struct minios_list_head *_head = (head);                                  \
+       minios_list_empty(_head) ? NULL : minios_list_entry(_head->next, type, member); \
 })
 
 /*
@@ -36,9 +36,9 @@ struct list_head {
  * This is only for internal list manipulation where we know
  * the prev/next entries already!
  */
-static __inline__ void __list_add(struct list_head * new,
-       struct list_head * prev,
-       struct list_head * next)
+static __inline__ void __minios_list_add(struct minios_list_head * new,
+       struct minios_list_head * prev,
+       struct minios_list_head * next)
 {
        next->prev = new;
        new->next = next;
@@ -47,29 +47,29 @@ static __inline__ void __list_add(struct list_head * new,
 }
 
 /**
- * list_add - add a new entry
+ * minios_list_add - add a new entry
  * @new: new entry to be added
  * @head: list head to add it after
  *
  * Insert a new entry after the specified head.
  * This is good for implementing stacks.
  */
-static __inline__ void list_add(struct list_head *new, struct list_head *head)
+static __inline__ void minios_list_add(struct minios_list_head *new, struct minios_list_head *head)
 {
-       __list_add(new, head, head->next);
+       __minios_list_add(new, head, head->next);
 }
 
 /**
- * list_add_tail - add a new entry
+ * minios_list_add_tail - add a new entry
  * @new: new entry to be added
  * @head: list head to add it before
  *
  * Insert a new entry before the specified head.
  * This is useful for implementing queues.
  */
-static __inline__ void list_add_tail(struct list_head *new, struct list_head *head)
+static __inline__ void minios_list_add_tail(struct minios_list_head *new, struct minios_list_head *head)
 {
-       __list_add(new, head->prev, head);
+       __minios_list_add(new, head->prev, head);
 }
 
 /*
@@ -79,54 +79,54 @@ static __inline__ void list_add_tail(struct list_head *new, struct list_head *he
  * This is only for internal list manipulation where we know
  * the prev/next entries already!
  */
-static __inline__ void __list_del(struct list_head * prev,
-                                 struct list_head * next)
+static __inline__ void __minios_list_del(struct minios_list_head * prev,
+                                 struct minios_list_head * next)
 {
        next->prev = prev;
        prev->next = next;
 }
 
 /**
- * list_del - deletes entry from list.
+ * minios_list_del - deletes entry from list.
  * @entry: the element to delete from the list.
- * Note: list_empty on entry does not return true after this, the entry is in an undefined state.
+ * Note: minios_list_empty on entry does not return true after this, the entry is in an undefined state.
  */
-static __inline__ void list_del(struct list_head *entry)
+static __inline__ void minios_list_del(struct minios_list_head *entry)
 {
-       __list_del(entry->prev, entry->next);
+       __minios_list_del(entry->prev, entry->next);
 }
 
 /**
- * list_del_init - deletes entry from list and reinitialize it.
+ * minios_list_del_init - deletes entry from list and reinitialize it.
  * @entry: the element to delete from the list.
  */
-static __inline__ void list_del_init(struct list_head *entry)
+static __inline__ void minios_list_del_init(struct minios_list_head *entry)
 {
-       __list_del(entry->prev, entry->next);
-       INIT_LIST_HEAD(entry); 
+       __minios_list_del(entry->prev, entry->next);
+       MINIOS_INIT_LIST_HEAD(entry); 
 }
 
 /**
- * list_empty - tests whether a list is empty
+ * minios_list_empty - tests whether a list is empty
  * @head: the list to test.
  */
-static __inline__ int list_empty(struct list_head *head)
+static __inline__ int minios_list_empty(struct minios_list_head *head)
 {
        return head->next == head;
 }
 
 /**
- * list_splice - join two lists
+ * minios_list_splice - join two lists
  * @list: the new list to add.
  * @head: the place to add it in the first list.
  */
-static __inline__ void list_splice(struct list_head *list, struct list_head *head)
+static __inline__ void minios_list_splice(struct minios_list_head *list, struct minios_list_head *head)
 {
-       struct list_head *first = list->next;
+       struct minios_list_head *first = list->next;
 
        if (first != list) {
-               struct list_head *last = list->prev;
-               struct list_head *at = head->next;
+               struct minios_list_head *last = list->prev;
+               struct minios_list_head *at = head->next;
 
                first->prev = head;
                head->next = first;
@@ -137,54 +137,54 @@ static __inline__ void list_splice(struct list_head *list, struct list_head *hea
 }
 
 /**
- * list_entry - get the struct for this entry
- * @ptr:       the &struct list_head pointer.
+ * minios_list_entry - get the struct for this entry
+ * @ptr:       the &struct minios_list_head pointer.
  * @type:      the type of the struct this is embedded in.
- * @member:    the name of the list_struct within the struct.
+ * @member:    the name of the minios_list_struct within the struct.
  */
-#define list_entry(ptr, type, member) \
+#define minios_list_entry(ptr, type, member) \
        ((type *)((char *)(ptr)-(unsigned long)(&((type *)0)->member)))
 
 /**
- * list_for_each       -       iterate over a list
- * @pos:       the &struct list_head to use as a loop counter.
+ * minios_list_for_each        -       iterate over a list
+ * @pos:       the &struct minios_list_head to use as a loop counter.
  * @head:      the head for your list.
  */
-#define list_for_each(pos, head) \
+#define minios_list_for_each(pos, head) \
        for (pos = (head)->next; pos != (head); pos = pos->next)
                
 /**
- * list_for_each_safe  -       iterate over a list safe against removal of list entry
- * @pos:       the &struct list_head to use as a loop counter.
- * @n:         another &struct list_head to use as temporary storage
+ * minios_list_for_each_safe   -       iterate over a list safe against removal of list entry
+ * @pos:       the &struct minios_list_head to use as a loop counter.
+ * @n:         another &struct minios_list_head to use as temporary storage
  * @head:      the head for your list.
  */
-#define list_for_each_safe(pos, n, head) \
+#define minios_list_for_each_safe(pos, n, head) \
        for (pos = (head)->next, n = pos->next; pos != (head); \
                pos = n, n = pos->next)
 
 /**
- * list_for_each_entry -       iterate over list of given type
+ * minios_list_for_each_entry  -       iterate over list of given type
  * @pos:       the type * to use as a loop counter.
  * @head:      the head for your list.
- * @member:    the name of the list_struct within the struct.
+ * @member:    the name of the minios_list_struct within the struct.
  */
-#define list_for_each_entry(pos, head, member)                         \
-       for (pos = list_entry((head)->next, typeof(*pos), member);      \
+#define minios_list_for_each_entry(pos, head, member)                          \
+       for (pos = minios_list_entry((head)->next, typeof(*pos), member);       \
             &pos->member != (head);                                    \
-            pos = list_entry(pos->member.next, typeof(*pos), member))
+            pos = minios_list_entry(pos->member.next, typeof(*pos), member))
 
 /**
- * list_for_each_entry_safe - iterate over list of given type safe against removal of list entry
+ * minios_list_for_each_entry_safe - iterate over list of given type safe against removal of list entry
  * @pos:       the type * to use as a loop counter.
  * @n:         another type * to use as temporary storage
  * @head:      the head for your list.
- * @member:    the name of the list_struct within the struct.
+ * @member:    the name of the minios_list_struct within the struct.
  */
-#define list_for_each_entry_safe(pos, n, head, member)                 \
-       for (pos = list_entry((head)->next, typeof(*pos), member),      \
-               n = list_entry(pos->member.next, typeof(*pos), member); \
+#define minios_list_for_each_entry_safe(pos, n, head, member)                  \
+       for (pos = minios_list_entry((head)->next, typeof(*pos), member),       \
+               n = minios_list_entry(pos->member.next, typeof(*pos), member);  \
             &pos->member != (head);                                    \
-            pos = n, n = list_entry(n->member.next, typeof(*n), member))
+            pos = n, n = minios_list_entry(n->member.next, typeof(*n), member))
 #endif /* _LINUX_LIST_H */
 
index b3dab8dc6c893d8657d44619a1a698b594ce1005..3359439b55d5f62fc5d273bd98f5f744839b4642 100644 (file)
@@ -19,7 +19,7 @@ struct thread
 #else /* !defined(__ia64__) */
     thread_regs_t regs;
 #endif /* !defined(__ia64__) */
-    struct list_head thread_list;
+    struct minios_list_head thread_list;
     u32 flags;
     s_time_t wakeup_time;
 #ifdef HAVE_LIBC
index 368d09ecb4ece01f1b3d1c4d65cceabd07d518e3..82360467148bf248cdcfd34ab016c010f33c7b11 100644 (file)
@@ -21,7 +21,7 @@ struct semaphore
 struct rw_semaphore {
        signed long             count;
        spinlock_t              wait_lock;
-       struct list_head        wait_list;
+       struct minios_list_head wait_list;
        int                     debug;
 };
 
index 2dc109b4f74ce5e03acc5bdedff20c6d0771bcd6..14e98ba755df5099c423a3e2652eb7ed8c39b1a7 100644 (file)
@@ -8,42 +8,42 @@
 #define DEFINE_WAIT(name)                               \
 struct wait_queue name = {                              \
     .thread       = current,                            \
-    .thread_list  = LIST_HEAD_INIT((name).thread_list), \
+    .thread_list  = MINIOS_LIST_HEAD_INIT((name).thread_list), \
 }
 
 
 static inline void init_waitqueue_head(struct wait_queue_head *h)
 {
-  INIT_LIST_HEAD(&h->thread_list);
+  MINIOS_INIT_LIST_HEAD(&h->thread_list);
 }
 
 static inline void init_waitqueue_entry(struct wait_queue *q, struct thread *thread)
 {
     q->thread = thread;
-    INIT_LIST_HEAD(&q->thread_list);
+    MINIOS_INIT_LIST_HEAD(&q->thread_list);
 }
 
 
 static inline void add_wait_queue(struct wait_queue_head *h, struct wait_queue *q)
 {
-    if (list_empty(&q->thread_list))
-        list_add(&q->thread_list, &h->thread_list);   
+    if (minios_list_empty(&q->thread_list))
+        minios_list_add(&q->thread_list, &h->thread_list);   
 }
 
 static inline void remove_wait_queue(struct wait_queue *q)
 {
-    list_del(&q->thread_list);
+    minios_list_del(&q->thread_list);
 }
 
 static inline void wake_up(struct wait_queue_head *head)
 {
     unsigned long flags;
-    struct list_head *tmp, *next;
+    struct minios_list_head *tmp, *next;
     local_irq_save(flags);
-    list_for_each_safe(tmp, next, &head->thread_list)
+    minios_list_for_each_safe(tmp, next, &head->thread_list)
     {
          struct wait_queue *curr;
-         curr = list_entry(tmp, struct wait_queue, thread_list);
+         curr = minios_list_entry(tmp, struct wait_queue, thread_list);
          wake(curr->thread);
     }
     local_irq_restore(flags);
index 326eef0f45c6947d2b29e874fb7d080950644c70..1215ffe0bebb4bca5ff3be119a1bba6781648b00 100644 (file)
@@ -7,13 +7,13 @@ struct thread;
 struct wait_queue
 {
     struct thread *thread;
-    struct list_head thread_list;
+    struct minios_list_head thread_list;
 };
 
 struct wait_queue_head
 {
     /* TODO - lock required? */
-    struct list_head thread_list;
+    struct minios_list_head thread_list;
 };
 
 #define DECLARE_WAIT_QUEUE_HEAD(name) \
index 292b2085d057047960dab5ab279cce16a88095a0..c33c48ab41062b7aed5e2de02e545d51e7baad50 100644 (file)
 #include <xmalloc.h>
 
 #ifndef HAVE_LIBC
-static LIST_HEAD(freelist);
+static MINIOS_LIST_HEAD(freelist);
 /* static spinlock_t freelist_lock = SPIN_LOCK_UNLOCKED; */
 
 struct xmalloc_hdr
 {
     /* Total including this hdr, unused padding and second hdr. */
     size_t size;
-    struct list_head freelist;
+    struct minios_list_head freelist;
 } __cacheline_aligned;
 
 /* Unused padding data between the two hdrs. */
@@ -82,7 +82,7 @@ static void maybe_split(struct xmalloc_hdr *hdr, size_t size, size_t block)
         extra = (struct xmalloc_hdr *)((unsigned long)hdr + size);
         extra->size = leftover;
         /* spin_lock_irqsave(&freelist_lock, flags); */
-        list_add(&extra->freelist, &freelist);
+        minios_list_add(&extra->freelist, &freelist);
         /* spin_unlock_irqrestore(&freelist_lock, flags); */
     }
     else
@@ -155,14 +155,14 @@ void *_xmalloc(size_t size, size_t align)
 
     /* Search free list. */
     /* spin_lock_irqsave(&freelist_lock, flags); */
-    list_for_each_entry_safe( i, tmp, &freelist, freelist )
+    minios_list_for_each_entry_safe( i, tmp, &freelist, freelist )
     {
         data_begin = align_up((uintptr_t)i + hdr_size, align);
 
         if ( data_begin + size > (uintptr_t)i + i->size )
             continue;
 
-        list_del(&i->freelist);
+        minios_list_del(&i->freelist);
         /* spin_unlock_irqrestore(&freelist_lock, flags); */
 
         uintptr_t size_before = (data_begin - hdr_size) - (uintptr_t)i;
@@ -173,7 +173,7 @@ void *_xmalloc(size_t size, size_t align)
             new_i->size = i->size - size_before;
             i->size = size_before;
             /* spin_lock_irqsave(&freelist_lock, flags); */
-            list_add(&i->freelist, &freelist);
+            minios_list_add(&i->freelist, &freelist);
             /* spin_unlock_irqrestore(&freelist_lock, flags); */
             i = new_i;
         }
@@ -231,7 +231,7 @@ void xfree(const void *p)
 
     /* Merge with other free block, or put in list. */
     /* spin_lock_irqsave(&freelist_lock, flags); */
-    list_for_each_entry_safe( i, tmp, &freelist, freelist )
+    minios_list_for_each_entry_safe( i, tmp, &freelist, freelist )
     {
         unsigned long _i   = (unsigned long)i;
         unsigned long _hdr = (unsigned long)hdr;
@@ -243,7 +243,7 @@ void xfree(const void *p)
         /* We follow this block?  Swallow it. */
         if ( (_i + i->size) == _hdr )
         {
-            list_del(&i->freelist);
+            minios_list_del(&i->freelist);
             i->size += hdr->size;
             hdr = i;
         }
@@ -251,7 +251,7 @@ void xfree(const void *p)
         /* We precede this block? Swallow it. */
         if ( (_hdr + hdr->size) == _i )
         {
-            list_del(&i->freelist);
+            minios_list_del(&i->freelist);
             hdr->size += i->size;
         }
     }
@@ -268,7 +268,7 @@ void xfree(const void *p)
     }
     else
     {
-        list_add(&hdr->freelist, &freelist);
+        minios_list_add(&hdr->freelist, &freelist);
     }
 
     /* spin_unlock_irqrestore(&freelist_lock, flags); */
diff --git a/sched.c b/sched.c
index 9b20dee4e49acffae27f0ba62c08b760f35662d2..ab454cd83a6c4480a5c28b4f00811a29daaae5af 100644 (file)
--- a/sched.c
+++ b/sched.c
 #endif
 
 struct thread *idle_thread = NULL;
-LIST_HEAD(exited_threads);
+MINIOS_LIST_HEAD(exited_threads);
 static int threads_started;
 
 struct thread *main_thread;
 
 void inline print_runqueue(void)
 {
-    struct list_head *it;
+    struct minios_list_head *it;
     struct thread *th;
-    list_for_each(it, &idle_thread->thread_list)
+    minios_list_for_each(it, &idle_thread->thread_list)
     {
-        th = list_entry(it, struct thread, thread_list);
+        th = minios_list_entry(it, struct thread, thread_list);
         printk("   Thread \"%s\", runnable=%d\n", th->name, is_runnable(th));
     }
     printk("\n");
@@ -75,7 +75,7 @@ void inline print_runqueue(void)
 void schedule(void)
 {
     struct thread *prev, *next, *thread;
-    struct list_head *iterator, *next_iterator;
+    struct minios_list_head *iterator, *next_iterator;
     unsigned long flags;
 
     prev = current;
@@ -97,9 +97,9 @@ void schedule(void)
         s_time_t now = NOW();
         s_time_t min_wakeup_time = now + SECONDS(10);
         next = NULL;   
-        list_for_each_safe(iterator, next_iterator, &idle_thread->thread_list)
+        minios_list_for_each_safe(iterator, next_iterator, &idle_thread->thread_list)
         {
-            thread = list_entry(iterator, struct thread, thread_list);
+            thread = minios_list_entry(iterator, struct thread, thread_list);
             if (!is_runnable(thread) && thread->wakeup_time != 0LL)
             {
                 if (thread->wakeup_time <= now)
@@ -111,8 +111,8 @@ void schedule(void)
             {
                 next = thread;
                 /* Put this thread on the end of the list */
-                list_del(&thread->thread_list);
-                list_add_tail(&thread->thread_list, &idle_thread->thread_list);
+                minios_list_del(&thread->thread_list);
+                minios_list_add_tail(&thread->thread_list, &idle_thread->thread_list);
                 break;
             }
         }
@@ -128,12 +128,12 @@ void schedule(void)
        inturrupted at the return instruction. And therefore at safe point. */
     if(prev != next) switch_threads(prev, next);
 
-    list_for_each_safe(iterator, next_iterator, &exited_threads)
+    minios_list_for_each_safe(iterator, next_iterator, &exited_threads)
     {
-        thread = list_entry(iterator, struct thread, thread_list);
+        thread = minios_list_entry(iterator, struct thread, thread_list);
         if(thread != prev)
         {
-            list_del(&thread->thread_list);
+            minios_list_del(&thread->thread_list);
             free_pages(thread->stack, STACK_SIZE_PAGE_ORDER);
             xfree(thread);
         }
@@ -155,7 +155,7 @@ struct thread* create_thread(char *name, void (*function)(void *), void *data)
     set_runnable(thread);
     local_irq_save(flags);
     if(idle_thread != NULL) {
-        list_add_tail(&thread->thread_list, &idle_thread->thread_list); 
+        minios_list_add_tail(&thread->thread_list, &idle_thread->thread_list); 
     } else if(function != idle_thread_fn)
     {
         printk("BUG: Not allowed to create thread before initialising scheduler.\n");
@@ -208,10 +208,10 @@ void exit_thread(void)
     printk("Thread \"%s\" exited.\n", thread->name);
     local_irq_save(flags);
     /* Remove from the thread list */
-    list_del(&thread->thread_list);
+    minios_list_del(&thread->thread_list);
     clear_runnable(thread);
     /* Put onto exited list */
-    list_add(&thread->thread_list, &exited_threads);
+    minios_list_add(&thread->thread_list, &exited_threads);
     local_irq_restore(flags);
     /* Schedule will free the resources */
     while(1)
@@ -296,6 +296,6 @@ void init_sched(void)
     _REENT_INIT_PTR((&callback_reent))
 #endif
     idle_thread = create_thread("Idle", idle_thread_fn, NULL);
-    INIT_LIST_HEAD(&idle_thread->thread_list);
+    MINIOS_INIT_LIST_HEAD(&idle_thread->thread_list);
 }