WARNING - OLD ARCHIVES

This is an archived copy of the Xen.org mailing list, which we have preserved to ensure that existing links to archives are not broken. The live archive, which contains the latest emails, can be found at http://lists.xen.org/
   
 
 
Xen 
 
Home Products Support Community News
 
   
 

xen-changelog

[Xen-changelog] [xen-unstable] ioemu: avoid name clashes due to LIST_* m

To: xen-changelog@xxxxxxxxxxxxxxxxxxx
Subject: [Xen-changelog] [xen-unstable] ioemu: avoid name clashes due to LIST_* macros
From: Xen patchbot-unstable <patchbot-unstable@xxxxxxxxxxxxxxxxxxx>
Date: Thu, 07 Feb 2008 11:00:33 -0800
Delivery-date: Thu, 07 Feb 2008 11:00:37 -0800
Envelope-to: www-data@xxxxxxxxxxxxxxxxxx
List-help: <mailto:xen-changelog-request@lists.xensource.com?subject=help>
List-id: BK change log <xen-changelog.lists.xensource.com>
List-post: <mailto:xen-changelog@lists.xensource.com>
List-subscribe: <http://lists.xensource.com/cgi-bin/mailman/listinfo/xen-changelog>, <mailto:xen-changelog-request@lists.xensource.com?subject=subscribe>
List-unsubscribe: <http://lists.xensource.com/cgi-bin/mailman/listinfo/xen-changelog>, <mailto:xen-changelog-request@lists.xensource.com?subject=unsubscribe>
Reply-to: xen-devel@xxxxxxxxxxxxxxxxxxx
Sender: xen-changelog-bounces@xxxxxxxxxxxxxxxxxxx
# HG changeset patch
# User Keir Fraser <keir.fraser@xxxxxxxxxx>
# Date 1202376079 0
# Node ID 45b2e7d59e3a1895e903cbb7939e79c2f1f351d6
# Parent  3821e39cc1a056921c65612154f0946638be25e6
ioemu: avoid name clashes due to LIST_* macros

Here is what I wrote in my submission to qemu upstream:

 qemu's audio subdirectory contains a copy of BSD's sys-queue.h, which
 defines a bunch of LIST_ macros.  This makes it difficult to build a
 program made partly out of qemu and partly out of the Linux
 kernel[1], since Linux has a different set of LIST_ macros.  It might
 also cause trouble when mixing with BSD-derived code.

 Under the circumstances it's probably best to rename the versions in
 qemu.  The attached patch does this.

 [1] You might well ask why anyone would want to do this.  In Xen we
 are moving our emulation of IO devices from processes which run on
 the host into a dedicated VM (one per actual VM) which we call a
 `stub domain'.  This dedicated VM runs a very cut-down `operating
 system' which uses some code from Linux.

Signed-off-by: Ian Jackson <ian.jackson@xxxxxxxxxxxxx>
---
 tools/ioemu/audio/audio.c          |   38 ++++++++++++++++++-------------------
 tools/ioemu/audio/audio.h          |    4 +--
 tools/ioemu/audio/audio_int.h      |   34 ++++++++++++++++-----------------
 tools/ioemu/audio/audio_template.h |   14 ++++++-------
 tools/ioemu/audio/sys-queue.h      |   12 +++++------
 5 files changed, 51 insertions(+), 51 deletions(-)

diff -r 3821e39cc1a0 -r 45b2e7d59e3a tools/ioemu/audio/audio.c
--- a/tools/ioemu/audio/audio.c Thu Feb 07 09:19:12 2008 +0000
+++ b/tools/ioemu/audio/audio.c Thu Feb 07 09:21:19 2008 +0000
@@ -707,8 +707,8 @@ static void audio_detach_capture (HWVoic
             sw->rate = NULL;
         }
 
-        LIST_REMOVE (sw, entries);
-        LIST_REMOVE (sc, entries);
+        QEMU_LIST_REMOVE (sw, entries);
+        QEMU_LIST_REMOVE (sc, entries);
         qemu_free (sc);
         if (was_active) {
             /* We have removed soft voice from the capture:
@@ -751,8 +751,8 @@ static int audio_attach_capture (AudioSt
             qemu_free (sw);
             return -1;
         }
-        LIST_INSERT_HEAD (&hw_cap->sw_head, sw, entries);
-        LIST_INSERT_HEAD (&hw->cap_head, sc, entries);
+        QEMU_LIST_INSERT_HEAD (&hw_cap->sw_head, sw, entries);
+        QEMU_LIST_INSERT_HEAD (&hw->cap_head, sc, entries);
 #ifdef DEBUG_CAPTURE
         asprintf (&sw->name, "for %p %d,%d,%d",
                   hw, sw->info.freq, sw->info.bits, sw->info.nchannels);
@@ -1620,12 +1620,12 @@ void AUD_register_card (AudioState *s, c
     card->audio = s;
     card->name = qemu_strdup (name);
     memset (&card->entries, 0, sizeof (card->entries));
-    LIST_INSERT_HEAD (&s->card_head, card, entries);
+    QEMU_LIST_INSERT_HEAD (&s->card_head, card, entries);
 }
 
 void AUD_remove_card (QEMUSoundCard *card)
 {
-    LIST_REMOVE (card, entries);
+    QEMU_LIST_REMOVE (card, entries);
     card->audio = NULL;
     qemu_free (card->name);
 }
@@ -1637,9 +1637,9 @@ AudioState *AUD_init (void)
     const char *drvname;
     AudioState *s = &glob_audio_state;
 
-    LIST_INIT (&s->hw_head_out);
-    LIST_INIT (&s->hw_head_in);
-    LIST_INIT (&s->cap_head);
+    QEMU_LIST_INIT (&s->hw_head_out);
+    QEMU_LIST_INIT (&s->hw_head_in);
+    QEMU_LIST_INIT (&s->cap_head);
     atexit (audio_atexit);
 
     s->ts = qemu_new_timer (vm_clock, audio_timer, s);
@@ -1731,7 +1731,7 @@ AudioState *AUD_init (void)
         return NULL;
     }
 
-    LIST_INIT (&s->card_head);
+    QEMU_LIST_INIT (&s->card_head);
     register_savevm ("audio", 0, 1, audio_save, audio_load, s);
     qemu_mod_timer (s->ts, qemu_get_clock (vm_clock) + conf.period.ticks);
     return s;
@@ -1769,7 +1769,7 @@ CaptureVoiceOut *AUD_add_capture (
 
     cap = audio_pcm_capture_find_specific (s, as);
     if (cap) {
-        LIST_INSERT_HEAD (&cap->cb_head, cb, entries);
+        QEMU_LIST_INSERT_HEAD (&cap->cb_head, cb, entries);
         return cap;
     }
     else {
@@ -1784,8 +1784,8 @@ CaptureVoiceOut *AUD_add_capture (
         }
 
         hw = &cap->hw;
-        LIST_INIT (&hw->sw_head);
-        LIST_INIT (&cap->cb_head);
+        QEMU_LIST_INIT (&hw->sw_head);
+        QEMU_LIST_INIT (&cap->cb_head);
 
         /* XXX find a more elegant way */
         hw->samples = 4096 * 4;
@@ -1813,8 +1813,8 @@ CaptureVoiceOut *AUD_add_capture (
             [hw->info.swap_endianness]
             [hw->info.bits == 16];
 
-        LIST_INSERT_HEAD (&s->cap_head, cap, entries);
-        LIST_INSERT_HEAD (&cap->cb_head, cb, entries);
+        QEMU_LIST_INSERT_HEAD (&s->cap_head, cap, entries);
+        QEMU_LIST_INSERT_HEAD (&cap->cb_head, cb, entries);
 
         hw = NULL;
         while ((hw = audio_pcm_hw_find_any_out (s, hw))) {
@@ -1840,7 +1840,7 @@ void AUD_del_capture (CaptureVoiceOut *c
     for (cb = cap->cb_head.lh_first; cb; cb = cb->entries.le_next) {
         if (cb->opaque == cb_opaque) {
             cb->ops.destroy (cb_opaque);
-            LIST_REMOVE (cb, entries);
+            QEMU_LIST_REMOVE (cb, entries);
             qemu_free (cb);
 
             if (!cap->cb_head.lh_first) {
@@ -1857,12 +1857,12 @@ void AUD_del_capture (CaptureVoiceOut *c
                         st_rate_stop (sw->rate);
                         sw->rate = NULL;
                     }
-                    LIST_REMOVE (sw, entries);
-                    LIST_REMOVE (sc, entries);
+                    QEMU_LIST_REMOVE (sw, entries);
+                    QEMU_LIST_REMOVE (sc, entries);
                     qemu_free (sc);
                     sw = sw1;
                 }
-                LIST_REMOVE (cap, entries);
+                QEMU_LIST_REMOVE (cap, entries);
                 qemu_free (cap);
             }
             return;
diff -r 3821e39cc1a0 -r 45b2e7d59e3a tools/ioemu/audio/audio.h
--- a/tools/ioemu/audio/audio.h Thu Feb 07 09:19:12 2008 +0000
+++ b/tools/ioemu/audio/audio.h Thu Feb 07 09:21:19 2008 +0000
@@ -68,7 +68,7 @@ typedef struct CaptureState {
 typedef struct CaptureState {
     void *opaque;
     struct capture_ops ops;
-    LIST_ENTRY (CaptureState) entries;
+    QEMU_LIST_ENTRY (CaptureState) entries;
 } CaptureState;
 
 typedef struct AudioState AudioState;
@@ -79,7 +79,7 @@ typedef struct QEMUSoundCard {
 typedef struct QEMUSoundCard {
     AudioState *audio;
     char *name;
-    LIST_ENTRY (QEMUSoundCard) entries;
+    QEMU_LIST_ENTRY (QEMUSoundCard) entries;
 } QEMUSoundCard;
 
 typedef struct QEMUAudioTimeStamp {
diff -r 3821e39cc1a0 -r 45b2e7d59e3a tools/ioemu/audio/audio_int.h
--- a/tools/ioemu/audio/audio_int.h     Thu Feb 07 09:19:12 2008 +0000
+++ b/tools/ioemu/audio/audio_int.h     Thu Feb 07 09:21:19 2008 +0000
@@ -79,10 +79,10 @@ typedef struct HWVoiceOut {
     st_sample_t *mix_buf;
 
     int samples;
-    LIST_HEAD (sw_out_listhead, SWVoiceOut) sw_head;
-    LIST_HEAD (sw_cap_listhead, SWVoiceCap) cap_head;
-    struct audio_pcm_ops *pcm_ops;
-    LIST_ENTRY (HWVoiceOut) entries;
+    QEMU_LIST_HEAD (sw_out_listhead, SWVoiceOut) sw_head;
+    QEMU_LIST_HEAD (sw_cap_listhead, SWVoiceCap) cap_head;
+    struct audio_pcm_ops *pcm_ops;
+    QEMU_LIST_ENTRY (HWVoiceOut) entries;
 } HWVoiceOut;
 
 typedef struct HWVoiceIn {
@@ -98,9 +98,9 @@ typedef struct HWVoiceIn {
     st_sample_t *conv_buf;
 
     int samples;
-    LIST_HEAD (sw_in_listhead, SWVoiceIn) sw_head;
-    struct audio_pcm_ops *pcm_ops;
-    LIST_ENTRY (HWVoiceIn) entries;
+    QEMU_LIST_HEAD (sw_in_listhead, SWVoiceIn) sw_head;
+    struct audio_pcm_ops *pcm_ops;
+    QEMU_LIST_ENTRY (HWVoiceIn) entries;
 } HWVoiceIn;
 
 struct SWVoiceOut {
@@ -116,7 +116,7 @@ struct SWVoiceOut {
     char *name;
     volume_t vol;
     struct audio_callback callback;
-    LIST_ENTRY (SWVoiceOut) entries;
+    QEMU_LIST_ENTRY (SWVoiceOut) entries;
 };
 
 struct SWVoiceIn {
@@ -131,7 +131,7 @@ struct SWVoiceIn {
     char *name;
     volume_t vol;
     struct audio_callback callback;
-    LIST_ENTRY (SWVoiceIn) entries;
+    QEMU_LIST_ENTRY (SWVoiceIn) entries;
 };
 
 struct audio_driver {
@@ -165,20 +165,20 @@ struct capture_callback {
 struct capture_callback {
     struct audio_capture_ops ops;
     void *opaque;
-    LIST_ENTRY (capture_callback) entries;
+    QEMU_LIST_ENTRY (capture_callback) entries;
 };
 
 struct CaptureVoiceOut {
     HWVoiceOut hw;
     void *buf;
-    LIST_HEAD (cb_listhead, capture_callback) cb_head;
-    LIST_ENTRY (CaptureVoiceOut) entries;
+    QEMU_LIST_HEAD (cb_listhead, capture_callback) cb_head;
+    QEMU_LIST_ENTRY (CaptureVoiceOut) entries;
 };
 
 struct SWVoiceCap {
     SWVoiceOut sw;
     CaptureVoiceOut *cap;
-    LIST_ENTRY (SWVoiceCap) entries;
+    QEMU_LIST_ENTRY (SWVoiceCap) entries;
 };
 
 struct AudioState {
@@ -186,10 +186,10 @@ struct AudioState {
     void *drv_opaque;
 
     QEMUTimer *ts;
-    LIST_HEAD (card_listhead, QEMUSoundCard) card_head;
-    LIST_HEAD (hw_in_listhead, HWVoiceIn) hw_head_in;
-    LIST_HEAD (hw_out_listhead, HWVoiceOut) hw_head_out;
-    LIST_HEAD (cap_listhead, CaptureVoiceOut) cap_head;
+    QEMU_LIST_HEAD (card_listhead, QEMUSoundCard) card_head;
+    QEMU_LIST_HEAD (hw_in_listhead, HWVoiceIn) hw_head_in;
+    QEMU_LIST_HEAD (hw_out_listhead, HWVoiceOut) hw_head_out;
+    QEMU_LIST_HEAD (cap_listhead, CaptureVoiceOut) cap_head;
     int nb_hw_voices_out;
     int nb_hw_voices_in;
 };
diff -r 3821e39cc1a0 -r 45b2e7d59e3a tools/ioemu/audio/audio_template.h
--- a/tools/ioemu/audio/audio_template.h        Thu Feb 07 09:19:12 2008 +0000
+++ b/tools/ioemu/audio/audio_template.h        Thu Feb 07 09:21:19 2008 +0000
@@ -186,12 +186,12 @@ static void glue (audio_pcm_sw_fini_, TY
 
 static void glue (audio_pcm_hw_add_sw_, TYPE) (HW *hw, SW *sw)
 {
-    LIST_INSERT_HEAD (&hw->sw_head, sw, entries);
+    QEMU_LIST_INSERT_HEAD (&hw->sw_head, sw, entries);
 }
 
 static void glue (audio_pcm_hw_del_sw_, TYPE) (SW *sw)
 {
-    LIST_REMOVE (sw, entries);
+    QEMU_LIST_REMOVE (sw, entries);
 }
 
 static void glue (audio_pcm_hw_gc_, TYPE) (AudioState *s, HW **hwp)
@@ -202,7 +202,7 @@ static void glue (audio_pcm_hw_gc_, TYPE
 #ifdef DAC
         audio_detach_capture (hw);
 #endif
-        LIST_REMOVE (hw, entries);
+        QEMU_LIST_REMOVE (hw, entries);
         glue (s->nb_hw_voices_, TYPE) += 1;
         glue (audio_pcm_hw_free_resources_ ,TYPE) (hw);
         glue (hw->pcm_ops->fini_, TYPE) (hw);
@@ -267,9 +267,9 @@ static HW *glue (audio_pcm_hw_add_new_, 
     }
 
     hw->pcm_ops = drv->pcm_ops;
-    LIST_INIT (&hw->sw_head);
-#ifdef DAC
-    LIST_INIT (&hw->cap_head);
+    QEMU_LIST_INIT (&hw->sw_head);
+#ifdef DAC
+    QEMU_LIST_INIT (&hw->cap_head);
 #endif
     if (glue (hw->pcm_ops->init_, TYPE) (hw, as)) {
         goto err0;
@@ -294,7 +294,7 @@ static HW *glue (audio_pcm_hw_add_new_, 
         goto err1;
     }
 
-    LIST_INSERT_HEAD (&s->glue (hw_head_, TYPE), hw, entries);
+    QEMU_LIST_INSERT_HEAD (&s->glue (hw_head_, TYPE), hw, entries);
     glue (s->nb_hw_voices_, TYPE) -= 1;
 #ifdef DAC
     audio_attach_capture (s, hw);
diff -r 3821e39cc1a0 -r 45b2e7d59e3a tools/ioemu/audio/sys-queue.h
--- a/tools/ioemu/audio/sys-queue.h     Thu Feb 07 09:19:12 2008 +0000
+++ b/tools/ioemu/audio/sys-queue.h     Thu Feb 07 09:21:19 2008 +0000
@@ -64,12 +64,12 @@
 /*
  * List definitions.
  */
-#define LIST_HEAD(name, type)                                          \
+#define QEMU_LIST_HEAD(name, type)                                     \
 struct name {                                                          \
        struct type *lh_first;  /* first element */                     \
 }
 
-#define LIST_ENTRY(type)                                               \
+#define QEMU_LIST_ENTRY(type)                                          \
 struct {                                                               \
        struct type *le_next;   /* next element */                      \
        struct type **le_prev;  /* address of previous next element */  \
@@ -78,11 +78,11 @@ struct {                                                    
        \
 /*
  * List functions.
  */
-#define        LIST_INIT(head) {                                               
\
+#define        QEMU_LIST_INIT(head) {                                          
\
        (head)->lh_first = NULL;                                        \
 }
 
-#define LIST_INSERT_AFTER(listelm, elm, field) {                       \
+#define QEMU_LIST_INSERT_AFTER(listelm, elm, field) {                  \
        if (((elm)->field.le_next = (listelm)->field.le_next) != NULL)  \
                (listelm)->field.le_next->field.le_prev =               \
                    &(elm)->field.le_next;                              \
@@ -90,14 +90,14 @@ struct {                                                    
        \
        (elm)->field.le_prev = &(listelm)->field.le_next;               \
 }
 
-#define LIST_INSERT_HEAD(head, elm, field) {                           \
+#define QEMU_LIST_INSERT_HEAD(head, elm, field) {                      \
        if (((elm)->field.le_next = (head)->lh_first) != NULL)          \
                (head)->lh_first->field.le_prev = &(elm)->field.le_next;\
        (head)->lh_first = (elm);                                       \
        (elm)->field.le_prev = &(head)->lh_first;                       \
 }
 
-#define LIST_REMOVE(elm, field) {                                      \
+#define QEMU_LIST_REMOVE(elm, field) {                                 \
        if ((elm)->field.le_next != NULL)                               \
                (elm)->field.le_next->field.le_prev =                   \
                    (elm)->field.le_prev;                               \

_______________________________________________
Xen-changelog mailing list
Xen-changelog@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-changelog

<Prev in Thread] Current Thread [Next in Thread>
  • [Xen-changelog] [xen-unstable] ioemu: avoid name clashes due to LIST_* macros, Xen patchbot-unstable <=