From nobody Fri Nov 7 00:44:59 2025 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) client-ip=208.118.235.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=redhat.com Return-Path: Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) by mx.zohomail.com with SMTPS id 1544629392430554.3082194691015; Wed, 12 Dec 2018 07:43:12 -0800 (PST) Received: from localhost ([::1]:45659 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gX6fH-0008B5-4y for importer@patchew.org; Wed, 12 Dec 2018 10:43:11 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:52390) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gX6Mc-0000tb-AZ for qemu-devel@nongnu.org; Wed, 12 Dec 2018 10:23:58 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1gX6MY-0000H1-Ti for qemu-devel@nongnu.org; Wed, 12 Dec 2018 10:23:54 -0500 Received: from mail-wm1-x32b.google.com ([2a00:1450:4864:20::32b]:50376) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1gX6MY-0000Ea-A7 for qemu-devel@nongnu.org; Wed, 12 Dec 2018 10:23:50 -0500 Received: by mail-wm1-x32b.google.com with SMTP id n190so6209731wmd.0 for ; Wed, 12 Dec 2018 07:23:49 -0800 (PST) Received: from 640k.lan ([93.56.166.5]) by smtp.gmail.com with ESMTPSA id u10sm15878859wrr.33.2018.12.12.07.23.47 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 12 Dec 2018 07:23:47 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:from:to:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=m+S9G74m3JSBEClKOiJM8gEL38X3fTn+quy9Nw7kZWA=; b=qRCdDvAgmqBp80tDq9nTY3cknh7Slw2GQmXGB68z9mtPzBi3rvpepXqCyusRCh2UYO zRKHBa47SNNISEZhM7KW+VWfgBV7uAwwod+VsIyp3i9oTX76lhdGIldcF3sThU0nvErZ 3wYnIgeupBd4iNF5V1GAgmM0Dwcpsb1rTdRbHEt3DXrFZbi6s31k5Gfzjtbt5iJ0wIxL Oq5kMt3GRf2hi/1koVtWxix2vSQ8PLW2jB3fL4pzxaQ8GDgqoy2v9XUNQCfRk6jd4ZQ0 S4vDvZkIAWV7P98EmfionysYyZEGN6eBZ0v3ps3dr4bZoQ3nbCHO7cG+z/DfXkwNd6fC WbdA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:from:to:subject:date:message-id :in-reply-to:references:mime-version:content-transfer-encoding; bh=m+S9G74m3JSBEClKOiJM8gEL38X3fTn+quy9Nw7kZWA=; b=UDjeR4AykpwNYEEsT6o77YKwiQFwS7kIh+ZbC7jQOdXyGhskgMTSEcDb7pf1wg2UYB GenQs67hXaGRBoKXuzEkebAdttAsrEgGAIcKvJ+Nj4d4mkyysX53BMCPpjeugLWMMe57 vXcB3u0b4xfX132awAAibk0BzJMSKYs8ABsTSZ8eHAa941q8d1sOma6vTLhGWkIfAVF7 fe9p3H1NYWgxBtI/XzGp5pI5UU/mV3biriwvQrufeE+BQOd8TU0o6YKPxiHhgVtEbIFB NFgGt1tXQ3/sz4Q+6s1WzcICEoI3ybO9cg5hgIOVds3LGhXcHvuZLSl4LtjwAAVNaakz VL6w== X-Gm-Message-State: AA+aEWbr/dNCY9jcFNrPC4djpaIN3W7HKULnAjRHPW/yp9T3cLptB6dT 78JEmpBNWR8KLfYPE6/2+kp98P2p X-Google-Smtp-Source: AFSGD/Vd5kLoXEfpW/ORhXCSGDYtbzECOryAHm5V9cLstrc+mT0pfc863ainONjYZtTfUHsxxW6zAQ== X-Received: by 2002:a1c:2d42:: with SMTP id t63mr7042897wmt.9.1544628228595; Wed, 12 Dec 2018 07:23:48 -0800 (PST) From: Paolo Bonzini To: qemu-devel@nongnu.org Date: Wed, 12 Dec 2018 16:22:49 +0100 Message-Id: <1544628195-37728-29-git-send-email-pbonzini@redhat.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1544628195-37728-1-git-send-email-pbonzini@redhat.com> References: <1544628195-37728-1-git-send-email-pbonzini@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2a00:1450:4864:20::32b Subject: [Qemu-devel] [PULL 28/54] qemu/queue.h: typedef QTAILQ heads X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) This will be needed when we change the QTAILQ head and elem structs to unions. However, it is also consistent with the usage elsewhere in QEMU for other list head structs (see for example FsMountList). Note that most QTAILQs only need their name in order to do backwards walks. Those do not break with the struct->union change, and anyway the change will also remove the need to name heads when doing backwards walks, so those are not touched here. Reviewed-by: Philippe Mathieu-Daud=C3=A9 Reviewed-by: Markus Armbruster Signed-off-by: Paolo Bonzini --- exec.c | 3 ++- hw/vfio/common.c | 2 +- include/hw/vfio/vfio-common.h | 3 ++- include/qom/cpu.h | 5 +++-- ui/input.c | 14 ++++++++------ 5 files changed, 16 insertions(+), 11 deletions(-) diff --git a/exec.c b/exec.c index b6b2007..a629c98 100644 --- a/exec.c +++ b/exec.c @@ -94,7 +94,8 @@ int target_page_bits; bool target_page_bits_decided; #endif =20 -struct CPUTailQ cpus =3D QTAILQ_HEAD_INITIALIZER(cpus); +CPUTailQ cpus =3D QTAILQ_HEAD_INITIALIZER(cpus); + /* current CPU in the current thread. It is only valid inside cpu_exec() */ __thread CPUState *current_cpu; diff --git a/hw/vfio/common.c b/hw/vfio/common.c index 7aa804e..4262b80 100644 --- a/hw/vfio/common.c +++ b/hw/vfio/common.c @@ -37,7 +37,7 @@ #include "trace.h" #include "qapi/error.h" =20 -struct vfio_group_head vfio_group_list =3D +VFIOGroupList vfio_group_list =3D QLIST_HEAD_INITIALIZER(vfio_group_list); static QLIST_HEAD(, VFIOAddressSpace) vfio_address_spaces =3D QLIST_HEAD_INITIALIZER(vfio_address_spaces); diff --git a/include/hw/vfio/vfio-common.h b/include/hw/vfio/vfio-common.h index 127ca47..7624c9f 100644 --- a/include/hw/vfio/vfio-common.h +++ b/include/hw/vfio/vfio-common.h @@ -180,7 +180,8 @@ int vfio_get_device(VFIOGroup *group, const char *name, VFIODevice *vbasedev, Error **errp); =20 extern const MemoryRegionOps vfio_region_ops; -extern QLIST_HEAD(vfio_group_head, VFIOGroup) vfio_group_list; +typedef QLIST_HEAD(VFIOGroupList, VFIOGroup) VFIOGroupList; +extern VFIOGroupList vfio_group_list; =20 #ifdef CONFIG_LINUX int vfio_get_region_info(VFIODevice *vbasedev, int index, diff --git a/include/qom/cpu.h b/include/qom/cpu.h index 62aef77..4662a20 100644 --- a/include/qom/cpu.h +++ b/include/qom/cpu.h @@ -435,8 +435,9 @@ struct CPUState { GArray *iommu_notifiers; }; =20 -QTAILQ_HEAD(CPUTailQ, CPUState); -extern struct CPUTailQ cpus; +typedef QTAILQ_HEAD(CPUTailQ, CPUState) CPUTailQ; +extern CPUTailQ cpus; + #define first_cpu QTAILQ_FIRST_RCU(&cpus) #define CPU_NEXT(cpu) QTAILQ_NEXT_RCU(cpu, node) #define CPU_FOREACH(cpu) QTAILQ_FOREACH_RCU(cpu, &cpus, node) diff --git a/ui/input.c b/ui/input.c index 7c9a410..35c7964 100644 --- a/ui/input.c +++ b/ui/input.c @@ -19,6 +19,9 @@ struct QemuInputHandlerState { }; =20 typedef struct QemuInputEventQueue QemuInputEventQueue; +typedef QTAILQ_HEAD(QemuInputEventQueueHead, QemuInputEventQueue) + QemuInputEventQueueHead; + struct QemuInputEventQueue { enum { QEMU_INPUT_QUEUE_DELAY =3D 1, @@ -37,8 +40,7 @@ static QTAILQ_HEAD(, QemuInputHandlerState) handlers =3D static NotifierList mouse_mode_notifiers =3D NOTIFIER_LIST_INITIALIZER(mouse_mode_notifiers); =20 -static QTAILQ_HEAD(QemuInputEventQueueHead, QemuInputEventQueue) kbd_queue= =3D - QTAILQ_HEAD_INITIALIZER(kbd_queue); +static QemuInputEventQueueHead kbd_queue =3D QTAILQ_HEAD_INITIALIZER(kbd_q= ueue); static QEMUTimer *kbd_timer; static uint32_t kbd_default_delay_ms =3D 10; static uint32_t queue_count; @@ -257,7 +259,7 @@ static void qemu_input_event_trace(QemuConsole *src, In= putEvent *evt) =20 static void qemu_input_queue_process(void *opaque) { - struct QemuInputEventQueueHead *queue =3D opaque; + QemuInputEventQueueHead *queue =3D opaque; QemuInputEventQueue *item; =20 g_assert(!QTAILQ_EMPTY(queue)); @@ -288,7 +290,7 @@ static void qemu_input_queue_process(void *opaque) } } =20 -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 =3D g_new0(QemuInputEventQueue, 1); @@ -306,7 +308,7 @@ static void qemu_input_queue_delay(struct QemuInputEven= tQueueHead *queue, } } =20 -static void qemu_input_queue_event(struct QemuInputEventQueueHead *queue, +static void qemu_input_queue_event(QemuInputEventQueueHead *queue, QemuConsole *src, InputEvent *evt) { QemuInputEventQueue *item =3D g_new0(QemuInputEventQueue, 1); @@ -318,7 +320,7 @@ static void qemu_input_queue_event(struct QemuInputEven= tQueueHead *queue, queue_count++; } =20 -static void qemu_input_queue_sync(struct QemuInputEventQueueHead *queue) +static void qemu_input_queue_sync(QemuInputEventQueueHead *queue) { QemuInputEventQueue *item =3D g_new0(QemuInputEventQueue, 1); =20 --=20 1.8.3.1