From nobody Tue Feb 10 15:46:11 2026 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.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; Authentication-Results: mx.zohomail.com; spf=pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1554826960; cv=none; d=zoho.com; s=zohoarc; b=SaIqtQsS3IWc5K9/uz2+5S9kquJClWNn2dc1FhODcVhkuP/m0vl7rV20N3tQrYFRvkqA5Z4jLvOeO4f+0BrM4DXIz3bLesh8gH8bUpSfZfWWuLkJhkFMknWvmqfMhnkaa8qyeNmEV9ryA6UNlEV1X9XsQ7EnYq+9FIT9FSnDsjk= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1554826960; 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:ARC-Authentication-Results; bh=sI4O5y9M0ZI/qza8XNPO8qWd8xo4e6MlNT/1WIYyUwk=; b=Nm5bIsewbgMUyiZOAVDHYsX7bYwvRAJWNhI/3gjLMv5yZDAaAZ2ilVWBRYbbeZh5BCJ6aHu66cyHdppXxXhsOZ64rO2RNxQzYaC45OpwshcjWRas/Tq1LyeFiZ1K4BSG2LUW2ThZvQU7ROn4M0doM3PKl09n84zM5LFe6aEnZfM= ARC-Authentication-Results: i=1; mx.zoho.com; spf=pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 155482696084890.51143612720023; Tue, 9 Apr 2019 09:22:40 -0700 (PDT) Received: from localhost ([127.0.0.1]:45794 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1hDtW9-0003X3-P8 for importer@patchew.org; Tue, 09 Apr 2019 12:22:37 -0400 Received: from eggs.gnu.org ([209.51.188.92]:55750) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1hDtLe-0003FI-8c for qemu-devel@nongnu.org; Tue, 09 Apr 2019 12:11:47 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1hDtLd-00057T-2x for qemu-devel@nongnu.org; Tue, 09 Apr 2019 12:11:46 -0400 Received: from mx1.redhat.com ([209.132.183.28]:50330) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1hDtLb-00055s-9B for qemu-devel@nongnu.org; Tue, 09 Apr 2019 12:11:43 -0400 Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.phx2.redhat.com [10.5.11.14]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 843B1308CF9A; Tue, 9 Apr 2019 16:11:42 +0000 (UTC) Received: from localhost (ovpn-112-27.ams2.redhat.com [10.36.112.27]) by smtp.corp.redhat.com (Postfix) with ESMTP id 1C0535D9C9; Tue, 9 Apr 2019 16:11:41 +0000 (UTC) From: =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= To: qemu-devel@nongnu.org Date: Tue, 9 Apr 2019 18:10:04 +0200 Message-Id: <20190409161009.6322-16-marcandre.lureau@redhat.com> In-Reply-To: <20190409161009.6322-1-marcandre.lureau@redhat.com> References: <20190409161009.6322-1-marcandre.lureau@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.14 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.44]); Tue, 09 Apr 2019 16:11:42 +0000 (UTC) Content-Transfer-Encoding: quoted-printable X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 209.132.183.28 Subject: [Qemu-devel] [PATCH v4 15/20] monitor: add qmp_return_get_monitor() 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: , Cc: Michael Roth , Markus Armbruster , Gerd Hoffmann , =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= , "Dr. David Alan Gilbert" Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" Content-Type: text/plain; charset="utf-8" If necessary, add an helper that can be used to retrieve the associated monitor. This is useful for asynchronous commands that may have to update cur_mon for various reasons. Signed-off-by: Marc-Andr=C3=A9 Lureau --- include/monitor/monitor.h | 3 +++ monitor.c | 6 ++++++ 2 files changed, 9 insertions(+) diff --git a/include/monitor/monitor.h b/include/monitor/monitor.h index c1b40a9cac..5f25cd2616 100644 --- a/include/monitor/monitor.h +++ b/include/monitor/monitor.h @@ -5,6 +5,7 @@ #include "block/block.h" #include "qapi/qapi-types-misc.h" #include "qemu/readline.h" +#include "qapi/qmp/dispatch.h" =20 extern __thread Monitor *cur_mon; =20 @@ -51,4 +52,6 @@ int monitor_fdset_dup_fd_find(int dup_fd); void monitor_vfprintf(FILE *stream, const char *fmt, va_list ap) GCC_FMT_ATTR(2, 0); =20 +Monitor *qmp_return_get_monitor(QmpReturn *qret); + #endif /* MONITOR_H */ diff --git a/monitor.c b/monitor.c index b1c4647a37..76bc2f8c7c 100644 --- a/monitor.c +++ b/monitor.c @@ -324,6 +324,12 @@ bool monitor_cur_is_qmp(void) return cur_mon && monitor_is_qmp(cur_mon); } =20 +Monitor *qmp_return_get_monitor(QmpReturn *qret) +{ + return qret->session ? + container_of(qret->session, Monitor, qmp.session) : NULL; +} + void monitor_read_command(Monitor *mon, int show_prompt) { if (!mon->rs) --=20 2.21.0.196.g041f5ea1cf