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 --- hw/usb-bus.c | 32 ++++++++++++++++---------------- 1 file changed, 16 insertions(+), 16 deletions(-) (limited to 'hw/usb-bus.c') diff --git a/hw/usb-bus.c b/hw/usb-bus.c index 169fb2f..03933f1 100644 --- a/hw/usb-bus.c +++ b/hw/usb-bus.c @@ -12,7 +12,7 @@ static struct BusInfo usb_bus_info = { .print_dev = usb_bus_dev_print, }; static int next_usb_bus = 0; -static TAILQ_HEAD(, USBBus) busses = TAILQ_HEAD_INITIALIZER(busses); +static QTAILQ_HEAD(, USBBus) busses = QTAILQ_HEAD_INITIALIZER(busses); USBBus *usb_bus_new(DeviceState *host) { @@ -20,9 +20,9 @@ USBBus *usb_bus_new(DeviceState *host) bus = FROM_QBUS(USBBus, qbus_create(&usb_bus_info, host, NULL)); bus->busnr = next_usb_bus++; - TAILQ_INIT(&bus->free); - TAILQ_INIT(&bus->used); - TAILQ_INSERT_TAIL(&busses, bus, next); + QTAILQ_INIT(&bus->free); + QTAILQ_INIT(&bus->used); + QTAILQ_INSERT_TAIL(&busses, bus, next); return bus; } @@ -31,8 +31,8 @@ USBBus *usb_bus_find(int busnr) USBBus *bus; if (-1 == busnr) - return TAILQ_FIRST(&busses); - TAILQ_FOREACH(bus, &busses, next) { + return QTAILQ_FIRST(&busses); + QTAILQ_FOREACH(bus, &busses, next) { if (bus->busnr == busnr) return bus; } @@ -100,7 +100,7 @@ void usb_register_port(USBBus *bus, USBPort *port, void *opaque, int index, port->opaque = opaque; port->index = index; port->attach = attach; - TAILQ_INSERT_TAIL(&bus->free, port, next); + QTAILQ_INSERT_TAIL(&bus->free, port, next); bus->nfree++; } @@ -116,13 +116,13 @@ static void do_attach(USBDevice *dev) } dev->attached++; - port = TAILQ_FIRST(&bus->free); - TAILQ_REMOVE(&bus->free, port, next); + port = QTAILQ_FIRST(&bus->free); + QTAILQ_REMOVE(&bus->free, port, next); bus->nfree--; usb_attach(port, dev); - TAILQ_INSERT_TAIL(&bus->used, port, next); + QTAILQ_INSERT_TAIL(&bus->used, port, next); bus->nused++; } @@ -149,7 +149,7 @@ int usb_device_delete_addr(int busnr, int addr) if (!bus) return -1; - TAILQ_FOREACH(port, &bus->used, next) { + QTAILQ_FOREACH(port, &bus->used, next) { if (port->dev->addr == addr) break; } @@ -157,13 +157,13 @@ int usb_device_delete_addr(int busnr, int addr) return -1; dev = port->dev; - TAILQ_REMOVE(&bus->used, port, next); + QTAILQ_REMOVE(&bus->used, port, next); bus->nused--; usb_attach(port, NULL); dev->info->handle_destroy(dev); - TAILQ_INSERT_TAIL(&bus->free, port, next); + QTAILQ_INSERT_TAIL(&bus->free, port, next); bus->nfree++; return 0; } @@ -196,13 +196,13 @@ void usb_info(Monitor *mon) USBDevice *dev; USBPort *port; - if (TAILQ_EMPTY(&busses)) { + if (QTAILQ_EMPTY(&busses)) { monitor_printf(mon, "USB support not enabled\n"); return; } - TAILQ_FOREACH(bus, &busses, next) { - TAILQ_FOREACH(port, &bus->used, next) { + QTAILQ_FOREACH(bus, &busses, next) { + QTAILQ_FOREACH(port, &bus->used, next) { dev = port->dev; if (!dev) continue; -- cgit v1.1