From 72cf2d4f0e181d0d3a3122e04129c58a95da713e Mon Sep 17 00:00:00 2001 From: Blue Swirl Date: Sat, 12 Sep 2009 07:36:22 +0000 Subject: 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 --- block/qcow2-cluster.c | 4 ++-- block/qcow2.c | 16 ++++++++-------- block/qcow2.h | 6 +++--- 3 files changed, 13 insertions(+), 13 deletions(-) (limited to 'block') diff --git a/block/qcow2-cluster.c b/block/qcow2-cluster.c index d4631c3..54e505c 100644 --- a/block/qcow2-cluster.c +++ b/block/qcow2-cluster.c @@ -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 */ diff --git a/block/qcow2.c b/block/qcow2.c index 8579e01..a9e7682 100644 --- a/block/qcow2.c +++ b/block/qcow2.c @@ -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); diff --git a/block/qcow2.h b/block/qcow2.h index 965a2f4..ecc94cb 100644 --- a/block/qcow2.h +++ b/block/qcow2.h @@ -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) -- cgit v1.1