diff options
author | Peter Maydell <peter.maydell@linaro.org> | 2019-01-11 15:46:09 +0000 |
---|---|---|
committer | Peter Maydell <peter.maydell@linaro.org> | 2019-01-11 15:46:09 +0000 |
commit | 15bede554162dda822cd762c689edb6fa32b6e3b (patch) | |
tree | ba397197336b06e020d9c5b403471e9d82d19c63 /include | |
parent | e53f7796fbe71a5c7c24ffebf04b4aa9a759da36 (diff) | |
parent | 7d37435bd5801bb49e1c4b550fedd1c5fe143131 (diff) | |
download | qemu-15bede554162dda822cd762c689edb6fa32b6e3b.zip qemu-15bede554162dda822cd762c689edb6fa32b6e3b.tar.gz qemu-15bede554162dda822cd762c689edb6fa32b6e3b.tar.bz2 |
Merge remote-tracking branch 'remotes/bonzini/tags/for-upstream' into staging
* HAX support for Linux hosts (Alejandro)
* esp bugfixes (Guenter)
* Windows build cleanup (Marc-André)
* checkpatch logic improvements (Paolo)
* coalesced range bugfix (Paolo)
* switch testsuite to TAP (Paolo)
* QTAILQ rewrite (Paolo)
* block/iscsi.c cancellation fixes (Stefan)
* improve selection of the default accelerator (Thomas)
# gpg: Signature made Fri 11 Jan 2019 14:47:40 GMT
# gpg: using RSA key BFFBD25F78C7AE83
# gpg: Good signature from "Paolo Bonzini <bonzini@gnu.org>"
# gpg: aka "Paolo Bonzini <pbonzini@redhat.com>"
# Primary key fingerprint: 46F5 9FBD 57D6 12E7 BFD4 E2F7 7E15 100C CD36 69B1
# Subkey fingerprint: F133 3857 4B66 2389 866C 7682 BFFB D25F 78C7 AE83
* remotes/bonzini/tags/for-upstream: (34 commits)
avoid TABs in files that only contain a few
remove space-tab sequences
scripts: add script to convert multiline comments into 4-line format
hw/watchdog/wdt_i6300esb: remove a unnecessary comment
checkpatch: warn about qemu/queue.h head structs that are not typedef-ed
qemu/queue.h: simplify reverse access to QTAILQ
qemu/queue.h: reimplement QTAILQ without pointer-to-pointers
qemu/queue.h: remove Q_TAILQ_{HEAD,ENTRY}
qemu/queue.h: typedef QTAILQ heads
qemu/queue.h: leave head structs anonymous unless necessary
vfio: make vfio_address_spaces static
qemu/queue.h: do not access tqe_prev directly
test: replace gtester with a TAP driver
test: execute g_test_run when tests are skipped
qga: drop < Vista compatibility
build-sys: build with Vista API by default
build-sys: move windows defines in osdep.h header
build-sys: don't include windows.h, osdep.h does it
scsi: esp: Defer command completion until previous interrupts have been handled
esp-pci: Fix status register write erase control
...
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Diffstat (limited to 'include')
-rw-r--r-- | include/elf.h | 10 | ||||
-rw-r--r-- | include/exec/memory.h | 6 | ||||
-rw-r--r-- | include/hw/acpi/acpi.h | 14 | ||||
-rw-r--r-- | include/hw/elf_ops.h | 2 | ||||
-rw-r--r-- | include/hw/ide/internal.h | 2 | ||||
-rw-r--r-- | include/hw/qdev-core.h | 2 | ||||
-rw-r--r-- | include/hw/scsi/esp.h | 2 | ||||
-rw-r--r-- | include/hw/sh4/sh_intc.h | 20 | ||||
-rw-r--r-- | include/hw/usb.h | 2 | ||||
-rw-r--r-- | include/hw/vfio/vfio-common.h | 4 | ||||
-rw-r--r-- | include/hw/vfio/vfio-platform.h | 2 | ||||
-rw-r--r-- | include/hw/xen/io/ring.h | 4 | ||||
-rw-r--r-- | include/net/net.h | 2 | ||||
-rw-r--r-- | include/qemu/acl.h | 14 | ||||
-rw-r--r-- | include/qemu/iov.h | 2 | ||||
-rw-r--r-- | include/qemu/option_int.h | 2 | ||||
-rw-r--r-- | include/qemu/osdep.h | 17 | ||||
-rw-r--r-- | include/qemu/queue.h | 153 | ||||
-rw-r--r-- | include/qemu/rcu_queue.h | 45 | ||||
-rw-r--r-- | include/qom/cpu.h | 9 | ||||
-rw-r--r-- | include/scsi/constants.h | 2 | ||||
-rw-r--r-- | include/sysemu/accel.h | 2 | ||||
-rw-r--r-- | include/sysemu/balloon.h | 2 | ||||
-rw-r--r-- | include/sysemu/kvm.h | 2 | ||||
-rw-r--r-- | include/sysemu/memory_mapping.h | 2 | ||||
-rw-r--r-- | include/sysemu/rng.h | 2 |
26 files changed, 164 insertions, 162 deletions
diff --git a/include/elf.h b/include/elf.h index 0ac7911..e816fb4 100644 --- a/include/elf.h +++ b/include/elf.h @@ -782,11 +782,11 @@ typedef struct { /* ARM-specific values for sh_flags */ #define SHF_ARM_ENTRYSECT 0x10000000 /* Section contains an entry point */ #define SHF_ARM_COMDEF 0x80000000 /* Section may be multiply defined - in the input to a link step */ + in the input to a link step */ /* ARM-specific program header flags */ #define PF_ARM_SB 0x10000000 /* Segment contains the location - addressed by the static base */ + addressed by the static base */ /* ARM relocs. */ #define R_ARM_NONE 0 /* No reloc */ @@ -1047,7 +1047,7 @@ typedef struct { #define R_X86_64_JUMP_SLOT 7 /* Create PLT entry */ #define R_X86_64_RELATIVE 8 /* Adjust by program base */ #define R_X86_64_GOTPCREL 9 /* 32 bit signed pc relative - offset to GOT */ + offset to GOT */ #define R_X86_64_32 10 /* Direct 32 bit zero extended */ #define R_X86_64_32S 11 /* Direct 32 bit sign extended */ #define R_X86_64_16 12 /* Direct 16 bit zero extended */ @@ -1070,7 +1070,7 @@ typedef struct { #define EF_PARISC_LSB 0x00040000 /* Program expects little endian. */ #define EF_PARISC_WIDE 0x00080000 /* Program expects wide mode. */ #define EF_PARISC_NO_KABP 0x00100000 /* No kernel assisted branch - prediction. */ + prediction. */ #define EF_PARISC_LAZYSWAP 0x00400000 /* Allow lazy swapping. */ #define EF_PARISC_ARCH 0x0000ffff /* Architecture version. */ @@ -1083,7 +1083,7 @@ typedef struct { /* Additional section indeces. */ #define SHN_PARISC_ANSI_COMMON 0xff00 /* Section for tenatively declared - symbols in ANSI C. */ + symbols in ANSI C. */ #define SHN_PARISC_HUGE_COMMON 0xff01 /* Common blocks in huge model. */ /* Legal values for sh_type field of Elf32_Shdr. */ diff --git a/include/exec/memory.h b/include/exec/memory.h index ffd23ed..cd2f209 100644 --- a/include/exec/memory.h +++ b/include/exec/memory.h @@ -379,9 +379,9 @@ struct MemoryRegion { MemoryRegion *alias; hwaddr alias_offset; int32_t priority; - QTAILQ_HEAD(subregions, MemoryRegion) subregions; + QTAILQ_HEAD(, MemoryRegion) subregions; QTAILQ_ENTRY(MemoryRegion) subregions_link; - QTAILQ_HEAD(coalesced_ranges, CoalescedMemoryRange) coalesced; + QTAILQ_HEAD(, CoalescedMemoryRange) coalesced; const char *name; unsigned ioeventfd_nb; MemoryRegionIoeventfd *ioeventfds; @@ -445,7 +445,7 @@ struct AddressSpace { int ioeventfd_nb; struct MemoryRegionIoeventfd *ioeventfds; - QTAILQ_HEAD(memory_listeners_as, MemoryListener) listeners; + QTAILQ_HEAD(, MemoryListener) listeners; QTAILQ_ENTRY(AddressSpace) address_spaces_link; }; diff --git a/include/hw/acpi/acpi.h b/include/hw/acpi/acpi.h index c20ace0..bbf5412 100644 --- a/include/hw/acpi/acpi.h +++ b/include/hw/acpi/acpi.h @@ -69,13 +69,13 @@ #define ACPI_BITMASK_WAKE_STATUS 0x8000 #define ACPI_BITMASK_ALL_FIXED_STATUS (\ - ACPI_BITMASK_TIMER_STATUS | \ - ACPI_BITMASK_BUS_MASTER_STATUS | \ - ACPI_BITMASK_GLOBAL_LOCK_STATUS | \ - ACPI_BITMASK_POWER_BUTTON_STATUS | \ - ACPI_BITMASK_SLEEP_BUTTON_STATUS | \ - ACPI_BITMASK_RT_CLOCK_STATUS | \ - ACPI_BITMASK_WAKE_STATUS) + ACPI_BITMASK_TIMER_STATUS | \ + ACPI_BITMASK_BUS_MASTER_STATUS | \ + ACPI_BITMASK_GLOBAL_LOCK_STATUS | \ + ACPI_BITMASK_POWER_BUTTON_STATUS | \ + ACPI_BITMASK_SLEEP_BUTTON_STATUS | \ + ACPI_BITMASK_RT_CLOCK_STATUS | \ + ACPI_BITMASK_WAKE_STATUS) /* PM1x_EN */ #define ACPI_BITMASK_TIMER_ENABLE 0x0001 diff --git a/include/hw/elf_ops.h b/include/hw/elf_ops.h index 74679ff..e2cb675 100644 --- a/include/hw/elf_ops.h +++ b/include/hw/elf_ops.h @@ -343,7 +343,7 @@ static int glue(load_elf, SZ)(const char *name, int fd, } if (pentry) - *pentry = (uint64_t)(elf_sword)ehdr.e_entry; + *pentry = (uint64_t)(elf_sword)ehdr.e_entry; glue(load_symbols, SZ)(&ehdr, fd, must_swab, clear_lsb, sym_cb); diff --git a/include/hw/ide/internal.h b/include/hw/ide/internal.h index 594081e..880413d 100644 --- a/include/hw/ide/internal.h +++ b/include/hw/ide/internal.h @@ -342,7 +342,7 @@ enum ide_dma_cmd { extern const char *IDE_DMA_CMD_lookup[IDE_DMA__COUNT]; #define ide_cmd_is_read(s) \ - ((s)->dma_cmd == IDE_DMA_READ) + ((s)->dma_cmd == IDE_DMA_READ) typedef struct IDEBufferedRequest { QLIST_ENTRY(IDEBufferedRequest) list; diff --git a/include/hw/qdev-core.h b/include/hw/qdev-core.h index bc014c1..9614f76 100644 --- a/include/hw/qdev-core.h +++ b/include/hw/qdev-core.h @@ -206,7 +206,7 @@ struct BusState { HotplugHandler *hotplug_handler; int max_index; bool realized; - QTAILQ_HEAD(ChildrenHead, BusChild) children; + QTAILQ_HEAD(, BusChild) children; QLIST_ENTRY(BusState) sibling; }; diff --git a/include/hw/scsi/esp.h b/include/hw/scsi/esp.h index 682a0d2..adab63d 100644 --- a/include/hw/scsi/esp.h +++ b/include/hw/scsi/esp.h @@ -23,6 +23,8 @@ struct ESPState { int32_t ti_size; uint32_t ti_rptr, ti_wptr; uint32_t status; + uint32_t deferred_status; + bool deferred_complete; uint32_t dma; uint8_t ti_buf[TI_BUFSZ]; SCSIBus bus; diff --git a/include/hw/sh4/sh_intc.h b/include/hw/sh4/sh_intc.h index fbcee94..adfedb2 100644 --- a/include/hw/sh4/sh_intc.h +++ b/include/hw/sh4/sh_intc.h @@ -61,21 +61,21 @@ struct intc_desc { int sh_intc_get_pending_vector(struct intc_desc *desc, int imask); struct intc_source *sh_intc_source(struct intc_desc *desc, intc_enum id); void sh_intc_toggle_source(struct intc_source *source, - int enable_adj, int assert_adj); + int enable_adj, int assert_adj); void sh_intc_register_sources(struct intc_desc *desc, - struct intc_vect *vectors, - int nr_vectors, - struct intc_group *groups, - int nr_groups); + struct intc_vect *vectors, + int nr_vectors, + struct intc_group *groups, + int nr_groups); int sh_intc_init(MemoryRegion *sysmem, struct intc_desc *desc, - int nr_sources, - struct intc_mask_reg *mask_regs, - int nr_mask_regs, - struct intc_prio_reg *prio_regs, - int nr_prio_regs); + int nr_sources, + struct intc_mask_reg *mask_regs, + int nr_mask_regs, + struct intc_prio_reg *prio_regs, + int nr_prio_regs); void sh_intc_set_irl(void *opaque, int n, int level); diff --git a/include/hw/usb.h b/include/hw/usb.h index 4961405..c21f41c 100644 --- a/include/hw/usb.h +++ b/include/hw/usb.h @@ -408,7 +408,7 @@ struct USBPacket { struct USBCombinedPacket { USBPacket *first; - QTAILQ_HEAD(packets_head, USBPacket) packets; + QTAILQ_HEAD(, USBPacket) packets; QEMUIOVector iov; }; diff --git a/include/hw/vfio/vfio-common.h b/include/hw/vfio/vfio-common.h index 1b434d0..7624c9f 100644 --- a/include/hw/vfio/vfio-common.h +++ b/include/hw/vfio/vfio-common.h @@ -180,8 +180,8 @@ int vfio_get_device(VFIOGroup *group, const char *name, VFIODevice *vbasedev, Error **errp); extern const MemoryRegionOps vfio_region_ops; -extern QLIST_HEAD(vfio_group_head, VFIOGroup) vfio_group_list; -extern QLIST_HEAD(vfio_as_head, VFIOAddressSpace) vfio_address_spaces; +typedef QLIST_HEAD(VFIOGroupList, VFIOGroup) VFIOGroupList; +extern VFIOGroupList vfio_group_list; #ifdef CONFIG_LINUX int vfio_get_region_info(VFIODevice *vbasedev, int index, diff --git a/include/hw/vfio/vfio-platform.h b/include/hw/vfio/vfio-platform.h index 0ee10b1..30d3c28 100644 --- a/include/hw/vfio/vfio-platform.h +++ b/include/hw/vfio/vfio-platform.h @@ -53,7 +53,7 @@ typedef struct VFIOPlatformDevice { VFIORegion **regions; QLIST_HEAD(, VFIOINTp) intp_list; /* list of IRQs */ /* queue of pending IRQs */ - QSIMPLEQ_HEAD(pending_intp_queue, VFIOINTp) pending_intp_queue; + QSIMPLEQ_HEAD(, VFIOINTp) pending_intp_queue; char *compat; /* DT compatible values, separated by NUL */ unsigned int num_compat; /* number of compatible values */ uint32_t mmap_timeout; /* delay to re-enable mmaps after interrupt */ diff --git a/include/hw/xen/io/ring.h b/include/hw/xen/io/ring.h index ffa3eba..1adacf0 100644 --- a/include/hw/xen/io/ring.h +++ b/include/hw/xen/io/ring.h @@ -235,8 +235,8 @@ typedef struct __name##_back_ring __name##_back_ring_t * to be ineffective where _req is a struct which consists of only bitfields. */ #define RING_COPY_REQUEST(_r, _idx, _req) do { \ - /* Use volatile to force the copy into _req. */ \ - *(_req) = *(volatile typeof(_req))RING_GET_REQUEST(_r, _idx); \ + /* Use volatile to force the copy into _req. */ \ + *(_req) = *(volatile typeof(_req))RING_GET_REQUEST(_r, _idx); \ } while (0) #define RING_GET_RESPONSE(_r, _idx) \ diff --git a/include/net/net.h b/include/net/net.h index ec13702..643295d 100644 --- a/include/net/net.h +++ b/include/net/net.h @@ -97,7 +97,7 @@ struct NetClientState { unsigned rxfilter_notify_enabled:1; int vring_enable; int vnet_hdr_len; - QTAILQ_HEAD(NetFilterHead, NetFilterState) filters; + QTAILQ_HEAD(, NetFilterState) filters; }; typedef struct NICState { diff --git a/include/qemu/acl.h b/include/qemu/acl.h index 7c44119..73d2a71 100644 --- a/include/qemu/acl.h +++ b/include/qemu/acl.h @@ -49,18 +49,18 @@ qemu_acl *qemu_acl_init(const char *aclname); qemu_acl *qemu_acl_find(const char *aclname); int qemu_acl_party_is_allowed(qemu_acl *acl, - const char *party); + const char *party); void qemu_acl_reset(qemu_acl *acl); int qemu_acl_append(qemu_acl *acl, - int deny, - const char *match); + int deny, + const char *match); int qemu_acl_insert(qemu_acl *acl, - int deny, - const char *match, - int index); + int deny, + const char *match, + int index); int qemu_acl_remove(qemu_acl *acl, - const char *match); + const char *match); #endif /* QEMU_ACL_H */ diff --git a/include/qemu/iov.h b/include/qemu/iov.h index 72d4c55..5f433c7 100644 --- a/include/qemu/iov.h +++ b/include/qemu/iov.h @@ -35,7 +35,7 @@ size_t iov_size(const struct iovec *iov, const unsigned int iov_cnt); size_t iov_from_buf_full(const struct iovec *iov, unsigned int iov_cnt, size_t offset, const void *buf, size_t bytes); size_t iov_to_buf_full(const struct iovec *iov, const unsigned int iov_cnt, - size_t offset, void *buf, size_t bytes); + size_t offset, void *buf, size_t bytes); static inline size_t iov_from_buf(const struct iovec *iov, unsigned int iov_cnt, diff --git a/include/qemu/option_int.h b/include/qemu/option_int.h index 26b1d9e..5dd9a51 100644 --- a/include/qemu/option_int.h +++ b/include/qemu/option_int.h @@ -47,7 +47,7 @@ struct QemuOpts { char *id; QemuOptsList *list; Location loc; - QTAILQ_HEAD(QemuOptHead, QemuOpt) head; + QTAILQ_HEAD(, QemuOpt) head; QTAILQ_ENTRY(QemuOpts) next; }; diff --git a/include/qemu/osdep.h b/include/qemu/osdep.h index 3bf48bc..80df725 100644 --- a/include/qemu/osdep.h +++ b/include/qemu/osdep.h @@ -74,13 +74,30 @@ typedef __float128 _Float128; extern int daemon(int, int); #endif +#ifdef _WIN32 +/* as defined in sdkddkver.h */ +#ifndef _WIN32_WINNT +#define _WIN32_WINNT 0x0600 /* Vista */ +#endif +/* reduces the number of implicitly included headers */ +#ifndef WIN32_LEAN_AND_MEAN +#define WIN32_LEAN_AND_MEAN +#endif +#endif + #include <stdarg.h> #include <stddef.h> #include <stdbool.h> #include <stdint.h> #include <sys/types.h> #include <stdlib.h> + +/* enable C99/POSIX format strings (needs mingw32-runtime 3.15 or later) */ +#ifdef __MINGW32__ +#define __USE_MINGW_ANSI_STDIO 1 +#endif #include <stdio.h> + #include <string.h> #include <strings.h> #include <inttypes.h> diff --git a/include/qemu/queue.h b/include/qemu/queue.h index ac418ef..1f8e219 100644 --- a/include/qemu/queue.h +++ b/include/qemu/queue.h @@ -346,77 +346,80 @@ struct { \ #define QSIMPLEQ_FIRST(head) ((head)->sqh_first) #define QSIMPLEQ_NEXT(elm, field) ((elm)->field.sqe_next) +typedef struct QTailQLink { + void *tql_next; + struct QTailQLink *tql_prev; +} QTailQLink; /* - * Tail queue definitions. + * Tail queue definitions. The union acts as a poor man template, as if + * it were QTailQLink<type>. */ -#define Q_TAILQ_HEAD(name, type, qual) \ -struct name { \ - qual type *tqh_first; /* first element */ \ - qual type *qual *tqh_last; /* addr of last next element */ \ +#define QTAILQ_HEAD(name, type) \ +union name { \ + struct type *tqh_first; /* first element */ \ + QTailQLink tqh_circ; /* link for circular backwards list */ \ } -#define QTAILQ_HEAD(name, type) Q_TAILQ_HEAD(name, struct type,) #define QTAILQ_HEAD_INITIALIZER(head) \ - { NULL, &(head).tqh_first } + { .tqh_circ = { NULL, &(head).tqh_circ } } -#define Q_TAILQ_ENTRY(type, qual) \ -struct { \ - qual type *tqe_next; /* next element */ \ - qual type *qual *tqe_prev; /* address of previous next element */\ +#define QTAILQ_ENTRY(type) \ +union { \ + struct type *tqe_next; /* next element */ \ + QTailQLink tqe_circ; /* link for circular backwards list */ \ } -#define QTAILQ_ENTRY(type) Q_TAILQ_ENTRY(struct type,) /* * Tail queue functions. */ #define QTAILQ_INIT(head) do { \ (head)->tqh_first = NULL; \ - (head)->tqh_last = &(head)->tqh_first; \ + (head)->tqh_circ.tql_prev = &(head)->tqh_circ; \ } while (/*CONSTCOND*/0) #define QTAILQ_INSERT_HEAD(head, elm, field) do { \ if (((elm)->field.tqe_next = (head)->tqh_first) != NULL) \ - (head)->tqh_first->field.tqe_prev = \ - &(elm)->field.tqe_next; \ + (head)->tqh_first->field.tqe_circ.tql_prev = \ + &(elm)->field.tqe_circ; \ else \ - (head)->tqh_last = &(elm)->field.tqe_next; \ + (head)->tqh_circ.tql_prev = &(elm)->field.tqe_circ; \ (head)->tqh_first = (elm); \ - (elm)->field.tqe_prev = &(head)->tqh_first; \ + (elm)->field.tqe_circ.tql_prev = &(head)->tqh_circ; \ } while (/*CONSTCOND*/0) #define QTAILQ_INSERT_TAIL(head, elm, field) do { \ (elm)->field.tqe_next = NULL; \ - (elm)->field.tqe_prev = (head)->tqh_last; \ - *(head)->tqh_last = (elm); \ - (head)->tqh_last = &(elm)->field.tqe_next; \ + (elm)->field.tqe_circ.tql_prev = (head)->tqh_circ.tql_prev; \ + (head)->tqh_circ.tql_prev->tql_next = (elm); \ + (head)->tqh_circ.tql_prev = &(elm)->field.tqe_circ; \ } while (/*CONSTCOND*/0) #define QTAILQ_INSERT_AFTER(head, listelm, elm, field) do { \ if (((elm)->field.tqe_next = (listelm)->field.tqe_next) != NULL)\ - (elm)->field.tqe_next->field.tqe_prev = \ - &(elm)->field.tqe_next; \ + (elm)->field.tqe_next->field.tqe_circ.tql_prev = \ + &(elm)->field.tqe_circ; \ else \ - (head)->tqh_last = &(elm)->field.tqe_next; \ + (head)->tqh_circ.tql_prev = &(elm)->field.tqe_circ; \ (listelm)->field.tqe_next = (elm); \ - (elm)->field.tqe_prev = &(listelm)->field.tqe_next; \ + (elm)->field.tqe_circ.tql_prev = &(listelm)->field.tqe_circ; \ } while (/*CONSTCOND*/0) -#define QTAILQ_INSERT_BEFORE(listelm, elm, field) do { \ - (elm)->field.tqe_prev = (listelm)->field.tqe_prev; \ - (elm)->field.tqe_next = (listelm); \ - *(listelm)->field.tqe_prev = (elm); \ - (listelm)->field.tqe_prev = &(elm)->field.tqe_next; \ +#define QTAILQ_INSERT_BEFORE(listelm, elm, field) do { \ + (elm)->field.tqe_circ.tql_prev = (listelm)->field.tqe_circ.tql_prev; \ + (elm)->field.tqe_next = (listelm); \ + (listelm)->field.tqe_circ.tql_prev->tql_next = (elm); \ + (listelm)->field.tqe_circ.tql_prev = &(elm)->field.tqe_circ; \ } while (/*CONSTCOND*/0) #define QTAILQ_REMOVE(head, elm, field) do { \ if (((elm)->field.tqe_next) != NULL) \ - (elm)->field.tqe_next->field.tqe_prev = \ - (elm)->field.tqe_prev; \ + (elm)->field.tqe_next->field.tqe_circ.tql_prev = \ + (elm)->field.tqe_circ.tql_prev; \ else \ - (head)->tqh_last = (elm)->field.tqe_prev; \ - *(elm)->field.tqe_prev = (elm)->field.tqe_next; \ - (elm)->field.tqe_prev = NULL; \ + (head)->tqh_circ.tql_prev = (elm)->field.tqe_circ.tql_prev; \ + (elm)->field.tqe_circ.tql_prev->tql_next = (elm)->field.tqe_next; \ + (elm)->field.tqe_circ.tql_prev = NULL; \ } while (/*CONSTCOND*/0) #define QTAILQ_FOREACH(var, head, field) \ @@ -429,14 +432,14 @@ struct { \ (var) && ((next_var) = ((var)->field.tqe_next), 1); \ (var) = (next_var)) -#define QTAILQ_FOREACH_REVERSE(var, head, headname, field) \ - for ((var) = (*(((struct headname *)((head)->tqh_last))->tqh_last)); \ +#define QTAILQ_FOREACH_REVERSE(var, head, field) \ + for ((var) = QTAILQ_LAST(head); \ (var); \ - (var) = (*(((struct headname *)((var)->field.tqe_prev))->tqh_last))) + (var) = QTAILQ_PREV(var, field)) -#define QTAILQ_FOREACH_REVERSE_SAFE(var, head, headname, field, prev_var) \ - for ((var) = (*(((struct headname *)((head)->tqh_last))->tqh_last)); \ - (var) && ((prev_var) = (*(((struct headname *)((var)->field.tqe_prev))->tqh_last)), 1); \ +#define QTAILQ_FOREACH_REVERSE_SAFE(var, head, field, prev_var) \ + for ((var) = QTAILQ_LAST(head); \ + (var) && ((prev_var) = QTAILQ_PREV(var, field)); \ (var) = (prev_var)) /* @@ -445,71 +448,49 @@ struct { \ #define QTAILQ_EMPTY(head) ((head)->tqh_first == NULL) #define QTAILQ_FIRST(head) ((head)->tqh_first) #define QTAILQ_NEXT(elm, field) ((elm)->field.tqe_next) -#define QTAILQ_IN_USE(elm, field) ((elm)->field.tqe_prev != NULL) +#define QTAILQ_IN_USE(elm, field) ((elm)->field.tqe_circ.tql_prev != NULL) -#define QTAILQ_LAST(head, headname) \ - (*(((struct headname *)((head)->tqh_last))->tqh_last)) -#define QTAILQ_PREV(elm, headname, field) \ - (*(((struct headname *)((elm)->field.tqe_prev))->tqh_last)) +#define QTAILQ_LINK_PREV(link) \ + ((link).tql_prev->tql_prev->tql_next) +#define QTAILQ_LAST(head) \ + ((typeof((head)->tqh_first)) QTAILQ_LINK_PREV((head)->tqh_circ)) +#define QTAILQ_PREV(elm, field) \ + ((typeof((elm)->field.tqe_next)) QTAILQ_LINK_PREV((elm)->field.tqe_circ)) #define field_at_offset(base, offset, type) \ - ((type) (((char *) (base)) + (offset))) - -typedef struct DUMMY_Q_ENTRY DUMMY_Q_ENTRY; -typedef struct DUMMY_Q DUMMY_Q; - -struct DUMMY_Q_ENTRY { - QTAILQ_ENTRY(DUMMY_Q_ENTRY) next; -}; - -struct DUMMY_Q { - QTAILQ_HEAD(DUMMY_Q_HEAD, DUMMY_Q_ENTRY) head; -}; - -#define dummy_q ((DUMMY_Q *) 0) -#define dummy_qe ((DUMMY_Q_ENTRY *) 0) + ((type *) (((char *) (base)) + (offset))) /* - * Offsets of layout of a tail queue head. - */ -#define QTAILQ_FIRST_OFFSET (offsetof(typeof(dummy_q->head), tqh_first)) -#define QTAILQ_LAST_OFFSET (offsetof(typeof(dummy_q->head), tqh_last)) -/* - * Raw access of elements of a tail queue + * Raw access of elements of a tail queue head. Offsets are all zero + * because it's a union. */ #define QTAILQ_RAW_FIRST(head) \ - (*field_at_offset(head, QTAILQ_FIRST_OFFSET, void **)) -#define QTAILQ_RAW_TQH_LAST(head) \ - (*field_at_offset(head, QTAILQ_LAST_OFFSET, void ***)) - -/* - * Offsets of layout of a tail queue element. - */ -#define QTAILQ_NEXT_OFFSET (offsetof(typeof(dummy_qe->next), tqe_next)) -#define QTAILQ_PREV_OFFSET (offsetof(typeof(dummy_qe->next), tqe_prev)) + field_at_offset(head, 0, void *) +#define QTAILQ_RAW_TQH_CIRC(head) \ + field_at_offset(head, 0, QTailQLink) /* * Raw access of elements of a tail entry */ #define QTAILQ_RAW_NEXT(elm, entry) \ - (*field_at_offset(elm, entry + QTAILQ_NEXT_OFFSET, void **)) -#define QTAILQ_RAW_TQE_PREV(elm, entry) \ - (*field_at_offset(elm, entry + QTAILQ_PREV_OFFSET, void ***)) + field_at_offset(elm, entry, void *) +#define QTAILQ_RAW_TQE_CIRC(elm, entry) \ + field_at_offset(elm, entry, QTailQLink) /* - * Tail queue tranversal using pointer arithmetic. + * Tail queue traversal using pointer arithmetic. */ #define QTAILQ_RAW_FOREACH(elm, head, entry) \ - for ((elm) = QTAILQ_RAW_FIRST(head); \ + for ((elm) = *QTAILQ_RAW_FIRST(head); \ (elm); \ - (elm) = QTAILQ_RAW_NEXT(elm, entry)) + (elm) = *QTAILQ_RAW_NEXT(elm, entry)) /* * Tail queue insertion using pointer arithmetic. */ -#define QTAILQ_RAW_INSERT_TAIL(head, elm, entry) do { \ - QTAILQ_RAW_NEXT(elm, entry) = NULL; \ - QTAILQ_RAW_TQE_PREV(elm, entry) = QTAILQ_RAW_TQH_LAST(head); \ - *QTAILQ_RAW_TQH_LAST(head) = (elm); \ - QTAILQ_RAW_TQH_LAST(head) = &QTAILQ_RAW_NEXT(elm, entry); \ +#define QTAILQ_RAW_INSERT_TAIL(head, elm, entry) do { \ + *QTAILQ_RAW_NEXT(elm, entry) = NULL; \ + QTAILQ_RAW_TQE_CIRC(elm, entry)->tql_prev = QTAILQ_RAW_TQH_CIRC(head)->tql_prev; \ + QTAILQ_RAW_TQH_CIRC(head)->tql_prev->tql_next = (elm); \ + QTAILQ_RAW_TQH_CIRC(head)->tql_prev = QTAILQ_RAW_TQE_CIRC(elm, entry); \ } while (/*CONSTCOND*/0) #endif /* QEMU_SYS_QUEUE_H */ diff --git a/include/qemu/rcu_queue.h b/include/qemu/rcu_queue.h index 904b337..2d386f3 100644 --- a/include/qemu/rcu_queue.h +++ b/include/qemu/rcu_queue.h @@ -206,47 +206,50 @@ extern "C" { #define QTAILQ_INSERT_HEAD_RCU(head, elm, field) do { \ (elm)->field.tqe_next = (head)->tqh_first; \ if ((elm)->field.tqe_next != NULL) { \ - (head)->tqh_first->field.tqe_prev = &(elm)->field.tqe_next; \ + (head)->tqh_first->field.tqe_circ.tql_prev = \ + &(elm)->field.tqe_circ; \ } else { \ - (head)->tqh_last = &(elm)->field.tqe_next; \ + (head)->tqh_circ.tql_prev = &(elm)->field.tqe_circ; \ } \ atomic_rcu_set(&(head)->tqh_first, (elm)); \ - (elm)->field.tqe_prev = &(head)->tqh_first; \ + (elm)->field.tqe_circ.tql_prev = &(head)->tqh_circ; \ } while (/*CONSTCOND*/0) -#define QTAILQ_INSERT_TAIL_RCU(head, elm, field) do { \ - (elm)->field.tqe_next = NULL; \ - (elm)->field.tqe_prev = (head)->tqh_last; \ - atomic_rcu_set((head)->tqh_last, (elm)); \ - (head)->tqh_last = &(elm)->field.tqe_next; \ +#define QTAILQ_INSERT_TAIL_RCU(head, elm, field) do { \ + (elm)->field.tqe_next = NULL; \ + (elm)->field.tqe_circ.tql_prev = (head)->tqh_circ.tql_prev; \ + atomic_rcu_set(&(head)->tqh_circ.tql_prev->tql_next, (elm)); \ + (head)->tqh_circ.tql_prev = &(elm)->field.tqe_circ; \ } while (/*CONSTCOND*/0) #define QTAILQ_INSERT_AFTER_RCU(head, listelm, elm, field) do { \ (elm)->field.tqe_next = (listelm)->field.tqe_next; \ if ((elm)->field.tqe_next != NULL) { \ - (elm)->field.tqe_next->field.tqe_prev = &(elm)->field.tqe_next; \ + (elm)->field.tqe_next->field.tqe_circ.tql_prev = \ + &(elm)->field.tqe_circ; \ } else { \ - (head)->tqh_last = &(elm)->field.tqe_next; \ + (head)->tqh_circ.tql_prev = &(elm)->field.tqe_circ; \ } \ atomic_rcu_set(&(listelm)->field.tqe_next, (elm)); \ - (elm)->field.tqe_prev = &(listelm)->field.tqe_next; \ + (elm)->field.tqe_circ.tql_prev = &(listelm)->field.tqe_circ; \ } while (/*CONSTCOND*/0) -#define QTAILQ_INSERT_BEFORE_RCU(listelm, elm, field) do { \ - (elm)->field.tqe_prev = (listelm)->field.tqe_prev; \ - (elm)->field.tqe_next = (listelm); \ - atomic_rcu_set((listelm)->field.tqe_prev, (elm)); \ - (listelm)->field.tqe_prev = &(elm)->field.tqe_next; \ - } while (/*CONSTCOND*/0) +#define QTAILQ_INSERT_BEFORE_RCU(listelm, elm, field) do { \ + (elm)->field.tqe_circ.tql_prev = (listelm)->field.tqe_circ.tql_prev; \ + (elm)->field.tqe_next = (listelm); \ + atomic_rcu_set(&(listelm)->field.tqe_circ.tql_prev->tql_next, (elm)); \ + (listelm)->field.tqe_circ.tql_prev = &(elm)->field.tqe_circ; \ +} while (/*CONSTCOND*/0) #define QTAILQ_REMOVE_RCU(head, elm, field) do { \ if (((elm)->field.tqe_next) != NULL) { \ - (elm)->field.tqe_next->field.tqe_prev = (elm)->field.tqe_prev; \ + (elm)->field.tqe_next->field.tqe_circ.tql_prev = \ + (elm)->field.tqe_circ.tql_prev; \ } else { \ - (head)->tqh_last = (elm)->field.tqe_prev; \ + (head)->tqh_circ.tql_prev = (elm)->field.tqe_circ.tql_prev; \ } \ - atomic_set((elm)->field.tqe_prev, (elm)->field.tqe_next); \ - (elm)->field.tqe_prev = NULL; \ + atomic_set(&(elm)->field.tqe_circ.tql_prev->tql_next, (elm)->field.tqe_next); \ + (elm)->field.tqe_circ.tql_prev = NULL; \ } while (/*CONSTCOND*/0) #define QTAILQ_FOREACH_RCU(var, head, field) \ diff --git a/include/qom/cpu.h b/include/qom/cpu.h index 6d1ba53..16bbed1 100644 --- a/include/qom/cpu.h +++ b/include/qom/cpu.h @@ -376,9 +376,9 @@ struct CPUState { QTAILQ_ENTRY(CPUState) node; /* ice debug support */ - QTAILQ_HEAD(breakpoints_head, CPUBreakpoint) breakpoints; + QTAILQ_HEAD(, CPUBreakpoint) breakpoints; - QTAILQ_HEAD(watchpoints_head, CPUWatchpoint) watchpoints; + QTAILQ_HEAD(, CPUWatchpoint) watchpoints; CPUWatchpoint *watchpoint_hit; void *opaque; @@ -436,8 +436,9 @@ struct CPUState { GArray *iommu_notifiers; }; -QTAILQ_HEAD(CPUTailQ, CPUState); -extern struct CPUTailQ cpus; +typedef QTAILQ_HEAD(CPUTailQ, CPUState) CPUTailQ; +extern CPUTailQ cpus; + #define first_cpu QTAILQ_FIRST_RCU(&cpus) #define CPU_NEXT(cpu) QTAILQ_NEXT_RCU(cpu, node) #define CPU_FOREACH(cpu) QTAILQ_FOREACH_RCU(cpu, &cpus, node) diff --git a/include/scsi/constants.h b/include/scsi/constants.h index 083a8e8..0dc5507 100644 --- a/include/scsi/constants.h +++ b/include/scsi/constants.h @@ -212,7 +212,7 @@ #define TYPE_ROM 0x05 #define TYPE_SCANNER 0x06 #define TYPE_MOD 0x07 /* Magneto-optical disk - - * - treated as TYPE_DISK */ + * - treated as TYPE_DISK */ #define TYPE_MEDIUM_CHANGER 0x08 #define TYPE_STORAGE_ARRAY 0x0c /* Storage array device */ #define TYPE_ENCLOSURE 0x0d /* Enclosure Services Device */ diff --git a/include/sysemu/accel.h b/include/sysemu/accel.h index f331d12..5565e00 100644 --- a/include/sysemu/accel.h +++ b/include/sysemu/accel.h @@ -66,7 +66,7 @@ typedef struct AccelClass { extern unsigned long tcg_tb_size; -void configure_accelerator(MachineState *ms); +void configure_accelerator(MachineState *ms, const char *progname); /* Called just before os_setup_post (ie just before drop OS privs) */ void accel_setup_post(MachineState *ms); diff --git a/include/sysemu/balloon.h b/include/sysemu/balloon.h index 66543ae..c8f6145 100644 --- a/include/sysemu/balloon.h +++ b/include/sysemu/balloon.h @@ -20,7 +20,7 @@ typedef void (QEMUBalloonEvent)(void *opaque, ram_addr_t target); typedef void (QEMUBalloonStatus)(void *opaque, BalloonInfo *info); int qemu_add_balloon_handler(QEMUBalloonEvent *event_func, - QEMUBalloonStatus *stat_func, void *opaque); + QEMUBalloonStatus *stat_func, void *opaque); void qemu_remove_balloon_handler(void *opaque); bool qemu_balloon_is_inhibited(void); void qemu_balloon_inhibit(bool state); diff --git a/include/sysemu/kvm.h b/include/sysemu/kvm.h index 97d8d9d..a6d1cd1 100644 --- a/include/sysemu/kvm.h +++ b/include/sysemu/kvm.h @@ -412,8 +412,6 @@ struct kvm_sw_breakpoint { QTAILQ_ENTRY(kvm_sw_breakpoint) entry; }; -QTAILQ_HEAD(kvm_sw_breakpoint_head, kvm_sw_breakpoint); - struct kvm_sw_breakpoint *kvm_find_sw_breakpoint(CPUState *cpu, target_ulong pc); diff --git a/include/sysemu/memory_mapping.h b/include/sysemu/memory_mapping.h index 706152d..5845245 100644 --- a/include/sysemu/memory_mapping.h +++ b/include/sysemu/memory_mapping.h @@ -36,7 +36,7 @@ typedef struct GuestPhysBlock { /* point-in-time snapshot of guest-visible physical mappings */ typedef struct GuestPhysBlockList { unsigned num; - QTAILQ_HEAD(GuestPhysBlockHead, GuestPhysBlock) head; + QTAILQ_HEAD(, GuestPhysBlock) head; } GuestPhysBlockList; /* The physical and virtual address in the memory mapping are contiguous. */ diff --git a/include/sysemu/rng.h b/include/sysemu/rng.h index 45629c4..27b37da 100644 --- a/include/sysemu/rng.h +++ b/include/sysemu/rng.h @@ -57,7 +57,7 @@ struct RngBackend /*< protected >*/ bool opened; - QSIMPLEQ_HEAD(requests, RngRequest) requests; + QSIMPLEQ_HEAD(, RngRequest) requests; }; |