From nobody Tue Feb 10 13:17:04 2026 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1660136692; cv=none; d=zohomail.com; s=zohoarc; b=cuKJkx0nmgjDfH67POlcR+4tro6XinLEdiiSixWiQtjgEyRQ/PcefTttrJLNu09BKJ6LUYbEAfNXcPKcBcZjFzQ3X/A1wFH7izz8jMc7qgSs5pw9mB/YSbpbHKD1ZrpKfIjY2hM8QOk49sz86ImedERT7GCisab/5mON7Rcv0mU= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1660136692; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=hrfDTuWUgST19eVeDMl7zAEG1isktyWLHIrGlJyRbsM=; b=PB3thlG2NhnXeI2OWT+Bj/pH9mvQBr7Rx6KBd7wc9CUndm5R2E630gzGQ9/uyXnNyCnpaIuAESYlPgg7mI1CIJgRBD4kX68IA970G8kCd/rtmpQ0Szeag5nBBIhofjJSzUJvwccxT6S5GGgtoAohoEAa9A6K306WqMPXnBL0v3k= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1660136692144482.5365000638293; Wed, 10 Aug 2022 06:04:52 -0700 (PDT) Received: from localhost ([::1]:43786 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1oLlOD-0008GL-0W for importer@patchew.org; Wed, 10 Aug 2022 09:04:50 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:46734) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1oLl9Z-0001go-AP for qemu-devel@nongnu.org; Wed, 10 Aug 2022 08:49:41 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.133.124]:41582) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1oLl9X-0007Rv-MW for qemu-devel@nongnu.org; Wed, 10 Aug 2022 08:49:41 -0400 Received: from mimecast-mx02.redhat.com (mx3-rdu2.redhat.com [66.187.233.73]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-552-TkR5iolJMRWwUe88HJSJbA-1; Wed, 10 Aug 2022 08:49:37 -0400 Received: from smtp.corp.redhat.com (int-mx09.intmail.prod.int.rdu2.redhat.com [10.11.54.9]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 19BC31C16B4B; Wed, 10 Aug 2022 12:49:37 +0000 (UTC) Received: from localhost (unknown [10.39.208.40]) by smtp.corp.redhat.com (Postfix) with ESMTP id E26C4492C3B; Wed, 10 Aug 2022 12:49:35 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1660135779; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=hrfDTuWUgST19eVeDMl7zAEG1isktyWLHIrGlJyRbsM=; b=hXLakgPI1WMnnB3KSpu+dZN61GYmhPDfA3b5XFDl64pZvoaY+EJ2AEnXBt/WrjMz3mFTaB XBqjrlywe3YtbXHkVAkNGqJIclfgysMs9Lvv0TmHh9OZ6adglN22IaJ4dXLSRp0LBlyrvJ RZU4V4Nt00ODZi5ofhpOdPQ8JIQ5ypQ= X-MC-Unique: TkR5iolJMRWwUe88HJSJbA-1 From: marcandre.lureau@redhat.com To: qemu-devel@nongnu.org Cc: Markus Armbruster , Peter Maydell , Cleber Rosa , Michael Roth , John Snow , Xie Yongji , Paolo Bonzini , =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= Subject: [PATCH v3 07/16] qapi: remove QEMU-specific monitor dependency from dispatch Date: Wed, 10 Aug 2022 16:48:48 +0400 Message-Id: <20220810124857.1360211-8-marcandre.lureau@redhat.com> In-Reply-To: <20220810124857.1360211-1-marcandre.lureau@redhat.com> References: <20220810124857.1360211-1-marcandre.lureau@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-Scanned-By: MIMEDefang 2.85 on 10.11.54.9 Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=170.10.133.124; envelope-from=marcandre.lureau@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -21 X-Spam_score: -2.2 X-Spam_bar: -- X-Spam_report: (-2.2 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.082, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 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: pass (identity @redhat.com) X-ZM-MESSAGEID: 1660136692581100001 From: Marc-Andr=C3=A9 Lureau The monitor is specific to QEMU. Instead of passing a Monitor type argument to the exec handler, use a generic void* pointer. This simplify also the unit dependency, as now the dispatching code is free from QEMU-specifics. Signed-off-by: Marc-Andr=C3=A9 Lureau --- include/qapi/qmp/dispatch.h | 5 ++--- monitor/qmp.c | 3 ++- qapi/qmp-dispatch.c | 4 ++-- stubs/qmp-dispatch-exec.c | 2 +- 4 files changed, 7 insertions(+), 7 deletions(-) diff --git a/include/qapi/qmp/dispatch.h b/include/qapi/qmp/dispatch.h index 6941a759a7..ee8a05015a 100644 --- a/include/qapi/qmp/dispatch.h +++ b/include/qapi/qmp/dispatch.h @@ -14,7 +14,6 @@ #ifndef QAPI_QMP_DISPATCH_H #define QAPI_QMP_DISPATCH_H =20 -#include "monitor/monitor.h" #include "qemu/queue.h" =20 typedef void (QmpCommandFunc)(QDict *, QObject **, Error **); @@ -41,7 +40,7 @@ typedef struct QmpCommand =20 typedef QTAILQ_HEAD(QmpCommandList, QmpCommand) QmpCommandList; =20 -void qmp_dispatch_exec(const QmpCommand *cmd, bool oob, Monitor *cur_mon, +void qmp_dispatch_exec(const QmpCommand *cmd, bool oob, void *exec_data, QDict *args, QObject **ret, Error **err); =20 void qmp_register_command(QmpCommandList *cmds, const char *name, @@ -59,7 +58,7 @@ const char *qmp_command_name(const QmpCommand *cmd); bool qmp_has_success_response(const QmpCommand *cmd); QDict *qmp_error_response(Error *err); QDict *qmp_dispatch(const QmpCommandList *cmds, QObject *request, - bool allow_oob, Monitor *cur_mon); + bool allow_oob, void *exec_data); bool qmp_is_oob(const QDict *dict); =20 typedef void (*qmp_cmd_callback_fn)(const QmpCommand *cmd, void *opaque); diff --git a/monitor/qmp.c b/monitor/qmp.c index b9b109a40a..4f0eb6e200 100644 --- a/monitor/qmp.c +++ b/monitor/qmp.c @@ -156,9 +156,10 @@ static void do_qmp_dispatch_bh(void *opaque) * Runs outside of coroutine context for OOB commands, but in coroutine * context for everything else. */ -void qmp_dispatch_exec(const QmpCommand *cmd, bool oob, Monitor *cur_mon, +void qmp_dispatch_exec(const QmpCommand *cmd, bool oob, void *exec_data, QDict *args, QObject **ret, Error **errp) { + Monitor *cur_mon =3D exec_data; assert(!(oob && qemu_in_coroutine())); assert(monitor_cur() =3D=3D NULL); =20 diff --git a/qapi/qmp-dispatch.c b/qapi/qmp-dispatch.c index bec07e4958..2fea789fd3 100644 --- a/qapi/qmp-dispatch.c +++ b/qapi/qmp-dispatch.c @@ -108,7 +108,7 @@ bool qmp_is_oob(const QDict *dict) } =20 QDict *qmp_dispatch(const QmpCommandList *cmds, QObject *request, - bool allow_oob, Monitor *cur_mon) + bool allow_oob, void *exec_data) { Error *err =3D NULL; bool oob; @@ -176,7 +176,7 @@ QDict *qmp_dispatch(const QmpCommandList *cmds, QObject= *request, qobject_ref(args); } =20 - qmp_dispatch_exec(cmd, oob, cur_mon, args, &ret, &err); + qmp_dispatch_exec(cmd, oob, exec_data, args, &ret, &err); =20 qobject_unref(args); if (err) { diff --git a/stubs/qmp-dispatch-exec.c b/stubs/qmp-dispatch-exec.c index 4aef28d198..4740f55222 100644 --- a/stubs/qmp-dispatch-exec.c +++ b/stubs/qmp-dispatch-exec.c @@ -1,7 +1,7 @@ #include "qemu/osdep.h" #include "qapi/qmp/dispatch.h" =20 -void qmp_dispatch_exec(const QmpCommand *cmd, bool oob, Monitor *cur_mon, +void qmp_dispatch_exec(const QmpCommand *cmd, bool oob, void *exec_data, QDict *args, QObject **ret, Error **err) { cmd->fn(args, ret, err); --=20 2.37.1