diff options
author | Blue Swirl <blauwirbel@gmail.com> | 2009-09-12 07:36:22 +0000 |
---|---|---|
committer | Blue Swirl <blauwirbel@gmail.com> | 2009-09-12 07:36:22 +0000 |
commit | 72cf2d4f0e181d0d3a3122e04129c58a95da713e (patch) | |
tree | 4d13c505a692104406090e94dd654fd1e98ec34e /posix-aio-compat.c | |
parent | 620150dc9c1827cdddfa64a0fada7af5f7ee405b (diff) |
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>
Diffstat (limited to 'posix-aio-compat.c')
-rw-r--r-- | posix-aio-compat.c | 20 |
1 files changed, 10 insertions, 10 deletions
diff --git a/posix-aio-compat.c b/posix-aio-compat.c index 8bb3d10ee8..68cbec8bd1 100644 --- a/posix-aio-compat.c +++ b/posix-aio-compat.c @@ -22,7 +22,7 @@ #include <stdlib.h> #include <stdio.h> -#include "sys-queue.h" +#include "qemu-queue.h" #include "osdep.h" #include "qemu-common.h" #include "block_int.h" @@ -43,7 +43,7 @@ struct qemu_paiocb { int ev_signo; off_t aio_offset; - TAILQ_ENTRY(qemu_paiocb) node; + QTAILQ_ENTRY(qemu_paiocb) node; int aio_type; ssize_t ret; int active; @@ -63,7 +63,7 @@ static pthread_attr_t attr; static int max_threads = 64; static int cur_threads = 0; static int idle_threads = 0; -static TAILQ_HEAD(, qemu_paiocb) request_list; +static QTAILQ_HEAD(, qemu_paiocb) request_list; #ifdef CONFIG_PREADV static int preadv_present = 1; @@ -321,16 +321,16 @@ static void *aio_thread(void *unused) mutex_lock(&lock); - while (TAILQ_EMPTY(&request_list) && + while (QTAILQ_EMPTY(&request_list) && !(ret == ETIMEDOUT)) { ret = cond_timedwait(&cond, &lock, &ts); } - if (TAILQ_EMPTY(&request_list)) + if (QTAILQ_EMPTY(&request_list)) break; - aiocb = TAILQ_FIRST(&request_list); - TAILQ_REMOVE(&request_list, aiocb, node); + aiocb = QTAILQ_FIRST(&request_list); + QTAILQ_REMOVE(&request_list, aiocb, node); aiocb->active = 1; idle_threads--; mutex_unlock(&lock); @@ -381,7 +381,7 @@ static void qemu_paio_submit(struct qemu_paiocb *aiocb) mutex_lock(&lock); if (idle_threads == 0 && cur_threads < max_threads) spawn_thread(); - TAILQ_INSERT_TAIL(&request_list, aiocb, node); + QTAILQ_INSERT_TAIL(&request_list, aiocb, node); mutex_unlock(&lock); cond_signal(&cond); } @@ -509,7 +509,7 @@ static void paio_cancel(BlockDriverAIOCB *blockacb) mutex_lock(&lock); if (!acb->active) { - TAILQ_REMOVE(&request_list, acb, node); + QTAILQ_REMOVE(&request_list, acb, node); acb->ret = -ECANCELED; } else if (acb->ret == -EINPROGRESS) { active = 1; @@ -619,7 +619,7 @@ void *paio_init(void) if (ret) die2(ret, "pthread_attr_setdetachstate"); - TAILQ_INIT(&request_list); + QTAILQ_INIT(&request_list); posix_aio_state = s; |