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 /hw | |
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 'hw')
-rw-r--r-- | hw/device-hotplug.c | 2 | ||||
-rw-r--r-- | hw/i2c.c | 2 | ||||
-rw-r--r-- | hw/pci-hotplug.c | 2 | ||||
-rw-r--r-- | hw/qdev.c | 32 | ||||
-rw-r--r-- | hw/qdev.h | 10 | ||||
-rw-r--r-- | hw/ssi.c | 6 | ||||
-rw-r--r-- | hw/usb-bus.c | 32 | ||||
-rw-r--r-- | hw/usb-net.c | 14 | ||||
-rw-r--r-- | hw/usb.h | 10 | ||||
-rw-r--r-- | hw/watchdog.c | 12 | ||||
-rw-r--r-- | hw/watchdog.h | 2 | ||||
-rw-r--r-- | hw/xen_backend.c | 10 | ||||
-rw-r--r-- | hw/xen_backend.h | 2 | ||||
-rw-r--r-- | hw/xen_devconfig.c | 8 | ||||
-rw-r--r-- | hw/xen_disk.c | 40 |
15 files changed, 92 insertions, 92 deletions
diff --git a/hw/device-hotplug.c b/hw/device-hotplug.c index fd4cc3fb54..69779caef5 100644 --- a/hw/device-hotplug.c +++ b/hw/device-hotplug.c @@ -68,7 +68,7 @@ void destroy_bdrvs(dev_match_fn *match_fn, void *arg) DriveInfo *dinfo; struct BlockDriverState *bs; - TAILQ_FOREACH(dinfo, &drives, next) { + QTAILQ_FOREACH(dinfo, &drives, next) { bs = dinfo->bdrv; if (bs) { if (bs->private && match_fn(bs->private, arg)) { @@ -76,7 +76,7 @@ int i2c_start_transfer(i2c_bus *bus, int address, int recv) DeviceState *qdev; i2c_slave *slave = NULL; - LIST_FOREACH(qdev, &bus->qbus.children, sibling) { + QLIST_FOREACH(qdev, &bus->qbus.children, sibling) { slave = I2C_SLAVE_FROM_QDEV(qdev); if (slave->address == address) break; diff --git a/hw/pci-hotplug.c b/hw/pci-hotplug.c index 5348dd1b2e..f3dc42103d 100644 --- a/hw/pci-hotplug.c +++ b/hw/pci-hotplug.c @@ -84,7 +84,7 @@ void drive_hot_add(Monitor *mon, const QDict *qdict) switch (type) { case IF_SCSI: success = 1; - scsibus = LIST_FIRST(&dev->qdev.child_bus); + scsibus = QLIST_FIRST(&dev->qdev.child_bus); scsi_bus_legacy_add_drive(DO_UPCAST(SCSIBus, qbus, scsibus), dinfo, dinfo->unit); break; @@ -101,7 +101,7 @@ DeviceState *qdev_create(BusState *bus, const char *name) qdev_prop_set_defaults(dev, dev->info->props); qdev_prop_set_defaults(dev, dev->parent_bus->info->props); qdev_prop_set_compat(dev); - LIST_INSERT_HEAD(&bus->children, dev, sibling); + QLIST_INSERT_HEAD(&bus->children, dev, sibling); return dev; } @@ -235,7 +235,7 @@ void qdev_free(DeviceState *dev) #endif if (dev->info->reset) qemu_unregister_reset(dev->info->reset, dev); - LIST_REMOVE(dev, sibling); + QLIST_REMOVE(dev, sibling); qemu_free(dev); } @@ -321,7 +321,7 @@ BusState *qdev_get_child_bus(DeviceState *dev, const char *name) { BusState *bus; - LIST_FOREACH(bus, &dev->child_bus, sibling) { + QLIST_FOREACH(bus, &dev->child_bus, sibling) { if (strcmp(name, bus->name) == 0) { return bus; } @@ -346,8 +346,8 @@ static BusState *qbus_find_recursive(BusState *bus, const char *name, return bus; } - LIST_FOREACH(dev, &bus->children, sibling) { - LIST_FOREACH(child, &dev->child_bus, sibling) { + QLIST_FOREACH(dev, &bus->children, sibling) { + QLIST_FOREACH(child, &dev->child_bus, sibling) { ret = qbus_find_recursive(child, name, info); if (ret) { return ret; @@ -365,7 +365,7 @@ static void qbus_list_bus(DeviceState *dev, char *dest, int len) pos += snprintf(dest+pos, len-pos,"child busses at \"%s\":", dev->id ? dev->id : dev->info->name); - LIST_FOREACH(child, &dev->child_bus, sibling) { + QLIST_FOREACH(child, &dev->child_bus, sibling) { pos += snprintf(dest+pos, len-pos, "%s\"%s\"", sep, child->name); sep = ", "; } @@ -379,7 +379,7 @@ static void qbus_list_dev(BusState *bus, char *dest, int len) pos += snprintf(dest+pos, len-pos, "devices at \"%s\":", bus->name); - LIST_FOREACH(dev, &bus->children, sibling) { + QLIST_FOREACH(dev, &bus->children, sibling) { pos += snprintf(dest+pos, len-pos, "%s\"%s\"", sep, dev->info->name); if (dev->id) @@ -392,7 +392,7 @@ static BusState *qbus_find_bus(DeviceState *dev, char *elem) { BusState *child; - LIST_FOREACH(child, &dev->child_bus, sibling) { + QLIST_FOREACH(child, &dev->child_bus, sibling) { if (strcmp(child->name, elem) == 0) { return child; } @@ -410,17 +410,17 @@ static DeviceState *qbus_find_dev(BusState *bus, char *elem) * (2) driver name * (3) driver alias, if present */ - LIST_FOREACH(dev, &bus->children, sibling) { + QLIST_FOREACH(dev, &bus->children, sibling) { if (dev->id && strcmp(dev->id, elem) == 0) { return dev; } } - LIST_FOREACH(dev, &bus->children, sibling) { + QLIST_FOREACH(dev, &bus->children, sibling) { if (strcmp(dev->info->name, elem) == 0) { return dev; } } - LIST_FOREACH(dev, &bus->children, sibling) { + QLIST_FOREACH(dev, &bus->children, sibling) { if (dev->info->alias && strcmp(dev->info->alias, elem) == 0) { return dev; } @@ -478,7 +478,7 @@ static BusState *qbus_find(const char *path) qemu_error("device has no child bus (%s)\n", path); return NULL; case 1: - return LIST_FIRST(&dev->child_bus); + return QLIST_FIRST(&dev->child_bus); default: qbus_list_bus(dev, msg, sizeof(msg)); qemu_error("device has multiple child busses (%s)\n%s\n", @@ -532,9 +532,9 @@ BusState *qbus_create(BusInfo *info, DeviceState *parent, const char *name) bus->name = buf; } - LIST_INIT(&bus->children); + QLIST_INIT(&bus->children); if (parent) { - LIST_INSERT_HEAD(&parent->child_bus, bus, sibling); + QLIST_INSERT_HEAD(&parent->child_bus, bus, sibling); parent->num_child_bus++; } return bus; @@ -575,7 +575,7 @@ static void qdev_print(Monitor *mon, DeviceState *dev, int indent) qdev_print_props(mon, dev, dev->parent_bus->info->props, "bus", indent); if (dev->parent_bus->info->print_dev) dev->parent_bus->info->print_dev(mon, dev, indent); - LIST_FOREACH(child, &dev->child_bus, sibling) { + QLIST_FOREACH(child, &dev->child_bus, sibling) { qbus_print(mon, child, indent); } } @@ -587,7 +587,7 @@ static void qbus_print(Monitor *mon, BusState *bus, int indent) qdev_printf("bus: %s\n", bus->name); indent += 2; qdev_printf("type %s\n", bus->info->name); - LIST_FOREACH(dev, &bus->children, sibling) { + QLIST_FOREACH(dev, &bus->children, sibling) { qdev_print(mon, dev, indent); } } @@ -3,7 +3,7 @@ #include "hw.h" #include "sysemu.h" -#include "sys-queue.h" +#include "qemu-queue.h" #include "qemu-char.h" #include "qemu-option.h" @@ -29,10 +29,10 @@ struct DeviceState { qemu_irq *gpio_out; int num_gpio_in; qemu_irq *gpio_in; - LIST_HEAD(, BusState) child_bus; + QLIST_HEAD(, BusState) child_bus; int num_child_bus; NICInfo *nd; - LIST_ENTRY(DeviceState) sibling; + QLIST_ENTRY(DeviceState) sibling; }; typedef void (*bus_dev_printfn)(Monitor *mon, DeviceState *dev, int indent); @@ -47,8 +47,8 @@ struct BusState { DeviceState *parent; BusInfo *info; const char *name; - LIST_HEAD(, DeviceState) children; - LIST_ENTRY(BusState) sibling; + QLIST_HEAD(, DeviceState) children; + QLIST_ENTRY(BusState) sibling; }; struct Property { @@ -25,8 +25,8 @@ static int ssi_slave_init(DeviceState *dev, DeviceInfo *base_info) SSIBus *bus; bus = FROM_QBUS(SSIBus, qdev_get_parent_bus(dev)); - if (LIST_FIRST(&bus->qbus.children) != dev - || LIST_NEXT(dev, sibling) != NULL) { + if (QLIST_FIRST(&bus->qbus.children) != dev + || QLIST_NEXT(dev, sibling) != NULL) { hw_error("Too many devices on SSI bus"); } @@ -61,7 +61,7 @@ uint32_t ssi_transfer(SSIBus *bus, uint32_t val) { DeviceState *dev; SSISlave *slave; - dev = LIST_FIRST(&bus->qbus.children); + dev = QLIST_FIRST(&bus->qbus.children); if (!dev) { return 0; } diff --git a/hw/usb-bus.c b/hw/usb-bus.c index 169fb2f58d..03933f12f1 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; diff --git a/hw/usb-net.c b/hw/usb-net.c index f19309ee13..b33e32927c 100644 --- a/hw/usb-net.c +++ b/hw/usb-net.c @@ -26,7 +26,7 @@ #include "qemu-common.h" #include "usb.h" #include "net.h" -#include "sys-queue.h" +#include "qemu-queue.h" /*#define TRAFFIC_DEBUG*/ /* Thanks to NetChip Technologies for donating this product ID. @@ -595,7 +595,7 @@ static const uint32_t oid_supported_list[] = #define NDIS_MAC_OPTION_8021P_PRIORITY (1 << 6) struct rndis_response { - TAILQ_ENTRY(rndis_response) entries; + QTAILQ_ENTRY(rndis_response) entries; uint32_t length; uint8_t buf[0]; }; @@ -621,7 +621,7 @@ typedef struct USBNetState { char usbstring_mac[13]; VLANClientState *vc; - TAILQ_HEAD(rndis_resp_head, rndis_response) rndis_resp; + QTAILQ_HEAD(rndis_resp_head, rndis_response) rndis_resp; } USBNetState; static int ndis_query(USBNetState *s, uint32_t oid, @@ -812,7 +812,7 @@ static int rndis_get_response(USBNetState *s, uint8_t *buf) if (!r) return ret; - TAILQ_REMOVE(&s->rndis_resp, r, entries); + QTAILQ_REMOVE(&s->rndis_resp, r, entries); ret = r->length; memcpy(buf, r->buf, r->length); qemu_free(r); @@ -825,7 +825,7 @@ static void *rndis_queue_response(USBNetState *s, unsigned int length) struct rndis_response *r = qemu_mallocz(sizeof(struct rndis_response) + length); - TAILQ_INSERT_TAIL(&s->rndis_resp, r, entries); + QTAILQ_INSERT_TAIL(&s->rndis_resp, r, entries); r->length = length; return &r->buf[0]; @@ -836,7 +836,7 @@ static void rndis_clear_responsequeue(USBNetState *s) struct rndis_response *r; while ((r = s->rndis_resp.tqh_first)) { - TAILQ_REMOVE(&s->rndis_resp, r, entries); + QTAILQ_REMOVE(&s->rndis_resp, r, entries); qemu_free(r); } } @@ -1440,7 +1440,7 @@ static int usb_net_initfn(USBDevice *dev) s->rndis = 1; s->rndis_state = RNDIS_UNINITIALIZED; - TAILQ_INIT(&s->rndis_resp); + QTAILQ_INIT(&s->rndis_resp); s->medium = 0; /* NDIS_MEDIUM_802_3 */ s->speed = 1000000; /* 100MBps, in 100Bps units */ @@ -24,7 +24,7 @@ #include "block.h" #include "qdev.h" -#include "sys-queue.h" +#include "qemu-queue.h" #define USB_TOKEN_SETUP 0x2d #define USB_TOKEN_IN 0x69 /* device -> host */ @@ -193,7 +193,7 @@ struct USBPort { usb_attachfn attach; void *opaque; int index; /* internal port index, may be used with the opaque */ - TAILQ_ENTRY(USBPort) next; + QTAILQ_ENTRY(USBPort) next; }; typedef void USBCallback(USBPacket * packet, void *opaque); @@ -298,9 +298,9 @@ struct USBBus { int busnr; int nfree; int nused; - TAILQ_HEAD(, USBPort) free; - TAILQ_HEAD(, USBPort) used; - TAILQ_ENTRY(USBBus) next; + QTAILQ_HEAD(, USBPort) free; + QTAILQ_HEAD(, USBPort) used; + QTAILQ_ENTRY(USBBus) next; }; USBBus *usb_bus_new(DeviceState *host); diff --git a/hw/watchdog.c b/hw/watchdog.c index adba872533..6a3d1b4320 100644 --- a/hw/watchdog.c +++ b/hw/watchdog.c @@ -22,7 +22,7 @@ #include "qemu-common.h" #include "qemu-option.h" #include "qemu-config.h" -#include "sys-queue.h" +#include "qemu-queue.h" #include "sysemu.h" #include "hw/watchdog.h" @@ -35,11 +35,11 @@ #define WDT_NONE 6 /* Do nothing. */ static int watchdog_action = WDT_RESET; -static LIST_HEAD(watchdog_list, WatchdogTimerModel) watchdog_list; +static QLIST_HEAD(watchdog_list, WatchdogTimerModel) watchdog_list; void watchdog_add_model(WatchdogTimerModel *model) { - LIST_INSERT_HEAD(&watchdog_list, model, entry); + QLIST_INSERT_HEAD(&watchdog_list, model, entry); } /* Returns: @@ -54,14 +54,14 @@ int select_watchdog(const char *p) /* -watchdog ? lists available devices and exits cleanly. */ if (strcmp(p, "?") == 0) { - LIST_FOREACH(model, &watchdog_list, entry) { + QLIST_FOREACH(model, &watchdog_list, entry) { fprintf(stderr, "\t%s\t%s\n", model->wdt_name, model->wdt_description); } return 2; } - LIST_FOREACH(model, &watchdog_list, entry) { + QLIST_FOREACH(model, &watchdog_list, entry) { if (strcasecmp(model->wdt_name, p) == 0) { /* add the device */ opts = qemu_opts_create(&qemu_device_opts, NULL, 0); @@ -71,7 +71,7 @@ int select_watchdog(const char *p) } fprintf(stderr, "Unknown -watchdog device. Supported devices are:\n"); - LIST_FOREACH(model, &watchdog_list, entry) { + QLIST_FOREACH(model, &watchdog_list, entry) { fprintf(stderr, "\t%s\t%s\n", model->wdt_name, model->wdt_description); } diff --git a/hw/watchdog.h b/hw/watchdog.h index 8c54fa41fd..330062c85f 100644 --- a/hw/watchdog.h +++ b/hw/watchdog.h @@ -23,7 +23,7 @@ #define QEMU_WATCHDOG_H struct WatchdogTimerModel { - LIST_ENTRY(WatchdogTimerModel) entry; + QLIST_ENTRY(WatchdogTimerModel) entry; /* Short name of the device - used to select it on the command line. */ const char *wdt_name; diff --git a/hw/xen_backend.c b/hw/xen_backend.c index efafd2fa52..658ea8d1d3 100644 --- a/hw/xen_backend.c +++ b/hw/xen_backend.c @@ -48,7 +48,7 @@ struct xs_handle *xenstore = NULL; const char *xen_protocol; /* private */ -static TAILQ_HEAD(XenDeviceHead, XenDevice) xendevs = TAILQ_HEAD_INITIALIZER(xendevs); +static QTAILQ_HEAD(XenDeviceHead, XenDevice) xendevs = QTAILQ_HEAD_INITIALIZER(xendevs); static int debug = 0; /* ------------------------------------------------------------- */ @@ -165,7 +165,7 @@ struct XenDevice *xen_be_find_xendev(const char *type, int dom, int dev) { struct XenDevice *xendev; - TAILQ_FOREACH(xendev, &xendevs, next) { + QTAILQ_FOREACH(xendev, &xendevs, next) { if (xendev->dom != dom) continue; if (xendev->dev != dev) @@ -227,7 +227,7 @@ static struct XenDevice *xen_be_get_xendev(const char *type, int dom, int dev, xendev->gnttabdev = -1; } - TAILQ_INSERT_TAIL(&xendevs, xendev, next); + QTAILQ_INSERT_TAIL(&xendevs, xendev, next); if (xendev->ops->alloc) xendev->ops->alloc(xendev); @@ -243,7 +243,7 @@ static struct XenDevice *xen_be_del_xendev(int dom, int dev) struct XenDevice *xendev, *xnext; /* - * This is pretty much like TAILQ_FOREACH(xendev, &xendevs, next) but + * This is pretty much like QTAILQ_FOREACH(xendev, &xendevs, next) but * we save the next pointer in xnext because we might free xendev. */ xnext = xendevs.tqh_first; @@ -271,7 +271,7 @@ static struct XenDevice *xen_be_del_xendev(int dom, int dev) if (xendev->gnttabdev >= 0) xc_gnttab_close(xendev->gnttabdev); - TAILQ_REMOVE(&xendevs, xendev, next); + QTAILQ_REMOVE(&xendevs, xendev, next); qemu_free(xendev); } return NULL; diff --git a/hw/xen_backend.h b/hw/xen_backend.h index 4dbfdb4a4a..f07f7d4224 100644 --- a/hw/xen_backend.h +++ b/hw/xen_backend.h @@ -50,7 +50,7 @@ struct XenDevice { int gnttabdev; struct XenDevOps *ops; - TAILQ_ENTRY(XenDevice) next; + QTAILQ_ENTRY(XenDevice) next; }; /* ------------------------------------------------------------- */ diff --git a/hw/xen_devconfig.c b/hw/xen_devconfig.c index 4121188a48..ea8f8c4c2d 100644 --- a/hw/xen_devconfig.c +++ b/hw/xen_devconfig.c @@ -4,9 +4,9 @@ struct xs_dirs { char *xs_dir; - TAILQ_ENTRY(xs_dirs) list; + QTAILQ_ENTRY(xs_dirs) list; }; -static TAILQ_HEAD(xs_dirs_head, xs_dirs) xs_cleanup = TAILQ_HEAD_INITIALIZER(xs_cleanup); +static QTAILQ_HEAD(xs_dirs_head, xs_dirs) xs_cleanup = QTAILQ_HEAD_INITIALIZER(xs_cleanup); static void xen_config_cleanup_dir(char *dir) { @@ -14,14 +14,14 @@ static void xen_config_cleanup_dir(char *dir) d = qemu_malloc(sizeof(*d)); d->xs_dir = dir; - TAILQ_INSERT_TAIL(&xs_cleanup, d, list); + QTAILQ_INSERT_TAIL(&xs_cleanup, d, list); } void xen_config_cleanup(void) { struct xs_dirs *d; - TAILQ_FOREACH(d, &xs_cleanup, list) { + QTAILQ_FOREACH(d, &xs_cleanup, list) { xs_rm(xenstore, 0, d->xs_dir); } } diff --git a/hw/xen_disk.c b/hw/xen_disk.c index 100ef8e9bc..74cde80691 100644 --- a/hw/xen_disk.c +++ b/hw/xen_disk.c @@ -77,7 +77,7 @@ struct ioreq { int aio_errors; struct XenBlkDev *blkdev; - LIST_ENTRY(ioreq) list; + QLIST_ENTRY(ioreq) list; }; struct XenBlkDev { @@ -99,9 +99,9 @@ struct XenBlkDev { int cnt_map; /* request lists */ - LIST_HEAD(inflight_head, ioreq) inflight; - LIST_HEAD(finished_head, ioreq) finished; - LIST_HEAD(freelist_head, ioreq) freelist; + QLIST_HEAD(inflight_head, ioreq) inflight; + QLIST_HEAD(finished_head, ioreq) finished; + QLIST_HEAD(freelist_head, ioreq) freelist; int requests_total; int requests_inflight; int requests_finished; @@ -118,7 +118,7 @@ static struct ioreq *ioreq_start(struct XenBlkDev *blkdev) { struct ioreq *ioreq = NULL; - if (LIST_EMPTY(&blkdev->freelist)) { + if (QLIST_EMPTY(&blkdev->freelist)) { if (blkdev->requests_total >= max_requests) goto out; /* allocate new struct */ @@ -128,11 +128,11 @@ static struct ioreq *ioreq_start(struct XenBlkDev *blkdev) qemu_iovec_init(&ioreq->v, BLKIF_MAX_SEGMENTS_PER_REQUEST); } else { /* get one from freelist */ - ioreq = LIST_FIRST(&blkdev->freelist); - LIST_REMOVE(ioreq, list); + ioreq = QLIST_FIRST(&blkdev->freelist); + QLIST_REMOVE(ioreq, list); qemu_iovec_reset(&ioreq->v); } - LIST_INSERT_HEAD(&blkdev->inflight, ioreq, list); + QLIST_INSERT_HEAD(&blkdev->inflight, ioreq, list); blkdev->requests_inflight++; out: @@ -143,8 +143,8 @@ static void ioreq_finish(struct ioreq *ioreq) { struct XenBlkDev *blkdev = ioreq->blkdev; - LIST_REMOVE(ioreq, list); - LIST_INSERT_HEAD(&blkdev->finished, ioreq, list); + QLIST_REMOVE(ioreq, list); + QLIST_INSERT_HEAD(&blkdev->finished, ioreq, list); blkdev->requests_inflight--; blkdev->requests_finished++; } @@ -153,10 +153,10 @@ static void ioreq_release(struct ioreq *ioreq) { struct XenBlkDev *blkdev = ioreq->blkdev; - LIST_REMOVE(ioreq, list); + QLIST_REMOVE(ioreq, list); memset(ioreq, 0, sizeof(*ioreq)); ioreq->blkdev = blkdev; - LIST_INSERT_HEAD(&blkdev->freelist, ioreq, list); + QLIST_INSERT_HEAD(&blkdev->freelist, ioreq, list); blkdev->requests_finished--; } @@ -476,8 +476,8 @@ static void blk_send_response_all(struct XenBlkDev *blkdev) struct ioreq *ioreq; int send_notify = 0; - while (!LIST_EMPTY(&blkdev->finished)) { - ioreq = LIST_FIRST(&blkdev->finished); + while (!QLIST_EMPTY(&blkdev->finished)) { + ioreq = QLIST_FIRST(&blkdev->finished); send_notify += blk_send_response_one(ioreq); ioreq_release(ioreq); } @@ -564,9 +564,9 @@ static void blk_alloc(struct XenDevice *xendev) { struct XenBlkDev *blkdev = container_of(xendev, struct XenBlkDev, xendev); - LIST_INIT(&blkdev->inflight); - LIST_INIT(&blkdev->finished); - LIST_INIT(&blkdev->freelist); + QLIST_INIT(&blkdev->inflight); + QLIST_INIT(&blkdev->finished); + QLIST_INIT(&blkdev->freelist); blkdev->bh = qemu_bh_new(blk_bh, blkdev); if (xen_mode != XEN_EMULATE) batch_maps = 1; @@ -750,9 +750,9 @@ static int blk_free(struct XenDevice *xendev) struct XenBlkDev *blkdev = container_of(xendev, struct XenBlkDev, xendev); struct ioreq *ioreq; - while (!LIST_EMPTY(&blkdev->freelist)) { - ioreq = LIST_FIRST(&blkdev->freelist); - LIST_REMOVE(ioreq, list); + while (!QLIST_EMPTY(&blkdev->freelist)) { + ioreq = QLIST_FIRST(&blkdev->freelist); + QLIST_REMOVE(ioreq, list); qemu_iovec_destroy(&ioreq->v); qemu_free(ioreq); } |