From patchwork Wed Dec 18 16:19:52 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kevin Wolf X-Patchwork-Id: 11301245 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id C3A0814E3 for ; Wed, 18 Dec 2019 16:23:13 +0000 (UTC) Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 9992F227BF for ; Wed, 18 Dec 2019 16:23:13 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b="ZDJcLCyh" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 9992F227BF Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=redhat.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Received: from localhost ([::1]:56742 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1ihc6S-0004IK-Kk for patchwork-qemu-devel@patchwork.kernel.org; Wed, 18 Dec 2019 11:23:12 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:53211) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1ihc3i-000061-Mr for qemu-devel@nongnu.org; Wed, 18 Dec 2019 11:20:24 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ihc3g-0004Vb-W8 for qemu-devel@nongnu.org; Wed, 18 Dec 2019 11:20:22 -0500 Received: from us-smtp-delivery-1.mimecast.com ([207.211.31.120]:32377 helo=us-smtp-1.mimecast.com) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1ihc3g-0004SO-On for qemu-devel@nongnu.org; Wed, 18 Dec 2019 11:20:20 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1576686020; 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=KNe1IMjIGmXeuqdnaC4u1N+/tCWcwT0DPZLrMAIe5Lo=; b=ZDJcLCyhem2KgrmZm1DA5sUAojdltwr7dtdD4+uxfDShqQ/2KjFgP0YQKjZsedQmt3DNe+ bv8KhJLfmfpLRbdsLWpukRm1aHPDZH3eoyyUdsjtN9xni4TSFzSVM1WEk+o104gjLH9M8G Gc9uVf7Dh5rUlRF477uEoiSir0Bvz9Q= Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-273-Z1S5wJneOYu0OKI4KTRKEQ-1; Wed, 18 Dec 2019 11:20:17 -0500 Received: from smtp.corp.redhat.com (int-mx07.intmail.prod.int.phx2.redhat.com [10.5.11.22]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 1795618B5FC4; Wed, 18 Dec 2019 16:20:16 +0000 (UTC) Received: from linux.fritz.box.com (ovpn-116-210.ams2.redhat.com [10.36.116.210]) by smtp.corp.redhat.com (Postfix) with ESMTP id 1AEA51000322; Wed, 18 Dec 2019 16:20:14 +0000 (UTC) From: Kevin Wolf To: qemu-block@nongnu.org Subject: [PATCH 4/4] monitor: Move qmp_query_qmp_schema to qmp-cmds-monitor.c Date: Wed, 18 Dec 2019 17:19:52 +0100 Message-Id: <20191218161952.10202-5-kwolf@redhat.com> In-Reply-To: <20191218161952.10202-1-kwolf@redhat.com> References: <20191218161952.10202-1-kwolf@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.84 on 10.5.11.22 X-MC-Unique: Z1S5wJneOYu0OKI4KTRKEQ-1 X-Mimecast-Spam-Score: 0 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 207.211.31.120 X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: kwolf@redhat.com, armbru@redhat.com, qemu-devel@nongnu.org Errors-To: qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Sender: "Qemu-devel" monitor/misc.c contains code that works only in the system emulator, so it can't be linked to tools like a storage daemon. In order to make schema introspection available for tools, move the function to monitor/qmp-cmds-monitor.c, which can be linked into the storage daemon. Signed-off-by: Kevin Wolf --- monitor/monitor-internal.h | 3 +++ monitor/misc.c | 16 ---------------- monitor/qmp-cmds-monitor.c | 16 ++++++++++++++++ 3 files changed, 19 insertions(+), 16 deletions(-) diff --git a/monitor/monitor-internal.h b/monitor/monitor-internal.h index 451aa64c1a..b91cb09ee5 100644 --- a/monitor/monitor-internal.h +++ b/monitor/monitor-internal.h @@ -180,4 +180,7 @@ void help_cmd(Monitor *mon, const char *name); void handle_hmp_command(MonitorHMP *mon, const char *cmdline); int hmp_compare_cmd(const char *name, const char *list); +void qmp_query_qmp_schema(QDict *qdict, QObject **ret_data, + Error **errp); + #endif diff --git a/monitor/misc.c b/monitor/misc.c index c647ba6313..54c89b9391 100644 --- a/monitor/misc.c +++ b/monitor/misc.c @@ -69,7 +69,6 @@ #include "qapi/qapi-commands.h" #include "qapi/error.h" #include "qapi/qmp-event.h" -#include "qapi/qapi-introspect.h" #include "sysemu/cpus.h" #include "qemu/cutils.h" #include "tcg/tcg.h" @@ -229,21 +228,6 @@ static void hmp_info_help(Monitor *mon, const QDict *qdict) help_cmd(mon, "info"); } -/* - * Minor hack: generated marshalling suppressed for this command - * ('gen': false in the schema) so we can parse the JSON string - * directly into QObject instead of first parsing it with - * visit_type_SchemaInfoList() into a SchemaInfoList, then marshal it - * to QObject with generated output marshallers, every time. Instead, - * we do it in test-qobject-input-visitor.c, just to make sure - * qapi-gen.py's output actually conforms to the schema. - */ -static void qmp_query_qmp_schema(QDict *qdict, QObject **ret_data, - Error **errp) -{ - *ret_data = qobject_from_qlit(&qmp_schema_qlit); -} - static void monitor_init_qmp_commands(void) { /* diff --git a/monitor/qmp-cmds-monitor.c b/monitor/qmp-cmds-monitor.c index acebfd3716..7215392f3e 100644 --- a/monitor/qmp-cmds-monitor.c +++ b/monitor/qmp-cmds-monitor.c @@ -29,6 +29,7 @@ #include "qapi/error.h" #include "qapi/qapi-commands-monitor.h" #include "qapi/qapi-emit-events.h" +#include "qapi/qapi-introspect.h" /* * Accept QMP capabilities in @list for @mon. @@ -151,3 +152,18 @@ EventInfoList *qmp_query_events(Error **errp) return ev_list; } + +/* + * Minor hack: generated marshalling suppressed for this command + * ('gen': false in the schema) so we can parse the JSON string + * directly into QObject instead of first parsing it with + * visit_type_SchemaInfoList() into a SchemaInfoList, then marshal it + * to QObject with generated output marshallers, every time. Instead, + * we do it in test-qobject-input-visitor.c, just to make sure + * qapi-gen.py's output actually conforms to the schema. + */ +void qmp_query_qmp_schema(QDict *qdict, QObject **ret_data, + Error **errp) +{ + *ret_data = qobject_from_qlit(&qmp_schema_qlit); +}