* 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)
 -----BEGIN PGP SIGNATURE-----
 Version: GnuPG v2.0.22 (GNU/Linux)
 
 iQEcBAABAgAGBQJcOKyMAAoJEL/70l94x66DxKEH/1ho2Xl8ezxCecA6q3HqTgMT
 NJ/ntdqQwVwekKOWzsywnM3/LkEDLH55MxbTeQ8M/Vb1seS8eROz24/gPTzvFrfR
 n/d11rDV1EJfWe0H7nGLLFiRv0MSjxLpG9c3dlOKWhwOYHm25tr48PsdfVFP9Slz
 BK3rwrMeDgArfptHAIsAXt2h1S0EzrG9pMwGDpErCDzziXxBhUESE0Iqfw8LsH1K
 VjMn6rn7Ts1XKlxxwsm+BzHlTJghbj3tWPIfk+6uK2isP4iM3gFCoav3SG9XVXof
 V9+vFyMxdtZKT/0HvajhUS4/1S/uGBNNchZRnCxXlpbueWc5ROtvarhM6Hb0eck=
 =i8E5
 -----END PGP SIGNATURE-----
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>
			
			
This commit is contained in:
		
						commit
						15bede5541
					
				@ -69,7 +69,7 @@ static int accel_init_machine(AccelClass *acc, MachineState *ms)
 | 
			
		||||
    return ret;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
void configure_accelerator(MachineState *ms)
 | 
			
		||||
void configure_accelerator(MachineState *ms, const char *progname)
 | 
			
		||||
{
 | 
			
		||||
    const char *accel;
 | 
			
		||||
    char **accel_list, **tmp;
 | 
			
		||||
@ -80,8 +80,20 @@ void configure_accelerator(MachineState *ms)
 | 
			
		||||
 | 
			
		||||
    accel = qemu_opt_get(qemu_get_machine_opts(), "accel");
 | 
			
		||||
    if (accel == NULL) {
 | 
			
		||||
        /* Use the default "accelerator", tcg */
 | 
			
		||||
        /* Select the default accelerator */
 | 
			
		||||
        int pnlen = strlen(progname);
 | 
			
		||||
        if (pnlen >= 3 && g_str_equal(&progname[pnlen - 3], "kvm")) {
 | 
			
		||||
            /* If the program name ends with "kvm", we prefer KVM */
 | 
			
		||||
            accel = "kvm:tcg";
 | 
			
		||||
        } else {
 | 
			
		||||
#if defined(CONFIG_TCG)
 | 
			
		||||
            accel = "tcg";
 | 
			
		||||
#elif defined(CONFIG_KVM)
 | 
			
		||||
            accel = "kvm";
 | 
			
		||||
#else
 | 
			
		||||
#error "No default accelerator available"
 | 
			
		||||
#endif
 | 
			
		||||
        }
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    accel_list = g_strsplit(accel, ":", 0);
 | 
			
		||||
 | 
			
		||||
@ -86,7 +86,7 @@ struct KVMState
 | 
			
		||||
    int robust_singlestep;
 | 
			
		||||
    int debugregs;
 | 
			
		||||
#ifdef KVM_CAP_SET_GUEST_DEBUG
 | 
			
		||||
    struct kvm_sw_breakpoint_head kvm_sw_breakpoints;
 | 
			
		||||
    QTAILQ_HEAD(, kvm_sw_breakpoint) kvm_sw_breakpoints;
 | 
			
		||||
#endif
 | 
			
		||||
    int many_ioeventfds;
 | 
			
		||||
    int intx_set_mask;
 | 
			
		||||
@ -102,7 +102,7 @@ struct KVMState
 | 
			
		||||
    int nr_allocated_irq_routes;
 | 
			
		||||
    unsigned long *used_gsi_bitmap;
 | 
			
		||||
    unsigned int gsi_count;
 | 
			
		||||
    QTAILQ_HEAD(msi_hashtab, KVMMSIRoute) msi_hashtab[KVM_MSI_HASHTAB_SIZE];
 | 
			
		||||
    QTAILQ_HEAD(, KVMMSIRoute) msi_hashtab[KVM_MSI_HASHTAB_SIZE];
 | 
			
		||||
#endif
 | 
			
		||||
    KVMMemoryListener memory_listener;
 | 
			
		||||
    QLIST_HEAD(, KVMParkedVcpu) kvm_parked_vcpus;
 | 
			
		||||
 | 
			
		||||
@ -16,12 +16,8 @@
 | 
			
		||||
 * You should have received a copy of the GNU Lesser General Public
 | 
			
		||||
 * License along with this library; if not, see <http://www.gnu.org/licenses/>.
 | 
			
		||||
 */
 | 
			
		||||
#ifdef _WIN32
 | 
			
		||||
#include <windows.h>
 | 
			
		||||
#endif
 | 
			
		||||
#include "qemu/osdep.h"
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
#include "qemu-common.h"
 | 
			
		||||
#define NO_CPU_IO_DEFS
 | 
			
		||||
#include "cpu.h"
 | 
			
		||||
 | 
			
		||||
@ -72,7 +72,7 @@ typedef struct ListElement {
 | 
			
		||||
    GlfsPreopened saved;
 | 
			
		||||
} ListElement;
 | 
			
		||||
 | 
			
		||||
static QLIST_HEAD(glfs_list, ListElement) glfs_list;
 | 
			
		||||
static QLIST_HEAD(, ListElement) glfs_list;
 | 
			
		||||
 | 
			
		||||
static QemuOptsList qemu_gluster_create_opts = {
 | 
			
		||||
    .name = "qemu-gluster-create-opts",
 | 
			
		||||
 | 
			
		||||
@ -117,7 +117,6 @@ typedef struct IscsiAIOCB {
 | 
			
		||||
    QEMUBH *bh;
 | 
			
		||||
    IscsiLun *iscsilun;
 | 
			
		||||
    struct scsi_task *task;
 | 
			
		||||
    uint8_t *buf;
 | 
			
		||||
    int status;
 | 
			
		||||
    int64_t sector_num;
 | 
			
		||||
    int nb_sectors;
 | 
			
		||||
@ -125,6 +124,7 @@ typedef struct IscsiAIOCB {
 | 
			
		||||
#ifdef __linux__
 | 
			
		||||
    sg_io_hdr_t *ioh;
 | 
			
		||||
#endif
 | 
			
		||||
    bool cancelled;
 | 
			
		||||
} IscsiAIOCB;
 | 
			
		||||
 | 
			
		||||
/* libiscsi uses time_t so its enough to process events every second */
 | 
			
		||||
@ -150,9 +150,6 @@ iscsi_bh_cb(void *p)
 | 
			
		||||
 | 
			
		||||
    qemu_bh_delete(acb->bh);
 | 
			
		||||
 | 
			
		||||
    g_free(acb->buf);
 | 
			
		||||
    acb->buf = NULL;
 | 
			
		||||
 | 
			
		||||
    acb->common.cb(acb->common.opaque, acb->status);
 | 
			
		||||
 | 
			
		||||
    if (acb->task != NULL) {
 | 
			
		||||
@ -291,14 +288,20 @@ static void iscsi_co_init_iscsitask(IscsiLun *iscsilun, struct IscsiTask *iTask)
 | 
			
		||||
    };
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
/* Called (via iscsi_service) with QemuMutex held. */
 | 
			
		||||
static void
 | 
			
		||||
iscsi_abort_task_cb(struct iscsi_context *iscsi, int status, void *command_data,
 | 
			
		||||
                    void *private_data)
 | 
			
		||||
{
 | 
			
		||||
    IscsiAIOCB *acb = private_data;
 | 
			
		||||
 | 
			
		||||
    acb->status = -ECANCELED;
 | 
			
		||||
    iscsi_schedule_bh(acb);
 | 
			
		||||
    /* If the command callback hasn't been called yet, drop the task */
 | 
			
		||||
    if (!acb->bh) {
 | 
			
		||||
        /* Call iscsi_aio_ioctl_cb() with SCSI_STATUS_CANCELLED */
 | 
			
		||||
        iscsi_scsi_cancel_task(iscsi, acb->task);
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    qemu_aio_unref(acb); /* acquired in iscsi_aio_cancel() */
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
static void
 | 
			
		||||
@ -307,14 +310,25 @@ iscsi_aio_cancel(BlockAIOCB *blockacb)
 | 
			
		||||
    IscsiAIOCB *acb = (IscsiAIOCB *)blockacb;
 | 
			
		||||
    IscsiLun *iscsilun = acb->iscsilun;
 | 
			
		||||
 | 
			
		||||
    if (acb->status != -EINPROGRESS) {
 | 
			
		||||
    qemu_mutex_lock(&iscsilun->mutex);
 | 
			
		||||
 | 
			
		||||
    /* If it was cancelled or completed already, our work is done here */
 | 
			
		||||
    if (acb->cancelled || acb->status != -EINPROGRESS) {
 | 
			
		||||
        qemu_mutex_unlock(&iscsilun->mutex);
 | 
			
		||||
        return;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    /* send a task mgmt call to the target to cancel the task on the target */
 | 
			
		||||
    iscsi_task_mgmt_abort_task_async(iscsilun->iscsi, acb->task,
 | 
			
		||||
                                     iscsi_abort_task_cb, acb);
 | 
			
		||||
    acb->cancelled = true;
 | 
			
		||||
 | 
			
		||||
    qemu_aio_ref(acb); /* released in iscsi_abort_task_cb() */
 | 
			
		||||
 | 
			
		||||
    /* send a task mgmt call to the target to cancel the task on the target */
 | 
			
		||||
    if (iscsi_task_mgmt_abort_task_async(iscsilun->iscsi, acb->task,
 | 
			
		||||
                                         iscsi_abort_task_cb, acb) < 0) {
 | 
			
		||||
        qemu_aio_unref(acb); /* since iscsi_abort_task_cb() won't be called */
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    qemu_mutex_unlock(&iscsilun->mutex);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
static const AIOCBInfo iscsi_aiocb_info = {
 | 
			
		||||
@ -348,6 +362,8 @@ static void iscsi_timed_check_events(void *opaque)
 | 
			
		||||
{
 | 
			
		||||
    IscsiLun *iscsilun = opaque;
 | 
			
		||||
 | 
			
		||||
    qemu_mutex_lock(&iscsilun->mutex);
 | 
			
		||||
 | 
			
		||||
    /* check for timed out requests */
 | 
			
		||||
    iscsi_service(iscsilun->iscsi, 0);
 | 
			
		||||
 | 
			
		||||
@ -360,6 +376,8 @@ static void iscsi_timed_check_events(void *opaque)
 | 
			
		||||
     * to return to service once this situation changes. */
 | 
			
		||||
    iscsi_set_events(iscsilun);
 | 
			
		||||
 | 
			
		||||
    qemu_mutex_unlock(&iscsilun->mutex);
 | 
			
		||||
 | 
			
		||||
    timer_mod(iscsilun->event_timer,
 | 
			
		||||
              qemu_clock_get_ms(QEMU_CLOCK_REALTIME) + EVENT_INTERVAL);
 | 
			
		||||
}
 | 
			
		||||
@ -933,8 +951,13 @@ iscsi_aio_ioctl_cb(struct iscsi_context *iscsi, int status,
 | 
			
		||||
{
 | 
			
		||||
    IscsiAIOCB *acb = opaque;
 | 
			
		||||
 | 
			
		||||
    g_free(acb->buf);
 | 
			
		||||
    acb->buf = NULL;
 | 
			
		||||
    if (status == SCSI_STATUS_CANCELLED) {
 | 
			
		||||
        if (!acb->bh) {
 | 
			
		||||
            acb->status = -ECANCELED;
 | 
			
		||||
            iscsi_schedule_bh(acb);
 | 
			
		||||
        }
 | 
			
		||||
        return;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    acb->status = 0;
 | 
			
		||||
    if (status < 0) {
 | 
			
		||||
@ -1010,8 +1033,8 @@ static BlockAIOCB *iscsi_aio_ioctl(BlockDriverState *bs,
 | 
			
		||||
    acb->iscsilun = iscsilun;
 | 
			
		||||
    acb->bh          = NULL;
 | 
			
		||||
    acb->status      = -EINPROGRESS;
 | 
			
		||||
    acb->buf         = NULL;
 | 
			
		||||
    acb->ioh         = buf;
 | 
			
		||||
    acb->cancelled   = false;
 | 
			
		||||
 | 
			
		||||
    if (req != SG_IO) {
 | 
			
		||||
        iscsi_ioctl_handle_emulated(acb, req, buf);
 | 
			
		||||
 | 
			
		||||
@ -72,7 +72,7 @@ typedef struct MirrorBlockJob {
 | 
			
		||||
    unsigned long *in_flight_bitmap;
 | 
			
		||||
    int in_flight;
 | 
			
		||||
    int64_t bytes_in_flight;
 | 
			
		||||
    QTAILQ_HEAD(MirrorOpList, MirrorOp) ops_in_flight;
 | 
			
		||||
    QTAILQ_HEAD(, MirrorOp) ops_in_flight;
 | 
			
		||||
    int ret;
 | 
			
		||||
    bool unmap;
 | 
			
		||||
    int target_cluster_size;
 | 
			
		||||
 | 
			
		||||
@ -77,8 +77,6 @@ typedef struct Qcow2BitmapTable {
 | 
			
		||||
    uint32_t size; /* number of 64bit entries */
 | 
			
		||||
    QSIMPLEQ_ENTRY(Qcow2BitmapTable) entry;
 | 
			
		||||
} Qcow2BitmapTable;
 | 
			
		||||
typedef QSIMPLEQ_HEAD(Qcow2BitmapTableList, Qcow2BitmapTable)
 | 
			
		||||
    Qcow2BitmapTableList;
 | 
			
		||||
 | 
			
		||||
typedef struct Qcow2Bitmap {
 | 
			
		||||
    Qcow2BitmapTable table;
 | 
			
		||||
@ -1316,7 +1314,7 @@ void qcow2_store_persistent_dirty_bitmaps(BlockDriverState *bs, Error **errp)
 | 
			
		||||
    int ret;
 | 
			
		||||
    Qcow2BitmapList *bm_list;
 | 
			
		||||
    Qcow2Bitmap *bm;
 | 
			
		||||
    Qcow2BitmapTableList drop_tables;
 | 
			
		||||
    QSIMPLEQ_HEAD(, Qcow2BitmapTable) drop_tables;
 | 
			
		||||
    Qcow2BitmapTable *tb, *tb_next;
 | 
			
		||||
 | 
			
		||||
    if (!bdrv_has_changed_persistent_bitmaps(bs)) {
 | 
			
		||||
 | 
			
		||||
@ -278,7 +278,10 @@ typedef struct BDRVQcow2State {
 | 
			
		||||
    QEMUTimer *cache_clean_timer;
 | 
			
		||||
    unsigned cache_clean_interval;
 | 
			
		||||
 | 
			
		||||
    QLIST_HEAD(QCowClusterAlloc, QCowL2Meta) cluster_allocs;
 | 
			
		||||
    uint8_t *cluster_cache;
 | 
			
		||||
    uint8_t *cluster_data;
 | 
			
		||||
    uint64_t cluster_cache_offset;
 | 
			
		||||
    QLIST_HEAD(, QCowL2Meta) cluster_allocs;
 | 
			
		||||
 | 
			
		||||
    uint64_t *refcount_table;
 | 
			
		||||
    uint64_t refcount_table_offset;
 | 
			
		||||
 | 
			
		||||
@ -391,12 +391,12 @@ struct BDRVSheepdogState {
 | 
			
		||||
    uint32_t aioreq_seq_num;
 | 
			
		||||
 | 
			
		||||
    /* Every aio request must be linked to either of these queues. */
 | 
			
		||||
    QLIST_HEAD(inflight_aio_head, AIOReq) inflight_aio_head;
 | 
			
		||||
    QLIST_HEAD(failed_aio_head, AIOReq) failed_aio_head;
 | 
			
		||||
    QLIST_HEAD(, AIOReq) inflight_aio_head;
 | 
			
		||||
    QLIST_HEAD(, AIOReq) failed_aio_head;
 | 
			
		||||
 | 
			
		||||
    CoMutex queue_lock;
 | 
			
		||||
    CoQueue overlapping_queue;
 | 
			
		||||
    QLIST_HEAD(inflight_aiocb_head, SheepdogAIOCB) inflight_aiocb_head;
 | 
			
		||||
    QLIST_HEAD(, SheepdogAIOCB) inflight_aiocb_head;
 | 
			
		||||
};
 | 
			
		||||
 | 
			
		||||
typedef struct BDRVSheepdogReopenState {
 | 
			
		||||
 | 
			
		||||
@ -398,7 +398,7 @@ typedef struct BDRVVHDXState {
 | 
			
		||||
 | 
			
		||||
    bool log_replayed_on_open;
 | 
			
		||||
 | 
			
		||||
    QLIST_HEAD(VHDXRegionHead, VHDXRegionEntry) regions;
 | 
			
		||||
    QLIST_HEAD(, VHDXRegionEntry) regions;
 | 
			
		||||
} BDRVVHDXState;
 | 
			
		||||
 | 
			
		||||
void vhdx_guid_generate(MSGUID *guid);
 | 
			
		||||
 | 
			
		||||
@ -2266,7 +2266,7 @@ void qmp_transaction(TransactionActionList *dev_list,
 | 
			
		||||
    BlkActionState *state, *next;
 | 
			
		||||
    Error *local_err = NULL;
 | 
			
		||||
 | 
			
		||||
    QSIMPLEQ_HEAD(snap_bdrv_states, BlkActionState) snap_bdrv_states;
 | 
			
		||||
    QSIMPLEQ_HEAD(, BlkActionState) snap_bdrv_states;
 | 
			
		||||
    QSIMPLEQ_INIT(&snap_bdrv_states);
 | 
			
		||||
 | 
			
		||||
    /* Does this transaction get canceled as a group on failure?
 | 
			
		||||
@ -4252,7 +4252,7 @@ void qmp_blockdev_del(const char *node_name, Error **errp)
 | 
			
		||||
        goto out;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    if (!bs->monitor_list.tqe_prev) {
 | 
			
		||||
    if (!QTAILQ_IN_USE(bs, monitor_list)) {
 | 
			
		||||
        error_setg(errp, "Node %s is not owned by the monitor",
 | 
			
		||||
                   bs->node_name);
 | 
			
		||||
        goto out;
 | 
			
		||||
 | 
			
		||||
							
								
								
									
										3
									
								
								configure
									
									
									
									
										vendored
									
									
								
							
							
						
						
									
										3
									
								
								configure
									
									
									
									
										vendored
									
									
								
							@ -912,9 +912,6 @@ fi
 | 
			
		||||
if test "$mingw32" = "yes" ; then
 | 
			
		||||
  EXESUF=".exe"
 | 
			
		||||
  DSOSUF=".dll"
 | 
			
		||||
  QEMU_CFLAGS="-DWIN32_LEAN_AND_MEAN -DWINVER=0x501 $QEMU_CFLAGS"
 | 
			
		||||
  # enable C99/POSIX format strings (needs mingw32-runtime 3.15 or later)
 | 
			
		||||
  QEMU_CFLAGS="-D__USE_MINGW_ANSI_STDIO=1 $QEMU_CFLAGS"
 | 
			
		||||
  # MinGW needs -mthreads for TLS and macro _MT.
 | 
			
		||||
  QEMU_CFLAGS="-mthreads $QEMU_CFLAGS"
 | 
			
		||||
  LIBS="-lwinmm -lws2_32 -liphlpapi $LIBS"
 | 
			
		||||
 | 
			
		||||
@ -46,9 +46,7 @@ typedef struct IvshmemClientPeer {
 | 
			
		||||
    int vectors[IVSHMEM_CLIENT_MAX_VECTORS]; /**< one fd per vector */
 | 
			
		||||
    unsigned vectors_count;                  /**< number of vectors */
 | 
			
		||||
} IvshmemClientPeer;
 | 
			
		||||
QTAILQ_HEAD(IvshmemClientPeerList, IvshmemClientPeer);
 | 
			
		||||
 | 
			
		||||
typedef struct IvshmemClientPeerList IvshmemClientPeerList;
 | 
			
		||||
typedef struct IvshmemClient IvshmemClient;
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
@ -73,7 +71,7 @@ struct IvshmemClient {
 | 
			
		||||
    int sock_fd;                        /**< unix sock filedesc */
 | 
			
		||||
    int shm_fd;                         /**< shm file descriptor */
 | 
			
		||||
 | 
			
		||||
    IvshmemClientPeerList peer_list;    /**< list of peers */
 | 
			
		||||
    QTAILQ_HEAD(, IvshmemClientPeer) peer_list;    /**< list of peers */
 | 
			
		||||
    IvshmemClientPeer local;            /**< our own infos */
 | 
			
		||||
 | 
			
		||||
    IvshmemClientNotifCb notif_cb;      /**< notification callback */
 | 
			
		||||
 | 
			
		||||
@ -52,9 +52,6 @@ typedef struct IvshmemServerPeer {
 | 
			
		||||
    EventNotifier vectors[IVSHMEM_SERVER_MAX_VECTORS]; /**< one per vector */
 | 
			
		||||
    unsigned vectors_count;                  /**< number of vectors */
 | 
			
		||||
} IvshmemServerPeer;
 | 
			
		||||
QTAILQ_HEAD(IvshmemServerPeerList, IvshmemServerPeer);
 | 
			
		||||
 | 
			
		||||
typedef struct IvshmemServerPeerList IvshmemServerPeerList;
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
 * Structure describing an ivshmem server
 | 
			
		||||
@ -72,7 +69,7 @@ typedef struct IvshmemServer {
 | 
			
		||||
    unsigned n_vectors;              /**< number of vectors */
 | 
			
		||||
    uint16_t cur_id;                 /**< id to be given to next client */
 | 
			
		||||
    bool verbose;                    /**< true in verbose mode */
 | 
			
		||||
    IvshmemServerPeerList peer_list; /**< list of peers */
 | 
			
		||||
    QTAILQ_HEAD(, IvshmemServerPeer) peer_list; /**< list of peers */
 | 
			
		||||
} IvshmemServer;
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
 | 
			
		||||
@ -99,7 +99,7 @@ void cpu_list_remove(CPUState *cpu)
 | 
			
		||||
        return;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    assert(!(cpu_index_auto_assigned && cpu != QTAILQ_LAST(&cpus, CPUTailQ)));
 | 
			
		||||
    assert(!(cpu_index_auto_assigned && cpu != QTAILQ_LAST(&cpus)));
 | 
			
		||||
 | 
			
		||||
    QTAILQ_REMOVE_RCU(&cpus, cpu, node);
 | 
			
		||||
    cpu->cpu_index = UNASSIGNED_CPU_INDEX;
 | 
			
		||||
 | 
			
		||||
							
								
								
									
										2
									
								
								dump.c
									
									
									
									
									
								
							
							
						
						
									
										2
									
								
								dump.c
									
									
									
									
									
								
							@ -1557,7 +1557,7 @@ static void get_max_mapnr(DumpState *s)
 | 
			
		||||
{
 | 
			
		||||
    GuestPhysBlock *last_block;
 | 
			
		||||
 | 
			
		||||
    last_block = QTAILQ_LAST(&s->guest_phys_blocks.head, GuestPhysBlockHead);
 | 
			
		||||
    last_block = QTAILQ_LAST(&s->guest_phys_blocks.head);
 | 
			
		||||
    s->max_mapnr = dump_paddr_to_pfn(s, last_block->target_end);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
							
								
								
									
										5
									
								
								exec.c
									
									
									
									
									
								
							
							
						
						
									
										5
									
								
								exec.c
									
									
									
									
									
								
							@ -94,7 +94,8 @@ int target_page_bits;
 | 
			
		||||
bool target_page_bits_decided;
 | 
			
		||||
#endif
 | 
			
		||||
 | 
			
		||||
struct CPUTailQ cpus = QTAILQ_HEAD_INITIALIZER(cpus);
 | 
			
		||||
CPUTailQ cpus = QTAILQ_HEAD_INITIALIZER(cpus);
 | 
			
		||||
 | 
			
		||||
/* current CPU in the current thread. It is only valid inside
 | 
			
		||||
   cpu_exec() */
 | 
			
		||||
__thread CPUState *current_cpu;
 | 
			
		||||
@ -3471,7 +3472,7 @@ typedef struct MapClient {
 | 
			
		||||
} MapClient;
 | 
			
		||||
 | 
			
		||||
QemuMutex map_client_list_lock;
 | 
			
		||||
static QLIST_HEAD(map_client_list, MapClient) map_client_list
 | 
			
		||||
static QLIST_HEAD(, MapClient) map_client_list
 | 
			
		||||
    = QLIST_HEAD_INITIALIZER(map_client_list);
 | 
			
		||||
 | 
			
		||||
static void cpu_unregister_map_client_do(MapClient *client)
 | 
			
		||||
 | 
			
		||||
@ -18,7 +18,7 @@
 | 
			
		||||
#include "qemu/error-report.h"
 | 
			
		||||
#include "qemu/option.h"
 | 
			
		||||
 | 
			
		||||
static QTAILQ_HEAD(FsDriverEntry_head, FsDriverListEntry) fsdriver_entries =
 | 
			
		||||
static QTAILQ_HEAD(, FsDriverListEntry) fsdriver_entries =
 | 
			
		||||
    QTAILQ_HEAD_INITIALIZER(fsdriver_entries);
 | 
			
		||||
 | 
			
		||||
static FsDriverTable FsDrivers[] = {
 | 
			
		||||
 | 
			
		||||
@ -29,8 +29,8 @@ typedef struct NvmeSQueue {
 | 
			
		||||
    uint64_t    dma_addr;
 | 
			
		||||
    QEMUTimer   *timer;
 | 
			
		||||
    NvmeRequest *io_req;
 | 
			
		||||
    QTAILQ_HEAD(sq_req_list, NvmeRequest) req_list;
 | 
			
		||||
    QTAILQ_HEAD(out_req_list, NvmeRequest) out_req_list;
 | 
			
		||||
    QTAILQ_HEAD(, NvmeRequest) req_list;
 | 
			
		||||
    QTAILQ_HEAD(, NvmeRequest) out_req_list;
 | 
			
		||||
    QTAILQ_ENTRY(NvmeSQueue) entry;
 | 
			
		||||
} NvmeSQueue;
 | 
			
		||||
 | 
			
		||||
@ -45,8 +45,8 @@ typedef struct NvmeCQueue {
 | 
			
		||||
    uint32_t    size;
 | 
			
		||||
    uint64_t    dma_addr;
 | 
			
		||||
    QEMUTimer   *timer;
 | 
			
		||||
    QTAILQ_HEAD(sq_list, NvmeSQueue) sq_list;
 | 
			
		||||
    QTAILQ_HEAD(cq_req_list, NvmeRequest) req_list;
 | 
			
		||||
    QTAILQ_HEAD(, NvmeSQueue) sq_list;
 | 
			
		||||
    QTAILQ_HEAD(, NvmeRequest) req_list;
 | 
			
		||||
} NvmeCQueue;
 | 
			
		||||
 | 
			
		||||
typedef struct NvmeNamespace {
 | 
			
		||||
 | 
			
		||||
@ -82,9 +82,9 @@ struct XenBlkDev {
 | 
			
		||||
    int                 more_work;
 | 
			
		||||
 | 
			
		||||
    /* request lists */
 | 
			
		||||
    QLIST_HEAD(inflight_head, ioreq) inflight;
 | 
			
		||||
    QLIST_HEAD(finished_head, ioreq) finished;
 | 
			
		||||
    QLIST_HEAD(freelist_head, ioreq) freelist;
 | 
			
		||||
    QLIST_HEAD(, ioreq) inflight;
 | 
			
		||||
    QLIST_HEAD(, ioreq) finished;
 | 
			
		||||
    QLIST_HEAD(, ioreq) freelist;
 | 
			
		||||
    int                 requests_total;
 | 
			
		||||
    int                 requests_inflight;
 | 
			
		||||
    int                 requests_finished;
 | 
			
		||||
 | 
			
		||||
@ -158,7 +158,7 @@ DeviceState *qdev_try_create(BusState *bus, const char *type)
 | 
			
		||||
    return dev;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
static QTAILQ_HEAD(device_listeners, DeviceListener) device_listeners
 | 
			
		||||
static QTAILQ_HEAD(, DeviceListener) device_listeners
 | 
			
		||||
    = QTAILQ_HEAD_INITIALIZER(device_listeners);
 | 
			
		||||
 | 
			
		||||
enum ListenerDirection { Forward, Reverse };
 | 
			
		||||
@ -177,7 +177,7 @@ enum ListenerDirection { Forward, Reverse };
 | 
			
		||||
            break;                                                \
 | 
			
		||||
        case Reverse:                                             \
 | 
			
		||||
            QTAILQ_FOREACH_REVERSE(_listener, &device_listeners,  \
 | 
			
		||||
                                   device_listeners, link) {      \
 | 
			
		||||
                                   link) {                        \
 | 
			
		||||
                if (_listener->_callback) {                       \
 | 
			
		||||
                    _listener->_callback(_listener, ##_args);     \
 | 
			
		||||
                }                                                 \
 | 
			
		||||
 | 
			
		||||
@ -35,7 +35,7 @@ typedef struct QEMUResetEntry {
 | 
			
		||||
    void *opaque;
 | 
			
		||||
} QEMUResetEntry;
 | 
			
		||||
 | 
			
		||||
static QTAILQ_HEAD(reset_handlers, QEMUResetEntry) reset_handlers =
 | 
			
		||||
static QTAILQ_HEAD(, QEMUResetEntry) reset_handlers =
 | 
			
		||||
    QTAILQ_HEAD_INITIALIZER(reset_handlers);
 | 
			
		||||
 | 
			
		||||
void qemu_register_reset(QEMUResetHandler *func, void *opaque)
 | 
			
		||||
 | 
			
		||||
@ -71,7 +71,7 @@ typedef struct MapCacheRev {
 | 
			
		||||
typedef struct MapCache {
 | 
			
		||||
    MapCacheEntry *entry;
 | 
			
		||||
    unsigned long nr_buckets;
 | 
			
		||||
    QTAILQ_HEAD(map_cache_head, MapCacheRev) locked_entries;
 | 
			
		||||
    QTAILQ_HEAD(, MapCacheRev) locked_entries;
 | 
			
		||||
 | 
			
		||||
    /* For most cases (>99.9%), the page address is the same. */
 | 
			
		||||
    MapCacheEntry *last_entry;
 | 
			
		||||
 | 
			
		||||
@ -52,11 +52,13 @@ void init_pam(DeviceState *dev, MemoryRegion *ram_memory,
 | 
			
		||||
    memory_region_init_alias(&mem->alias[2], OBJECT(dev), "pam-pci", ram_memory,
 | 
			
		||||
                             start, size);
 | 
			
		||||
 | 
			
		||||
    memory_region_transaction_begin();
 | 
			
		||||
    for (i = 0; i < 4; ++i) {
 | 
			
		||||
        memory_region_set_enabled(&mem->alias[i], false);
 | 
			
		||||
        memory_region_add_subregion_overlap(system_memory, start,
 | 
			
		||||
                                            &mem->alias[i], 1);
 | 
			
		||||
    }
 | 
			
		||||
    memory_region_transaction_commit();
 | 
			
		||||
    mem->current = 0;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
@ -42,7 +42,7 @@ enum sPAPRTCEAccess {
 | 
			
		||||
#define IOMMU_PAGE_SIZE(shift)      (1ULL << (shift))
 | 
			
		||||
#define IOMMU_PAGE_MASK(shift)      (~(IOMMU_PAGE_SIZE(shift) - 1))
 | 
			
		||||
 | 
			
		||||
static QLIST_HEAD(spapr_tce_tables, sPAPRTCETable) spapr_tce_tables;
 | 
			
		||||
static QLIST_HEAD(, sPAPRTCETable) spapr_tce_tables;
 | 
			
		||||
 | 
			
		||||
sPAPRTCETable *spapr_tce_find_by_liobn(target_ulong liobn)
 | 
			
		||||
{
 | 
			
		||||
 | 
			
		||||
@ -59,7 +59,7 @@
 | 
			
		||||
#define DMA_STAT_SCSIINT 0x10
 | 
			
		||||
#define DMA_STAT_BCMBLT  0x20
 | 
			
		||||
 | 
			
		||||
#define SBAC_STATUS 0x1000
 | 
			
		||||
#define SBAC_STATUS (1 << 24)
 | 
			
		||||
 | 
			
		||||
typedef struct PCIESPState {
 | 
			
		||||
    /*< private >*/
 | 
			
		||||
@ -136,7 +136,7 @@ static void esp_pci_dma_write(PCIESPState *pci, uint32_t saddr, uint32_t val)
 | 
			
		||||
        pci->dma_regs[saddr] = val;
 | 
			
		||||
        break;
 | 
			
		||||
    case DMA_STAT:
 | 
			
		||||
        if (!(pci->sbac & SBAC_STATUS)) {
 | 
			
		||||
        if (pci->sbac & SBAC_STATUS) {
 | 
			
		||||
            /* clear some bits on write */
 | 
			
		||||
            uint32_t mask = DMA_STAT_ERROR | DMA_STAT_ABORT | DMA_STAT_DONE;
 | 
			
		||||
            pci->dma_regs[DMA_STAT] &= ~(val & mask);
 | 
			
		||||
@ -157,7 +157,7 @@ static uint32_t esp_pci_dma_read(PCIESPState *pci, uint32_t saddr)
 | 
			
		||||
        if (pci->esp.rregs[ESP_RSTAT] & STAT_INT) {
 | 
			
		||||
            val |= DMA_STAT_SCSIINT;
 | 
			
		||||
        }
 | 
			
		||||
        if (pci->sbac & SBAC_STATUS) {
 | 
			
		||||
        if (!(pci->sbac & SBAC_STATUS)) {
 | 
			
		||||
            pci->dma_regs[DMA_STAT] &= ~(DMA_STAT_ERROR | DMA_STAT_ABORT |
 | 
			
		||||
                                         DMA_STAT_DONE);
 | 
			
		||||
        }
 | 
			
		||||
@ -313,8 +313,8 @@ static void esp_pci_hard_reset(DeviceState *dev)
 | 
			
		||||
 | 
			
		||||
static const VMStateDescription vmstate_esp_pci_scsi = {
 | 
			
		||||
    .name = "pciespscsi",
 | 
			
		||||
    .version_id = 0,
 | 
			
		||||
    .minimum_version_id = 0,
 | 
			
		||||
    .version_id = 1,
 | 
			
		||||
    .minimum_version_id = 1,
 | 
			
		||||
    .fields = (VMStateField[]) {
 | 
			
		||||
        VMSTATE_PCI_DEVICE(parent_obj, PCIESPState),
 | 
			
		||||
        VMSTATE_BUFFER_UNSAFE(dma_regs, PCIESPState, 0, 8 * sizeof(uint32_t)),
 | 
			
		||||
 | 
			
		||||
@ -286,11 +286,8 @@ static void esp_do_dma(ESPState *s)
 | 
			
		||||
    esp_dma_done(s);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
void esp_command_complete(SCSIRequest *req, uint32_t status,
 | 
			
		||||
                                 size_t resid)
 | 
			
		||||
static void esp_report_command_complete(ESPState *s, uint32_t status)
 | 
			
		||||
{
 | 
			
		||||
    ESPState *s = req->hba_private;
 | 
			
		||||
 | 
			
		||||
    trace_esp_command_complete();
 | 
			
		||||
    if (s->ti_size != 0) {
 | 
			
		||||
        trace_esp_command_complete_unexpected();
 | 
			
		||||
@ -311,6 +308,23 @@ void esp_command_complete(SCSIRequest *req, uint32_t status,
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
void esp_command_complete(SCSIRequest *req, uint32_t status,
 | 
			
		||||
                          size_t resid)
 | 
			
		||||
{
 | 
			
		||||
    ESPState *s = req->hba_private;
 | 
			
		||||
 | 
			
		||||
    if (s->rregs[ESP_RSTAT] & STAT_INT) {
 | 
			
		||||
        /* Defer handling command complete until the previous
 | 
			
		||||
         * interrupt has been handled.
 | 
			
		||||
         */
 | 
			
		||||
        trace_esp_command_complete_deferred();
 | 
			
		||||
        s->deferred_status = status;
 | 
			
		||||
        s->deferred_complete = true;
 | 
			
		||||
        return;
 | 
			
		||||
    }
 | 
			
		||||
    esp_report_command_complete(s, status);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
void esp_transfer_data(SCSIRequest *req, uint32_t len)
 | 
			
		||||
{
 | 
			
		||||
    ESPState *s = req->hba_private;
 | 
			
		||||
@ -422,7 +436,10 @@ uint64_t esp_reg_read(ESPState *s, uint32_t saddr)
 | 
			
		||||
        s->rregs[ESP_RSTAT] &= ~STAT_TC;
 | 
			
		||||
        s->rregs[ESP_RSEQ] = SEQ_CD;
 | 
			
		||||
        esp_lower_irq(s);
 | 
			
		||||
 | 
			
		||||
        if (s->deferred_complete) {
 | 
			
		||||
            esp_report_command_complete(s, s->deferred_status);
 | 
			
		||||
            s->deferred_complete = false;
 | 
			
		||||
        }
 | 
			
		||||
        return old_val;
 | 
			
		||||
    case ESP_TCHI:
 | 
			
		||||
        /* Return the unique id if the value has never been written */
 | 
			
		||||
@ -582,6 +599,8 @@ const VMStateDescription vmstate_esp = {
 | 
			
		||||
        VMSTATE_UINT32(ti_wptr, ESPState),
 | 
			
		||||
        VMSTATE_BUFFER(ti_buf, ESPState),
 | 
			
		||||
        VMSTATE_UINT32(status, ESPState),
 | 
			
		||||
        VMSTATE_UINT32(deferred_status, ESPState),
 | 
			
		||||
        VMSTATE_BOOL(deferred_complete, ESPState),
 | 
			
		||||
        VMSTATE_UINT32(dma, ESPState),
 | 
			
		||||
        VMSTATE_PARTIAL_BUFFER(cmdbuf, ESPState, 16),
 | 
			
		||||
        VMSTATE_BUFFER_START_MIDDLE_V(cmdbuf, ESPState, 16, 4),
 | 
			
		||||
@ -671,8 +690,8 @@ static void sysbus_esp_hard_reset(DeviceState *dev)
 | 
			
		||||
 | 
			
		||||
static const VMStateDescription vmstate_sysbus_esp_scsi = {
 | 
			
		||||
    .name = "sysbusespscsi",
 | 
			
		||||
    .version_id = 0,
 | 
			
		||||
    .minimum_version_id = 0,
 | 
			
		||||
    .version_id = 1,
 | 
			
		||||
    .minimum_version_id = 1,
 | 
			
		||||
    .fields = (VMStateField[]) {
 | 
			
		||||
        VMSTATE_STRUCT(esp, SysBusESPState, 0, vmstate_esp, ESPState),
 | 
			
		||||
        VMSTATE_END_OF_LIST()
 | 
			
		||||
 | 
			
		||||
@ -1554,7 +1554,7 @@ SCSIDevice *scsi_device_find(SCSIBus *bus, int channel, int id, int lun)
 | 
			
		||||
    BusChild *kid;
 | 
			
		||||
    SCSIDevice *target_dev = NULL;
 | 
			
		||||
 | 
			
		||||
    QTAILQ_FOREACH_REVERSE(kid, &bus->qbus.children, ChildrenHead, sibling) {
 | 
			
		||||
    QTAILQ_FOREACH_REVERSE(kid, &bus->qbus.children, sibling) {
 | 
			
		||||
        DeviceState *qdev = kid->child;
 | 
			
		||||
        SCSIDevice *dev = SCSI_DEVICE(qdev);
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
@ -167,6 +167,7 @@ esp_handle_satn_stop(uint32_t cmdlen) "cmdlen %d"
 | 
			
		||||
esp_write_response(uint32_t status) "Transfer status (status=%d)"
 | 
			
		||||
esp_do_dma(uint32_t cmdlen, uint32_t len) "command len %d + %d"
 | 
			
		||||
esp_command_complete(void) "SCSI Command complete"
 | 
			
		||||
esp_command_complete_deferred(void) "SCSI Command complete deferred"
 | 
			
		||||
esp_command_complete_unexpected(void) "SCSI command completed unexpectedly"
 | 
			
		||||
esp_command_complete_fail(void) "Command failed"
 | 
			
		||||
esp_transfer_data(uint32_t dma_left, int32_t ti_size) "transfer %d/%d"
 | 
			
		||||
 | 
			
		||||
@ -119,11 +119,11 @@ struct EmulatedState {
 | 
			
		||||
    char    *db;
 | 
			
		||||
    uint8_t  atr[MAX_ATR_SIZE];
 | 
			
		||||
    uint8_t  atr_length;
 | 
			
		||||
    QSIMPLEQ_HEAD(event_list, EmulEvent) event_list;
 | 
			
		||||
    QSIMPLEQ_HEAD(, EmulEvent) event_list;
 | 
			
		||||
    QemuMutex event_list_mutex;
 | 
			
		||||
    QemuThread event_thread_id;
 | 
			
		||||
    VReader *reader;
 | 
			
		||||
    QSIMPLEQ_HEAD(guest_apdu_list, EmulEvent) guest_apdu_list;
 | 
			
		||||
    QSIMPLEQ_HEAD(, EmulEvent) guest_apdu_list;
 | 
			
		||||
    QemuMutex vreader_mutex; /* and guest_apdu_list mutex */
 | 
			
		||||
    QemuMutex handle_apdu_mutex;
 | 
			
		||||
    QemuCond handle_apdu_cond;
 | 
			
		||||
 | 
			
		||||
@ -64,7 +64,7 @@ void usb_combined_input_packet_complete(USBDevice *dev, USBPacket *p)
 | 
			
		||||
 | 
			
		||||
    status = combined->first->status;
 | 
			
		||||
    actual_length = combined->first->actual_length;
 | 
			
		||||
    short_not_ok = QTAILQ_LAST(&combined->packets, packets_head)->short_not_ok;
 | 
			
		||||
    short_not_ok = QTAILQ_LAST(&combined->packets)->short_not_ok;
 | 
			
		||||
 | 
			
		||||
    QTAILQ_FOREACH_SAFE(p, &combined->packets, combined_entry, next) {
 | 
			
		||||
        if (!done) {
 | 
			
		||||
 | 
			
		||||
@ -191,7 +191,7 @@ struct MTPState {
 | 
			
		||||
#ifdef CONFIG_INOTIFY1
 | 
			
		||||
    /* inotify descriptor */
 | 
			
		||||
    int          inotifyfd;
 | 
			
		||||
    QTAILQ_HEAD(events, MTPMonEntry) events;
 | 
			
		||||
    QTAILQ_HEAD(, MTPMonEntry) events;
 | 
			
		||||
#endif
 | 
			
		||||
    /* Responder is expecting a write operation */
 | 
			
		||||
    bool write_pending;
 | 
			
		||||
@ -1989,7 +1989,7 @@ static void usb_mtp_handle_data(USBDevice *dev, USBPacket *p)
 | 
			
		||||
    case EP_EVENT:
 | 
			
		||||
#ifdef CONFIG_INOTIFY1
 | 
			
		||||
        if (!QTAILQ_EMPTY(&s->events)) {
 | 
			
		||||
            struct MTPMonEntry *e = QTAILQ_LAST(&s->events, events);
 | 
			
		||||
            struct MTPMonEntry *e = QTAILQ_LAST(&s->events);
 | 
			
		||||
            uint32_t handle;
 | 
			
		||||
            int len = sizeof(container) + sizeof(uint32_t);
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
@ -648,7 +648,7 @@ typedef struct USBNetState {
 | 
			
		||||
    char usbstring_mac[13];
 | 
			
		||||
    NICState *nic;
 | 
			
		||||
    NICConf conf;
 | 
			
		||||
    QTAILQ_HEAD(rndis_resp_head, rndis_response) rndis_resp;
 | 
			
		||||
    QTAILQ_HEAD(, rndis_response) rndis_resp;
 | 
			
		||||
} USBNetState;
 | 
			
		||||
 | 
			
		||||
#define TYPE_USB_NET "usb-net"
 | 
			
		||||
 | 
			
		||||
@ -1823,7 +1823,7 @@ static int ehci_state_fetchqtd(EHCIQueue *q)
 | 
			
		||||
            break;
 | 
			
		||||
        case EHCI_ASYNC_INFLIGHT:
 | 
			
		||||
            /* Check if the guest has added new tds to the queue */
 | 
			
		||||
            again = ehci_fill_queue(QTAILQ_LAST(&q->packets, pkts_head));
 | 
			
		||||
            again = ehci_fill_queue(QTAILQ_LAST(&q->packets));
 | 
			
		||||
            /* Unfinished async handled packet, go horizontal */
 | 
			
		||||
            ehci_set_state(q->ehci, q->async, EST_HORIZONTALQH);
 | 
			
		||||
            break;
 | 
			
		||||
 | 
			
		||||
@ -247,7 +247,7 @@ struct EHCIQueue {
 | 
			
		||||
    uint32_t qtdaddr;      /* address QTD read from                */
 | 
			
		||||
    int last_pid;          /* pid of last packet executed          */
 | 
			
		||||
    USBDevice *dev;
 | 
			
		||||
    QTAILQ_HEAD(pkts_head, EHCIPacket) packets;
 | 
			
		||||
    QTAILQ_HEAD(, EHCIPacket) packets;
 | 
			
		||||
};
 | 
			
		||||
 | 
			
		||||
typedef QTAILQ_HEAD(EHCIQueueHead, EHCIQueue) EHCIQueueHead;
 | 
			
		||||
 | 
			
		||||
@ -99,7 +99,7 @@ struct UHCIQueue {
 | 
			
		||||
    UHCIState *uhci;
 | 
			
		||||
    USBEndpoint *ep;
 | 
			
		||||
    QTAILQ_ENTRY(UHCIQueue) next;
 | 
			
		||||
    QTAILQ_HEAD(asyncs_head, UHCIAsync) asyncs;
 | 
			
		||||
    QTAILQ_HEAD(, UHCIAsync) asyncs;
 | 
			
		||||
    int8_t    valid;
 | 
			
		||||
};
 | 
			
		||||
 | 
			
		||||
@ -837,7 +837,7 @@ static int uhci_handle_td(UHCIState *s, UHCIQueue *q, uint32_t qh_addr,
 | 
			
		||||
        }
 | 
			
		||||
        if (!async->done) {
 | 
			
		||||
            UHCI_TD last_td;
 | 
			
		||||
            UHCIAsync *last = QTAILQ_LAST(&async->queue->asyncs, asyncs_head);
 | 
			
		||||
            UHCIAsync *last = QTAILQ_LAST(&async->queue->asyncs);
 | 
			
		||||
            /*
 | 
			
		||||
             * While we are waiting for the current td to complete, the guest
 | 
			
		||||
             * may have added more tds to the queue. Note we re-read the td
 | 
			
		||||
 | 
			
		||||
@ -72,7 +72,7 @@ struct usbback_stub {
 | 
			
		||||
    USBPort       port;
 | 
			
		||||
    unsigned int  speed;
 | 
			
		||||
    bool          attached;
 | 
			
		||||
    QTAILQ_HEAD(submit_q_head, usbback_req) submit_q;
 | 
			
		||||
    QTAILQ_HEAD(, usbback_req) submit_q;
 | 
			
		||||
};
 | 
			
		||||
 | 
			
		||||
struct usbback_req {
 | 
			
		||||
@ -108,8 +108,8 @@ struct usbback_info {
 | 
			
		||||
    int                      num_ports;
 | 
			
		||||
    int                      usb_ver;
 | 
			
		||||
    bool                     ring_error;
 | 
			
		||||
    QTAILQ_HEAD(req_free_q_head, usbback_req) req_free_q;
 | 
			
		||||
    QSIMPLEQ_HEAD(hotplug_q_head, usbback_hotplug) hotplug_q;
 | 
			
		||||
    QTAILQ_HEAD(, usbback_req) req_free_q;
 | 
			
		||||
    QSIMPLEQ_HEAD(, usbback_hotplug) hotplug_q;
 | 
			
		||||
    struct usbback_stub      ports[USBBACK_MAXPORTS];
 | 
			
		||||
    struct usbback_stub      *addr_table[USB_DEV_ADDR_SIZE];
 | 
			
		||||
    QEMUBH                   *bh;
 | 
			
		||||
 | 
			
		||||
@ -37,9 +37,9 @@
 | 
			
		||||
#include "trace.h"
 | 
			
		||||
#include "qapi/error.h"
 | 
			
		||||
 | 
			
		||||
struct vfio_group_head vfio_group_list =
 | 
			
		||||
VFIOGroupList vfio_group_list =
 | 
			
		||||
    QLIST_HEAD_INITIALIZER(vfio_group_list);
 | 
			
		||||
struct vfio_as_head vfio_address_spaces =
 | 
			
		||||
static QLIST_HEAD(, VFIOAddressSpace) vfio_address_spaces =
 | 
			
		||||
    QLIST_HEAD_INITIALIZER(vfio_address_spaces);
 | 
			
		||||
 | 
			
		||||
#ifdef CONFIG_KVM
 | 
			
		||||
 | 
			
		||||
@ -32,7 +32,7 @@
 | 
			
		||||
#include "qemu/help_option.h"
 | 
			
		||||
 | 
			
		||||
static WatchdogAction watchdog_action = WATCHDOG_ACTION_RESET;
 | 
			
		||||
static QLIST_HEAD(watchdog_list, WatchdogTimerModel) watchdog_list;
 | 
			
		||||
static QLIST_HEAD(, WatchdogTimerModel) watchdog_list;
 | 
			
		||||
 | 
			
		||||
void watchdog_add_model(WatchdogTimerModel *model)
 | 
			
		||||
{
 | 
			
		||||
 | 
			
		||||
@ -449,7 +449,6 @@ static void i6300esb_realize(PCIDevice *dev, Error **errp)
 | 
			
		||||
    memory_region_init_io(&d->io_mem, OBJECT(d), &i6300esb_ops, d,
 | 
			
		||||
                          "i6300esb", 0x10);
 | 
			
		||||
    pci_register_bar(&d->dev, 0, 0, &d->io_mem);
 | 
			
		||||
    /* qemu_register_coalesced_mmio (addr, 0x10); ? */
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
static void i6300esb_exit(PCIDevice *dev)
 | 
			
		||||
 | 
			
		||||
@ -31,10 +31,10 @@ struct xs_dirs {
 | 
			
		||||
    QTAILQ_ENTRY(xs_dirs) list;
 | 
			
		||||
};
 | 
			
		||||
 | 
			
		||||
static QTAILQ_HEAD(xs_dirs_head, xs_dirs) xs_cleanup =
 | 
			
		||||
static QTAILQ_HEAD(, xs_dirs) xs_cleanup =
 | 
			
		||||
    QTAILQ_HEAD_INITIALIZER(xs_cleanup);
 | 
			
		||||
 | 
			
		||||
static QTAILQ_HEAD(XenDeviceHead, XenDevice) xendevs =
 | 
			
		||||
static QTAILQ_HEAD(, XenDevice) xendevs =
 | 
			
		||||
    QTAILQ_HEAD_INITIALIZER(xendevs);
 | 
			
		||||
 | 
			
		||||
/* ------------------------------------------------------------- */
 | 
			
		||||
 | 
			
		||||
@ -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;
 | 
			
		||||
};
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
@ -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;
 | 
			
		||||
};
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
@ -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;
 | 
			
		||||
 | 
			
		||||
@ -408,7 +408,7 @@ struct USBPacket {
 | 
			
		||||
 | 
			
		||||
struct USBCombinedPacket {
 | 
			
		||||
    USBPacket *first;
 | 
			
		||||
    QTAILQ_HEAD(packets_head, USBPacket) packets;
 | 
			
		||||
    QTAILQ_HEAD(, USBPacket) packets;
 | 
			
		||||
    QEMUIOVector iov;
 | 
			
		||||
};
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
@ -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,
 | 
			
		||||
 | 
			
		||||
@ -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 */
 | 
			
		||||
 | 
			
		||||
@ -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 {
 | 
			
		||||
 | 
			
		||||
@ -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;
 | 
			
		||||
};
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
@ -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>
 | 
			
		||||
 | 
			
		||||
@ -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_circ.tql_prev = (listelm)->field.tqe_circ.tql_prev; \
 | 
			
		||||
        (elm)->field.tqe_next = (listelm);                                   \
 | 
			
		||||
        *(listelm)->field.tqe_prev = (elm);                             \
 | 
			
		||||
        (listelm)->field.tqe_prev = &(elm)->field.tqe_next;             \
 | 
			
		||||
        (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);              \
 | 
			
		||||
        *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 */
 | 
			
		||||
 | 
			
		||||
@ -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;                      \
 | 
			
		||||
    (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_circ.tql_prev = (listelm)->field.tqe_circ.tql_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)
 | 
			
		||||
    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)                            \
 | 
			
		||||
 | 
			
		||||
@ -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)
 | 
			
		||||
 | 
			
		||||
@ -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);
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
@ -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);
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
@ -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. */
 | 
			
		||||
 | 
			
		||||
@ -57,7 +57,7 @@ struct RngBackend
 | 
			
		||||
 | 
			
		||||
    /*< protected >*/
 | 
			
		||||
    bool opened;
 | 
			
		||||
    QSIMPLEQ_HEAD(requests, RngRequest) requests;
 | 
			
		||||
    QSIMPLEQ_HEAD(, RngRequest) requests;
 | 
			
		||||
};
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
@ -2844,7 +2844,7 @@ struct elf_note_info {
 | 
			
		||||
    struct target_elf_prstatus *prstatus;  /* NT_PRSTATUS */
 | 
			
		||||
    struct target_elf_prpsinfo *psinfo;    /* NT_PRPSINFO */
 | 
			
		||||
 | 
			
		||||
    QTAILQ_HEAD(thread_list_head, elf_thread_status) thread_list;
 | 
			
		||||
    QTAILQ_HEAD(, elf_thread_status) thread_list;
 | 
			
		||||
#if 0
 | 
			
		||||
    /*
 | 
			
		||||
     * Current version of ELF coredump doesn't support
 | 
			
		||||
 | 
			
		||||
							
								
								
									
										97
									
								
								memory.c
									
									
									
									
									
								
							
							
						
						
									
										97
									
								
								memory.c
									
									
									
									
									
								
							@ -39,7 +39,7 @@ static bool memory_region_update_pending;
 | 
			
		||||
static bool ioeventfd_update_pending;
 | 
			
		||||
static bool global_dirty_log = false;
 | 
			
		||||
 | 
			
		||||
static QTAILQ_HEAD(memory_listeners, MemoryListener) memory_listeners
 | 
			
		||||
static QTAILQ_HEAD(, MemoryListener) memory_listeners
 | 
			
		||||
    = QTAILQ_HEAD_INITIALIZER(memory_listeners);
 | 
			
		||||
 | 
			
		||||
static QTAILQ_HEAD(, AddressSpace) address_spaces
 | 
			
		||||
@ -113,8 +113,7 @@ enum ListenerDirection { Forward, Reverse };
 | 
			
		||||
            }                                                           \
 | 
			
		||||
            break;                                                      \
 | 
			
		||||
        case Reverse:                                                   \
 | 
			
		||||
            QTAILQ_FOREACH_REVERSE(_listener, &memory_listeners,        \
 | 
			
		||||
                                   memory_listeners, link) {            \
 | 
			
		||||
            QTAILQ_FOREACH_REVERSE(_listener, &memory_listeners, link) { \
 | 
			
		||||
                if (_listener->_callback) {                             \
 | 
			
		||||
                    _listener->_callback(_listener, ##_args);           \
 | 
			
		||||
                }                                                       \
 | 
			
		||||
@ -128,19 +127,17 @@ enum ListenerDirection { Forward, Reverse };
 | 
			
		||||
#define MEMORY_LISTENER_CALL(_as, _callback, _direction, _section, _args...) \
 | 
			
		||||
    do {                                                                \
 | 
			
		||||
        MemoryListener *_listener;                                      \
 | 
			
		||||
        struct memory_listeners_as *list = &(_as)->listeners;           \
 | 
			
		||||
                                                                        \
 | 
			
		||||
        switch (_direction) {                                           \
 | 
			
		||||
        case Forward:                                                   \
 | 
			
		||||
            QTAILQ_FOREACH(_listener, list, link_as) {                  \
 | 
			
		||||
            QTAILQ_FOREACH(_listener, &(_as)->listeners, link_as) {     \
 | 
			
		||||
                if (_listener->_callback) {                             \
 | 
			
		||||
                    _listener->_callback(_listener, _section, ##_args); \
 | 
			
		||||
                }                                                       \
 | 
			
		||||
            }                                                           \
 | 
			
		||||
            break;                                                      \
 | 
			
		||||
        case Reverse:                                                   \
 | 
			
		||||
            QTAILQ_FOREACH_REVERSE(_listener, list, memory_listeners_as, \
 | 
			
		||||
                                   link_as) {                           \
 | 
			
		||||
            QTAILQ_FOREACH_REVERSE(_listener, &(_as)->listeners, link_as) { \
 | 
			
		||||
                if (_listener->_callback) {                             \
 | 
			
		||||
                    _listener->_callback(_listener, _section, ##_args); \
 | 
			
		||||
                }                                                       \
 | 
			
		||||
@ -217,6 +214,7 @@ struct FlatRange {
 | 
			
		||||
    bool romd_mode;
 | 
			
		||||
    bool readonly;
 | 
			
		||||
    bool nonvolatile;
 | 
			
		||||
    int has_coalesced_range;
 | 
			
		||||
};
 | 
			
		||||
 | 
			
		||||
#define FOR_EACH_FLAT_RANGE(var, view)          \
 | 
			
		||||
@ -650,6 +648,7 @@ static void render_memory_region(FlatView *view,
 | 
			
		||||
    fr.romd_mode = mr->romd_mode;
 | 
			
		||||
    fr.readonly = readonly;
 | 
			
		||||
    fr.nonvolatile = nonvolatile;
 | 
			
		||||
    fr.has_coalesced_range = 0;
 | 
			
		||||
 | 
			
		||||
    /* Render the region itself into any gaps left by the current view. */
 | 
			
		||||
    for (i = 0; i < view->nr && int128_nz(remain); ++i) {
 | 
			
		||||
@ -850,6 +849,49 @@ static void address_space_update_ioeventfds(AddressSpace *as)
 | 
			
		||||
    flatview_unref(view);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
static void flat_range_coalesced_io_del(FlatRange *fr, AddressSpace *as)
 | 
			
		||||
{
 | 
			
		||||
    if (!fr->has_coalesced_range) {
 | 
			
		||||
        return;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    if (--fr->has_coalesced_range > 0) {
 | 
			
		||||
        return;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    MEMORY_LISTENER_UPDATE_REGION(fr, as, Reverse, coalesced_io_del,
 | 
			
		||||
                                  int128_get64(fr->addr.start),
 | 
			
		||||
                                  int128_get64(fr->addr.size));
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
static void flat_range_coalesced_io_add(FlatRange *fr, AddressSpace *as)
 | 
			
		||||
{
 | 
			
		||||
    MemoryRegion *mr = fr->mr;
 | 
			
		||||
    CoalescedMemoryRange *cmr;
 | 
			
		||||
    AddrRange tmp;
 | 
			
		||||
 | 
			
		||||
    if (QTAILQ_EMPTY(&mr->coalesced)) {
 | 
			
		||||
        return;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    if (fr->has_coalesced_range++) {
 | 
			
		||||
        return;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    QTAILQ_FOREACH(cmr, &mr->coalesced, link) {
 | 
			
		||||
        tmp = addrrange_shift(cmr->addr,
 | 
			
		||||
                              int128_sub(fr->addr.start,
 | 
			
		||||
                                         int128_make64(fr->offset_in_region)));
 | 
			
		||||
        if (!addrrange_intersects(tmp, fr->addr)) {
 | 
			
		||||
            continue;
 | 
			
		||||
        }
 | 
			
		||||
        tmp = addrrange_intersection(tmp, fr->addr);
 | 
			
		||||
        MEMORY_LISTENER_UPDATE_REGION(fr, as, Forward, coalesced_io_add,
 | 
			
		||||
                                      int128_get64(tmp.start),
 | 
			
		||||
                                      int128_get64(tmp.size));
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
static void address_space_update_topology_pass(AddressSpace *as,
 | 
			
		||||
                                               const FlatView *old_view,
 | 
			
		||||
                                               const FlatView *new_view,
 | 
			
		||||
@ -882,6 +924,7 @@ static void address_space_update_topology_pass(AddressSpace *as,
 | 
			
		||||
            /* In old but not in new, or in both but attributes changed. */
 | 
			
		||||
 | 
			
		||||
            if (!adding) {
 | 
			
		||||
                flat_range_coalesced_io_del(frold, as);
 | 
			
		||||
                MEMORY_LISTENER_UPDATE_REGION(frold, as, Reverse, region_del);
 | 
			
		||||
            }
 | 
			
		||||
 | 
			
		||||
@ -889,7 +932,9 @@ static void address_space_update_topology_pass(AddressSpace *as,
 | 
			
		||||
        } else if (frold && frnew && flatrange_equal(frold, frnew)) {
 | 
			
		||||
            /* In both and unchanged (except logging may have changed) */
 | 
			
		||||
 | 
			
		||||
            if (adding) {
 | 
			
		||||
            if (!adding) {
 | 
			
		||||
                flat_range_coalesced_io_del(frold, as);
 | 
			
		||||
            } else {
 | 
			
		||||
                MEMORY_LISTENER_UPDATE_REGION(frnew, as, Forward, region_nop);
 | 
			
		||||
                if (frnew->dirty_log_mask & ~frold->dirty_log_mask) {
 | 
			
		||||
                    MEMORY_LISTENER_UPDATE_REGION(frnew, as, Forward, log_start,
 | 
			
		||||
@ -901,6 +946,7 @@ static void address_space_update_topology_pass(AddressSpace *as,
 | 
			
		||||
                                                  frold->dirty_log_mask,
 | 
			
		||||
                                                  frnew->dirty_log_mask);
 | 
			
		||||
                }
 | 
			
		||||
                flat_range_coalesced_io_add(frnew, as);
 | 
			
		||||
            }
 | 
			
		||||
 | 
			
		||||
            ++iold;
 | 
			
		||||
@ -910,6 +956,7 @@ static void address_space_update_topology_pass(AddressSpace *as,
 | 
			
		||||
 | 
			
		||||
            if (adding) {
 | 
			
		||||
                MEMORY_LISTENER_UPDATE_REGION(frnew, as, Forward, region_add);
 | 
			
		||||
                flat_range_coalesced_io_add(frnew, as);
 | 
			
		||||
            }
 | 
			
		||||
 | 
			
		||||
            ++inew;
 | 
			
		||||
@ -2136,34 +2183,12 @@ static void memory_region_update_coalesced_range_as(MemoryRegion *mr, AddressSpa
 | 
			
		||||
{
 | 
			
		||||
    FlatView *view;
 | 
			
		||||
    FlatRange *fr;
 | 
			
		||||
    CoalescedMemoryRange *cmr;
 | 
			
		||||
    AddrRange tmp;
 | 
			
		||||
    MemoryRegionSection section;
 | 
			
		||||
 | 
			
		||||
    view = address_space_get_flatview(as);
 | 
			
		||||
    FOR_EACH_FLAT_RANGE(fr, view) {
 | 
			
		||||
        if (fr->mr == mr) {
 | 
			
		||||
            section = (MemoryRegionSection) {
 | 
			
		||||
                .fv = view,
 | 
			
		||||
                .offset_within_address_space = int128_get64(fr->addr.start),
 | 
			
		||||
                .size = fr->addr.size,
 | 
			
		||||
            };
 | 
			
		||||
 | 
			
		||||
            MEMORY_LISTENER_CALL(as, coalesced_io_del, Reverse, §ion,
 | 
			
		||||
                                 int128_get64(fr->addr.start),
 | 
			
		||||
                                 int128_get64(fr->addr.size));
 | 
			
		||||
            QTAILQ_FOREACH(cmr, &mr->coalesced, link) {
 | 
			
		||||
                tmp = addrrange_shift(cmr->addr,
 | 
			
		||||
                                      int128_sub(fr->addr.start,
 | 
			
		||||
                                                 int128_make64(fr->offset_in_region)));
 | 
			
		||||
                if (!addrrange_intersects(tmp, fr->addr)) {
 | 
			
		||||
                    continue;
 | 
			
		||||
                }
 | 
			
		||||
                tmp = addrrange_intersection(tmp, fr->addr);
 | 
			
		||||
                MEMORY_LISTENER_CALL(as, coalesced_io_add, Forward, §ion,
 | 
			
		||||
                                     int128_get64(tmp.start),
 | 
			
		||||
                                     int128_get64(tmp.size));
 | 
			
		||||
            }
 | 
			
		||||
            flat_range_coalesced_io_del(fr, as);
 | 
			
		||||
            flat_range_coalesced_io_add(fr, as);
 | 
			
		||||
        }
 | 
			
		||||
    }
 | 
			
		||||
    flatview_unref(view);
 | 
			
		||||
@ -2663,8 +2688,7 @@ void memory_listener_register(MemoryListener *listener, AddressSpace *as)
 | 
			
		||||
 | 
			
		||||
    listener->address_space = as;
 | 
			
		||||
    if (QTAILQ_EMPTY(&memory_listeners)
 | 
			
		||||
        || listener->priority >= QTAILQ_LAST(&memory_listeners,
 | 
			
		||||
                                             memory_listeners)->priority) {
 | 
			
		||||
        || listener->priority >= QTAILQ_LAST(&memory_listeners)->priority) {
 | 
			
		||||
        QTAILQ_INSERT_TAIL(&memory_listeners, listener, link);
 | 
			
		||||
    } else {
 | 
			
		||||
        QTAILQ_FOREACH(other, &memory_listeners, link) {
 | 
			
		||||
@ -2676,8 +2700,7 @@ void memory_listener_register(MemoryListener *listener, AddressSpace *as)
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    if (QTAILQ_EMPTY(&as->listeners)
 | 
			
		||||
        || listener->priority >= QTAILQ_LAST(&as->listeners,
 | 
			
		||||
                                             memory_listeners)->priority) {
 | 
			
		||||
        || listener->priority >= QTAILQ_LAST(&as->listeners)->priority) {
 | 
			
		||||
        QTAILQ_INSERT_TAIL(&as->listeners, listener, link_as);
 | 
			
		||||
    } else {
 | 
			
		||||
        QTAILQ_FOREACH(other, &as->listeners, link_as) {
 | 
			
		||||
@ -2767,7 +2790,7 @@ struct MemoryRegionList {
 | 
			
		||||
    QTAILQ_ENTRY(MemoryRegionList) mrqueue;
 | 
			
		||||
};
 | 
			
		||||
 | 
			
		||||
typedef QTAILQ_HEAD(mrqueue, MemoryRegionList) MemoryRegionListHead;
 | 
			
		||||
typedef QTAILQ_HEAD(, MemoryRegionList) MemoryRegionListHead;
 | 
			
		||||
 | 
			
		||||
#define MR_SIZE(size) (int128_nz(size) ? (hwaddr)int128_get64( \
 | 
			
		||||
                           int128_sub((size), int128_one())) : 0)
 | 
			
		||||
 | 
			
		||||
@ -223,7 +223,7 @@ static void guest_phys_blocks_region_add(MemoryListener *listener,
 | 
			
		||||
    if (!QTAILQ_EMPTY(&g->list->head)) {
 | 
			
		||||
        hwaddr predecessor_size;
 | 
			
		||||
 | 
			
		||||
        predecessor = QTAILQ_LAST(&g->list->head, GuestPhysBlockHead);
 | 
			
		||||
        predecessor = QTAILQ_LAST(&g->list->head);
 | 
			
		||||
        predecessor_size = predecessor->target_end - predecessor->target_start;
 | 
			
		||||
 | 
			
		||||
        /* the memory API guarantees monotonically increasing traversal */
 | 
			
		||||
 | 
			
		||||
@ -116,7 +116,7 @@ typedef struct DirtyBitmapMigBitmapState {
 | 
			
		||||
} DirtyBitmapMigBitmapState;
 | 
			
		||||
 | 
			
		||||
typedef struct DirtyBitmapMigState {
 | 
			
		||||
    QSIMPLEQ_HEAD(dbms_list, DirtyBitmapMigBitmapState) dbms_list;
 | 
			
		||||
    QSIMPLEQ_HEAD(, DirtyBitmapMigBitmapState) dbms_list;
 | 
			
		||||
 | 
			
		||||
    bool bulk_completed;
 | 
			
		||||
    bool no_bitmaps;
 | 
			
		||||
 | 
			
		||||
@ -93,12 +93,12 @@ typedef struct BlkMigBlock {
 | 
			
		||||
} BlkMigBlock;
 | 
			
		||||
 | 
			
		||||
typedef struct BlkMigState {
 | 
			
		||||
    QSIMPLEQ_HEAD(bmds_list, BlkMigDevState) bmds_list;
 | 
			
		||||
    QSIMPLEQ_HEAD(, BlkMigDevState) bmds_list;
 | 
			
		||||
    int64_t total_sector_sum;
 | 
			
		||||
    bool zero_blocks;
 | 
			
		||||
 | 
			
		||||
    /* Protected by lock.  */
 | 
			
		||||
    QSIMPLEQ_HEAD(blk_list, BlkMigBlock) blk_list;
 | 
			
		||||
    QSIMPLEQ_HEAD(, BlkMigBlock) blk_list;
 | 
			
		||||
    int submitted;
 | 
			
		||||
    int read_done;
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
@ -322,7 +322,7 @@ struct RAMState {
 | 
			
		||||
    RAMBlock *last_req_rb;
 | 
			
		||||
    /* Queue of outstanding page requests from the destination */
 | 
			
		||||
    QemuMutex src_page_req_mutex;
 | 
			
		||||
    QSIMPLEQ_HEAD(src_page_requests, RAMSrcPageRequest) src_page_requests;
 | 
			
		||||
    QSIMPLEQ_HEAD(, RAMSrcPageRequest) src_page_requests;
 | 
			
		||||
};
 | 
			
		||||
typedef struct RAMState RAMState;
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
@ -266,12 +266,12 @@ typedef struct QMPRequest QMPRequest;
 | 
			
		||||
/* Protects mon_list, monitor_qapi_event_state, monitor_destroyed.  */
 | 
			
		||||
static QemuMutex monitor_lock;
 | 
			
		||||
static GHashTable *monitor_qapi_event_state;
 | 
			
		||||
static QTAILQ_HEAD(mon_list, Monitor) mon_list;
 | 
			
		||||
static QTAILQ_HEAD(, Monitor) mon_list;
 | 
			
		||||
static bool monitor_destroyed;
 | 
			
		||||
 | 
			
		||||
/* Protects mon_fdsets */
 | 
			
		||||
static QemuMutex mon_fdsets_lock;
 | 
			
		||||
static QLIST_HEAD(mon_fdsets, MonFdset) mon_fdsets;
 | 
			
		||||
static QLIST_HEAD(, MonFdset) mon_fdsets;
 | 
			
		||||
 | 
			
		||||
static int mon_refcount;
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
@ -55,7 +55,7 @@ static NetFilterState *netfilter_next(NetFilterState *nf,
 | 
			
		||||
        next = QTAILQ_NEXT(nf, next);
 | 
			
		||||
    } else {
 | 
			
		||||
        /* reverse order */
 | 
			
		||||
        next = QTAILQ_PREV(nf, NetFilterHead, next);
 | 
			
		||||
        next = QTAILQ_PREV(nf, next);
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    return next;
 | 
			
		||||
 | 
			
		||||
@ -563,7 +563,7 @@ static ssize_t filter_receive_iov(NetClientState *nc,
 | 
			
		||||
            }
 | 
			
		||||
        }
 | 
			
		||||
    } else {
 | 
			
		||||
        QTAILQ_FOREACH_REVERSE(nf, &nc->filters, NetFilterHead, next) {
 | 
			
		||||
        QTAILQ_FOREACH_REVERSE(nf, &nc->filters, next) {
 | 
			
		||||
            ret = qemu_netfilter_receive(nf, direction, sender, flags, iov,
 | 
			
		||||
                                         iovcnt, sent_cb);
 | 
			
		||||
            if (ret) {
 | 
			
		||||
 | 
			
		||||
@ -55,7 +55,7 @@ struct NetQueue {
 | 
			
		||||
    uint32_t nq_count;
 | 
			
		||||
    NetQueueDeliverFunc *deliver;
 | 
			
		||||
 | 
			
		||||
    QTAILQ_HEAD(packets, NetPacket) packets;
 | 
			
		||||
    QTAILQ_HEAD(, NetPacket) packets;
 | 
			
		||||
 | 
			
		||||
    unsigned delivering : 1;
 | 
			
		||||
};
 | 
			
		||||
 | 
			
		||||
@ -85,7 +85,7 @@ typedef struct SlirpState {
 | 
			
		||||
} SlirpState;
 | 
			
		||||
 | 
			
		||||
static struct slirp_config_str *slirp_configs;
 | 
			
		||||
static QTAILQ_HEAD(slirp_stacks, SlirpState) slirp_stacks =
 | 
			
		||||
static QTAILQ_HEAD(, SlirpState) slirp_stacks =
 | 
			
		||||
    QTAILQ_HEAD_INITIALIZER(slirp_stacks);
 | 
			
		||||
 | 
			
		||||
static int slirp_hostfwd(SlirpState *s, const char *redir_str, Error **errp);
 | 
			
		||||
 | 
			
		||||
@ -1291,7 +1291,7 @@ int64_t qmp_guest_fsfreeze_freeze_list(bool has_mountpoints,
 | 
			
		||||
    /* cannot risk guest agent blocking itself on a write in this state */
 | 
			
		||||
    ga_set_frozen(ga_state);
 | 
			
		||||
 | 
			
		||||
    QTAILQ_FOREACH_REVERSE(mount, &mounts, FsMountList, next) {
 | 
			
		||||
    QTAILQ_FOREACH_REVERSE(mount, &mounts, next) {
 | 
			
		||||
        /* To issue fsfreeze in the reverse order of mounts, check if the
 | 
			
		||||
         * mount is listed in the list here */
 | 
			
		||||
        if (has_mountpoints) {
 | 
			
		||||
 | 
			
		||||
@ -10,12 +10,8 @@
 | 
			
		||||
 * This work is licensed under the terms of the GNU GPL, version 2 or later.
 | 
			
		||||
 * See the COPYING file in the top-level directory.
 | 
			
		||||
 */
 | 
			
		||||
 | 
			
		||||
#ifndef _WIN32_WINNT
 | 
			
		||||
#   define _WIN32_WINNT 0x0600
 | 
			
		||||
#endif
 | 
			
		||||
 | 
			
		||||
#include "qemu/osdep.h"
 | 
			
		||||
 | 
			
		||||
#include <wtypes.h>
 | 
			
		||||
#include <powrprof.h>
 | 
			
		||||
#include <winsock2.h>
 | 
			
		||||
@ -470,13 +466,11 @@ static STORAGE_BUS_TYPE win2qemu[] = {
 | 
			
		||||
    [BusTypeFibre] = GUEST_DISK_BUS_TYPE_SSA,
 | 
			
		||||
    [BusTypeUsb] = GUEST_DISK_BUS_TYPE_USB,
 | 
			
		||||
    [BusTypeRAID] = GUEST_DISK_BUS_TYPE_RAID,
 | 
			
		||||
#if (_WIN32_WINNT >= 0x0600)
 | 
			
		||||
    [BusTypeiScsi] = GUEST_DISK_BUS_TYPE_ISCSI,
 | 
			
		||||
    [BusTypeSas] = GUEST_DISK_BUS_TYPE_SAS,
 | 
			
		||||
    [BusTypeSata] = GUEST_DISK_BUS_TYPE_SATA,
 | 
			
		||||
    [BusTypeSd] =  GUEST_DISK_BUS_TYPE_SD,
 | 
			
		||||
    [BusTypeMmc] = GUEST_DISK_BUS_TYPE_MMC,
 | 
			
		||||
#endif
 | 
			
		||||
#if (_WIN32_WINNT >= 0x0601)
 | 
			
		||||
    [BusTypeVirtual] = GUEST_DISK_BUS_TYPE_VIRTUAL,
 | 
			
		||||
    [BusTypeFileBackedVirtual] = GUEST_DISK_BUS_TYPE_FILE_BACKED_VIRTUAL,
 | 
			
		||||
@ -728,10 +722,8 @@ static void get_single_disk_info(GuestDiskAddress *disk, Error **errp)
 | 
			
		||||
    if (disk->bus_type == GUEST_DISK_BUS_TYPE_SCSI
 | 
			
		||||
            || disk->bus_type == GUEST_DISK_BUS_TYPE_IDE
 | 
			
		||||
            || disk->bus_type == GUEST_DISK_BUS_TYPE_RAID
 | 
			
		||||
#if (_WIN32_WINNT >= 0x0600)
 | 
			
		||||
            /* This bus type is not supported before Windows Server 2003 SP1 */
 | 
			
		||||
            || disk->bus_type == GUEST_DISK_BUS_TYPE_SAS
 | 
			
		||||
#endif
 | 
			
		||||
        ) {
 | 
			
		||||
        /* We are able to use the same ioctls for different bus types
 | 
			
		||||
         * according to Microsoft docs
 | 
			
		||||
@ -1326,7 +1318,6 @@ static char *guest_addr_to_str(IP_ADAPTER_UNICAST_ADDRESS *ip_addr,
 | 
			
		||||
    return NULL;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
#if (_WIN32_WINNT >= 0x0600)
 | 
			
		||||
static int64_t guest_ip_prefix(IP_ADAPTER_UNICAST_ADDRESS *ip_addr)
 | 
			
		||||
{
 | 
			
		||||
    /* For Windows Vista/2008 and newer, use the OnLinkPrefixLength
 | 
			
		||||
@ -1334,60 +1325,6 @@ static int64_t guest_ip_prefix(IP_ADAPTER_UNICAST_ADDRESS *ip_addr)
 | 
			
		||||
     */
 | 
			
		||||
    return ip_addr->OnLinkPrefixLength;
 | 
			
		||||
}
 | 
			
		||||
#else
 | 
			
		||||
/* When using the Windows XP and 2003 build environment, do the best we can to
 | 
			
		||||
 * figure out the prefix.
 | 
			
		||||
 */
 | 
			
		||||
static IP_ADAPTER_INFO *guest_get_adapters_info(void)
 | 
			
		||||
{
 | 
			
		||||
    IP_ADAPTER_INFO *adptr_info = NULL;
 | 
			
		||||
    ULONG adptr_info_len = 0;
 | 
			
		||||
    DWORD ret;
 | 
			
		||||
 | 
			
		||||
    /* Call the first time to get the adptr_info_len. */
 | 
			
		||||
    GetAdaptersInfo(adptr_info, &adptr_info_len);
 | 
			
		||||
 | 
			
		||||
    adptr_info = g_malloc(adptr_info_len);
 | 
			
		||||
    ret = GetAdaptersInfo(adptr_info, &adptr_info_len);
 | 
			
		||||
    if (ret != ERROR_SUCCESS) {
 | 
			
		||||
        g_free(adptr_info);
 | 
			
		||||
        adptr_info = NULL;
 | 
			
		||||
    }
 | 
			
		||||
    return adptr_info;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
static int64_t guest_ip_prefix(IP_ADAPTER_UNICAST_ADDRESS *ip_addr)
 | 
			
		||||
{
 | 
			
		||||
    int64_t prefix = -1; /* Use for AF_INET6 and unknown/undetermined values. */
 | 
			
		||||
    IP_ADAPTER_INFO *adptr_info, *info;
 | 
			
		||||
    IP_ADDR_STRING *ip;
 | 
			
		||||
    struct in_addr *p;
 | 
			
		||||
 | 
			
		||||
    if (ip_addr->Address.lpSockaddr->sa_family != AF_INET) {
 | 
			
		||||
        return prefix;
 | 
			
		||||
    }
 | 
			
		||||
    adptr_info = guest_get_adapters_info();
 | 
			
		||||
    if (adptr_info == NULL) {
 | 
			
		||||
        return prefix;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    /* Match up the passed in ip_addr with one found in adaptr_info.
 | 
			
		||||
     * The matching one in adptr_info will have the netmask.
 | 
			
		||||
     */
 | 
			
		||||
    p = &((struct sockaddr_in *)ip_addr->Address.lpSockaddr)->sin_addr;
 | 
			
		||||
    for (info = adptr_info; info; info = info->Next) {
 | 
			
		||||
        for (ip = &info->IpAddressList; ip; ip = ip->Next) {
 | 
			
		||||
            if (p->S_un.S_addr == inet_addr(ip->IpAddress.String)) {
 | 
			
		||||
                prefix = ctpop32(inet_addr(ip->IpMask.String));
 | 
			
		||||
                goto out;
 | 
			
		||||
            }
 | 
			
		||||
        }
 | 
			
		||||
    }
 | 
			
		||||
out:
 | 
			
		||||
    g_free(adptr_info);
 | 
			
		||||
    return prefix;
 | 
			
		||||
}
 | 
			
		||||
#endif
 | 
			
		||||
 | 
			
		||||
#define INTERFACE_PATH_BUF_SZ 512
 | 
			
		||||
 | 
			
		||||
@ -1908,7 +1845,6 @@ typedef struct _GA_WTSINFOA {
 | 
			
		||||
 | 
			
		||||
GuestUserList *qmp_guest_get_users(Error **err)
 | 
			
		||||
{
 | 
			
		||||
#if (_WIN32_WINNT >= 0x0600)
 | 
			
		||||
#define QGA_NANOSECONDS 10000000
 | 
			
		||||
 | 
			
		||||
    GHashTable *cache = NULL;
 | 
			
		||||
@ -1978,10 +1914,6 @@ GuestUserList *qmp_guest_get_users(Error **err)
 | 
			
		||||
    }
 | 
			
		||||
    g_hash_table_destroy(cache);
 | 
			
		||||
    return head;
 | 
			
		||||
#else
 | 
			
		||||
    error_setg(err, QERR_UNSUPPORTED);
 | 
			
		||||
    return NULL;
 | 
			
		||||
#endif
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
typedef struct _ga_matrix_lookup_t {
 | 
			
		||||
 | 
			
		||||
@ -132,7 +132,9 @@ modules:
 | 
			
		||||
#  otherwise print the 'quiet' output in the format "  NAME     args to print"
 | 
			
		||||
# NAME should be a short name of the command, 7 letters or fewer.
 | 
			
		||||
# If called with only a single argument, will print nothing in quiet mode.
 | 
			
		||||
quiet-command = $(if $(V),$1,$(if $(2),@printf "  %-7s %s\n" $2 $3 && $1, @$1))
 | 
			
		||||
quiet-command-run = $(if $(V),,$(if $2,printf "  %-7s %s\n" $2 $3 && ))$1
 | 
			
		||||
quiet-@ = $(if $(V),,@)
 | 
			
		||||
quiet-command = $(quiet-@)$(call quiet-command-run,$1,$2,$3)
 | 
			
		||||
 | 
			
		||||
# cc-option
 | 
			
		||||
# Usage: CFLAGS+=$(call cc-option, -falign-functions=0, -malign-functions=0)
 | 
			
		||||
 | 
			
		||||
@ -7,6 +7,7 @@
 | 
			
		||||
 | 
			
		||||
use strict;
 | 
			
		||||
use warnings;
 | 
			
		||||
use Term::ANSIColor qw(:constants);
 | 
			
		||||
 | 
			
		||||
my $P = $0;
 | 
			
		||||
$P =~ s@.*/@@g;
 | 
			
		||||
@ -26,6 +27,7 @@ my $tst_only;
 | 
			
		||||
my $emacs = 0;
 | 
			
		||||
my $terse = 0;
 | 
			
		||||
my $file = undef;
 | 
			
		||||
my $color = "auto";
 | 
			
		||||
my $no_warnings = 0;
 | 
			
		||||
my $summary = 1;
 | 
			
		||||
my $mailback = 0;
 | 
			
		||||
@ -64,6 +66,8 @@ Options:
 | 
			
		||||
                             is all off)
 | 
			
		||||
  --test-only=WORD           report only warnings/errors containing WORD
 | 
			
		||||
                             literally
 | 
			
		||||
  --color[=WHEN]             Use colors 'always', 'never', or only when output
 | 
			
		||||
                             is a terminal ('auto'). Default is 'auto'.
 | 
			
		||||
  -h, --help, --version      display this help and exit
 | 
			
		||||
 | 
			
		||||
When FILE is - read standard input.
 | 
			
		||||
@ -72,6 +76,14 @@ EOM
 | 
			
		||||
	exit($exitcode);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
# Perl's Getopt::Long allows options to take optional arguments after a space.
 | 
			
		||||
# Prevent --color by itself from consuming other arguments
 | 
			
		||||
foreach (@ARGV) {
 | 
			
		||||
	if ($_ eq "--color" || $_ eq "-color") {
 | 
			
		||||
		$_ = "--color=$color";
 | 
			
		||||
	}
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
GetOptions(
 | 
			
		||||
	'q|quiet+'	=> \$quiet,
 | 
			
		||||
	'tree!'		=> \$tree,
 | 
			
		||||
@ -89,6 +101,8 @@ GetOptions(
 | 
			
		||||
 | 
			
		||||
	'debug=s'	=> \%debug,
 | 
			
		||||
	'test-only=s'	=> \$tst_only,
 | 
			
		||||
	'color=s'       => \$color,
 | 
			
		||||
	'no-color'      => sub { $color = 'never'; },
 | 
			
		||||
	'h|help'	=> \$help,
 | 
			
		||||
	'version'	=> \$help
 | 
			
		||||
) or help(1);
 | 
			
		||||
@ -144,6 +158,16 @@ if (!$chk_patch && !$chk_branch && !$file) {
 | 
			
		||||
	die "One of --file, --branch, --patch is required\n";
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
if ($color =~ /^always$/i) {
 | 
			
		||||
	$color = 1;
 | 
			
		||||
} elsif ($color =~ /^never$/i) {
 | 
			
		||||
	$color = 0;
 | 
			
		||||
} elsif ($color =~ /^auto$/i) {
 | 
			
		||||
	$color = (-t STDOUT);
 | 
			
		||||
} else {
 | 
			
		||||
	die "Invalid color mode: $color\n";
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
my $dbg_values = 0;
 | 
			
		||||
my $dbg_possible = 0;
 | 
			
		||||
my $dbg_type = 0;
 | 
			
		||||
@ -339,13 +363,18 @@ my @lines = ();
 | 
			
		||||
my $vname;
 | 
			
		||||
if ($chk_branch) {
 | 
			
		||||
	my @patches;
 | 
			
		||||
	my %git_commits = ();
 | 
			
		||||
	my $HASH;
 | 
			
		||||
	open($HASH, "-|", "git", "log", "--format=%H", $ARGV[0]) ||
 | 
			
		||||
		die "$P: git log --format=%H $ARGV[0] failed - $!\n";
 | 
			
		||||
	open($HASH, "-|", "git", "log", "--reverse", "--no-merges", "--format=%H %s", $ARGV[0]) ||
 | 
			
		||||
		die "$P: git log --reverse --no-merges --format='%H %s' $ARGV[0] failed - $!\n";
 | 
			
		||||
 | 
			
		||||
	while (<$HASH>) {
 | 
			
		||||
		chomp;
 | 
			
		||||
		push @patches, $_;
 | 
			
		||||
	for my $line (<$HASH>) {
 | 
			
		||||
		$line =~ /^([0-9a-fA-F]{40,40}) (.*)$/;
 | 
			
		||||
		next if (!defined($1) || !defined($2));
 | 
			
		||||
		my $sha1 = $1;
 | 
			
		||||
		my $subject = $2;
 | 
			
		||||
		push(@patches, $sha1);
 | 
			
		||||
		$git_commits{$sha1} = $subject;
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	close $HASH;
 | 
			
		||||
@ -353,21 +382,33 @@ if ($chk_branch) {
 | 
			
		||||
	die "$P: no revisions returned for revlist '$chk_branch'\n"
 | 
			
		||||
	    unless @patches;
 | 
			
		||||
 | 
			
		||||
	my $i = 1;
 | 
			
		||||
	my $num_patches = @patches;
 | 
			
		||||
	for my $hash (@patches) {
 | 
			
		||||
		my $FILE;
 | 
			
		||||
		open($FILE, '-|', "git", "show", $hash) ||
 | 
			
		||||
			die "$P: git show $hash - $!\n";
 | 
			
		||||
		$vname = $hash;
 | 
			
		||||
		while (<$FILE>) {
 | 
			
		||||
			chomp;
 | 
			
		||||
			push(@rawlines, $_);
 | 
			
		||||
		}
 | 
			
		||||
		close($FILE);
 | 
			
		||||
		$vname = substr($hash, 0, 12) . ' (' . $git_commits{$hash} . ')';
 | 
			
		||||
		if ($num_patches > 1 && $quiet == 0) {
 | 
			
		||||
			my $prefix = "$i/$num_patches";
 | 
			
		||||
			$prefix = BLUE . BOLD . $prefix . RESET if $color;
 | 
			
		||||
			print "$prefix Checking commit $vname\n";
 | 
			
		||||
			$vname = "Patch $i/$num_patches";
 | 
			
		||||
		} else {
 | 
			
		||||
			$vname = "Commit " . $vname;
 | 
			
		||||
		}
 | 
			
		||||
		if (!process($hash)) {
 | 
			
		||||
			$exit = 1;
 | 
			
		||||
			print "\n" if ($num_patches > 1 && $quiet == 0);
 | 
			
		||||
		}
 | 
			
		||||
		@rawlines = ();
 | 
			
		||||
		@lines = ();
 | 
			
		||||
		$i++;
 | 
			
		||||
	}
 | 
			
		||||
} else {
 | 
			
		||||
	for my $filename (@ARGV) {
 | 
			
		||||
@ -386,6 +427,7 @@ if ($chk_branch) {
 | 
			
		||||
		} else {
 | 
			
		||||
			$vname = $filename;
 | 
			
		||||
		}
 | 
			
		||||
		print "Checking $filename...\n" if @ARGV > 1 && $quiet == 0;
 | 
			
		||||
		while (<$FILE>) {
 | 
			
		||||
			chomp;
 | 
			
		||||
			push(@rawlines, $_);
 | 
			
		||||
@ -1165,14 +1207,23 @@ sub possible {
 | 
			
		||||
my $prefix = '';
 | 
			
		||||
 | 
			
		||||
sub report {
 | 
			
		||||
	if (defined $tst_only && $_[0] !~ /\Q$tst_only\E/) {
 | 
			
		||||
	my ($level, $msg) = @_;
 | 
			
		||||
	if (defined $tst_only && $msg !~ /\Q$tst_only\E/) {
 | 
			
		||||
		return 0;
 | 
			
		||||
	}
 | 
			
		||||
	my $line = $prefix . $_[0];
 | 
			
		||||
 | 
			
		||||
	$line = (split('\n', $line))[0] . "\n" if ($terse);
 | 
			
		||||
	my $output = '';
 | 
			
		||||
	$output .= BOLD if $color;
 | 
			
		||||
	$output .= $prefix;
 | 
			
		||||
	$output .= RED if $color && $level eq 'ERROR';
 | 
			
		||||
	$output .= MAGENTA if $color && $level eq 'WARNING';
 | 
			
		||||
	$output .= $level . ':';
 | 
			
		||||
	$output .= RESET if $color;
 | 
			
		||||
	$output .= ' ' . $msg . "\n";
 | 
			
		||||
 | 
			
		||||
	push(our @report, $line);
 | 
			
		||||
	$output = (split('\n', $output))[0] . "\n" if ($terse);
 | 
			
		||||
 | 
			
		||||
	push(our @report, $output);
 | 
			
		||||
 | 
			
		||||
	return 1;
 | 
			
		||||
}
 | 
			
		||||
@ -1180,13 +1231,13 @@ sub report_dump {
 | 
			
		||||
	our @report;
 | 
			
		||||
}
 | 
			
		||||
sub ERROR {
 | 
			
		||||
	if (report("ERROR: $_[0]\n")) {
 | 
			
		||||
	if (report("ERROR", $_[0])) {
 | 
			
		||||
		our $clean = 0;
 | 
			
		||||
		our $cnt_error++;
 | 
			
		||||
	}
 | 
			
		||||
}
 | 
			
		||||
sub WARN {
 | 
			
		||||
	if (report("WARNING: $_[0]\n")) {
 | 
			
		||||
	if (report("WARNING", $_[0])) {
 | 
			
		||||
		our $clean = 0;
 | 
			
		||||
		our $cnt_warn++;
 | 
			
		||||
	}
 | 
			
		||||
@ -2259,6 +2310,11 @@ sub process {
 | 
			
		||||
			}
 | 
			
		||||
		}
 | 
			
		||||
 | 
			
		||||
		if ($line =~ /^.\s*(Q(?:S?LIST|SIMPLEQ|TAILQ)_HEAD)\s*\(\s*[^,]/ &&
 | 
			
		||||
		    $line !~ /^.typedef/) {
 | 
			
		||||
		    ERROR("named $1 should be typedefed separately\n" . $herecurr);
 | 
			
		||||
		}
 | 
			
		||||
 | 
			
		||||
# Need a space before open parenthesis after if, while etc
 | 
			
		||||
		if ($line=~/\b(if|while|for|switch)\(/) {
 | 
			
		||||
			ERROR("space required before the open parenthesis '('\n" . $herecurr);
 | 
			
		||||
@ -2864,30 +2920,31 @@ sub process {
 | 
			
		||||
		}
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	if ($is_patch && $chk_signoff && $signoff == 0) {
 | 
			
		||||
		ERROR("Missing Signed-off-by: line(s)\n");
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	# If we have no input at all, then there is nothing to report on
 | 
			
		||||
	# so just keep quiet.
 | 
			
		||||
	if ($#rawlines == -1) {
 | 
			
		||||
		exit(0);
 | 
			
		||||
		return 1;
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	# In mailback mode only produce a report in the negative, for
 | 
			
		||||
	# things that appear to be patches.
 | 
			
		||||
	if ($mailback && ($clean == 1 || !$is_patch)) {
 | 
			
		||||
		exit(0);
 | 
			
		||||
		return 1;
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	# This is not a patch, and we are are in 'no-patch' mode so
 | 
			
		||||
	# just keep quiet.
 | 
			
		||||
	if (!$chk_patch && !$is_patch) {
 | 
			
		||||
		exit(0);
 | 
			
		||||
		return 1;
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	if (!$is_patch) {
 | 
			
		||||
		ERROR("Does not appear to be a unified-diff format patch\n");
 | 
			
		||||
	}
 | 
			
		||||
	if ($is_patch && $chk_signoff && $signoff == 0) {
 | 
			
		||||
		ERROR("Missing Signed-off-by: line(s)\n");
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	print report_dump();
 | 
			
		||||
	if ($summary && !($clean == 1 && $quiet == 1)) {
 | 
			
		||||
 | 
			
		||||
@ -92,29 +92,19 @@ struct {                                                                \
 | 
			
		||||
/*
 | 
			
		||||
 * Tail queue definitions.
 | 
			
		||||
 */
 | 
			
		||||
#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)                                         \
 | 
			
		||||
struct name {                                                           \
 | 
			
		||||
        type *tqh_first;      /* first element */                       \
 | 
			
		||||
        type **tqh_last;      /* addr of last next element */           \
 | 
			
		||||
union name {                                                            \
 | 
			
		||||
        struct type *tqh_first;       /* first element */               \
 | 
			
		||||
        QTailQLink tqh_circ;          /* link for last element */       \
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
#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)                                              \
 | 
			
		||||
struct {                                                                \
 | 
			
		||||
        type *tqe_next;       /* next element */                        \
 | 
			
		||||
        type **tqe_prev;      /* address of previous next element */    \
 | 
			
		||||
union {                                                                 \
 | 
			
		||||
        struct type *tqe_next;        /* next element */                \
 | 
			
		||||
        QTailQLink tqe_circ;          /* link for prev element */       \
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
/* From glib */
 | 
			
		||||
 | 
			
		||||
							
								
								
									
										62
									
								
								scripts/fix-multiline-comments.sh
									
									
									
									
									
										Executable file
									
								
							
							
						
						
									
										62
									
								
								scripts/fix-multiline-comments.sh
									
									
									
									
									
										Executable file
									
								
							@ -0,0 +1,62 @@
 | 
			
		||||
#! /bin/sh
 | 
			
		||||
#
 | 
			
		||||
# Fix multiline comments to match CODING_STYLE
 | 
			
		||||
#
 | 
			
		||||
# Copyright (C) 2018 Red Hat, Inc.
 | 
			
		||||
#
 | 
			
		||||
# Author: Paolo Bonzini
 | 
			
		||||
#
 | 
			
		||||
# Usage: scripts/fix-multiline-comments.sh [-i] FILE...
 | 
			
		||||
#
 | 
			
		||||
# -i edits the file in place (requires gawk 4.1.0).
 | 
			
		||||
#
 | 
			
		||||
# Set the AWK environment variable to choose the awk interpreter to use
 | 
			
		||||
# (default 'awk')
 | 
			
		||||
 | 
			
		||||
if test "$1" = -i; then
 | 
			
		||||
  # gawk extension
 | 
			
		||||
  inplace="-i inplace"
 | 
			
		||||
  shift
 | 
			
		||||
fi
 | 
			
		||||
${AWK-awk} $inplace 'BEGIN { indent = -1 }
 | 
			
		||||
{
 | 
			
		||||
    line = $0
 | 
			
		||||
    # apply a star to the indent on lines after the first
 | 
			
		||||
    if (indent != -1) {
 | 
			
		||||
        if (line == "") {
 | 
			
		||||
            line = sp " *"
 | 
			
		||||
        } else if (substr(line, 1, indent + 2) == sp "  ") {
 | 
			
		||||
            line = sp " *" substr(line, indent + 3)
 | 
			
		||||
        }
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    is_lead = (line ~ /^[ \t]*\/\*/)
 | 
			
		||||
    is_trail = (line ~ /\*\//)
 | 
			
		||||
    if (is_lead && !is_trail) {
 | 
			
		||||
        # grab the indent at the start of a comment, but not for
 | 
			
		||||
        # single-line comments
 | 
			
		||||
        match(line, /^[ \t]*\/\*/)
 | 
			
		||||
        indent = RLENGTH - 2
 | 
			
		||||
        sp = substr(line, 1, indent)
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    # the regular expression filters out lone /*, /**, or */
 | 
			
		||||
    if (indent != -1 && !(line ~ /^[ \t]*(\/\*+|\*\/)[ \t]*$/)) {
 | 
			
		||||
        if (is_lead) {
 | 
			
		||||
            # split the leading /* or /** on a separate line
 | 
			
		||||
            match(line, /^[ \t]*\/\*+/)
 | 
			
		||||
            lead = substr(line, 1, RLENGTH)
 | 
			
		||||
            match(line, /^[ \t]*\/\*+[ \t]*/)
 | 
			
		||||
            line = lead "\n" sp " *" substr(line, RLENGTH)
 | 
			
		||||
        }
 | 
			
		||||
        if (is_trail) {
 | 
			
		||||
            # split the trailing */ on a separate line
 | 
			
		||||
            match(line, /[ \t]*\*\//)
 | 
			
		||||
            line = substr(line, 1, RSTART - 1) "\n" sp " */"
 | 
			
		||||
        }
 | 
			
		||||
    }
 | 
			
		||||
    if (is_trail) {
 | 
			
		||||
        indent = -1
 | 
			
		||||
    }
 | 
			
		||||
    print line
 | 
			
		||||
}' "$@"
 | 
			
		||||
@ -1,26 +0,0 @@
 | 
			
		||||
#!/bin/sh
 | 
			
		||||
#
 | 
			
		||||
# Copyright IBM, Corp. 2012
 | 
			
		||||
#
 | 
			
		||||
# Authors:
 | 
			
		||||
#  Anthony Liguori <aliguori@us.ibm.com>
 | 
			
		||||
#
 | 
			
		||||
# This work is licensed under the terms of the GNU GPLv2 or later.
 | 
			
		||||
# See the COPYING file in the top-level directory.
 | 
			
		||||
 | 
			
		||||
cat <<EOF
 | 
			
		||||
<?xml version="1.0"?>
 | 
			
		||||
<gtester>
 | 
			
		||||
 <info>
 | 
			
		||||
  <package>qemu</package>
 | 
			
		||||
  <version>0.0</version>
 | 
			
		||||
  <revision>rev</revision>
 | 
			
		||||
 </info>
 | 
			
		||||
EOF
 | 
			
		||||
 | 
			
		||||
sed \
 | 
			
		||||
  -e '/<?xml/d' \
 | 
			
		||||
  -e '/^<gtester>$/d' \
 | 
			
		||||
  -e '/<info>/,/<\/info>/d' \
 | 
			
		||||
  -e '$b' \
 | 
			
		||||
  -e '/^<\/gtester>$/d' "$@"
 | 
			
		||||
							
								
								
									
										378
									
								
								scripts/tap-driver.pl
									
									
									
									
									
										Executable file
									
								
							
							
						
						
									
										378
									
								
								scripts/tap-driver.pl
									
									
									
									
									
										Executable file
									
								
							@ -0,0 +1,378 @@
 | 
			
		||||
#! /usr/bin/env perl
 | 
			
		||||
# Copyright (C) 2011-2013 Free Software Foundation, Inc.
 | 
			
		||||
# Copyright (C) 2018 Red Hat, Inc.
 | 
			
		||||
#
 | 
			
		||||
# This program is free software; you can redistribute it and/or modify
 | 
			
		||||
# it under the terms of the GNU General Public License as published by
 | 
			
		||||
# the Free Software Foundation; either version 2, or (at your option)
 | 
			
		||||
# any later version.
 | 
			
		||||
#
 | 
			
		||||
# This program is distributed in the hope that it will be useful,
 | 
			
		||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
 | 
			
		||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 | 
			
		||||
# GNU General Public License for more details.
 | 
			
		||||
#
 | 
			
		||||
# You should have received a copy of the GNU General Public License
 | 
			
		||||
# along with this program.  If not, see <https://www.gnu.org/licenses/>.
 | 
			
		||||
 | 
			
		||||
# As a special exception to the GNU General Public License, if you
 | 
			
		||||
# distribute this file as part of a program that contains a
 | 
			
		||||
# configuration script generated by Autoconf, you may include it under
 | 
			
		||||
# the same distribution terms that you use for the rest of that program.
 | 
			
		||||
 | 
			
		||||
# ---------------------------------- #
 | 
			
		||||
#  Imports, static data, and setup.  #
 | 
			
		||||
# ---------------------------------- #
 | 
			
		||||
 | 
			
		||||
use warnings FATAL => 'all';
 | 
			
		||||
use strict;
 | 
			
		||||
use Getopt::Long ();
 | 
			
		||||
use TAP::Parser;
 | 
			
		||||
use Term::ANSIColor qw(:constants);
 | 
			
		||||
 | 
			
		||||
my $ME = "tap-driver.pl";
 | 
			
		||||
my $VERSION = "2018-11-30";
 | 
			
		||||
 | 
			
		||||
my $USAGE = <<'END';
 | 
			
		||||
Usage:
 | 
			
		||||
  tap-driver [--test-name=TEST] [--color={always|never|auto}]
 | 
			
		||||
             [--verbose] [--show-failures-only]
 | 
			
		||||
END
 | 
			
		||||
 | 
			
		||||
my $HELP = "$ME: TAP-aware test driver for QEMU testsuite harness." .
 | 
			
		||||
           "\n" . $USAGE;
 | 
			
		||||
 | 
			
		||||
# It's important that NO_PLAN evaluates "false" as a boolean.
 | 
			
		||||
use constant NO_PLAN => 0;
 | 
			
		||||
use constant EARLY_PLAN => 1;
 | 
			
		||||
use constant LATE_PLAN => 2;
 | 
			
		||||
 | 
			
		||||
use constant DIAG_STRING => "#";
 | 
			
		||||
 | 
			
		||||
# ------------------- #
 | 
			
		||||
#  Global variables.  #
 | 
			
		||||
# ------------------- #
 | 
			
		||||
 | 
			
		||||
my $testno = 0;     # Number of test results seen so far.
 | 
			
		||||
my $bailed_out = 0; # Whether a "Bail out!" directive has been seen.
 | 
			
		||||
my $failed = 0;     # Final exit code
 | 
			
		||||
 | 
			
		||||
# Whether the TAP plan has been seen or not, and if yes, which kind
 | 
			
		||||
# it is ("early" is seen before any test result, "late" otherwise).
 | 
			
		||||
my $plan_seen = NO_PLAN;
 | 
			
		||||
 | 
			
		||||
# ----------------- #
 | 
			
		||||
#  Option parsing.  #
 | 
			
		||||
# ----------------- #
 | 
			
		||||
 | 
			
		||||
my %cfg = (
 | 
			
		||||
  "color" => 0,
 | 
			
		||||
  "verbose" => 0,
 | 
			
		||||
  "show-failures-only" => 0,
 | 
			
		||||
);
 | 
			
		||||
 | 
			
		||||
my $color = "auto";
 | 
			
		||||
my $test_name = undef;
 | 
			
		||||
 | 
			
		||||
# Perl's Getopt::Long allows options to take optional arguments after a space.
 | 
			
		||||
# Prevent --color by itself from consuming other arguments
 | 
			
		||||
foreach (@ARGV) {
 | 
			
		||||
  if ($_ eq "--color" || $_ eq "-color") {
 | 
			
		||||
    $_ = "--color=$color";
 | 
			
		||||
  }
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
Getopt::Long::GetOptions
 | 
			
		||||
  (
 | 
			
		||||
    'help' => sub { print $HELP; exit 0; },
 | 
			
		||||
    'version' => sub { print "$ME $VERSION\n"; exit 0; },
 | 
			
		||||
    'test-name=s' => \$test_name,
 | 
			
		||||
    'color=s'  => \$color,
 | 
			
		||||
    'show-failures-only' => sub { $cfg{"show-failures-only"} = 1; },
 | 
			
		||||
    'verbose' => sub { $cfg{"verbose"} = 1; },
 | 
			
		||||
  ) or exit 1;
 | 
			
		||||
 | 
			
		||||
if ($color =~ /^always$/i) {
 | 
			
		||||
  $cfg{'color'} = 1;
 | 
			
		||||
} elsif ($color =~ /^never$/i) {
 | 
			
		||||
  $cfg{'color'} = 0;
 | 
			
		||||
} elsif ($color =~ /^auto$/i) {
 | 
			
		||||
  $cfg{'color'} = (-t STDOUT);
 | 
			
		||||
} else {
 | 
			
		||||
  die "Invalid color mode: $color\n";
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
# ------------- #
 | 
			
		||||
#  Prototypes.  #
 | 
			
		||||
# ------------- #
 | 
			
		||||
 | 
			
		||||
sub colored ($$);
 | 
			
		||||
sub decorate_result ($);
 | 
			
		||||
sub extract_tap_comment ($);
 | 
			
		||||
sub handle_tap_bailout ($);
 | 
			
		||||
sub handle_tap_plan ($);
 | 
			
		||||
sub handle_tap_result ($);
 | 
			
		||||
sub is_null_string ($);
 | 
			
		||||
sub main ();
 | 
			
		||||
sub report ($;$);
 | 
			
		||||
sub stringify_result_obj ($);
 | 
			
		||||
sub testsuite_error ($);
 | 
			
		||||
 | 
			
		||||
# -------------- #
 | 
			
		||||
#  Subroutines.  #
 | 
			
		||||
# -------------- #
 | 
			
		||||
 | 
			
		||||
# If the given string is undefined or empty, return true, otherwise
 | 
			
		||||
# return false.  This function is useful to avoid pitfalls like:
 | 
			
		||||
#   if ($message) { print "$message\n"; }
 | 
			
		||||
# which wouldn't print anything if $message is the literal "0".
 | 
			
		||||
sub is_null_string ($)
 | 
			
		||||
{
 | 
			
		||||
  my $str = shift;
 | 
			
		||||
  return ! (defined $str and length $str);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
sub stringify_result_obj ($)
 | 
			
		||||
{
 | 
			
		||||
  my $result_obj = shift;
 | 
			
		||||
  if ($result_obj->is_unplanned || $result_obj->number != $testno)
 | 
			
		||||
    {
 | 
			
		||||
      return "ERROR";
 | 
			
		||||
    }
 | 
			
		||||
  elsif ($plan_seen == LATE_PLAN)
 | 
			
		||||
    {
 | 
			
		||||
      return "ERROR";
 | 
			
		||||
    }
 | 
			
		||||
  elsif (!$result_obj->directive)
 | 
			
		||||
    {
 | 
			
		||||
      return $result_obj->is_ok ? "PASS" : "FAIL";
 | 
			
		||||
    }
 | 
			
		||||
  elsif ($result_obj->has_todo)
 | 
			
		||||
    {
 | 
			
		||||
      return $result_obj->is_actual_ok ? "XPASS" : "XFAIL";
 | 
			
		||||
    }
 | 
			
		||||
  elsif ($result_obj->has_skip)
 | 
			
		||||
    {
 | 
			
		||||
      return $result_obj->is_ok ? "SKIP" : "FAIL";
 | 
			
		||||
    }
 | 
			
		||||
  die "$ME: INTERNAL ERROR"; # NOTREACHED
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
sub colored ($$)
 | 
			
		||||
{
 | 
			
		||||
  my ($color_string, $text) = @_;
 | 
			
		||||
  return $color_string . $text . RESET;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
sub decorate_result ($)
 | 
			
		||||
{
 | 
			
		||||
  my $result = shift;
 | 
			
		||||
  return $result unless $cfg{"color"};
 | 
			
		||||
  my %color_for_result =
 | 
			
		||||
    (
 | 
			
		||||
      "ERROR" => BOLD.MAGENTA,
 | 
			
		||||
      "PASS"  => GREEN,
 | 
			
		||||
      "XPASS" => BOLD.YELLOW,
 | 
			
		||||
      "FAIL"  => BOLD.RED,
 | 
			
		||||
      "XFAIL" => YELLOW,
 | 
			
		||||
      "SKIP"  => BLUE,
 | 
			
		||||
    );
 | 
			
		||||
  if (my $color = $color_for_result{$result})
 | 
			
		||||
    {
 | 
			
		||||
      return colored ($color, $result);
 | 
			
		||||
    }
 | 
			
		||||
  else
 | 
			
		||||
    {
 | 
			
		||||
      return $result; # Don't colorize unknown stuff.
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
sub report ($;$)
 | 
			
		||||
{
 | 
			
		||||
  my ($msg, $result, $explanation) = (undef, @_);
 | 
			
		||||
  if ($result =~ /^(?:X?(?:PASS|FAIL)|SKIP|ERROR)/)
 | 
			
		||||
    {
 | 
			
		||||
      # Output on console might be colorized.
 | 
			
		||||
      $msg = decorate_result($result);
 | 
			
		||||
      if ($result =~ /^(?:PASS|XFAIL|SKIP)/)
 | 
			
		||||
        {
 | 
			
		||||
          return if $cfg{"show-failures-only"};
 | 
			
		||||
        }
 | 
			
		||||
      else
 | 
			
		||||
        {
 | 
			
		||||
          $failed = 1;
 | 
			
		||||
        }
 | 
			
		||||
    }
 | 
			
		||||
  elsif ($result eq "#")
 | 
			
		||||
    {
 | 
			
		||||
      $msg = "  ";
 | 
			
		||||
    }
 | 
			
		||||
  else
 | 
			
		||||
    {
 | 
			
		||||
      die "$ME: INTERNAL ERROR"; # NOTREACHED
 | 
			
		||||
    }
 | 
			
		||||
  $msg .= " $explanation" if defined $explanation;
 | 
			
		||||
  print $msg . "\n";
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
sub testsuite_error ($)
 | 
			
		||||
{
 | 
			
		||||
  report "ERROR", "- $_[0]";
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
sub handle_tap_result ($)
 | 
			
		||||
{
 | 
			
		||||
  $testno++;
 | 
			
		||||
  my $result_obj = shift;
 | 
			
		||||
 | 
			
		||||
  my $test_result = stringify_result_obj $result_obj;
 | 
			
		||||
  my $string = $result_obj->number;
 | 
			
		||||
 | 
			
		||||
  my $description = $result_obj->description;
 | 
			
		||||
  $string .= " $test_name" unless is_null_string $test_name;
 | 
			
		||||
  $string .= " $description" unless is_null_string $description;
 | 
			
		||||
 | 
			
		||||
  if ($plan_seen == LATE_PLAN)
 | 
			
		||||
    {
 | 
			
		||||
      $string .= " # AFTER LATE PLAN";
 | 
			
		||||
    }
 | 
			
		||||
  elsif ($result_obj->is_unplanned)
 | 
			
		||||
    {
 | 
			
		||||
      $string .= " # UNPLANNED";
 | 
			
		||||
    }
 | 
			
		||||
  elsif ($result_obj->number != $testno)
 | 
			
		||||
    {
 | 
			
		||||
      $string .= " # OUT-OF-ORDER (expecting $testno)";
 | 
			
		||||
    }
 | 
			
		||||
  elsif (my $directive = $result_obj->directive)
 | 
			
		||||
    {
 | 
			
		||||
      $string .= " # $directive";
 | 
			
		||||
      my $explanation = $result_obj->explanation;
 | 
			
		||||
      $string .= " $explanation"
 | 
			
		||||
        unless is_null_string $explanation;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
  report $test_result, $string;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
sub handle_tap_plan ($)
 | 
			
		||||
{
 | 
			
		||||
  my $plan = shift;
 | 
			
		||||
  if ($plan_seen)
 | 
			
		||||
    {
 | 
			
		||||
      # Error, only one plan per stream is acceptable.
 | 
			
		||||
      testsuite_error "multiple test plans";
 | 
			
		||||
      return;
 | 
			
		||||
    }
 | 
			
		||||
  # The TAP plan can come before or after *all* the TAP results; we speak
 | 
			
		||||
  # respectively of an "early" or a "late" plan.  If we see the plan line
 | 
			
		||||
  # after at least one TAP result has been seen, assume we have a late
 | 
			
		||||
  # plan; in this case, any further test result seen after the plan will
 | 
			
		||||
  # be flagged as an error.
 | 
			
		||||
  $plan_seen = ($testno >= 1 ? LATE_PLAN : EARLY_PLAN);
 | 
			
		||||
  # If $testno > 0, we have an error ("too many tests run") that will be
 | 
			
		||||
  # automatically dealt with later, so don't worry about it here.  If
 | 
			
		||||
  # $plan_seen is true, we have an error due to a repeated plan, and that
 | 
			
		||||
  # has already been dealt with above.  Otherwise, we have a valid "plan
 | 
			
		||||
  # with SKIP" specification, and should report it as a particular kind
 | 
			
		||||
  # of SKIP result.
 | 
			
		||||
  if ($plan->directive && $testno == 0)
 | 
			
		||||
    {
 | 
			
		||||
      my $explanation = is_null_string ($plan->explanation) ?
 | 
			
		||||
                        undef : "- " . $plan->explanation;
 | 
			
		||||
      report "SKIP", $explanation;
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
sub handle_tap_bailout ($)
 | 
			
		||||
{
 | 
			
		||||
  my ($bailout, $msg) = ($_[0], "Bail out!");
 | 
			
		||||
  $bailed_out = 1;
 | 
			
		||||
  $msg .= " " . $bailout->explanation
 | 
			
		||||
    unless is_null_string $bailout->explanation;
 | 
			
		||||
  testsuite_error $msg;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
sub extract_tap_comment ($)
 | 
			
		||||
{
 | 
			
		||||
  my $line = shift;
 | 
			
		||||
  if (index ($line, DIAG_STRING) == 0)
 | 
			
		||||
    {
 | 
			
		||||
      # Strip leading `DIAG_STRING' from `$line'.
 | 
			
		||||
      $line = substr ($line, length (DIAG_STRING));
 | 
			
		||||
      # And strip any leading and trailing whitespace left.
 | 
			
		||||
      $line =~ s/(?:^\s*|\s*$)//g;
 | 
			
		||||
      # Return what is left (if any).
 | 
			
		||||
      return $line;
 | 
			
		||||
    }
 | 
			
		||||
  return "";
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
sub main ()
 | 
			
		||||
{
 | 
			
		||||
  my $iterator = TAP::Parser::Iterator::Stream->new(\*STDIN);
 | 
			
		||||
  my $parser = TAP::Parser->new ({iterator => $iterator });
 | 
			
		||||
 | 
			
		||||
  while (defined (my $cur = $parser->next))
 | 
			
		||||
    {
 | 
			
		||||
      # Parsing of TAP input should stop after a "Bail out!" directive.
 | 
			
		||||
      next if $bailed_out;
 | 
			
		||||
 | 
			
		||||
      if ($cur->is_plan)
 | 
			
		||||
        {
 | 
			
		||||
          handle_tap_plan ($cur);
 | 
			
		||||
        }
 | 
			
		||||
      elsif ($cur->is_test)
 | 
			
		||||
        {
 | 
			
		||||
          handle_tap_result ($cur);
 | 
			
		||||
        }
 | 
			
		||||
      elsif ($cur->is_bailout)
 | 
			
		||||
        {
 | 
			
		||||
          handle_tap_bailout ($cur);
 | 
			
		||||
        }
 | 
			
		||||
      elsif ($cfg{"verbose"})
 | 
			
		||||
        {
 | 
			
		||||
          my $comment = extract_tap_comment ($cur->raw);
 | 
			
		||||
          report "#", "$comment" if length $comment;
 | 
			
		||||
       }
 | 
			
		||||
    }
 | 
			
		||||
  # A "Bail out!" directive should cause us to ignore any following TAP
 | 
			
		||||
  # error.
 | 
			
		||||
  if (!$bailed_out)
 | 
			
		||||
    {
 | 
			
		||||
      if (!$plan_seen)
 | 
			
		||||
        {
 | 
			
		||||
          testsuite_error "missing test plan";
 | 
			
		||||
        }
 | 
			
		||||
      elsif ($parser->tests_planned != $parser->tests_run)
 | 
			
		||||
        {
 | 
			
		||||
          my ($planned, $run) = ($parser->tests_planned, $parser->tests_run);
 | 
			
		||||
          my $bad_amount = $run > $planned ? "many" : "few";
 | 
			
		||||
          testsuite_error (sprintf "too %s tests run (expected %d, got %d)",
 | 
			
		||||
                                   $bad_amount, $planned, $run);
 | 
			
		||||
        }
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
# ----------- #
 | 
			
		||||
#  Main code. #
 | 
			
		||||
# ----------- #
 | 
			
		||||
 | 
			
		||||
main;
 | 
			
		||||
exit($failed);
 | 
			
		||||
 | 
			
		||||
# Local Variables:
 | 
			
		||||
# perl-indent-level: 2
 | 
			
		||||
# perl-continued-statement-offset: 2
 | 
			
		||||
# perl-continued-brace-offset: 0
 | 
			
		||||
# perl-brace-offset: 0
 | 
			
		||||
# perl-brace-imaginary-offset: 0
 | 
			
		||||
# perl-label-offset: -2
 | 
			
		||||
# cperl-indent-level: 2
 | 
			
		||||
# cperl-brace-offset: 0
 | 
			
		||||
# cperl-continued-brace-offset: 0
 | 
			
		||||
# cperl-label-offset: -2
 | 
			
		||||
# cperl-extra-newline-before-brace: t
 | 
			
		||||
# cperl-merge-trailing-else: nil
 | 
			
		||||
# cperl-continued-statement-offset: 2
 | 
			
		||||
# End:
 | 
			
		||||
							
								
								
									
										110
									
								
								scripts/tap-merge.pl
									
									
									
									
									
										Executable file
									
								
							
							
						
						
									
										110
									
								
								scripts/tap-merge.pl
									
									
									
									
									
										Executable file
									
								
							@ -0,0 +1,110 @@
 | 
			
		||||
#! /usr/bin/env perl
 | 
			
		||||
# Copyright (C) 2018 Red Hat, Inc.
 | 
			
		||||
#
 | 
			
		||||
# Author: Paolo Bonzini <pbonzini@redhat.com>
 | 
			
		||||
#
 | 
			
		||||
# This program is free software; you can redistribute it and/or modify
 | 
			
		||||
# it under the terms of the GNU General Public License as published by
 | 
			
		||||
# the Free Software Foundation; either version 2, or (at your option)
 | 
			
		||||
# any later version.
 | 
			
		||||
#
 | 
			
		||||
# This program is distributed in the hope that it will be useful,
 | 
			
		||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
 | 
			
		||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 | 
			
		||||
# GNU General Public License for more details.
 | 
			
		||||
#
 | 
			
		||||
# You should have received a copy of the GNU General Public License
 | 
			
		||||
# along with this program.  If not, see <https://www.gnu.org/licenses/>.
 | 
			
		||||
 | 
			
		||||
# ---------------------------------- #
 | 
			
		||||
#  Imports, static data, and setup.  #
 | 
			
		||||
# ---------------------------------- #
 | 
			
		||||
 | 
			
		||||
use warnings FATAL => 'all';
 | 
			
		||||
use strict;
 | 
			
		||||
use Getopt::Long ();
 | 
			
		||||
use TAP::Parser;
 | 
			
		||||
 | 
			
		||||
my $ME = "tap-merge.pl";
 | 
			
		||||
my $VERSION = "2018-11-30";
 | 
			
		||||
 | 
			
		||||
my $HELP = "$ME: merge multiple TAP inputs from stdin.";
 | 
			
		||||
 | 
			
		||||
use constant DIAG_STRING => "#";
 | 
			
		||||
 | 
			
		||||
# ----------------- #
 | 
			
		||||
#  Option parsing.  #
 | 
			
		||||
# ----------------- #
 | 
			
		||||
 | 
			
		||||
Getopt::Long::GetOptions
 | 
			
		||||
  (
 | 
			
		||||
    'help' => sub { print $HELP; exit 0; },
 | 
			
		||||
    'version' => sub { print "$ME $VERSION\n"; exit 0; },
 | 
			
		||||
  );
 | 
			
		||||
 | 
			
		||||
# -------------- #
 | 
			
		||||
#  Subroutines.  #
 | 
			
		||||
# -------------- #
 | 
			
		||||
 | 
			
		||||
sub main ()
 | 
			
		||||
{
 | 
			
		||||
  my $iterator = TAP::Parser::Iterator::Stream->new(\*STDIN);
 | 
			
		||||
  my $parser = TAP::Parser->new ({iterator => $iterator });
 | 
			
		||||
  my $testno = 0;     # Number of test results seen so far.
 | 
			
		||||
  my $bailed_out = 0; # Whether a "Bail out!" directive has been seen.
 | 
			
		||||
 | 
			
		||||
  while (defined (my $cur = $parser->next))
 | 
			
		||||
    {
 | 
			
		||||
      if ($cur->is_bailout)
 | 
			
		||||
        {
 | 
			
		||||
          $bailed_out = 1;
 | 
			
		||||
          print DIAG_STRING . " " . $cur->as_string . "\n";
 | 
			
		||||
          next;
 | 
			
		||||
        }
 | 
			
		||||
      elsif ($cur->is_plan)
 | 
			
		||||
        {
 | 
			
		||||
          $bailed_out = 0;
 | 
			
		||||
          next;
 | 
			
		||||
        }
 | 
			
		||||
      elsif ($cur->is_test)
 | 
			
		||||
        {
 | 
			
		||||
          $bailed_out = 0 if $cur->number == 1;
 | 
			
		||||
          $testno++;
 | 
			
		||||
          $cur = TAP::Parser::Result::Test->new({
 | 
			
		||||
                          ok => $cur->ok,
 | 
			
		||||
                          test_num => $testno,
 | 
			
		||||
                          directive => $cur->directive,
 | 
			
		||||
                          explanation => $cur->explanation,
 | 
			
		||||
                          description => $cur->description
 | 
			
		||||
                  });
 | 
			
		||||
        }
 | 
			
		||||
      elsif ($cur->is_version)
 | 
			
		||||
        {
 | 
			
		||||
          next if $testno > 0;
 | 
			
		||||
        }
 | 
			
		||||
      print $cur->as_string . "\n" unless $bailed_out;
 | 
			
		||||
    }
 | 
			
		||||
  print "1..$testno\n";
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
# ----------- #
 | 
			
		||||
#  Main code. #
 | 
			
		||||
# ----------- #
 | 
			
		||||
 | 
			
		||||
main;
 | 
			
		||||
 | 
			
		||||
# Local Variables:
 | 
			
		||||
# perl-indent-level: 2
 | 
			
		||||
# perl-continued-statement-offset: 2
 | 
			
		||||
# perl-continued-brace-offset: 0
 | 
			
		||||
# perl-brace-offset: 0
 | 
			
		||||
# perl-brace-imaginary-offset: 0
 | 
			
		||||
# perl-label-offset: -2
 | 
			
		||||
# cperl-indent-level: 2
 | 
			
		||||
# cperl-brace-offset: 0
 | 
			
		||||
# cperl-continued-brace-offset: 0
 | 
			
		||||
# cperl-label-offset: -2
 | 
			
		||||
# cperl-extra-newline-before-brace: t
 | 
			
		||||
# cperl-merge-trailing-else: nil
 | 
			
		||||
# cperl-continued-statement-offset: 2
 | 
			
		||||
# End:
 | 
			
		||||
@ -47,7 +47,7 @@ static const uint8_t special_ethaddr[ETH_ALEN] = {
 | 
			
		||||
 | 
			
		||||
u_int curtime;
 | 
			
		||||
 | 
			
		||||
static QTAILQ_HEAD(slirp_instances, Slirp) slirp_instances =
 | 
			
		||||
static QTAILQ_HEAD(, Slirp) slirp_instances =
 | 
			
		||||
    QTAILQ_HEAD_INITIALIZER(slirp_instances);
 | 
			
		||||
 | 
			
		||||
static struct in_addr dns_addr;
 | 
			
		||||
 | 
			
		||||
@ -206,7 +206,7 @@ typedef struct KVMDevice {
 | 
			
		||||
    int dev_fd;
 | 
			
		||||
} KVMDevice;
 | 
			
		||||
 | 
			
		||||
static QSLIST_HEAD(kvm_devices_head, KVMDevice) kvm_devices_head;
 | 
			
		||||
static QSLIST_HEAD(, KVMDevice) kvm_devices_head;
 | 
			
		||||
 | 
			
		||||
static void kvm_arm_devlistener_add(MemoryListener *listener,
 | 
			
		||||
                                    MemoryRegionSection *section)
 | 
			
		||||
 | 
			
		||||
@ -12,10 +12,10 @@ obj-$(call lnot,$(CONFIG_HYPERV)) += hyperv-stub.o
 | 
			
		||||
ifeq ($(CONFIG_WIN32),y)
 | 
			
		||||
obj-$(CONFIG_HAX) += hax-all.o hax-mem.o hax-windows.o
 | 
			
		||||
endif
 | 
			
		||||
ifeq ($(CONFIG_DARWIN),y)
 | 
			
		||||
obj-$(CONFIG_HAX) += hax-all.o hax-mem.o hax-darwin.o
 | 
			
		||||
obj-$(CONFIG_HVF) += hvf/
 | 
			
		||||
ifeq ($(CONFIG_POSIX),y)
 | 
			
		||||
obj-$(CONFIG_HAX) += hax-all.o hax-mem.o hax-posix.o
 | 
			
		||||
endif
 | 
			
		||||
obj-$(CONFIG_HVF) += hvf/
 | 
			
		||||
obj-$(CONFIG_WHPX) += whpx-all.o
 | 
			
		||||
endif
 | 
			
		||||
obj-$(CONFIG_SEV) += sev.o
 | 
			
		||||
 | 
			
		||||
@ -16,7 +16,7 @@
 | 
			
		||||
#include "cpu.h"
 | 
			
		||||
#include "sysemu/hax.h"
 | 
			
		||||
 | 
			
		||||
#ifdef CONFIG_DARWIN
 | 
			
		||||
#ifdef CONFIG_POSIX
 | 
			
		||||
typedef int hax_fd;
 | 
			
		||||
#endif
 | 
			
		||||
 | 
			
		||||
@ -82,8 +82,8 @@ hax_fd hax_mod_open(void);
 | 
			
		||||
void hax_memory_init(void);
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
#ifdef CONFIG_DARWIN
 | 
			
		||||
#include "target/i386/hax-darwin.h"
 | 
			
		||||
#ifdef CONFIG_POSIX
 | 
			
		||||
#include "target/i386/hax-posix.h"
 | 
			
		||||
#endif
 | 
			
		||||
 | 
			
		||||
#ifdef CONFIG_WIN32
 | 
			
		||||
 | 
			
		||||
@ -56,7 +56,7 @@ typedef struct HAXMapping {
 | 
			
		||||
 * send to the kernel only the removal of the pages from the MMIO hole after
 | 
			
		||||
 * having computed locally the result of the deletion and additions.
 | 
			
		||||
 */
 | 
			
		||||
static QTAILQ_HEAD(HAXMappingListHead, HAXMapping) mappings =
 | 
			
		||||
static QTAILQ_HEAD(, HAXMapping) mappings =
 | 
			
		||||
    QTAILQ_HEAD_INITIALIZER(mappings);
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
 | 
			
		||||
@ -2319,7 +2319,7 @@ static void reachable_code_pass(TCGContext *s)
 | 
			
		||||
                 * wait until the dead code in between them was removed.
 | 
			
		||||
                 */
 | 
			
		||||
                if (label->refs == 1) {
 | 
			
		||||
                    TCGOp *op_prev = QTAILQ_PREV(op, TCGOpHead, link);
 | 
			
		||||
                    TCGOp *op_prev = QTAILQ_PREV(op, link);
 | 
			
		||||
                    if (op_prev->opc == INDEX_op_br &&
 | 
			
		||||
                        label == arg_label(op_prev->args[0])) {
 | 
			
		||||
                        tcg_op_remove(s, op_prev);
 | 
			
		||||
@ -2481,7 +2481,7 @@ static void liveness_pass_1(TCGContext *s)
 | 
			
		||||
    /* ??? Should be redundant with the exit_tb that ends the TB.  */
 | 
			
		||||
    la_func_end(s, nb_globals, nb_temps);
 | 
			
		||||
 | 
			
		||||
    QTAILQ_FOREACH_REVERSE_SAFE(op, &s->ops, TCGOpHead, link, op_prev) {
 | 
			
		||||
    QTAILQ_FOREACH_REVERSE_SAFE(op, &s->ops, link, op_prev) {
 | 
			
		||||
        int nb_iargs, nb_oargs;
 | 
			
		||||
        TCGOpcode opc_new, opc_new2;
 | 
			
		||||
        bool have_opc_new2;
 | 
			
		||||
 | 
			
		||||
@ -708,7 +708,7 @@ struct TCGContext {
 | 
			
		||||
 | 
			
		||||
    /* These structures are private to tcg-target.inc.c.  */
 | 
			
		||||
#ifdef TCG_TARGET_NEED_LDST_LABELS
 | 
			
		||||
    QSIMPLEQ_HEAD(ldst_labels, TCGLabelQemuLdst) ldst_labels;
 | 
			
		||||
    QSIMPLEQ_HEAD(, TCGLabelQemuLdst) ldst_labels;
 | 
			
		||||
#endif
 | 
			
		||||
#ifdef TCG_TARGET_NEED_POOL_LABELS
 | 
			
		||||
    struct TCGLabelPoolData *pool_labels;
 | 
			
		||||
@ -719,7 +719,7 @@ struct TCGContext {
 | 
			
		||||
    TCGTempSet free_temps[TCG_TYPE_COUNT * 2];
 | 
			
		||||
    TCGTemp temps[TCG_MAX_TEMPS]; /* globals first, temps after */
 | 
			
		||||
 | 
			
		||||
    QTAILQ_HEAD(TCGOpHead, TCGOp) ops, free_ops;
 | 
			
		||||
    QTAILQ_HEAD(, TCGOp) ops, free_ops;
 | 
			
		||||
 | 
			
		||||
    /* Tells which temporary holds a given register.
 | 
			
		||||
       It does not take into account fixed registers */
 | 
			
		||||
@ -847,7 +847,7 @@ static inline void tcg_set_insn_start_param(TCGOp *op, int arg, target_ulong v)
 | 
			
		||||
/* The last op that was emitted.  */
 | 
			
		||||
static inline TCGOp *tcg_last_op(void)
 | 
			
		||||
{
 | 
			
		||||
    return QTAILQ_LAST(&tcg_ctx->ops, TCGOpHead);
 | 
			
		||||
    return QTAILQ_LAST(&tcg_ctx->ops);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
/* Test for whether to terminate the TB for using too many opcodes.  */
 | 
			
		||||
 | 
			
		||||
@ -810,41 +810,68 @@ tests/test-qga$(EXESUF): qemu-ga$(EXESUF)
 | 
			
		||||
tests/test-qga$(EXESUF): tests/test-qga.o $(qtest-obj-y)
 | 
			
		||||
 | 
			
		||||
SPEED = quick
 | 
			
		||||
GTESTER_OPTIONS = -k $(if $(V),--verbose,-q)
 | 
			
		||||
GCOV_OPTIONS = -n $(if $(V),-f,)
 | 
			
		||||
 | 
			
		||||
# gtester tests, possibly with verbose output
 | 
			
		||||
# do_test_tap runs all tests, even if some of them fail, while do_test_human
 | 
			
		||||
# stops at the first failure unless -k is given on the command line
 | 
			
		||||
 | 
			
		||||
define do_test_human_k
 | 
			
		||||
        $(quiet-@)rc=0; $(foreach COMMAND, $1, \
 | 
			
		||||
          $(call quiet-command-run, \
 | 
			
		||||
            export MALLOC_PERTURB_=$${MALLOC_PERTURB_:-$$(( $${RANDOM:-0} % 255 + 1))} $2; \
 | 
			
		||||
              $(COMMAND) -m=$(SPEED) -k --tap < /dev/null \
 | 
			
		||||
              | ./scripts/tap-driver.pl --test-name="$(notdir $(COMMAND))" $(if $(V),, --show-failures-only) \
 | 
			
		||||
              || rc=$$?;, "TEST", "$@: $(COMMAND)")) exit $$rc
 | 
			
		||||
endef
 | 
			
		||||
define do_test_human_no_k
 | 
			
		||||
        $(foreach COMMAND, $1, \
 | 
			
		||||
          $(call quiet-command, \
 | 
			
		||||
            MALLOC_PERTURB_=$${MALLOC_PERTURB_:-$$(( $${RANDOM:-0} % 255 + 1))} $2 \
 | 
			
		||||
              $(COMMAND) -m=$(SPEED) -k --tap < /dev/null \
 | 
			
		||||
              | ./scripts/tap-driver.pl --test-name="$(notdir $(COMMAND))" $(if $(V),, --show-failures-only), \
 | 
			
		||||
              "TEST", "$@: $(COMMAND)")
 | 
			
		||||
)
 | 
			
		||||
endef
 | 
			
		||||
do_test_human = \
 | 
			
		||||
        $(if $(findstring k, $(MAKEFLAGS)), $(do_test_human_k), $(do_test_human_no_k))
 | 
			
		||||
 | 
			
		||||
define do_test_tap
 | 
			
		||||
	$(call quiet-command, \
 | 
			
		||||
          { export MALLOC_PERTURB_=$${MALLOC_PERTURB_:-$$(( $${RANDOM:-0} % 255 + 1))} $2; \
 | 
			
		||||
            $(foreach COMMAND, $1, \
 | 
			
		||||
	      $(COMMAND) -m=$(SPEED) -k --tap < /dev/null \
 | 
			
		||||
	      | sed "s/^[a-z][a-z]* [0-9]* /&$(notdir $(COMMAND)) /" || true; ) } \
 | 
			
		||||
	      | ./scripts/tap-merge.pl | tee "$@" \
 | 
			
		||||
	      | ./scripts/tap-driver.pl $(if $(V),, --show-failures-only), \
 | 
			
		||||
	  "TAP","$@")
 | 
			
		||||
endef
 | 
			
		||||
 | 
			
		||||
.PHONY: $(patsubst %, check-qtest-%, $(QTEST_TARGETS))
 | 
			
		||||
$(patsubst %, check-qtest-%, $(QTEST_TARGETS)): check-qtest-%: subdir-%-softmmu $(check-qtest-y)
 | 
			
		||||
	$(call quiet-command,QTEST_QEMU_BINARY=$*-softmmu/qemu-system-$* \
 | 
			
		||||
		QTEST_QEMU_IMG=qemu-img$(EXESUF) \
 | 
			
		||||
		MALLOC_PERTURB_=$${MALLOC_PERTURB_:-$$(( $${RANDOM:-0} % 255 + 1))} \
 | 
			
		||||
		gtester $(GTESTER_OPTIONS) -m=$(SPEED) $(check-qtest-$*-y) $(check-qtest-generic-y),"GTESTER","$@")
 | 
			
		||||
	$(call do_test_human,$(check-qtest-$*-y) $(check-qtest-generic-y), \
 | 
			
		||||
	  QTEST_QEMU_BINARY=$*-softmmu/qemu-system-$* \
 | 
			
		||||
	  QTEST_QEMU_IMG=qemu-img$(EXESUF))
 | 
			
		||||
 | 
			
		||||
.PHONY: $(patsubst %, check-%, $(check-unit-y) $(check-speed-y))
 | 
			
		||||
$(patsubst %, check-%, $(check-unit-y) $(check-speed-y)): check-%: %
 | 
			
		||||
	$(call quiet-command, \
 | 
			
		||||
		MALLOC_PERTURB_=$${MALLOC_PERTURB_:-$$(( $${RANDOM:-0} % 255 + 1))} \
 | 
			
		||||
		gtester $(GTESTER_OPTIONS) -m=$(SPEED) $*,"GTESTER","$*")
 | 
			
		||||
check-unit: $(check-unit-y)
 | 
			
		||||
	$(call do_test_human, $^)
 | 
			
		||||
 | 
			
		||||
# gtester tests with XML output
 | 
			
		||||
check-speed: $(check-speed-y)
 | 
			
		||||
	$(call do_test_human, $^)
 | 
			
		||||
 | 
			
		||||
$(patsubst %, check-report-qtest-%.xml, $(QTEST_TARGETS)): check-report-qtest-%.xml: $(check-qtest-y)
 | 
			
		||||
	$(call quiet-command,QTEST_QEMU_BINARY=$*-softmmu/qemu-system-$* \
 | 
			
		||||
		QTEST_QEMU_IMG=qemu-img$(EXESUF) \
 | 
			
		||||
	  gtester -q $(GTESTER_OPTIONS) -o $@ -m=$(SPEED) $(check-qtest-$*-y) $(check-qtest-generic-y),"GTESTER","$@")
 | 
			
		||||
# gtester tests with TAP output
 | 
			
		||||
 | 
			
		||||
check-report-unit.xml: $(check-unit-y)
 | 
			
		||||
	$(call quiet-command,gtester -q $(GTESTER_OPTIONS) -o $@ -m=$(SPEED) $^,"GTESTER","$@")
 | 
			
		||||
$(patsubst %, check-report-qtest-%.tap, $(QTEST_TARGETS)): check-report-qtest-%.tap: $(check-qtest-y)
 | 
			
		||||
	$(call do_test_tap, $(check-qtest-$*-y) $(check-qtest-generic-y), \
 | 
			
		||||
	  QTEST_QEMU_BINARY=$*-softmmu/qemu-system-$* \
 | 
			
		||||
	  QTEST_QEMU_IMG=qemu-img$(EXESUF))
 | 
			
		||||
 | 
			
		||||
check-report-unit.tap: $(check-unit-y)
 | 
			
		||||
	$(call do_test_tap,$^)
 | 
			
		||||
 | 
			
		||||
# Reports and overall runs
 | 
			
		||||
 | 
			
		||||
check-report.xml: $(patsubst %,check-report-qtest-%.xml, $(QTEST_TARGETS)) check-report-unit.xml
 | 
			
		||||
	$(call quiet-command,$(SRC_PATH)/scripts/gtester-cat $^ > $@,"GEN","$@")
 | 
			
		||||
 | 
			
		||||
check-report.html: check-report.xml
 | 
			
		||||
	$(call quiet-command,gtester-report $< > $@,"GEN","$@")
 | 
			
		||||
check-report.tap: $(patsubst %,check-report-qtest-%.tap, $(QTEST_TARGETS)) check-report-unit.tap
 | 
			
		||||
	$(call quiet-command,./scripts/tap-merge.py $^ > $@,"GEN","$@")
 | 
			
		||||
 | 
			
		||||
# Per guest TCG tests
 | 
			
		||||
 | 
			
		||||
@ -959,8 +986,6 @@ check-acceptance: check-venv $(TESTS_RESULTS_DIR)
 | 
			
		||||
.PHONY: check-qapi-schema check-qtest check-unit check check-clean
 | 
			
		||||
check-qapi-schema: $(patsubst %,check-%, $(check-qapi-schema-y)) check-tests/qapi-schema/doc-good.texi
 | 
			
		||||
check-qtest: $(patsubst %,check-qtest-%, $(QTEST_TARGETS))
 | 
			
		||||
check-unit: $(patsubst %,check-%, $(check-unit-y))
 | 
			
		||||
check-speed: $(patsubst %,check-%, $(check-speed-y))
 | 
			
		||||
check-block: $(patsubst %,check-%, $(check-block-y))
 | 
			
		||||
check: check-qapi-schema check-unit check-qtest check-decodetree
 | 
			
		||||
check-clean:
 | 
			
		||||
 | 
			
		||||
@ -169,7 +169,7 @@ int main(int argc, char **argv)
 | 
			
		||||
 | 
			
		||||
    if (exec_genisoimg(genisocheck)) {
 | 
			
		||||
        /* genisoimage not available - so can't run tests */
 | 
			
		||||
        return 0;
 | 
			
		||||
        return g_test_run();
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    ret = prepare_image(arch, isoimage);
 | 
			
		||||
 | 
			
		||||
@ -22,6 +22,7 @@ ENV PACKAGES \
 | 
			
		||||
    mesa-libEGL-devel \
 | 
			
		||||
    mesa-libgbm-devel \
 | 
			
		||||
    nettle-devel \
 | 
			
		||||
    perl-Test-Harness \
 | 
			
		||||
    pixman-devel \
 | 
			
		||||
    SDL-devel \
 | 
			
		||||
    spice-glib-devel \
 | 
			
		||||
 | 
			
		||||
@ -70,6 +70,7 @@ ENV PACKAGES \
 | 
			
		||||
    nss-devel \
 | 
			
		||||
    numactl-devel \
 | 
			
		||||
    perl \
 | 
			
		||||
    perl-Test-Harness \
 | 
			
		||||
    pixman-devel \
 | 
			
		||||
    python3 \
 | 
			
		||||
    PyYAML \
 | 
			
		||||
 | 
			
		||||
@ -492,7 +492,7 @@ int main(int argc, char **argv)
 | 
			
		||||
    /* shm */
 | 
			
		||||
    tmpshm = mktempshm(TMPSHMSIZE, &fd);
 | 
			
		||||
    if (!tmpshm) {
 | 
			
		||||
        return 0;
 | 
			
		||||
        goto out;
 | 
			
		||||
    }
 | 
			
		||||
    tmpshmem = mmap(0, TMPSHMSIZE, PROT_READ|PROT_WRITE, MAP_SHARED, fd, 0);
 | 
			
		||||
    g_assert(tmpshmem != MAP_FAILED);
 | 
			
		||||
@ -514,9 +514,8 @@ int main(int argc, char **argv)
 | 
			
		||||
        }
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
out:
 | 
			
		||||
    ret = g_test_run();
 | 
			
		||||
 | 
			
		||||
    cleanup();
 | 
			
		||||
 | 
			
		||||
    return ret;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
@ -104,7 +104,7 @@ static void mlist_coalesce(MemList *head, MemBlock *node)
 | 
			
		||||
 | 
			
		||||
    do {
 | 
			
		||||
        merge = 0;
 | 
			
		||||
        left = QTAILQ_PREV(node, MemList, MLIST_ENTNAME);
 | 
			
		||||
        left = QTAILQ_PREV(node, MLIST_ENTNAME);
 | 
			
		||||
        right = QTAILQ_NEXT(node, MLIST_ENTNAME);
 | 
			
		||||
 | 
			
		||||
        /* clowns to the left of me */
 | 
			
		||||
 | 
			
		||||
@ -789,7 +789,7 @@ int main(int argc, char **argv)
 | 
			
		||||
    g_test_init(&argc, &argv, NULL);
 | 
			
		||||
 | 
			
		||||
    if (!ufd_version_check()) {
 | 
			
		||||
        return 0;
 | 
			
		||||
        return g_test_run();
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    /*
 | 
			
		||||
@ -800,7 +800,7 @@ int main(int argc, char **argv)
 | 
			
		||||
    if (g_str_equal(qtest_get_arch(), "ppc64") &&
 | 
			
		||||
        access("/sys/module/kvm_hv", F_OK)) {
 | 
			
		||||
        g_test_message("Skipping test: kvm_hv not available");
 | 
			
		||||
        return 0;
 | 
			
		||||
        return g_test_run();
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    /*
 | 
			
		||||
@ -811,11 +811,11 @@ int main(int argc, char **argv)
 | 
			
		||||
#if defined(HOST_S390X)
 | 
			
		||||
        if (access("/dev/kvm", R_OK | W_OK)) {
 | 
			
		||||
            g_test_message("Skipping test: kvm not available");
 | 
			
		||||
            return 0;
 | 
			
		||||
            return g_test_run();
 | 
			
		||||
        }
 | 
			
		||||
#else
 | 
			
		||||
        g_test_message("Skipping test: Need s390x host to work properly");
 | 
			
		||||
        return 0;
 | 
			
		||||
        return g_test_run();
 | 
			
		||||
#endif
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
@ -440,6 +440,7 @@ int main(int argc, char **argv)
 | 
			
		||||
#else
 | 
			
		||||
int main(int argc, char **argv)
 | 
			
		||||
{
 | 
			
		||||
    return 0;
 | 
			
		||||
    g_test_init(&argc, &argv, NULL);
 | 
			
		||||
    return g_test_run();
 | 
			
		||||
}
 | 
			
		||||
#endif
 | 
			
		||||
 | 
			
		||||
@ -108,7 +108,7 @@ static void reclaim_list_el(struct rcu_head *prcu)
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
#if TEST_LIST_TYPE == 1
 | 
			
		||||
static QLIST_HEAD(q_list_head, list_element) Q_list_head;
 | 
			
		||||
static QLIST_HEAD(, list_element) Q_list_head;
 | 
			
		||||
 | 
			
		||||
#define TEST_NAME "qlist"
 | 
			
		||||
#define TEST_LIST_REMOVE_RCU        QLIST_REMOVE_RCU
 | 
			
		||||
 | 
			
		||||
@ -630,7 +630,7 @@ struct TestQtailqElement {
 | 
			
		||||
 | 
			
		||||
typedef struct TestQtailq {
 | 
			
		||||
    int16_t  i16;
 | 
			
		||||
    QTAILQ_HEAD(TestQtailqHead, TestQtailqElement) q;
 | 
			
		||||
    QTAILQ_HEAD(, TestQtailqElement) q;
 | 
			
		||||
    int32_t  i32;
 | 
			
		||||
} TestQtailq;
 | 
			
		||||
 | 
			
		||||
@ -735,9 +735,9 @@ static void test_load_q(void)
 | 
			
		||||
    g_assert_cmpint(eof, ==, QEMU_VM_EOF);
 | 
			
		||||
 | 
			
		||||
    TestQtailqElement *qele_from = QTAILQ_FIRST(&obj_q.q);
 | 
			
		||||
    TestQtailqElement *qlast_from = QTAILQ_LAST(&obj_q.q, TestQtailqHead);
 | 
			
		||||
    TestQtailqElement *qlast_from = QTAILQ_LAST(&obj_q.q);
 | 
			
		||||
    TestQtailqElement *qele_to = QTAILQ_FIRST(&tgt.q);
 | 
			
		||||
    TestQtailqElement *qlast_to = QTAILQ_LAST(&tgt.q, TestQtailqHead);
 | 
			
		||||
    TestQtailqElement *qlast_to = QTAILQ_LAST(&tgt.q);
 | 
			
		||||
 | 
			
		||||
    while (1) {
 | 
			
		||||
        g_assert_cmpint(qele_to->b, ==, qele_from->b);
 | 
			
		||||
@ -755,7 +755,7 @@ static void test_load_q(void)
 | 
			
		||||
    /* clean up */
 | 
			
		||||
    TestQtailqElement *qele;
 | 
			
		||||
    while (!QTAILQ_EMPTY(&tgt.q)) {
 | 
			
		||||
        qele = QTAILQ_LAST(&tgt.q, TestQtailqHead);
 | 
			
		||||
        qele = QTAILQ_LAST(&tgt.q);
 | 
			
		||||
        QTAILQ_REMOVE(&tgt.q, qele, next);
 | 
			
		||||
        free(qele);
 | 
			
		||||
        qele = NULL;
 | 
			
		||||
 | 
			
		||||
@ -182,7 +182,7 @@ struct DisplayState {
 | 
			
		||||
 | 
			
		||||
static DisplayState *display_state;
 | 
			
		||||
static QemuConsole *active_console;
 | 
			
		||||
static QTAILQ_HEAD(consoles_head, QemuConsole) consoles =
 | 
			
		||||
static QTAILQ_HEAD(, QemuConsole) consoles =
 | 
			
		||||
    QTAILQ_HEAD_INITIALIZER(consoles);
 | 
			
		||||
static bool cursor_visible_phase;
 | 
			
		||||
static QEMUTimer *cursor_timer;
 | 
			
		||||
@ -1303,7 +1303,7 @@ static QemuConsole *new_console(DisplayState *ds, console_type_t console_type,
 | 
			
		||||
        s->index = 0;
 | 
			
		||||
        QTAILQ_INSERT_TAIL(&consoles, s, next);
 | 
			
		||||
    } else if (console_type != GRAPHIC_CONSOLE || qdev_hotplug) {
 | 
			
		||||
        QemuConsole *last = QTAILQ_LAST(&consoles, consoles_head);
 | 
			
		||||
        QemuConsole *last = QTAILQ_LAST(&consoles);
 | 
			
		||||
        s->index = last->index + 1;
 | 
			
		||||
        QTAILQ_INSERT_TAIL(&consoles, s, next);
 | 
			
		||||
    } else {
 | 
			
		||||
 | 
			
		||||
							
								
								
									
										14
									
								
								ui/input.c
									
									
									
									
									
								
							
							
						
						
									
										14
									
								
								ui/input.c
									
									
									
									
									
								
							@ -19,6 +19,9 @@ struct QemuInputHandlerState {
 | 
			
		||||
};
 | 
			
		||||
 | 
			
		||||
typedef struct QemuInputEventQueue QemuInputEventQueue;
 | 
			
		||||
typedef QTAILQ_HEAD(QemuInputEventQueueHead, QemuInputEventQueue)
 | 
			
		||||
    QemuInputEventQueueHead;
 | 
			
		||||
 | 
			
		||||
struct QemuInputEventQueue {
 | 
			
		||||
    enum {
 | 
			
		||||
        QEMU_INPUT_QUEUE_DELAY = 1,
 | 
			
		||||
@ -37,8 +40,7 @@ static QTAILQ_HEAD(, QemuInputHandlerState) handlers =
 | 
			
		||||
static NotifierList mouse_mode_notifiers =
 | 
			
		||||
    NOTIFIER_LIST_INITIALIZER(mouse_mode_notifiers);
 | 
			
		||||
 | 
			
		||||
static QTAILQ_HEAD(QemuInputEventQueueHead, QemuInputEventQueue) kbd_queue =
 | 
			
		||||
    QTAILQ_HEAD_INITIALIZER(kbd_queue);
 | 
			
		||||
static QemuInputEventQueueHead kbd_queue = QTAILQ_HEAD_INITIALIZER(kbd_queue);
 | 
			
		||||
static QEMUTimer *kbd_timer;
 | 
			
		||||
static uint32_t kbd_default_delay_ms = 10;
 | 
			
		||||
static uint32_t queue_count;
 | 
			
		||||
@ -257,7 +259,7 @@ static void qemu_input_event_trace(QemuConsole *src, InputEvent *evt)
 | 
			
		||||
 | 
			
		||||
static void qemu_input_queue_process(void *opaque)
 | 
			
		||||
{
 | 
			
		||||
    struct QemuInputEventQueueHead *queue = opaque;
 | 
			
		||||
    QemuInputEventQueueHead *queue = opaque;
 | 
			
		||||
    QemuInputEventQueue *item;
 | 
			
		||||
 | 
			
		||||
    g_assert(!QTAILQ_EMPTY(queue));
 | 
			
		||||
@ -288,7 +290,7 @@ static void qemu_input_queue_process(void *opaque)
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
static void qemu_input_queue_delay(struct QemuInputEventQueueHead *queue,
 | 
			
		||||
static void qemu_input_queue_delay(QemuInputEventQueueHead *queue,
 | 
			
		||||
                                   QEMUTimer *timer, uint32_t delay_ms)
 | 
			
		||||
{
 | 
			
		||||
    QemuInputEventQueue *item = g_new0(QemuInputEventQueue, 1);
 | 
			
		||||
@ -306,7 +308,7 @@ static void qemu_input_queue_delay(struct QemuInputEventQueueHead *queue,
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
static void qemu_input_queue_event(struct QemuInputEventQueueHead *queue,
 | 
			
		||||
static void qemu_input_queue_event(QemuInputEventQueueHead *queue,
 | 
			
		||||
                                   QemuConsole *src, InputEvent *evt)
 | 
			
		||||
{
 | 
			
		||||
    QemuInputEventQueue *item = g_new0(QemuInputEventQueue, 1);
 | 
			
		||||
@ -318,7 +320,7 @@ static void qemu_input_queue_event(struct QemuInputEventQueueHead *queue,
 | 
			
		||||
    queue_count++;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
static void qemu_input_queue_sync(struct QemuInputEventQueueHead *queue)
 | 
			
		||||
static void qemu_input_queue_sync(QemuInputEventQueueHead *queue)
 | 
			
		||||
{
 | 
			
		||||
    QemuInputEventQueue *item = g_new0(QemuInputEventQueue, 1);
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
@ -280,7 +280,7 @@ QemuOpt *qemu_opt_find(QemuOpts *opts, const char *name)
 | 
			
		||||
{
 | 
			
		||||
    QemuOpt *opt;
 | 
			
		||||
 | 
			
		||||
    QTAILQ_FOREACH_REVERSE(opt, &opts->head, QemuOptHead, next) {
 | 
			
		||||
    QTAILQ_FOREACH_REVERSE(opt, &opts->head, next) {
 | 
			
		||||
        if (strcmp(opt->name, name) != 0)
 | 
			
		||||
            continue;
 | 
			
		||||
        return opt;
 | 
			
		||||
@ -379,7 +379,7 @@ bool qemu_opt_has_help_opt(QemuOpts *opts)
 | 
			
		||||
{
 | 
			
		||||
    QemuOpt *opt;
 | 
			
		||||
 | 
			
		||||
    QTAILQ_FOREACH_REVERSE(opt, &opts->head, QemuOptHead, next) {
 | 
			
		||||
    QTAILQ_FOREACH_REVERSE(opt, &opts->head, next) {
 | 
			
		||||
        if (is_help_option(opt->name)) {
 | 
			
		||||
            return true;
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
@ -11,10 +11,6 @@
 | 
			
		||||
 *
 | 
			
		||||
 */
 | 
			
		||||
 | 
			
		||||
#ifndef _WIN32_WINNT
 | 
			
		||||
#define _WIN32_WINNT 0x0600
 | 
			
		||||
#endif
 | 
			
		||||
 | 
			
		||||
#include "qemu/osdep.h"
 | 
			
		||||
#include "qemu-common.h"
 | 
			
		||||
#include "qemu/thread.h"
 | 
			
		||||
 | 
			
		||||
Some files were not shown because too many files have changed in this diff Show More
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user