Fix sys-queue.h conflict for good
Problem: Our file sys-queue.h is a copy of the BSD file, but there are
some additions and it's not entirely compatible. Because of that, there have
been conflicts with system headers on BSD systems. Some hacks have been
introduced in the commits 15cc9235840a22c289edbe064a9b3c19c5f49896,
f40d753718c72693c5f520f0d9899f6e50395e94,
96555a96d724016e13190b28cffa3bc929ac60dc and
3990d09adf4463eca200ad964cc55643c33feb50 but the fixes were fragile.
Solution: Avoid the conflict entirely by renaming the functions and the
file. Revert the previous hacks.
Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
diff --git a/audio/audio.c b/audio/audio.c
index aa9ea3e..e223cf3 100644
--- a/audio/audio.c
+++ b/audio/audio.c
@@ -766,8 +766,8 @@
sw->rate = NULL;
}
- LIST_REMOVE (sw, entries);
- LIST_REMOVE (sc, entries);
+ QLIST_REMOVE (sw, entries);
+ QLIST_REMOVE (sc, entries);
qemu_free (sc);
if (was_active) {
/* We have removed soft voice from the capture:
@@ -811,8 +811,8 @@
qemu_free (sw);
return -1;
}
- LIST_INSERT_HEAD (&hw_cap->sw_head, sw, entries);
- LIST_INSERT_HEAD (&hw->cap_head, sc, entries);
+ QLIST_INSERT_HEAD (&hw_cap->sw_head, sw, entries);
+ QLIST_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);
@@ -1803,9 +1803,9 @@
return;
}
- LIST_INIT (&s->hw_head_out);
- LIST_INIT (&s->hw_head_in);
- LIST_INIT (&s->cap_head);
+ QLIST_INIT (&s->hw_head_out);
+ QLIST_INIT (&s->hw_head_in);
+ QLIST_INIT (&s->cap_head);
atexit (audio_atexit);
s->ts = qemu_new_timer (vm_clock, audio_timer, s);
@@ -1887,7 +1887,7 @@
"(Audio can continue looping even after stopping the VM)\n");
}
- LIST_INIT (&s->card_head);
+ QLIST_INIT (&s->card_head);
register_savevm ("audio", 0, 1, audio_save, audio_load, s);
}
@@ -1896,12 +1896,12 @@
audio_init ();
card->name = qemu_strdup (name);
memset (&card->entries, 0, sizeof (card->entries));
- LIST_INSERT_HEAD (&glob_audio_state.card_head, card, entries);
+ QLIST_INSERT_HEAD (&glob_audio_state.card_head, card, entries);
}
void AUD_remove_card (QEMUSoundCard *card)
{
- LIST_REMOVE (card, entries);
+ QLIST_REMOVE (card, entries);
qemu_free (card->name);
}
@@ -1933,7 +1933,7 @@
cap = audio_pcm_capture_find_specific (as);
if (cap) {
- LIST_INSERT_HEAD (&cap->cb_head, cb, entries);
+ QLIST_INSERT_HEAD (&cap->cb_head, cb, entries);
return cap;
}
else {
@@ -1948,8 +1948,8 @@
}
hw = &cap->hw;
- LIST_INIT (&hw->sw_head);
- LIST_INIT (&cap->cb_head);
+ QLIST_INIT (&hw->sw_head);
+ QLIST_INIT (&cap->cb_head);
/* XXX find a more elegant way */
hw->samples = 4096 * 4;
@@ -1977,8 +1977,8 @@
[hw->info.swap_endianness]
[audio_bits_to_index (hw->info.bits)];
- LIST_INSERT_HEAD (&s->cap_head, cap, entries);
- LIST_INSERT_HEAD (&cap->cb_head, cb, entries);
+ QLIST_INSERT_HEAD (&s->cap_head, cap, entries);
+ QLIST_INSERT_HEAD (&cap->cb_head, cb, entries);
hw = NULL;
while ((hw = audio_pcm_hw_find_any_out (hw))) {
@@ -2004,7 +2004,7 @@
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);
+ QLIST_REMOVE (cb, entries);
qemu_free (cb);
if (!cap->cb_head.lh_first) {
@@ -2021,12 +2021,12 @@
st_rate_stop (sw->rate);
sw->rate = NULL;
}
- LIST_REMOVE (sw, entries);
- LIST_REMOVE (sc, entries);
+ QLIST_REMOVE (sw, entries);
+ QLIST_REMOVE (sc, entries);
qemu_free (sc);
sw = sw1;
}
- LIST_REMOVE (cap, entries);
+ QLIST_REMOVE (cap, entries);
qemu_free (cap);
}
return;
diff --git a/audio/audio.h b/audio/audio.h
index dec86e5..f234ad0 100644
--- a/audio/audio.h
+++ b/audio/audio.h
@@ -25,7 +25,7 @@
#define QEMU_AUDIO_H
#include "config-host.h"
-#include "sys-queue.h"
+#include "qemu-queue.h"
typedef void (*audio_callback_fn_t) (void *opaque, int avail);
@@ -70,7 +70,7 @@
typedef struct CaptureState {
void *opaque;
struct capture_ops ops;
- LIST_ENTRY (CaptureState) entries;
+ QLIST_ENTRY (CaptureState) entries;
} CaptureState;
typedef struct SWVoiceOut SWVoiceOut;
@@ -79,7 +79,7 @@
typedef struct QEMUSoundCard {
char *name;
- LIST_ENTRY (QEMUSoundCard) entries;
+ QLIST_ENTRY (QEMUSoundCard) entries;
} QEMUSoundCard;
typedef struct QEMUAudioTimeStamp {
diff --git a/audio/audio_int.h b/audio/audio_int.h
index d930d07..ce791ee 100644
--- a/audio/audio_int.h
+++ b/audio/audio_int.h
@@ -80,10 +80,10 @@
struct st_sample *mix_buf;
int samples;
- LIST_HEAD (sw_out_listhead, SWVoiceOut) sw_head;
- LIST_HEAD (sw_cap_listhead, SWVoiceCap) cap_head;
+ QLIST_HEAD (sw_out_listhead, SWVoiceOut) sw_head;
+ QLIST_HEAD (sw_cap_listhead, SWVoiceCap) cap_head;
struct audio_pcm_ops *pcm_ops;
- LIST_ENTRY (HWVoiceOut) entries;
+ QLIST_ENTRY (HWVoiceOut) entries;
} HWVoiceOut;
typedef struct HWVoiceIn {
@@ -100,9 +100,9 @@
struct st_sample *conv_buf;
int samples;
- LIST_HEAD (sw_in_listhead, SWVoiceIn) sw_head;
+ QLIST_HEAD (sw_in_listhead, SWVoiceIn) sw_head;
struct audio_pcm_ops *pcm_ops;
- LIST_ENTRY (HWVoiceIn) entries;
+ QLIST_ENTRY (HWVoiceIn) entries;
} HWVoiceIn;
struct SWVoiceOut {
@@ -119,7 +119,7 @@
char *name;
struct mixeng_volume vol;
struct audio_callback callback;
- LIST_ENTRY (SWVoiceOut) entries;
+ QLIST_ENTRY (SWVoiceOut) entries;
};
struct SWVoiceIn {
@@ -135,7 +135,7 @@
char *name;
struct mixeng_volume vol;
struct audio_callback callback;
- LIST_ENTRY (SWVoiceIn) entries;
+ QLIST_ENTRY (SWVoiceIn) entries;
};
struct audio_driver {
@@ -169,20 +169,20 @@
struct capture_callback {
struct audio_capture_ops ops;
void *opaque;
- LIST_ENTRY (capture_callback) entries;
+ QLIST_ENTRY (capture_callback) entries;
};
struct CaptureVoiceOut {
HWVoiceOut hw;
void *buf;
- LIST_HEAD (cb_listhead, capture_callback) cb_head;
- LIST_ENTRY (CaptureVoiceOut) entries;
+ QLIST_HEAD (cb_listhead, capture_callback) cb_head;
+ QLIST_ENTRY (CaptureVoiceOut) entries;
};
struct SWVoiceCap {
SWVoiceOut sw;
CaptureVoiceOut *cap;
- LIST_ENTRY (SWVoiceCap) entries;
+ QLIST_ENTRY (SWVoiceCap) entries;
};
struct AudioState {
@@ -190,10 +190,10 @@
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;
+ QLIST_HEAD (card_listhead, QEMUSoundCard) card_head;
+ QLIST_HEAD (hw_in_listhead, HWVoiceIn) hw_head_in;
+ QLIST_HEAD (hw_out_listhead, HWVoiceOut) hw_head_out;
+ QLIST_HEAD (cap_listhead, CaptureVoiceOut) cap_head;
int nb_hw_voices_out;
int nb_hw_voices_in;
int vm_running;
diff --git a/audio/audio_template.h b/audio/audio_template.h
index 0ffca65..e65d834 100644
--- a/audio/audio_template.h
+++ b/audio/audio_template.h
@@ -184,12 +184,12 @@
static void glue (audio_pcm_hw_add_sw_, TYPE) (HW *hw, SW *sw)
{
- LIST_INSERT_HEAD (&hw->sw_head, sw, entries);
+ QLIST_INSERT_HEAD (&hw->sw_head, sw, entries);
}
static void glue (audio_pcm_hw_del_sw_, TYPE) (SW *sw)
{
- LIST_REMOVE (sw, entries);
+ QLIST_REMOVE (sw, entries);
}
static void glue (audio_pcm_hw_gc_, TYPE) (HW **hwp)
@@ -201,7 +201,7 @@
#ifdef DAC
audio_detach_capture (hw);
#endif
- LIST_REMOVE (hw, entries);
+ QLIST_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 @@
}
hw->pcm_ops = drv->pcm_ops;
- LIST_INIT (&hw->sw_head);
+ QLIST_INIT (&hw->sw_head);
#ifdef DAC
- LIST_INIT (&hw->cap_head);
+ QLIST_INIT (&hw->cap_head);
#endif
if (glue (hw->pcm_ops->init_, TYPE) (hw, as)) {
goto err0;
@@ -294,7 +294,7 @@
goto err1;
}
- LIST_INSERT_HEAD (&s->glue (hw_head_, TYPE), hw, entries);
+ QLIST_INSERT_HEAD (&s->glue (hw_head_, TYPE), hw, entries);
glue (s->nb_hw_voices_, TYPE) -= 1;
#ifdef DAC
audio_attach_capture (hw);