Revision 72cf2d4f

b/acl.c
64 64
    acl->defaultDeny = 1;
65 65

  
66 66
    acl->nentries = 0;
67
    TAILQ_INIT(&acl->entries);
67
    QTAILQ_INIT(&acl->entries);
68 68

  
69 69
    acls = qemu_realloc(acls, sizeof(*acls) * (nacls +1));
70 70
    acls[nacls] = acl;
......
78 78
{
79 79
    qemu_acl_entry *entry;
80 80

  
81
    TAILQ_FOREACH(entry, &acl->entries, next) {
81
    QTAILQ_FOREACH(entry, &acl->entries, next) {
82 82
#ifdef CONFIG_FNMATCH
83 83
        if (fnmatch(entry->match, party, 0) == 0)
84 84
            return entry->deny ? 0 : 1;
......
102 102
     * of "open access" while the user re-initializes the
103 103
     * access control list */
104 104
    acl->defaultDeny = 1;
105
    TAILQ_FOREACH(entry, &acl->entries, next) {
106
        TAILQ_REMOVE(&acl->entries, entry, next);
105
    QTAILQ_FOREACH(entry, &acl->entries, next) {
106
        QTAILQ_REMOVE(&acl->entries, entry, next);
107 107
        free(entry->match);
108 108
        free(entry);
109 109
    }
......
121 121
    entry->match = qemu_strdup(match);
122 122
    entry->deny = deny;
123 123

  
124
    TAILQ_INSERT_TAIL(&acl->entries, entry, next);
124
    QTAILQ_INSERT_TAIL(&acl->entries, entry, next);
125 125
    acl->nentries++;
126 126

  
127 127
    return acl->nentries;
......
147 147
    entry->match = qemu_strdup(match);
148 148
    entry->deny = deny;
149 149

  
150
    TAILQ_FOREACH(tmp, &acl->entries, next) {
150
    QTAILQ_FOREACH(tmp, &acl->entries, next) {
151 151
        i++;
152 152
        if (i == index) {
153
            TAILQ_INSERT_BEFORE(tmp, entry, next);
153
            QTAILQ_INSERT_BEFORE(tmp, entry, next);
154 154
            acl->nentries++;
155 155
            break;
156 156
        }
......
165 165
    qemu_acl_entry *entry;
166 166
    int i = 0;
167 167

  
168
    TAILQ_FOREACH(entry, &acl->entries, next) {
168
    QTAILQ_FOREACH(entry, &acl->entries, next) {
169 169
        i++;
170 170
        if (strcmp(entry->match, match) == 0) {
171
            TAILQ_REMOVE(&acl->entries, entry, next);
171
            QTAILQ_REMOVE(&acl->entries, entry, next);
172 172
            return i;
173 173
        }
174 174
    }
b/acl.h
25 25
#ifndef __QEMU_ACL_H__
26 26
#define __QEMU_ACL_H__
27 27

  
28
#include "sys-queue.h"
28
#include "qemu-queue.h"
29 29

  
30 30
typedef struct qemu_acl_entry qemu_acl_entry;
31 31
typedef struct qemu_acl qemu_acl;
......
34 34
    char *match;
35 35
    int deny;
36 36

  
37
    TAILQ_ENTRY(qemu_acl_entry) next;
37
    QTAILQ_ENTRY(qemu_acl_entry) next;
38 38
};
39 39

  
40 40
struct qemu_acl {
41 41
    char *aclname;
42 42
    unsigned int nentries;
43
    TAILQ_HEAD(,qemu_acl_entry) entries;
43
    QTAILQ_HEAD(,qemu_acl_entry) entries;
44 44
    int defaultDeny;
45 45
};
46 46

  
b/aio.c
13 13

  
14 14
#include "qemu-common.h"
15 15
#include "block.h"
16
#include "sys-queue.h"
16
#include "qemu-queue.h"
17 17
#include "qemu_socket.h"
18 18

  
19 19
typedef struct AioHandler AioHandler;
20 20

  
21 21
/* The list of registered AIO handlers */
22
static LIST_HEAD(, AioHandler) aio_handlers;
22
static QLIST_HEAD(, AioHandler) aio_handlers;
23 23

  
24 24
/* This is a simple lock used to protect the aio_handlers list.  Specifically,
25 25
 * it's used to ensure that no callbacks are removed while we're walking and
......
35 35
    AioFlushHandler *io_flush;
36 36
    int deleted;
37 37
    void *opaque;
38
    LIST_ENTRY(AioHandler) node;
38
    QLIST_ENTRY(AioHandler) node;
39 39
};
40 40

  
41 41
static AioHandler *find_aio_handler(int fd)
42 42
{
43 43
    AioHandler *node;
44 44

  
45
    LIST_FOREACH(node, &aio_handlers, node) {
45
    QLIST_FOREACH(node, &aio_handlers, node) {
46 46
        if (node->fd == fd)
47 47
            if (!node->deleted)
48 48
                return node;
......
72 72
                 * deleted because deleted nodes are only cleaned up after
73 73
                 * releasing the walking_handlers lock.
74 74
                 */
75
                LIST_REMOVE(node, node);
75
                QLIST_REMOVE(node, node);
76 76
                qemu_free(node);
77 77
            }
78 78
        }
......
81 81
            /* Alloc and insert if it's not already there */
82 82
            node = qemu_mallocz(sizeof(AioHandler));
83 83
            node->fd = fd;
84
            LIST_INSERT_HEAD(&aio_handlers, node, node);
84
            QLIST_INSERT_HEAD(&aio_handlers, node, node);
85 85
        }
86 86
        /* Update handler with latest information */
87 87
        node->io_read = io_read;
......
109 109
	 */
110 110
        qemu_aio_wait();
111 111

  
112
        LIST_FOREACH(node, &aio_handlers, node) {
112
        QLIST_FOREACH(node, &aio_handlers, node) {
113 113
            ret |= node->io_flush(node->opaque);
114 114
        }
115 115
    } while (qemu_bh_poll() || ret > 0);
......
133 133
        FD_ZERO(&wrfds);
134 134

  
135 135
        /* fill fd sets */
136
        LIST_FOREACH(node, &aio_handlers, node) {
136
        QLIST_FOREACH(node, &aio_handlers, node) {
137 137
            /* If there aren't pending AIO operations, don't invoke callbacks.
138 138
             * Otherwise, if there are no AIO requests, qemu_aio_wait() would
139 139
             * wait indefinitely.
......
168 168

  
169 169
            /* we have to walk very carefully in case
170 170
             * qemu_aio_set_fd_handler is called while we're walking */
171
            node = LIST_FIRST(&aio_handlers);
171
            node = QLIST_FIRST(&aio_handlers);
172 172
            while (node) {
173 173
                AioHandler *tmp;
174 174

  
......
184 184
                }
185 185

  
186 186
                tmp = node;
187
                node = LIST_NEXT(node, node);
187
                node = QLIST_NEXT(node, node);
188 188

  
189 189
                if (tmp->deleted) {
190
                    LIST_REMOVE(tmp, node);
190
                    QLIST_REMOVE(tmp, node);
191 191
                    qemu_free(tmp);
192 192
                }
193 193
            }
b/audio/audio.c
766 766
            sw->rate = NULL;
767 767
        }
768 768

  
769
        LIST_REMOVE (sw, entries);
770
        LIST_REMOVE (sc, entries);
769
        QLIST_REMOVE (sw, entries);
770
        QLIST_REMOVE (sc, entries);
771 771
        qemu_free (sc);
772 772
        if (was_active) {
773 773
            /* We have removed soft voice from the capture:
......
811 811
            qemu_free (sw);
812 812
            return -1;
813 813
        }
814
        LIST_INSERT_HEAD (&hw_cap->sw_head, sw, entries);
815
        LIST_INSERT_HEAD (&hw->cap_head, sc, entries);
814
        QLIST_INSERT_HEAD (&hw_cap->sw_head, sw, entries);
815
        QLIST_INSERT_HEAD (&hw->cap_head, sc, entries);
816 816
#ifdef DEBUG_CAPTURE
817 817
        asprintf (&sw->name, "for %p %d,%d,%d",
818 818
                  hw, sw->info.freq, sw->info.bits, sw->info.nchannels);
......
1803 1803
        return;
1804 1804
    }
1805 1805

  
1806
    LIST_INIT (&s->hw_head_out);
1807
    LIST_INIT (&s->hw_head_in);
1808
    LIST_INIT (&s->cap_head);
1806
    QLIST_INIT (&s->hw_head_out);
1807
    QLIST_INIT (&s->hw_head_in);
1808
    QLIST_INIT (&s->cap_head);
1809 1809
    atexit (audio_atexit);
1810 1810

  
1811 1811
    s->ts = qemu_new_timer (vm_clock, audio_timer, s);
......
1887 1887
               "(Audio can continue looping even after stopping the VM)\n");
1888 1888
    }
1889 1889

  
1890
    LIST_INIT (&s->card_head);
1890
    QLIST_INIT (&s->card_head);
1891 1891
    register_savevm ("audio", 0, 1, audio_save, audio_load, s);
1892 1892
}
1893 1893

  
......
1896 1896
    audio_init ();
1897 1897
    card->name = qemu_strdup (name);
1898 1898
    memset (&card->entries, 0, sizeof (card->entries));
1899
    LIST_INSERT_HEAD (&glob_audio_state.card_head, card, entries);
1899
    QLIST_INSERT_HEAD (&glob_audio_state.card_head, card, entries);
1900 1900
}
1901 1901

  
1902 1902
void AUD_remove_card (QEMUSoundCard *card)
1903 1903
{
1904
    LIST_REMOVE (card, entries);
1904
    QLIST_REMOVE (card, entries);
1905 1905
    qemu_free (card->name);
1906 1906
}
1907 1907

  
......
1933 1933

  
1934 1934
    cap = audio_pcm_capture_find_specific (as);
1935 1935
    if (cap) {
1936
        LIST_INSERT_HEAD (&cap->cb_head, cb, entries);
1936
        QLIST_INSERT_HEAD (&cap->cb_head, cb, entries);
1937 1937
        return cap;
1938 1938
    }
1939 1939
    else {
......
1948 1948
        }
1949 1949

  
1950 1950
        hw = &cap->hw;
1951
        LIST_INIT (&hw->sw_head);
1952
        LIST_INIT (&cap->cb_head);
1951
        QLIST_INIT (&hw->sw_head);
1952
        QLIST_INIT (&cap->cb_head);
1953 1953

  
1954 1954
        /* XXX find a more elegant way */
1955 1955
        hw->samples = 4096 * 4;
......
1977 1977
            [hw->info.swap_endianness]
1978 1978
            [audio_bits_to_index (hw->info.bits)];
1979 1979

  
1980
        LIST_INSERT_HEAD (&s->cap_head, cap, entries);
1981
        LIST_INSERT_HEAD (&cap->cb_head, cb, entries);
1980
        QLIST_INSERT_HEAD (&s->cap_head, cap, entries);
1981
        QLIST_INSERT_HEAD (&cap->cb_head, cb, entries);
1982 1982

  
1983 1983
        hw = NULL;
1984 1984
        while ((hw = audio_pcm_hw_find_any_out (hw))) {
......
2004 2004
    for (cb = cap->cb_head.lh_first; cb; cb = cb->entries.le_next) {
2005 2005
        if (cb->opaque == cb_opaque) {
2006 2006
            cb->ops.destroy (cb_opaque);
2007
            LIST_REMOVE (cb, entries);
2007
            QLIST_REMOVE (cb, entries);
2008 2008
            qemu_free (cb);
2009 2009

  
2010 2010
            if (!cap->cb_head.lh_first) {
......
2021 2021
                        st_rate_stop (sw->rate);
2022 2022
                        sw->rate = NULL;
2023 2023
                    }
2024
                    LIST_REMOVE (sw, entries);
2025
                    LIST_REMOVE (sc, entries);
2024
                    QLIST_REMOVE (sw, entries);
2025
                    QLIST_REMOVE (sc, entries);
2026 2026
                    qemu_free (sc);
2027 2027
                    sw = sw1;
2028 2028
                }
2029
                LIST_REMOVE (cap, entries);
2029
                QLIST_REMOVE (cap, entries);
2030 2030
                qemu_free (cap);
2031 2031
            }
2032 2032
            return;
b/audio/audio.h
25 25
#define QEMU_AUDIO_H
26 26

  
27 27
#include "config-host.h"
28
#include "sys-queue.h"
28
#include "qemu-queue.h"
29 29

  
30 30
typedef void (*audio_callback_fn_t) (void *opaque, int avail);
31 31

  
......
70 70
typedef struct CaptureState {
71 71
    void *opaque;
72 72
    struct capture_ops ops;
73
    LIST_ENTRY (CaptureState) entries;
73
    QLIST_ENTRY (CaptureState) entries;
74 74
} CaptureState;
75 75

  
76 76
typedef struct SWVoiceOut SWVoiceOut;
......
79 79

  
80 80
typedef struct QEMUSoundCard {
81 81
    char *name;
82
    LIST_ENTRY (QEMUSoundCard) entries;
82
    QLIST_ENTRY (QEMUSoundCard) entries;
83 83
} QEMUSoundCard;
84 84

  
85 85
typedef struct QEMUAudioTimeStamp {
b/audio/audio_int.h
80 80
    struct st_sample *mix_buf;
81 81

  
82 82
    int samples;
83
    LIST_HEAD (sw_out_listhead, SWVoiceOut) sw_head;
84
    LIST_HEAD (sw_cap_listhead, SWVoiceCap) cap_head;
83
    QLIST_HEAD (sw_out_listhead, SWVoiceOut) sw_head;
84
    QLIST_HEAD (sw_cap_listhead, SWVoiceCap) cap_head;
85 85
    struct audio_pcm_ops *pcm_ops;
86
    LIST_ENTRY (HWVoiceOut) entries;
86
    QLIST_ENTRY (HWVoiceOut) entries;
87 87
} HWVoiceOut;
88 88

  
89 89
typedef struct HWVoiceIn {
......
100 100
    struct st_sample *conv_buf;
101 101

  
102 102
    int samples;
103
    LIST_HEAD (sw_in_listhead, SWVoiceIn) sw_head;
103
    QLIST_HEAD (sw_in_listhead, SWVoiceIn) sw_head;
104 104
    struct audio_pcm_ops *pcm_ops;
105
    LIST_ENTRY (HWVoiceIn) entries;
105
    QLIST_ENTRY (HWVoiceIn) entries;
106 106
} HWVoiceIn;
107 107

  
108 108
struct SWVoiceOut {
......
119 119
    char *name;
120 120
    struct mixeng_volume vol;
121 121
    struct audio_callback callback;
122
    LIST_ENTRY (SWVoiceOut) entries;
122
    QLIST_ENTRY (SWVoiceOut) entries;
123 123
};
124 124

  
125 125
struct SWVoiceIn {
......
135 135
    char *name;
136 136
    struct mixeng_volume vol;
137 137
    struct audio_callback callback;
138
    LIST_ENTRY (SWVoiceIn) entries;
138
    QLIST_ENTRY (SWVoiceIn) entries;
139 139
};
140 140

  
141 141
struct audio_driver {
......
169 169
struct capture_callback {
170 170
    struct audio_capture_ops ops;
171 171
    void *opaque;
172
    LIST_ENTRY (capture_callback) entries;
172
    QLIST_ENTRY (capture_callback) entries;
173 173
};
174 174

  
175 175
struct CaptureVoiceOut {
176 176
    HWVoiceOut hw;
177 177
    void *buf;
178
    LIST_HEAD (cb_listhead, capture_callback) cb_head;
179
    LIST_ENTRY (CaptureVoiceOut) entries;
178
    QLIST_HEAD (cb_listhead, capture_callback) cb_head;
179
    QLIST_ENTRY (CaptureVoiceOut) entries;
180 180
};
181 181

  
182 182
struct SWVoiceCap {
183 183
    SWVoiceOut sw;
184 184
    CaptureVoiceOut *cap;
185
    LIST_ENTRY (SWVoiceCap) entries;
185
    QLIST_ENTRY (SWVoiceCap) entries;
186 186
};
187 187

  
188 188
struct AudioState {
......
190 190
    void *drv_opaque;
191 191

  
192 192
    QEMUTimer *ts;
193
    LIST_HEAD (card_listhead, QEMUSoundCard) card_head;
194
    LIST_HEAD (hw_in_listhead, HWVoiceIn) hw_head_in;
195
    LIST_HEAD (hw_out_listhead, HWVoiceOut) hw_head_out;
196
    LIST_HEAD (cap_listhead, CaptureVoiceOut) cap_head;
193
    QLIST_HEAD (card_listhead, QEMUSoundCard) card_head;
194
    QLIST_HEAD (hw_in_listhead, HWVoiceIn) hw_head_in;
195
    QLIST_HEAD (hw_out_listhead, HWVoiceOut) hw_head_out;
196
    QLIST_HEAD (cap_listhead, CaptureVoiceOut) cap_head;
197 197
    int nb_hw_voices_out;
198 198
    int nb_hw_voices_in;
199 199
    int vm_running;
b/audio/audio_template.h
184 184

  
185 185
static void glue (audio_pcm_hw_add_sw_, TYPE) (HW *hw, SW *sw)
186 186
{
187
    LIST_INSERT_HEAD (&hw->sw_head, sw, entries);
187
    QLIST_INSERT_HEAD (&hw->sw_head, sw, entries);
188 188
}
189 189

  
190 190
static void glue (audio_pcm_hw_del_sw_, TYPE) (SW *sw)
191 191
{
192
    LIST_REMOVE (sw, entries);
192
    QLIST_REMOVE (sw, entries);
193 193
}
194 194

  
195 195
static void glue (audio_pcm_hw_gc_, TYPE) (HW **hwp)
......
201 201
#ifdef DAC
202 202
        audio_detach_capture (hw);
203 203
#endif
204
        LIST_REMOVE (hw, entries);
204
        QLIST_REMOVE (hw, entries);
205 205
        glue (s->nb_hw_voices_, TYPE) += 1;
206 206
        glue (audio_pcm_hw_free_resources_ ,TYPE) (hw);
207 207
        glue (hw->pcm_ops->fini_, TYPE) (hw);
......
267 267
    }
268 268

  
269 269
    hw->pcm_ops = drv->pcm_ops;
270
    LIST_INIT (&hw->sw_head);
270
    QLIST_INIT (&hw->sw_head);
271 271
#ifdef DAC
272
    LIST_INIT (&hw->cap_head);
272
    QLIST_INIT (&hw->cap_head);
273 273
#endif
274 274
    if (glue (hw->pcm_ops->init_, TYPE) (hw, as)) {
275 275
        goto err0;
......
294 294
        goto err1;
295 295
    }
296 296

  
297
    LIST_INSERT_HEAD (&s->glue (hw_head_, TYPE), hw, entries);
297
    QLIST_INSERT_HEAD (&s->glue (hw_head_, TYPE), hw, entries);
298 298
    glue (s->nb_hw_voices_, TYPE) -= 1;
299 299
#ifdef DAC
300 300
    audio_attach_capture (hw);
b/block.c
22 22
 * THE SOFTWARE.
23 23
 */
24 24
#include "config-host.h"
25
#ifdef CONFIG_BSD
26
/* include native header before sys-queue.h */
27
#include <sys/queue.h>
28
#endif
29

  
30 25
#include "qemu-common.h"
31 26
#include "monitor.h"
32 27
#include "block_int.h"
......
36 31
#include <sys/types.h>
37 32
#include <sys/stat.h>
38 33
#include <sys/ioctl.h>
34
#include <sys/queue.h>
39 35
#ifndef __DragonFly__
40 36
#include <sys/disk.h>
41 37
#endif
b/block/qcow2-cluster.c
738 738
     * the same cluster. In this case we need to wait until the previous
739 739
     * request has completed and updated the L2 table accordingly.
740 740
     */
741
    LIST_FOREACH(old_alloc, &s->cluster_allocs, next_in_flight) {
741
    QLIST_FOREACH(old_alloc, &s->cluster_allocs, next_in_flight) {
742 742

  
743 743
        uint64_t end_offset = offset + nb_clusters * s->cluster_size;
744 744
        uint64_t old_offset = old_alloc->offset;
......
769 769
        abort();
770 770
    }
771 771

  
772
    LIST_INSERT_HEAD(&s->cluster_allocs, m, next_in_flight);
772
    QLIST_INSERT_HEAD(&s->cluster_allocs, m, next_in_flight);
773 773

  
774 774
    /* allocate a new cluster */
775 775

  
b/block/qcow2.c
219 219
    if (qcow2_refcount_init(bs) < 0)
220 220
        goto fail;
221 221

  
222
    LIST_INIT(&s->cluster_allocs);
222
    QLIST_INIT(&s->cluster_allocs);
223 223

  
224 224
    /* read qcow2 extensions */
225 225
    if (header.backing_file_offset)
......
340 340
    QEMUIOVector hd_qiov;
341 341
    QEMUBH *bh;
342 342
    QCowL2Meta l2meta;
343
    LIST_ENTRY(QCowAIOCB) next_depend;
343
    QLIST_ENTRY(QCowAIOCB) next_depend;
344 344
} QCowAIOCB;
345 345

  
346 346
static void qcow_aio_cancel(BlockDriverAIOCB *blockacb)
......
503 503
    acb->n = 0;
504 504
    acb->cluster_offset = 0;
505 505
    acb->l2meta.nb_clusters = 0;
506
    LIST_INIT(&acb->l2meta.dependent_requests);
506
    QLIST_INIT(&acb->l2meta.dependent_requests);
507 507
    return acb;
508 508
}
509 509

  
......
530 530

  
531 531
    /* Take the request off the list of running requests */
532 532
    if (m->nb_clusters != 0) {
533
        LIST_REMOVE(m, next_in_flight);
533
        QLIST_REMOVE(m, next_in_flight);
534 534
    }
535 535

  
536 536
    /*
537 537
     * Restart all dependent requests.
538
     * Can't use LIST_FOREACH here - the next link might not be the same
538
     * Can't use QLIST_FOREACH here - the next link might not be the same
539 539
     * any more after the callback  (request could depend on a different
540 540
     * request now)
541 541
     */
......
545 545
    }
546 546

  
547 547
    /* Empty the list for the next part of the request */
548
    LIST_INIT(&m->dependent_requests);
548
    QLIST_INIT(&m->dependent_requests);
549 549
}
550 550

  
551 551
static void qcow_aio_write_cb(void *opaque, int ret)
......
590 590

  
591 591
    /* Need to wait for another request? If so, we are done for now. */
592 592
    if (!acb->cluster_offset && acb->l2meta.depends_on != NULL) {
593
        LIST_INSERT_HEAD(&acb->l2meta.depends_on->dependent_requests,
593
        QLIST_INSERT_HEAD(&acb->l2meta.depends_on->dependent_requests,
594 594
            acb, next_depend);
595 595
        return;
596 596
    }
......
690 690

  
691 691
    nb_sectors = bdrv_getlength(bs) >> 9;
692 692
    offset = 0;
693
    LIST_INIT(&meta.dependent_requests);
693
    QLIST_INIT(&meta.dependent_requests);
694 694

  
695 695
    while (nb_sectors) {
696 696
        num = MIN(nb_sectors, INT_MAX >> 9);
b/block/qcow2.h
98 98
    uint8_t *cluster_cache;
99 99
    uint8_t *cluster_data;
100 100
    uint64_t cluster_cache_offset;
101
    LIST_HEAD(QCowClusterAlloc, QCowL2Meta) cluster_allocs;
101
    QLIST_HEAD(QCowClusterAlloc, QCowL2Meta) cluster_allocs;
102 102

  
103 103
    uint64_t *refcount_table;
104 104
    uint64_t refcount_table_offset;
......
139 139
    int nb_available;
140 140
    int nb_clusters;
141 141
    struct QCowL2Meta *depends_on;
142
    LIST_HEAD(QCowAioDependencies, QCowAIOCB) dependent_requests;
142
    QLIST_HEAD(QCowAioDependencies, QCowAIOCB) dependent_requests;
143 143

  
144
    LIST_ENTRY(QCowL2Meta) next_in_flight;
144
    QLIST_ENTRY(QCowL2Meta) next_in_flight;
145 145
} QCowL2Meta;
146 146

  
147 147
static inline int size_to_clusters(BDRVQcowState *s, int64_t size)
b/check-qdict.c
47 47
    qdict_put_obj(qdict, "", QOBJECT(qint_from_int(num)));
48 48

  
49 49
    fail_unless(qdict_size(qdict) == 1);
50
    ent = LIST_FIRST(&qdict->table[12345 % QDICT_HASH_SIZE]);
50
    ent = QLIST_FIRST(&qdict->table[12345 % QDICT_HASH_SIZE]);
51 51
    qi = qobject_to_qint(ent->value);
52 52
    fail_unless(qint_get_int(qi) == num);
53 53

  
b/cpu-defs.h
28 28
#include <inttypes.h>
29 29
#include <signal.h>
30 30
#include "osdep.h"
31
#include "sys-queue.h"
31
#include "qemu-queue.h"
32 32
#include "targphys.h"
33 33

  
34 34
#ifndef TARGET_LONG_BITS
......
124 124
typedef struct CPUBreakpoint {
125 125
    target_ulong pc;
126 126
    int flags; /* BP_* */
127
    TAILQ_ENTRY(CPUBreakpoint) entry;
127
    QTAILQ_ENTRY(CPUBreakpoint) entry;
128 128
} CPUBreakpoint;
129 129

  
130 130
typedef struct CPUWatchpoint {
131 131
    target_ulong vaddr;
132 132
    target_ulong len_mask;
133 133
    int flags; /* BP_* */
134
    TAILQ_ENTRY(CPUWatchpoint) entry;
134
    QTAILQ_ENTRY(CPUWatchpoint) entry;
135 135
} CPUWatchpoint;
136 136

  
137 137
#define CPU_TEMP_BUF_NLONGS 128
......
169 169
                                                                        \
170 170
    /* from this point: preserved by CPU reset */                       \
171 171
    /* ice debug support */                                             \
172
    TAILQ_HEAD(breakpoints_head, CPUBreakpoint) breakpoints;            \
172
    QTAILQ_HEAD(breakpoints_head, CPUBreakpoint) breakpoints;            \
173 173
    int singlestep_enabled;                                             \
174 174
                                                                        \
175
    TAILQ_HEAD(watchpoints_head, CPUWatchpoint) watchpoints;            \
175
    QTAILQ_HEAD(watchpoints_head, CPUWatchpoint) watchpoints;            \
176 176
    CPUWatchpoint *watchpoint_hit;                                      \
177 177
                                                                        \
178 178
    struct GDBRegisterState *gdb_regs;                                  \
b/cpu-exec.c
202 202
    CPUWatchpoint *wp;
203 203

  
204 204
    if (!env->watchpoint_hit)
205
        TAILQ_FOREACH(wp, &env->watchpoints, entry)
205
        QTAILQ_FOREACH(wp, &env->watchpoints, entry)
206 206
            wp->flags &= ~BP_WATCHPOINT_HIT;
207 207

  
208 208
    if (debug_excp_handler)
b/envlist.c
1
#include <sys/queue.h>
2

  
3 1
#include <assert.h>
4 2
#include <errno.h>
5 3
#include <stdlib.h>
6 4
#include <string.h>
7 5
#include <unistd.h>
8 6

  
7
#include "qemu-queue.h"
9 8
#include "envlist.h"
10 9

  
11 10
struct envlist_entry {
12 11
	const char *ev_var;			/* actual env value */
13
	LIST_ENTRY(envlist_entry) ev_link;
12
	QLIST_ENTRY(envlist_entry) ev_link;
14 13
};
15 14

  
16 15
struct envlist {
17
	LIST_HEAD(, envlist_entry) el_entries;	/* actual entries */
16
	QLIST_HEAD(, envlist_entry) el_entries;	/* actual entries */
18 17
	size_t el_count;			/* number of entries */
19 18
};
20 19

  
......
33 32
	if ((envlist = malloc(sizeof (*envlist))) == NULL)
34 33
		return (NULL);
35 34

  
36
	LIST_INIT(&envlist->el_entries);
35
	QLIST_INIT(&envlist->el_entries);
37 36
	envlist->el_count = 0;
38 37

  
39 38
	return (envlist);
......
51 50

  
52 51
	while (envlist->el_entries.lh_first != NULL) {
53 52
		entry = envlist->el_entries.lh_first;
54
		LIST_REMOVE(entry, ev_link);
53
		QLIST_REMOVE(entry, ev_link);
55 54

  
56 55
		free((char *)entry->ev_var);
57 56
		free(entry);
......
159 158
	}
160 159

  
161 160
	if (entry != NULL) {
162
		LIST_REMOVE(entry, ev_link);
161
		QLIST_REMOVE(entry, ev_link);
163 162
		free((char *)entry->ev_var);
164 163
		free(entry);
165 164
	} else {
......
172 171
		free(entry);
173 172
		return (errno);
174 173
	}
175
	LIST_INSERT_HEAD(&envlist->el_entries, entry, ev_link);
174
	QLIST_INSERT_HEAD(&envlist->el_entries, entry, ev_link);
176 175

  
177 176
	return (0);
178 177
}
......
205 204
			break;
206 205
	}
207 206
	if (entry != NULL) {
208
		LIST_REMOVE(entry, ev_link);
207
		QLIST_REMOVE(entry, ev_link);
209 208
		free((char *)entry->ev_var);
210 209
		free(entry);
211 210

  
b/exec.c
586 586
    }
587 587
    env->cpu_index = cpu_index;
588 588
    env->numa_node = 0;
589
    TAILQ_INIT(&env->breakpoints);
590
    TAILQ_INIT(&env->watchpoints);
589
    QTAILQ_INIT(&env->breakpoints);
590
    QTAILQ_INIT(&env->watchpoints);
591 591
    *penv = env;
592 592
#if defined(CONFIG_USER_ONLY)
593 593
    cpu_list_unlock();
......
1348 1348

  
1349 1349
    /* keep all GDB-injected watchpoints in front */
1350 1350
    if (flags & BP_GDB)
1351
        TAILQ_INSERT_HEAD(&env->watchpoints, wp, entry);
1351
        QTAILQ_INSERT_HEAD(&env->watchpoints, wp, entry);
1352 1352
    else
1353
        TAILQ_INSERT_TAIL(&env->watchpoints, wp, entry);
1353
        QTAILQ_INSERT_TAIL(&env->watchpoints, wp, entry);
1354 1354

  
1355 1355
    tlb_flush_page(env, addr);
1356 1356

  
......
1366 1366
    target_ulong len_mask = ~(len - 1);
1367 1367
    CPUWatchpoint *wp;
1368 1368

  
1369
    TAILQ_FOREACH(wp, &env->watchpoints, entry) {
1369
    QTAILQ_FOREACH(wp, &env->watchpoints, entry) {
1370 1370
        if (addr == wp->vaddr && len_mask == wp->len_mask
1371 1371
                && flags == (wp->flags & ~BP_WATCHPOINT_HIT)) {
1372 1372
            cpu_watchpoint_remove_by_ref(env, wp);
......
1379 1379
/* Remove a specific watchpoint by reference.  */
1380 1380
void cpu_watchpoint_remove_by_ref(CPUState *env, CPUWatchpoint *watchpoint)
1381 1381
{
1382
    TAILQ_REMOVE(&env->watchpoints, watchpoint, entry);
1382
    QTAILQ_REMOVE(&env->watchpoints, watchpoint, entry);
1383 1383

  
1384 1384
    tlb_flush_page(env, watchpoint->vaddr);
1385 1385

  
......
1391 1391
{
1392 1392
    CPUWatchpoint *wp, *next;
1393 1393

  
1394
    TAILQ_FOREACH_SAFE(wp, &env->watchpoints, entry, next) {
1394
    QTAILQ_FOREACH_SAFE(wp, &env->watchpoints, entry, next) {
1395 1395
        if (wp->flags & mask)
1396 1396
            cpu_watchpoint_remove_by_ref(env, wp);
1397 1397
    }
......
1411 1411

  
1412 1412
    /* keep all GDB-injected breakpoints in front */
1413 1413
    if (flags & BP_GDB)
1414
        TAILQ_INSERT_HEAD(&env->breakpoints, bp, entry);
1414
        QTAILQ_INSERT_HEAD(&env->breakpoints, bp, entry);
1415 1415
    else
1416
        TAILQ_INSERT_TAIL(&env->breakpoints, bp, entry);
1416
        QTAILQ_INSERT_TAIL(&env->breakpoints, bp, entry);
1417 1417

  
1418 1418
    breakpoint_invalidate(env, pc);
1419 1419

  
......
1431 1431
#if defined(TARGET_HAS_ICE)
1432 1432
    CPUBreakpoint *bp;
1433 1433

  
1434
    TAILQ_FOREACH(bp, &env->breakpoints, entry) {
1434
    QTAILQ_FOREACH(bp, &env->breakpoints, entry) {
1435 1435
        if (bp->pc == pc && bp->flags == flags) {
1436 1436
            cpu_breakpoint_remove_by_ref(env, bp);
1437 1437
            return 0;
......
1447 1447
void cpu_breakpoint_remove_by_ref(CPUState *env, CPUBreakpoint *breakpoint)
1448 1448
{
1449 1449
#if defined(TARGET_HAS_ICE)
1450
    TAILQ_REMOVE(&env->breakpoints, breakpoint, entry);
1450
    QTAILQ_REMOVE(&env->breakpoints, breakpoint, entry);
1451 1451

  
1452 1452
    breakpoint_invalidate(env, breakpoint->pc);
1453 1453

  
......
1461 1461
#if defined(TARGET_HAS_ICE)
1462 1462
    CPUBreakpoint *bp, *next;
1463 1463

  
1464
    TAILQ_FOREACH_SAFE(bp, &env->breakpoints, entry, next) {
1464
    QTAILQ_FOREACH_SAFE(bp, &env->breakpoints, entry, next) {
1465 1465
        if (bp->flags & mask)
1466 1466
            cpu_breakpoint_remove_by_ref(env, bp);
1467 1467
    }
......
1712 1712
    /* Clone all break/watchpoints.
1713 1713
       Note: Once we support ptrace with hw-debug register access, make sure
1714 1714
       BP_CPU break/watchpoints are handled correctly on clone. */
1715
    TAILQ_INIT(&env->breakpoints);
1716
    TAILQ_INIT(&env->watchpoints);
1715
    QTAILQ_INIT(&env->breakpoints);
1716
    QTAILQ_INIT(&env->watchpoints);
1717 1717
#if defined(TARGET_HAS_ICE)
1718
    TAILQ_FOREACH(bp, &env->breakpoints, entry) {
1718
    QTAILQ_FOREACH(bp, &env->breakpoints, entry) {
1719 1719
        cpu_breakpoint_insert(new_env, bp->pc, bp->flags, NULL);
1720 1720
    }
1721
    TAILQ_FOREACH(wp, &env->watchpoints, entry) {
1721
    QTAILQ_FOREACH(wp, &env->watchpoints, entry) {
1722 1722
        cpu_watchpoint_insert(new_env, wp->vaddr, (~wp->len_mask) + 1,
1723 1723
                              wp->flags, NULL);
1724 1724
    }
......
2009 2009
    code_address = address;
2010 2010
    /* Make accesses to pages with watchpoints go via the
2011 2011
       watchpoint trap routines.  */
2012
    TAILQ_FOREACH(wp, &env->watchpoints, entry) {
2012
    QTAILQ_FOREACH(wp, &env->watchpoints, entry) {
2013 2013
        if (vaddr == (wp->vaddr & TARGET_PAGE_MASK)) {
2014 2014
            iotlb = io_mem_watch + paddr;
2015 2015
            /* TODO: The memory case can be optimized by not trapping
......
2663 2663
        return;
2664 2664
    }
2665 2665
    vaddr = (env->mem_io_vaddr & TARGET_PAGE_MASK) + offset;
2666
    TAILQ_FOREACH(wp, &env->watchpoints, entry) {
2666
    QTAILQ_FOREACH(wp, &env->watchpoints, entry) {
2667 2667
        if ((vaddr == (wp->vaddr & len_mask) ||
2668 2668
             (vaddr & wp->len_mask) == wp->vaddr) && (wp->flags & flags)) {
2669 2669
            wp->flags |= BP_WATCHPOINT_HIT;
......
3169 3169
typedef struct MapClient {
3170 3170
    void *opaque;
3171 3171
    void (*callback)(void *opaque);
3172
    LIST_ENTRY(MapClient) link;
3172
    QLIST_ENTRY(MapClient) link;
3173 3173
} MapClient;
3174 3174

  
3175
static LIST_HEAD(map_client_list, MapClient) map_client_list
3176
    = LIST_HEAD_INITIALIZER(map_client_list);
3175
static QLIST_HEAD(map_client_list, MapClient) map_client_list
3176
    = QLIST_HEAD_INITIALIZER(map_client_list);
3177 3177

  
3178 3178
void *cpu_register_map_client(void *opaque, void (*callback)(void *opaque))
3179 3179
{
......
3181 3181

  
3182 3182
    client->opaque = opaque;
3183 3183
    client->callback = callback;
3184
    LIST_INSERT_HEAD(&map_client_list, client, link);
3184
    QLIST_INSERT_HEAD(&map_client_list, client, link);
3185 3185
    return client;
3186 3186
}
3187 3187

  
......
3189 3189
{
3190 3190
    MapClient *client = (MapClient *)_client;
3191 3191

  
3192
    LIST_REMOVE(client, link);
3192
    QLIST_REMOVE(client, link);
3193 3193
    qemu_free(client);
3194 3194
}
3195 3195

  
......
3197 3197
{
3198 3198
    MapClient *client;
3199 3199

  
3200
    while (!LIST_EMPTY(&map_client_list)) {
3201
        client = LIST_FIRST(&map_client_list);
3200
    while (!QLIST_EMPTY(&map_client_list)) {
3201
        client = QLIST_FIRST(&map_client_list);
3202 3202
        client->callback(client->opaque);
3203 3203
        cpu_unregister_map_client(client);
3204 3204
    }
b/hw/device-hotplug.c
68 68
    DriveInfo *dinfo;
69 69
    struct BlockDriverState *bs;
70 70

  
71
    TAILQ_FOREACH(dinfo, &drives, next) {
71
    QTAILQ_FOREACH(dinfo, &drives, next) {
72 72
        bs = dinfo->bdrv;
73 73
        if (bs) {
74 74
            if (bs->private && match_fn(bs->private, arg)) {
b/hw/i2c.c
76 76
    DeviceState *qdev;
77 77
    i2c_slave *slave = NULL;
78 78

  
79
    LIST_FOREACH(qdev, &bus->qbus.children, sibling) {
79
    QLIST_FOREACH(qdev, &bus->qbus.children, sibling) {
80 80
        slave = I2C_SLAVE_FROM_QDEV(qdev);
81 81
        if (slave->address == address)
82 82
            break;
b/hw/pci-hotplug.c
84 84
    switch (type) {
85 85
    case IF_SCSI:
86 86
        success = 1;
87
        scsibus = LIST_FIRST(&dev->qdev.child_bus);
87
        scsibus = QLIST_FIRST(&dev->qdev.child_bus);
88 88
        scsi_bus_legacy_add_drive(DO_UPCAST(SCSIBus, qbus, scsibus),
89 89
                                  dinfo, dinfo->unit);
90 90
        break;
b/hw/qdev.c
101 101
    qdev_prop_set_defaults(dev, dev->info->props);
102 102
    qdev_prop_set_defaults(dev, dev->parent_bus->info->props);
103 103
    qdev_prop_set_compat(dev);
104
    LIST_INSERT_HEAD(&bus->children, dev, sibling);
104
    QLIST_INSERT_HEAD(&bus->children, dev, sibling);
105 105
    return dev;
106 106
}
107 107

  
......
235 235
#endif
236 236
    if (dev->info->reset)
237 237
        qemu_unregister_reset(dev->info->reset, dev);
238
    LIST_REMOVE(dev, sibling);
238
    QLIST_REMOVE(dev, sibling);
239 239
    qemu_free(dev);
240 240
}
241 241

  
......
321 321
{
322 322
    BusState *bus;
323 323

  
324
    LIST_FOREACH(bus, &dev->child_bus, sibling) {
324
    QLIST_FOREACH(bus, &dev->child_bus, sibling) {
325 325
        if (strcmp(name, bus->name) == 0) {
326 326
            return bus;
327 327
        }
......
346 346
        return bus;
347 347
    }
348 348

  
349
    LIST_FOREACH(dev, &bus->children, sibling) {
350
        LIST_FOREACH(child, &dev->child_bus, sibling) {
349
    QLIST_FOREACH(dev, &bus->children, sibling) {
350
        QLIST_FOREACH(child, &dev->child_bus, sibling) {
351 351
            ret = qbus_find_recursive(child, name, info);
352 352
            if (ret) {
353 353
                return ret;
......
365 365

  
366 366
    pos += snprintf(dest+pos, len-pos,"child busses at \"%s\":",
367 367
                    dev->id ? dev->id : dev->info->name);
368
    LIST_FOREACH(child, &dev->child_bus, sibling) {
368
    QLIST_FOREACH(child, &dev->child_bus, sibling) {
369 369
        pos += snprintf(dest+pos, len-pos, "%s\"%s\"", sep, child->name);
370 370
        sep = ", ";
371 371
    }
......
379 379

  
380 380
    pos += snprintf(dest+pos, len-pos, "devices at \"%s\":",
381 381
                    bus->name);
382
    LIST_FOREACH(dev, &bus->children, sibling) {
382
    QLIST_FOREACH(dev, &bus->children, sibling) {
383 383
        pos += snprintf(dest+pos, len-pos, "%s\"%s\"",
384 384
                        sep, dev->info->name);
385 385
        if (dev->id)
......
392 392
{
393 393
    BusState *child;
394 394

  
395
    LIST_FOREACH(child, &dev->child_bus, sibling) {
395
    QLIST_FOREACH(child, &dev->child_bus, sibling) {
396 396
        if (strcmp(child->name, elem) == 0) {
397 397
            return child;
398 398
        }
......
410 410
     *   (2) driver name
411 411
     *   (3) driver alias, if present
412 412
     */
413
    LIST_FOREACH(dev, &bus->children, sibling) {
413
    QLIST_FOREACH(dev, &bus->children, sibling) {
414 414
        if (dev->id  &&  strcmp(dev->id, elem) == 0) {
415 415
            return dev;
416 416
        }
417 417
    }
418
    LIST_FOREACH(dev, &bus->children, sibling) {
418
    QLIST_FOREACH(dev, &bus->children, sibling) {
419 419
        if (strcmp(dev->info->name, elem) == 0) {
420 420
            return dev;
421 421
        }
422 422
    }
423
    LIST_FOREACH(dev, &bus->children, sibling) {
423
    QLIST_FOREACH(dev, &bus->children, sibling) {
424 424
        if (dev->info->alias && strcmp(dev->info->alias, elem) == 0) {
425 425
            return dev;
426 426
        }
......
478 478
                qemu_error("device has no child bus (%s)\n", path);
479 479
                return NULL;
480 480
            case 1:
481
                return LIST_FIRST(&dev->child_bus);
481
                return QLIST_FIRST(&dev->child_bus);
482 482
            default:
483 483
                qbus_list_bus(dev, msg, sizeof(msg));
484 484
                qemu_error("device has multiple child busses (%s)\n%s\n",
......
532 532
        bus->name = buf;
533 533
    }
534 534

  
535
    LIST_INIT(&bus->children);
535
    QLIST_INIT(&bus->children);
536 536
    if (parent) {
537
        LIST_INSERT_HEAD(&parent->child_bus, bus, sibling);
537
        QLIST_INSERT_HEAD(&parent->child_bus, bus, sibling);
538 538
        parent->num_child_bus++;
539 539
    }
540 540
    return bus;
......
575 575
    qdev_print_props(mon, dev, dev->parent_bus->info->props, "bus", indent);
576 576
    if (dev->parent_bus->info->print_dev)
577 577
        dev->parent_bus->info->print_dev(mon, dev, indent);
578
    LIST_FOREACH(child, &dev->child_bus, sibling) {
578
    QLIST_FOREACH(child, &dev->child_bus, sibling) {
579 579
        qbus_print(mon, child, indent);
580 580
    }
581 581
}
......
587 587
    qdev_printf("bus: %s\n", bus->name);
588 588
    indent += 2;
589 589
    qdev_printf("type %s\n", bus->info->name);
590
    LIST_FOREACH(dev, &bus->children, sibling) {
590
    QLIST_FOREACH(dev, &bus->children, sibling) {
591 591
        qdev_print(mon, dev, indent);
592 592
    }
593 593
}
b/hw/qdev.h
3 3

  
4 4
#include "hw.h"
5 5
#include "sysemu.h"
6
#include "sys-queue.h"
6
#include "qemu-queue.h"
7 7
#include "qemu-char.h"
8 8
#include "qemu-option.h"
9 9

  
......
29 29
    qemu_irq *gpio_out;
30 30
    int num_gpio_in;
31 31
    qemu_irq *gpio_in;
32
    LIST_HEAD(, BusState) child_bus;
32
    QLIST_HEAD(, BusState) child_bus;
33 33
    int num_child_bus;
34 34
    NICInfo *nd;
35
    LIST_ENTRY(DeviceState) sibling;
35
    QLIST_ENTRY(DeviceState) sibling;
36 36
};
37 37

  
38 38
typedef void (*bus_dev_printfn)(Monitor *mon, DeviceState *dev, int indent);
......
47 47
    DeviceState *parent;
48 48
    BusInfo *info;
49 49
    const char *name;
50
    LIST_HEAD(, DeviceState) children;
51
    LIST_ENTRY(BusState) sibling;
50
    QLIST_HEAD(, DeviceState) children;
51
    QLIST_ENTRY(BusState) sibling;
52 52
};
53 53

  
54 54
struct Property {
b/hw/ssi.c
25 25
    SSIBus *bus;
26 26

  
27 27
    bus = FROM_QBUS(SSIBus, qdev_get_parent_bus(dev));
28
    if (LIST_FIRST(&bus->qbus.children) != dev
29
        || LIST_NEXT(dev, sibling) != NULL) {
28
    if (QLIST_FIRST(&bus->qbus.children) != dev
29
        || QLIST_NEXT(dev, sibling) != NULL) {
30 30
        hw_error("Too many devices on SSI bus");
31 31
    }
32 32

  
......
61 61
{
62 62
    DeviceState *dev;
63 63
    SSISlave *slave;
64
    dev = LIST_FIRST(&bus->qbus.children);
64
    dev = QLIST_FIRST(&bus->qbus.children);
65 65
    if (!dev) {
66 66
        return 0;
67 67
    }
b/hw/usb-bus.c
12 12
    .print_dev = usb_bus_dev_print,
13 13
};
14 14
static int next_usb_bus = 0;
15
static TAILQ_HEAD(, USBBus) busses = TAILQ_HEAD_INITIALIZER(busses);
15
static QTAILQ_HEAD(, USBBus) busses = QTAILQ_HEAD_INITIALIZER(busses);
16 16

  
17 17
USBBus *usb_bus_new(DeviceState *host)
18 18
{
......
20 20

  
21 21
    bus = FROM_QBUS(USBBus, qbus_create(&usb_bus_info, host, NULL));
22 22
    bus->busnr = next_usb_bus++;
23
    TAILQ_INIT(&bus->free);
24
    TAILQ_INIT(&bus->used);
25
    TAILQ_INSERT_TAIL(&busses, bus, next);
23
    QTAILQ_INIT(&bus->free);
24
    QTAILQ_INIT(&bus->used);
25
    QTAILQ_INSERT_TAIL(&busses, bus, next);
26 26
    return bus;
27 27
}
28 28

  
......
31 31
    USBBus *bus;
32 32

  
33 33
    if (-1 == busnr)
34
        return TAILQ_FIRST(&busses);
35
    TAILQ_FOREACH(bus, &busses, next) {
34
        return QTAILQ_FIRST(&busses);
35
    QTAILQ_FOREACH(bus, &busses, next) {
36 36
        if (bus->busnr == busnr)
37 37
            return bus;
38 38
    }
......
100 100
    port->opaque = opaque;
101 101
    port->index = index;
102 102
    port->attach = attach;
103
    TAILQ_INSERT_TAIL(&bus->free, port, next);
103
    QTAILQ_INSERT_TAIL(&bus->free, port, next);
104 104
    bus->nfree++;
105 105
}
106 106

  
......
116 116
    }
117 117
    dev->attached++;
118 118

  
119
    port = TAILQ_FIRST(&bus->free);
120
    TAILQ_REMOVE(&bus->free, port, next);
119
    port = QTAILQ_FIRST(&bus->free);
120
    QTAILQ_REMOVE(&bus->free, port, next);
121 121
    bus->nfree--;
122 122

  
123 123
    usb_attach(port, dev);
124 124

  
125
    TAILQ_INSERT_TAIL(&bus->used, port, next);
125
    QTAILQ_INSERT_TAIL(&bus->used, port, next);
126 126
    bus->nused++;
127 127
}
128 128

  
......
149 149
    if (!bus)
150 150
        return -1;
151 151

  
152
    TAILQ_FOREACH(port, &bus->used, next) {
152
    QTAILQ_FOREACH(port, &bus->used, next) {
153 153
        if (port->dev->addr == addr)
154 154
            break;
155 155
    }
......
157 157
        return -1;
158 158

  
159 159
    dev = port->dev;
160
    TAILQ_REMOVE(&bus->used, port, next);
160
    QTAILQ_REMOVE(&bus->used, port, next);
161 161
    bus->nused--;
162 162

  
163 163
    usb_attach(port, NULL);
164 164
    dev->info->handle_destroy(dev);
165 165

  
166
    TAILQ_INSERT_TAIL(&bus->free, port, next);
166
    QTAILQ_INSERT_TAIL(&bus->free, port, next);
167 167
    bus->nfree++;
168 168
    return 0;
169 169
}
......
196 196
    USBDevice *dev;
197 197
    USBPort *port;
198 198

  
199
    if (TAILQ_EMPTY(&busses)) {
199
    if (QTAILQ_EMPTY(&busses)) {
200 200
        monitor_printf(mon, "USB support not enabled\n");
201 201
        return;
202 202
    }
203 203

  
204
    TAILQ_FOREACH(bus, &busses, next) {
205
        TAILQ_FOREACH(port, &bus->used, next) {
204
    QTAILQ_FOREACH(bus, &busses, next) {
205
        QTAILQ_FOREACH(port, &bus->used, next) {
206 206
            dev = port->dev;
207 207
            if (!dev)
208 208
                continue;
b/hw/usb-net.c
26 26
#include "qemu-common.h"
27 27
#include "usb.h"
28 28
#include "net.h"
29
#include "sys-queue.h"
29
#include "qemu-queue.h"
30 30

  
31 31
/*#define TRAFFIC_DEBUG*/
32 32
/* Thanks to NetChip Technologies for donating this product ID.
......
595 595
#define NDIS_MAC_OPTION_8021P_PRIORITY		(1 << 6)
596 596

  
597 597
struct rndis_response {
598
    TAILQ_ENTRY(rndis_response) entries;
598
    QTAILQ_ENTRY(rndis_response) entries;
599 599
    uint32_t length;
600 600
    uint8_t buf[0];
601 601
};
......
621 621

  
622 622
    char usbstring_mac[13];
623 623
    VLANClientState *vc;
624
    TAILQ_HEAD(rndis_resp_head, rndis_response) rndis_resp;
624
    QTAILQ_HEAD(rndis_resp_head, rndis_response) rndis_resp;
625 625
} USBNetState;
626 626

  
627 627
static int ndis_query(USBNetState *s, uint32_t oid,
......
812 812
    if (!r)
813 813
        return ret;
814 814

  
815
    TAILQ_REMOVE(&s->rndis_resp, r, entries);
815
    QTAILQ_REMOVE(&s->rndis_resp, r, entries);
816 816
    ret = r->length;
817 817
    memcpy(buf, r->buf, r->length);
818 818
    qemu_free(r);
......
825 825
    struct rndis_response *r =
826 826
            qemu_mallocz(sizeof(struct rndis_response) + length);
827 827

  
828
    TAILQ_INSERT_TAIL(&s->rndis_resp, r, entries);
828
    QTAILQ_INSERT_TAIL(&s->rndis_resp, r, entries);
829 829
    r->length = length;
830 830

  
831 831
    return &r->buf[0];
......
836 836
    struct rndis_response *r;
837 837

  
838 838
    while ((r = s->rndis_resp.tqh_first)) {
839
        TAILQ_REMOVE(&s->rndis_resp, r, entries);
839
        QTAILQ_REMOVE(&s->rndis_resp, r, entries);
840 840
        qemu_free(r);
841 841
    }
842 842
}
......
1440 1440

  
1441 1441
    s->rndis = 1;
1442 1442
    s->rndis_state = RNDIS_UNINITIALIZED;
1443
    TAILQ_INIT(&s->rndis_resp);
1443
    QTAILQ_INIT(&s->rndis_resp);
1444 1444

  
1445 1445
    s->medium = 0;	/* NDIS_MEDIUM_802_3 */
1446 1446
    s->speed = 1000000; /* 100MBps, in 100Bps units */
b/hw/usb.h
24 24

  
25 25
#include "block.h"
26 26
#include "qdev.h"
27
#include "sys-queue.h"
27
#include "qemu-queue.h"
28 28

  
29 29
#define USB_TOKEN_SETUP 0x2d
30 30
#define USB_TOKEN_IN    0x69 /* device -> host */
......
193 193
    usb_attachfn attach;
194 194
    void *opaque;
195 195
    int index; /* internal port index, may be used with the opaque */
196
    TAILQ_ENTRY(USBPort) next;
196
    QTAILQ_ENTRY(USBPort) next;
197 197
};
198 198

  
199 199
typedef void USBCallback(USBPacket * packet, void *opaque);
......
298 298
    int busnr;
299 299
    int nfree;
300 300
    int nused;
301
    TAILQ_HEAD(, USBPort) free;
302
    TAILQ_HEAD(, USBPort) used;
303
    TAILQ_ENTRY(USBBus) next;
301
    QTAILQ_HEAD(, USBPort) free;
302
    QTAILQ_HEAD(, USBPort) used;
303
    QTAILQ_ENTRY(USBBus) next;
304 304
};
305 305

  
306 306
USBBus *usb_bus_new(DeviceState *host);
b/hw/watchdog.c
22 22
#include "qemu-common.h"
23 23
#include "qemu-option.h"
24 24
#include "qemu-config.h"
25
#include "sys-queue.h"
25
#include "qemu-queue.h"
26 26
#include "sysemu.h"
27 27
#include "hw/watchdog.h"
28 28

  
......
35 35
#define WDT_NONE         6	/* Do nothing. */
36 36

  
37 37
static int watchdog_action = WDT_RESET;
38
static LIST_HEAD(watchdog_list, WatchdogTimerModel) watchdog_list;
38
static QLIST_HEAD(watchdog_list, WatchdogTimerModel) watchdog_list;
39 39

  
40 40
void watchdog_add_model(WatchdogTimerModel *model)
41 41
{
42
    LIST_INSERT_HEAD(&watchdog_list, model, entry);
42
    QLIST_INSERT_HEAD(&watchdog_list, model, entry);
43 43
}
44 44

  
45 45
/* Returns:
......
54 54

  
55 55
    /* -watchdog ? lists available devices and exits cleanly. */
56 56
    if (strcmp(p, "?") == 0) {
57
        LIST_FOREACH(model, &watchdog_list, entry) {
57
        QLIST_FOREACH(model, &watchdog_list, entry) {
58 58
            fprintf(stderr, "\t%s\t%s\n",
59 59
                     model->wdt_name, model->wdt_description);
60 60
        }
61 61
        return 2;
62 62
    }
63 63

  
64
    LIST_FOREACH(model, &watchdog_list, entry) {
64
    QLIST_FOREACH(model, &watchdog_list, entry) {
65 65
        if (strcasecmp(model->wdt_name, p) == 0) {
66 66
            /* add the device */
67 67
            opts = qemu_opts_create(&qemu_device_opts, NULL, 0);
......
71 71
    }
72 72

  
73 73
    fprintf(stderr, "Unknown -watchdog device. Supported devices are:\n");
74
    LIST_FOREACH(model, &watchdog_list, entry) {
74
    QLIST_FOREACH(model, &watchdog_list, entry) {
75 75
        fprintf(stderr, "\t%s\t%s\n",
76 76
                 model->wdt_name, model->wdt_description);
77 77
    }
b/hw/watchdog.h
23 23
#define QEMU_WATCHDOG_H
24 24

  
25 25
struct WatchdogTimerModel {
26
    LIST_ENTRY(WatchdogTimerModel) entry;
26
    QLIST_ENTRY(WatchdogTimerModel) entry;
27 27

  
28 28
    /* Short name of the device - used to select it on the command line. */
29 29
    const char *wdt_name;
b/hw/xen_backend.c
48 48
const char *xen_protocol;
49 49

  
50 50
/* private */
51
static TAILQ_HEAD(XenDeviceHead, XenDevice) xendevs = TAILQ_HEAD_INITIALIZER(xendevs);
51
static QTAILQ_HEAD(XenDeviceHead, XenDevice) xendevs = QTAILQ_HEAD_INITIALIZER(xendevs);
52 52
static int debug = 0;
53 53

  
54 54
/* ------------------------------------------------------------- */
......
165 165
{
166 166
    struct XenDevice *xendev;
167 167

  
168
    TAILQ_FOREACH(xendev, &xendevs, next) {
168
    QTAILQ_FOREACH(xendev, &xendevs, next) {
169 169
	if (xendev->dom != dom)
170 170
	    continue;
171 171
	if (xendev->dev != dev)
......
227 227
	xendev->gnttabdev = -1;
228 228
    }
229 229

  
230
    TAILQ_INSERT_TAIL(&xendevs, xendev, next);
230
    QTAILQ_INSERT_TAIL(&xendevs, xendev, next);
231 231

  
232 232
    if (xendev->ops->alloc)
233 233
	xendev->ops->alloc(xendev);
......
243 243
    struct XenDevice *xendev, *xnext;
244 244

  
245 245
    /*
246
     * This is pretty much like TAILQ_FOREACH(xendev, &xendevs, next) but
246
     * This is pretty much like QTAILQ_FOREACH(xendev, &xendevs, next) but
247 247
     * we save the next pointer in xnext because we might free xendev.
248 248
     */
249 249
    xnext = xendevs.tqh_first;
......
271 271
	if (xendev->gnttabdev >= 0)
... This diff was truncated because it exceeds the maximum size that can be displayed.

Also available in: Unified diff