Commit 72cf2d4f authored by Blue Swirl's avatar Blue Swirl

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 15cc9235,
f40d7537,
96555a96 and
3990d09a but the fixes were fragile.

Solution: Avoid the conflict entirely by renaming the functions and the
file. Revert the previous hacks.
Signed-off-by: default avatarBlue Swirl <blauwirbel@gmail.com>
parent 620150dc
......@@ -64,7 +64,7 @@ qemu_acl *qemu_acl_init(const char *aclname)
acl->defaultDeny = 1;
acl->nentries = 0;
TAILQ_INIT(&acl->entries);
QTAILQ_INIT(&acl->entries);
acls = qemu_realloc(acls, sizeof(*acls) * (nacls +1));
acls[nacls] = acl;
......@@ -78,7 +78,7 @@ int qemu_acl_party_is_allowed(qemu_acl *acl,
{
qemu_acl_entry *entry;
TAILQ_FOREACH(entry, &acl->entries, next) {
QTAILQ_FOREACH(entry, &acl->entries, next) {
#ifdef CONFIG_FNMATCH
if (fnmatch(entry->match, party, 0) == 0)
return entry->deny ? 0 : 1;
......@@ -102,8 +102,8 @@ void qemu_acl_reset(qemu_acl *acl)
* of "open access" while the user re-initializes the
* access control list */
acl->defaultDeny = 1;
TAILQ_FOREACH(entry, &acl->entries, next) {
TAILQ_REMOVE(&acl->entries, entry, next);
QTAILQ_FOREACH(entry, &acl->entries, next) {
QTAILQ_REMOVE(&acl->entries, entry, next);
free(entry->match);
free(entry);
}
......@@ -121,7 +121,7 @@ int qemu_acl_append(qemu_acl *acl,
entry->match = qemu_strdup(match);
entry->deny = deny;
TAILQ_INSERT_TAIL(&acl->entries, entry, next);
QTAILQ_INSERT_TAIL(&acl->entries, entry, next);
acl->nentries++;
return acl->nentries;
......@@ -147,10 +147,10 @@ int qemu_acl_insert(qemu_acl *acl,
entry->match = qemu_strdup(match);
entry->deny = deny;
TAILQ_FOREACH(tmp, &acl->entries, next) {
QTAILQ_FOREACH(tmp, &acl->entries, next) {
i++;
if (i == index) {
TAILQ_INSERT_BEFORE(tmp, entry, next);
QTAILQ_INSERT_BEFORE(tmp, entry, next);
acl->nentries++;
break;
}
......@@ -165,10 +165,10 @@ int qemu_acl_remove(qemu_acl *acl,
qemu_acl_entry *entry;
int i = 0;
TAILQ_FOREACH(entry, &acl->entries, next) {
QTAILQ_FOREACH(entry, &acl->entries, next) {
i++;
if (strcmp(entry->match, match) == 0) {
TAILQ_REMOVE(&acl->entries, entry, next);
QTAILQ_REMOVE(&acl->entries, entry, next);
return i;
}
}
......
......@@ -25,7 +25,7 @@
#ifndef __QEMU_ACL_H__
#define __QEMU_ACL_H__
#include "sys-queue.h"
#include "qemu-queue.h"
typedef struct qemu_acl_entry qemu_acl_entry;
typedef struct qemu_acl qemu_acl;
......@@ -34,13 +34,13 @@ struct qemu_acl_entry {
char *match;
int deny;
TAILQ_ENTRY(qemu_acl_entry) next;
QTAILQ_ENTRY(qemu_acl_entry) next;
};
struct qemu_acl {
char *aclname;
unsigned int nentries;
TAILQ_HEAD(,qemu_acl_entry) entries;
QTAILQ_HEAD(,qemu_acl_entry) entries;
int defaultDeny;
};
......
......@@ -13,13 +13,13 @@
#include "qemu-common.h"
#include "block.h"
#include "sys-queue.h"
#include "qemu-queue.h"
#include "qemu_socket.h"
typedef struct AioHandler AioHandler;
/* The list of registered AIO handlers */
static LIST_HEAD(, AioHandler) aio_handlers;
static QLIST_HEAD(, AioHandler) aio_handlers;
/* This is a simple lock used to protect the aio_handlers list. Specifically,
* it's used to ensure that no callbacks are removed while we're walking and
......@@ -35,14 +35,14 @@ struct AioHandler
AioFlushHandler *io_flush;
int deleted;
void *opaque;
LIST_ENTRY(AioHandler) node;
QLIST_ENTRY(AioHandler) node;
};
static AioHandler *find_aio_handler(int fd)
{
AioHandler *node;
LIST_FOREACH(node, &aio_handlers, node) {
QLIST_FOREACH(node, &aio_handlers, node) {
if (node->fd == fd)
if (!node->deleted)
return node;
......@@ -72,7 +72,7 @@ int qemu_aio_set_fd_handler(int fd,
* deleted because deleted nodes are only cleaned up after
* releasing the walking_handlers lock.
*/
LIST_REMOVE(node, node);
QLIST_REMOVE(node, node);
qemu_free(node);
}
}
......@@ -81,7 +81,7 @@ int qemu_aio_set_fd_handler(int fd,
/* Alloc and insert if it's not already there */
node = qemu_mallocz(sizeof(AioHandler));
node->fd = fd;
LIST_INSERT_HEAD(&aio_handlers, node, node);
QLIST_INSERT_HEAD(&aio_handlers, node, node);
}
/* Update handler with latest information */
node->io_read = io_read;
......@@ -109,7 +109,7 @@ void qemu_aio_flush(void)
*/
qemu_aio_wait();
LIST_FOREACH(node, &aio_handlers, node) {
QLIST_FOREACH(node, &aio_handlers, node) {
ret |= node->io_flush(node->opaque);
}
} while (qemu_bh_poll() || ret > 0);
......@@ -133,7 +133,7 @@ void qemu_aio_wait(void)
FD_ZERO(&wrfds);
/* fill fd sets */
LIST_FOREACH(node, &aio_handlers, node) {
QLIST_FOREACH(node, &aio_handlers, node) {
/* If there aren't pending AIO operations, don't invoke callbacks.
* Otherwise, if there are no AIO requests, qemu_aio_wait() would
* wait indefinitely.
......@@ -168,7 +168,7 @@ void qemu_aio_wait(void)
/* we have to walk very carefully in case
* qemu_aio_set_fd_handler is called while we're walking */
node = LIST_FIRST(&aio_handlers);
node = QLIST_FIRST(&aio_handlers);
while (node) {
AioHandler *tmp;
......@@ -184,10 +184,10 @@ void qemu_aio_wait(void)
}
tmp = node;
node = LIST_NEXT(node, node);
node = QLIST_NEXT(node, node);
if (tmp->deleted) {
LIST_REMOVE(tmp, node);
QLIST_REMOVE(tmp, node);
qemu_free(tmp);
}
}
......
......@@ -766,8 +766,8 @@ static void audio_detach_capture (HWVoiceOut *hw)
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 @@ static int audio_attach_capture (HWVoiceOut *hw)
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 @@ static void audio_init (void)
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 @@ static void audio_init (void)
"(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 @@ void AUD_register_card (const char *name, QEMUSoundCard *card)
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 @@ CaptureVoiceOut *AUD_add_capture (
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 @@ CaptureVoiceOut *AUD_add_capture (
}
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 @@ CaptureVoiceOut *AUD_add_capture (
[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 @@ void AUD_del_capture (CaptureVoiceOut *cap, void *cb_opaque)
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 @@ void AUD_del_capture (CaptureVoiceOut *cap, void *cb_opaque)
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;
......
......@@ -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 @@ struct capture_ops {
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 SWVoiceIn SWVoiceIn;
typedef struct QEMUSoundCard {
char *name;
LIST_ENTRY (QEMUSoundCard) entries;
QLIST_ENTRY (QEMUSoundCard) entries;
} QEMUSoundCard;
typedef struct QEMUAudioTimeStamp {
......
......@@ -80,10 +80,10 @@ typedef struct HWVoiceOut {
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 @@ typedef struct HWVoiceIn {
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 @@ struct SWVoiceOut {
char *name;
struct mixeng_volume vol;
struct audio_callback callback;
LIST_ENTRY (SWVoiceOut) entries;
QLIST_ENTRY (SWVoiceOut) entries;
};
struct SWVoiceIn {
......@@ -135,7 +135,7 @@ struct SWVoiceIn {
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 audio_pcm_ops {
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 @@ 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;
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;
......
......@@ -184,12 +184,12 @@ static void glue (audio_pcm_sw_fini_, TYPE) (SW *sw)
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 @@ static void glue (audio_pcm_hw_gc_, TYPE) (HW **hwp)
#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 @@ static HW *glue (audio_pcm_hw_add_new_, TYPE) (struct audsettings *as)
}
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 @@ static HW *glue (audio_pcm_hw_add_new_, TYPE) (struct audsettings *as)
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);
......
......@@ -22,11 +22,6 @@
* THE SOFTWARE.
*/
#include "config-host.h"
#ifdef CONFIG_BSD
/* include native header before sys-queue.h */
#include <sys/queue.h>
#endif
#include "qemu-common.h"
#include "monitor.h"
#include "block_int.h"
......@@ -36,6 +31,7 @@
#include <sys/types.h>
#include <sys/stat.h>
#include <sys/ioctl.h>
#include <sys/queue.h>
#ifndef __DragonFly__
#include <sys/disk.h>
#endif
......
......@@ -738,7 +738,7 @@ uint64_t qcow2_alloc_cluster_offset(BlockDriverState *bs,
* the same cluster. In this case we need to wait until the previous
* request has completed and updated the L2 table accordingly.
*/
LIST_FOREACH(old_alloc, &s->cluster_allocs, next_in_flight) {
QLIST_FOREACH(old_alloc, &s->cluster_allocs, next_in_flight) {
uint64_t end_offset = offset + nb_clusters * s->cluster_size;
uint64_t old_offset = old_alloc->offset;
......@@ -769,7 +769,7 @@ uint64_t qcow2_alloc_cluster_offset(BlockDriverState *bs,
abort();
}
LIST_INSERT_HEAD(&s->cluster_allocs, m, next_in_flight);
QLIST_INSERT_HEAD(&s->cluster_allocs, m, next_in_flight);
/* allocate a new cluster */
......
......@@ -219,7 +219,7 @@ static int qcow_open(BlockDriverState *bs, const char *filename, int flags)
if (qcow2_refcount_init(bs) < 0)
goto fail;
LIST_INIT(&s->cluster_allocs);
QLIST_INIT(&s->cluster_allocs);
/* read qcow2 extensions */
if (header.backing_file_offset)
......@@ -340,7 +340,7 @@ typedef struct QCowAIOCB {
QEMUIOVector hd_qiov;
QEMUBH *bh;
QCowL2Meta l2meta;
LIST_ENTRY(QCowAIOCB) next_depend;
QLIST_ENTRY(QCowAIOCB) next_depend;
} QCowAIOCB;
static void qcow_aio_cancel(BlockDriverAIOCB *blockacb)
......@@ -503,7 +503,7 @@ static QCowAIOCB *qcow_aio_setup(BlockDriverState *bs,
acb->n = 0;
acb->cluster_offset = 0;
acb->l2meta.nb_clusters = 0;
LIST_INIT(&acb->l2meta.dependent_requests);
QLIST_INIT(&acb->l2meta.dependent_requests);
return acb;
}
......@@ -530,12 +530,12 @@ static void run_dependent_requests(QCowL2Meta *m)
/* Take the request off the list of running requests */
if (m->nb_clusters != 0) {
LIST_REMOVE(m, next_in_flight);
QLIST_REMOVE(m, next_in_flight);
}
/*
* Restart all dependent requests.
* Can't use LIST_FOREACH here - the next link might not be the same
* Can't use QLIST_FOREACH here - the next link might not be the same
* any more after the callback (request could depend on a different
* request now)
*/
......@@ -545,7 +545,7 @@ static void run_dependent_requests(QCowL2Meta *m)
}
/* Empty the list for the next part of the request */
LIST_INIT(&m->dependent_requests);
QLIST_INIT(&m->dependent_requests);
}
static void qcow_aio_write_cb(void *opaque, int ret)
......@@ -590,7 +590,7 @@ static void qcow_aio_write_cb(void *opaque, int ret)
/* Need to wait for another request? If so, we are done for now. */
if (!acb->cluster_offset && acb->l2meta.depends_on != NULL) {
LIST_INSERT_HEAD(&acb->l2meta.depends_on->dependent_requests,
QLIST_INSERT_HEAD(&acb->l2meta.depends_on->dependent_requests,
acb, next_depend);
return;
}
......@@ -690,7 +690,7 @@ static int preallocate(BlockDriverState *bs)
nb_sectors = bdrv_getlength(bs) >> 9;
offset = 0;
LIST_INIT(&meta.dependent_requests);
QLIST_INIT(&meta.dependent_requests);
while (nb_sectors) {
num = MIN(nb_sectors, INT_MAX >> 9);
......
......@@ -98,7 +98,7 @@ typedef struct BDRVQcowState {
uint8_t *cluster_cache;
uint8_t *cluster_data;
uint64_t cluster_cache_offset;
LIST_HEAD(QCowClusterAlloc, QCowL2Meta) cluster_allocs;
QLIST_HEAD(QCowClusterAlloc, QCowL2Meta) cluster_allocs;
uint64_t *refcount_table;
uint64_t refcount_table_offset;
......@@ -139,9 +139,9 @@ typedef struct QCowL2Meta
int nb_available;
int nb_clusters;
struct QCowL2Meta *depends_on;
LIST_HEAD(QCowAioDependencies, QCowAIOCB) dependent_requests;
QLIST_HEAD(QCowAioDependencies, QCowAIOCB) dependent_requests;
LIST_ENTRY(QCowL2Meta) next_in_flight;
QLIST_ENTRY(QCowL2Meta) next_in_flight;
} QCowL2Meta;
static inline int size_to_clusters(BDRVQcowState *s, int64_t size)
......
......@@ -47,7 +47,7 @@ START_TEST(qdict_put_obj_test)
qdict_put_obj(qdict, "", QOBJECT(qint_from_int(num)));
fail_unless(qdict_size(qdict) == 1);
ent = LIST_FIRST(&qdict->table[12345 % QDICT_HASH_SIZE]);
ent = QLIST_FIRST(&qdict->table[12345 % QDICT_HASH_SIZE]);
qi = qobject_to_qint(ent->value);
fail_unless(qint_get_int(qi) == num);
......
......@@ -28,7 +28,7 @@
#include <inttypes.h>
#include <signal.h>
#include "osdep.h"
#include "sys-queue.h"
#include "qemu-queue.h"
#include "targphys.h"
#ifndef TARGET_LONG_BITS
......@@ -124,14 +124,14 @@ struct KVMState;
typedef struct CPUBreakpoint {
target_ulong pc;
int flags; /* BP_* */
TAILQ_ENTRY(CPUBreakpoint) entry;
QTAILQ_ENTRY(CPUBreakpoint) entry;
} CPUBreakpoint;
typedef struct CPUWatchpoint {
target_ulong vaddr;
target_ulong len_mask;
int flags; /* BP_* */
TAILQ_ENTRY(CPUWatchpoint) entry;
QTAILQ_ENTRY(CPUWatchpoint) entry;
} CPUWatchpoint;
#define CPU_TEMP_BUF_NLONGS 128
......@@ -169,10 +169,10 @@ typedef struct CPUWatchpoint {
\
/* from this point: preserved by CPU reset */ \
/* ice debug support */ \
TAILQ_HEAD(breakpoints_head, CPUBreakpoint) breakpoints; \
QTAILQ_HEAD(breakpoints_head, CPUBreakpoint) breakpoints; \
int singlestep_enabled; \
\
TAILQ_HEAD(watchpoints_head, CPUWatchpoint) watchpoints; \
QTAILQ_HEAD(watchpoints_head, CPUWatchpoint) watchpoints; \
CPUWatchpoint *watchpoint_hit; \
\
struct GDBRegisterState *gdb_regs; \
......
......@@ -202,7 +202,7 @@ static void cpu_handle_debug_exception(CPUState *env)
CPUWatchpoint *wp;
if (!env->watchpoint_hit)
TAILQ_FOREACH(wp, &env->watchpoints, entry)
QTAILQ_FOREACH(wp, &env->watchpoints, entry)
wp->flags &= ~BP_WATCHPOINT_HIT;
if (debug_excp_handler)
......
#include <sys/queue.h>
#include <assert.h>
#include <errno.h>
#include <stdlib.h>
#include <string.h>
#include <unistd.h>
#include "qemu-queue.h"
#include "envlist.h"
struct envlist_entry {
const char *ev_var; /* actual env value */
LIST_ENTRY(envlist_entry) ev_link;
QLIST_ENTRY(envlist_entry) ev_link;
};
struct envlist {
LIST_HEAD(, envlist_entry) el_entries; /* actual entries */
QLIST_HEAD(, envlist_entry) el_entries; /* actual entries */
size_t el_count; /* number of entries */
};
......@@ -33,7 +32,7 @@ envlist_create(void)
if ((envlist = malloc(sizeof (*envlist))) == NULL)
return (NULL);
LIST_INIT(&envlist->el_entries);
QLIST_INIT(&envlist->el_entries);
envlist->el_count = 0;
return (envlist);
......@@ -51,7 +50,7 @@ envlist_free(envlist_t *envlist)
while (envlist->el_entries.lh_first != NULL) {
entry = envlist->el_entries.lh_first;
LIST_REMOVE(entry, ev_link);
QLIST_REMOVE(entry, ev_link);
free((char *)entry->ev_var);
free(entry);
......@@ -159,7 +158,7 @@ envlist_setenv(envlist_t *envlist, const char *env)
}
if (entry != NULL) {
LIST_REMOVE(entry, ev_link);
QLIST_REMOVE(entry, ev_link);
free((char *)entry->ev_var);
free(entry);
} else {
......@@ -172,7 +171,7 @@ envlist_setenv(envlist_t *envlist, const char *env)
free(entry);
return (errno);
}
LIST_INSERT_HEAD(&envlist->el_entries, entry, ev_link);
QLIST_INSERT_HEAD(&envlist->el_entries, entry, ev_link);
return (0);
}
......@@ -205,7 +204,7 @@ envlist_unsetenv(envlist_t *envlist, const char *env)
break;
}
if (entry != NULL) {
LIST_REMOVE(entry, ev_link);
QLIST_REMOVE(entry, ev_link);
free((char *)entry->ev_var);
free(entry);
......
......@@ -586,8 +586,8 @@ void cpu_exec_init(CPUState *env)
}
env->cpu_index = cpu_index;
env->numa_node = 0;
TAILQ_INIT(&env->breakpoints);
TAILQ_INIT(&env->watchpoints);
QTAILQ_INIT(&env->breakpoints);
QTAILQ_INIT(&env->watchpoints);
*penv = env;
#if defined(CONFIG_USER_ONLY)
cpu_list_unlock();
......@@ -1348,9 +1348,9 @@ int cpu_watchpoint_insert(CPUState *env, target_ulong addr, target_ulong len,
/* keep all GDB-injected watchpoints in front */
if (flags & BP_GDB)
TAILQ_INSERT_HEAD(&env->watchpoints, wp, entry);
QTAILQ_INSERT_HEAD(&env->watchpoints, wp, entry);
else
TAILQ_INSERT_TAIL(&env->watchpoints, wp, entry);
QTAILQ_INSERT_TAIL(&env->watchpoints, wp, entry);
tlb_flush_page(env, addr);
......@@ -1366,7 +1366,7 @@ int cpu_watchpoint_remove(CPUState *env, target_ulong addr, target_ulong len,
target_ulong len_mask = ~(len - 1);
CPUWatchpoint *wp;
TAILQ_FOREACH(wp, &env->watchpoints, entry) {
QTAILQ_FOREACH(wp, &env->watchpoints, entry) {
if (addr == wp->vaddr && len_mask == wp->len_mask
&& flags == (wp->flags & ~BP_WATCHPOINT_HIT)) {
cpu_watchpoint_remove_by_ref(env, wp);
......@@ -1379,7 +1379,7 @@ int cpu_watchpoint_remove(CPUState *env, target_ulong addr, target_ulong len,
/* Remove a specific watchpoint by reference. */
void cpu_watchpoint_remove_by_ref(CPUState *env, CPUWatchpoint *watchpoint)
{
TAILQ_REMOVE(&env->watchpoints, watchpoint, entry);
QTAILQ_REMOVE(&env->watchpoints, watchpoint, entry);
tlb_flush_page(env, watchpoint->vaddr);
......@@ -1391,7 +1391,7 @@ void cpu_watchpoint_remove_all(CPUState *env, int mask)
{
CPUWatchpoint *wp, *next;
TAILQ_FOREACH_SAFE(wp, &env->watchpoints, entry, next) {
QTAILQ_FOREACH_SAFE(wp, &env->watchpoints, entry, next) {
if (wp->flags & mask)