aboutsummaryrefslogtreecommitdiff
path: root/aio.c
diff options
context:
space:
mode:
authorBlue Swirl <blauwirbel@gmail.com>2009-09-12 07:36:22 +0000
committerBlue Swirl <blauwirbel@gmail.com>2009-09-12 07:36:22 +0000
commit72cf2d4f0e181d0d3a3122e04129c58a95da713e (patch)
tree4d13c505a692104406090e94dd654fd1e98ec34e /aio.c
parent620150dc9c1827cdddfa64a0fada7af5f7ee405b (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 'aio.c')
-rw-r--r--aio.c22
1 files changed, 11 insertions, 11 deletions
diff --git a/aio.c b/aio.c
index efc63fd9a1..da18443369 100644
--- a/aio.c
+++ b/aio.c
@@ -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);
}
}