From nobody Fri Oct 24 21:57:28 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; 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 1518785045643462.6887557080256; Fri, 16 Feb 2018 04:44:05 -0800 (PST) Received: from localhost ([::1]:44484 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1emfMv-0008Fr-8w for importer@patchew.org; Fri, 16 Feb 2018 07:44:01 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:44305) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1emfHy-0004Ih-1v for qemu-devel@nongnu.org; Fri, 16 Feb 2018 07:38:55 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1emfHx-0003Y8-2m for qemu-devel@nongnu.org; Fri, 16 Feb 2018 07:38:54 -0500 Received: from mx3-rdu2.redhat.com ([66.187.233.73]:45242 helo=mx1.redhat.com) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1emfHw-0003Xv-Td for qemu-devel@nongnu.org; Fri, 16 Feb 2018 07:38:53 -0500 Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.rdu2.redhat.com [10.11.54.5]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 7D06984221; Fri, 16 Feb 2018 12:38:52 +0000 (UTC) Received: from dell-r430-03.lab.eng.brq.redhat.com (dell-r430-03.lab.eng.brq.redhat.com [10.37.153.18]) by smtp.corp.redhat.com (Postfix) with ESMTP id 3322BAF027; Fri, 16 Feb 2018 12:38:51 +0000 (UTC) From: Igor Mammedov To: qemu-devel@nongnu.org Date: Fri, 16 Feb 2018 13:37:14 +0100 Message-Id: <1518784641-43151-3-git-send-email-imammedo@redhat.com> In-Reply-To: <1518784641-43151-1-git-send-email-imammedo@redhat.com> References: <1518784641-43151-1-git-send-email-imammedo@redhat.com> X-Scanned-By: MIMEDefang 2.79 on 10.11.54.5 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.11.55.2]); Fri, 16 Feb 2018 12:38:52 +0000 (UTC) X-Greylist: inspected by milter-greylist-4.5.16 (mx1.redhat.com [10.11.55.2]); Fri, 16 Feb 2018 12:38:52 +0000 (UTC) for IP:'10.11.54.5' DOMAIN:'int-mx05.intmail.prod.int.rdu2.redhat.com' HELO:'smtp.corp.redhat.com' FROM:'imammedo@redhat.com' RCPT:'' X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 66.187.233.73 Subject: [Qemu-devel] [PATCH v3 2/9] numa: split out NumaOptions parsing into parse_NumaOptions() 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: peter.maydell@linaro.org, pkrempa@redhat.com, ehabkost@redhat.com, cohuck@redhat.com, armbru@redhat.com, pbonzini@redhat.com, david@gibson.dropbear.id.au Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" it will allow to reuse parse_NumaOptions() for parsing configuration commands received via QMP interface Signed-off-by: Igor Mammedov --- include/sysemu/numa.h | 1 + numa.c | 48 +++++++++++++++++++++++++++++------------------- 2 files changed, 30 insertions(+), 19 deletions(-) diff --git a/include/sysemu/numa.h b/include/sysemu/numa.h index 21713b7..7a0ae75 100644 --- a/include/sysemu/numa.h +++ b/include/sysemu/numa.h @@ -22,6 +22,7 @@ struct NumaNodeMem { }; =20 extern NodeInfo numa_info[MAX_NODES]; +int parse_numa(void *opaque, QemuOpts *opts, Error **errp); void parse_numa_opts(MachineState *ms); void numa_complete_configuration(MachineState *ms); void query_numa_node_mem(NumaNodeMem node_mem[]); diff --git a/numa.c b/numa.c index 1b2820a..04e34eb 100644 --- a/numa.c +++ b/numa.c @@ -169,28 +169,11 @@ static void parse_numa_distance(NumaDistOptions *dist= , Error **errp) have_numa_distance =3D true; } =20 -static int parse_numa(void *opaque, QemuOpts *opts, Error **errp) +static +void parse_NumaOptions(MachineState *ms, NumaOptions *object, Error **errp) { - NumaOptions *object =3D NULL; - MachineState *ms =3D opaque; Error *err =3D NULL; =20 - { - Visitor *v =3D opts_visitor_new(opts); - visit_type_NumaOptions(v, NULL, &object, &err); - visit_free(v); - } - - if (err) { - goto end; - } - - /* Fix up legacy suffix-less format */ - if ((object->type =3D=3D NUMA_OPTIONS_TYPE_NODE) && object->u.node.has= _mem) { - const char *mem_str =3D qemu_opt_get(opts, "mem"); - qemu_strtosz_MiB(mem_str, NULL, &object->u.node.mem); - } - switch (object->type) { case NUMA_OPTIONS_TYPE_NODE: parse_numa_node(ms, &object->u.node, &err); @@ -224,6 +207,33 @@ static int parse_numa(void *opaque, QemuOpts *opts, Er= ror **errp) } =20 end: + if (err) { + error_propagate(errp, err); + } +} + +int parse_numa(void *opaque, QemuOpts *opts, Error **errp) +{ + NumaOptions *object =3D NULL; + MachineState *ms =3D MACHINE(opaque); + Error *err =3D NULL; + Visitor *v =3D opts_visitor_new(opts); + + visit_type_NumaOptions(v, NULL, &object, &err); + visit_free(v); + if (err) { + goto end; + } + + /* Fix up legacy suffix-less format */ + if ((object->type =3D=3D NUMA_OPTIONS_TYPE_NODE) && object->u.node.has= _mem) { + const char *mem_str =3D qemu_opt_get(opts, "mem"); + qemu_strtosz_MiB(mem_str, NULL, &object->u.node.mem); + } + + parse_NumaOptions(ms, object, &err); + +end: qapi_free_NumaOptions(object); if (err) { error_report_err(err); --=20 2.7.4