From nobody Sun Feb 8 11:25:52 2026 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 216.205.24.124 as permitted sender) client-ip=216.205.24.124; envelope-from=libvir-list-bounces@redhat.com; helo=us-smtp-delivery-124.mimecast.com; Authentication-Results: mx.zohomail.com; spf=pass (zohomail.com: domain of redhat.com designates 216.205.24.124 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=fail(p=none dis=none) header.from=gmail.com ARC-Seal: i=1; a=rsa-sha256; t=1599078378; cv=none; d=zohomail.com; s=zohoarc; b=PgVX6+KacxJCD7MERksSFClpbK8vkDk5c6ZNisXPczQ+IZSeVTe5QPJGdSEIO72YJt6wjhjNo08UL+YWh4eACS7UJjfPYpMeBbNiSZNlM5k5OChe79ClEmrdKO9kQ1m1lVTq0h9mPRe25oIJf/7S3mjyK5dvMAsnQrsEn2qZVPY= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1599078378; 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=yRdZyxjDWYtD0FtqrXVqzpxd2FgXvPr8ikkPj54gjBU=; b=WejxsDKb3CXWTDH91t6MKvuamsRWQ+EcdAIYL2SFKs0y3T3TdKoRlcR2ubvZyMoZPJ7PMadCZ+TjZRnsLrvhV/OXhnkybq/VMzHbCAAA8Rdugdjj3Eh/ZE4L8RBJGs6GxfeoEFAsD/DMamIguDMLfEtj6WziGSHjXxTtBVGL4Jo= ARC-Authentication-Results: i=1; mx.zohomail.com; spf=pass (zohomail.com: domain of redhat.com designates 216.205.24.124 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=fail header.from= (p=none dis=none) header.from= Return-Path: Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [216.205.24.124]) by mx.zohomail.com with SMTPS id 1599078378433457.5254217760337; Wed, 2 Sep 2020 13:26:18 -0700 (PDT) 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-201-MgM75iRgNcGgRRAEj8hSOg-1; Wed, 02 Sep 2020 16:26:13 -0400 Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.phx2.redhat.com [10.5.11.15]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id ED6181DE18; Wed, 2 Sep 2020 20:26:07 +0000 (UTC) Received: from colo-mx.corp.redhat.com (colo-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.21]) by smtp.corp.redhat.com (Postfix) with ESMTPS id B9E8778B20; Wed, 2 Sep 2020 20:26:07 +0000 (UTC) Received: from lists01.pubmisc.prod.ext.phx2.redhat.com (lists01.pubmisc.prod.ext.phx2.redhat.com [10.5.19.33]) by colo-mx.corp.redhat.com (Postfix) with ESMTP id CAA2C79DA2; Wed, 2 Sep 2020 20:26:06 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.rdu2.redhat.com [10.11.54.4]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 082KQ4ii002772 for ; Wed, 2 Sep 2020 16:26:04 -0400 Received: by smtp.corp.redhat.com (Postfix) id 78120200AD55; Wed, 2 Sep 2020 20:26:04 +0000 (UTC) Received: from mimecast-mx02.redhat.com (mimecast06.extmail.prod.ext.rdu2.redhat.com [10.11.55.22]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 736532028DC0 for ; Wed, 2 Sep 2020 20:26:04 +0000 (UTC) Received: from us-smtp-1.mimecast.com (us-smtp-delivery-1.mimecast.com [205.139.110.120]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-SHA384 (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 5A73718AE948 for ; Wed, 2 Sep 2020 20:26:04 +0000 (UTC) Received: from mail-qk1-f195.google.com (mail-qk1-f195.google.com [209.85.222.195]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-350-8wS9N0ztMKWQCuL34s9Asw-1; Wed, 02 Sep 2020 16:26:02 -0400 Received: by mail-qk1-f195.google.com with SMTP id o64so970960qkb.10 for ; Wed, 02 Sep 2020 13:26:02 -0700 (PDT) Received: from rekt.ibmuc.com ([2804:431:c7c7:d5bb:61e:5265:e62b:1233]) by smtp.gmail.com with ESMTPSA id b187sm547176qkd.107.2020.09.02.13.26.00 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 02 Sep 2020 13:26:01 -0700 (PDT) X-MC-Unique: MgM75iRgNcGgRRAEj8hSOg-1 X-MC-Unique: 8wS9N0ztMKWQCuL34s9Asw-1 X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=yRdZyxjDWYtD0FtqrXVqzpxd2FgXvPr8ikkPj54gjBU=; b=JXrX9ACvVr9/9UdAUyfS5/9+mNd54uOFkMSdNixecb5y+z6ytSudPF5OPUadBchrk4 U3R7deP1y783jmq4YNUSV8FLJ3NtyHcZwprDqdqrP48GRVquSeM4iEAtQ0N3F2VWV+Ck c0Izta4ZnzIvYWTurtmy2E8pLi/ONxqKCCx6vPEDT5uz/A3/docPCjIzadMJxifIu9uw O0QlyCADu1tyweqSvUaiiGQ3Ye9Is6Kok74TGzDXkJRKAIhvfjrefkgHKnLbQYb274gv 7f7sgmH1Cs985L0EPG0at3tgAjQ+rAWu853gww8K0ohAw4XlZVQ/FOwmFhy2JPgjiISo YClQ== X-Gm-Message-State: AOAM531V5eiRPtwdLsn9iON9Q5bVwoeMBUqaZ27Rub0CoF0hOA5xTo6a NPNXeGExn4gVFXVe070Z5yTgiXZEy5u7fA== X-Google-Smtp-Source: ABdhPJzTzP5G0kRVYPEQYUSwVjNZSAZUScdeWs+TKPZKsv1tReGT+K59wyzj2qwe6cg6O6L2fq83xw== X-Received: by 2002:a37:6f41:: with SMTP id k62mr8176979qkc.241.1599078361476; Wed, 02 Sep 2020 13:26:01 -0700 (PDT) From: Daniel Henrique Barboza To: libvir-list@redhat.com Subject: [PATCH 04/12] cpu_ppc64.c: use typedefs for 'struct ppc64_model' Date: Wed, 2 Sep 2020 17:25:38 -0300 Message-Id: <20200902202546.483726-5-danielhb413@gmail.com> In-Reply-To: <20200902202546.483726-1-danielhb413@gmail.com> References: <20200902202546.483726-1-danielhb413@gmail.com> MIME-Version: 1.0 X-Mimecast-Impersonation-Protect: Policy=CLT - Impersonation Protection Definition; Similar Internal Domain=false; Similar Monitored External Domain=false; Custom External Domain=false; Mimecast External Domain=false; Newly Observed Domain=false; Internal User Name=false; Custom Display Name List=false; Reply-to Address Mismatch=false; Targeted Threat Dictionary=false; Mimecast Threat Dictionary=false; Custom Threat Dictionary=false; X-Scanned-By: MIMEDefang 2.78 on 10.11.54.4 X-loop: libvir-list@redhat.com Cc: Daniel Henrique Barboza X-BeenThere: libvir-list@redhat.com X-Mailman-Version: 2.1.12 Precedence: junk List-Id: Development discussions about the libvirt library & tools List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: libvir-list-bounces@redhat.com Errors-To: libvir-list-bounces@redhat.com X-Scanned-By: MIMEDefang 2.79 on 10.5.11.15 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=libvir-list-bounces@redhat.com X-Mimecast-Spam-Score: 0.002 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" Introduce virCPUppc64Model and virCPUppc64ModelPtr types to improve code readability. Signed-off-by: Daniel Henrique Barboza Reviewed-by: J=C3=A1n Tomko --- src/cpu/cpu_ppc64.c | 34 ++++++++++++++++++---------------- 1 file changed, 18 insertions(+), 16 deletions(-) diff --git a/src/cpu/cpu_ppc64.c b/src/cpu/cpu_ppc64.c index 6c73145f06..7113c8ac33 100644 --- a/src/cpu/cpu_ppc64.c +++ b/src/cpu/cpu_ppc64.c @@ -40,7 +40,9 @@ struct _ppc64_vendor { char *name; }; =20 -struct ppc64_model { +typedef struct _ppc64_model virCPUppc64Model; +typedef struct _ppc64_model *virCPUppc64ModelPtr; +struct _ppc64_model { char *name; const virCPUppc64Vendor *vendor; virCPUppc64Data data; @@ -50,7 +52,7 @@ struct ppc64_map { size_t nvendors; virCPUppc64VendorPtr *vendors; size_t nmodels; - struct ppc64_model **models; + virCPUppc64ModelPtr *models; }; =20 /* Convert a legacy CPU definition by transforming @@ -169,7 +171,7 @@ ppc64VendorFind(const struct ppc64_map *map, } =20 static void -ppc64ModelFree(struct ppc64_model *model) +ppc64ModelFree(virCPUppc64ModelPtr model) { if (!model) return; @@ -179,10 +181,10 @@ ppc64ModelFree(struct ppc64_model *model) VIR_FREE(model); } =20 -static struct ppc64_model * -ppc64ModelCopy(const struct ppc64_model *model) +static virCPUppc64ModelPtr +ppc64ModelCopy(const virCPUppc64Model *model) { - struct ppc64_model *copy; + virCPUppc64ModelPtr copy; =20 if (VIR_ALLOC(copy) < 0) goto error; @@ -201,7 +203,7 @@ ppc64ModelCopy(const struct ppc64_model *model) return NULL; } =20 -static struct ppc64_model * +static virCPUppc64ModelPtr ppc64ModelFind(const struct ppc64_map *map, const char *name) { @@ -215,7 +217,7 @@ ppc64ModelFind(const struct ppc64_map *map, return NULL; } =20 -static struct ppc64_model * +static virCPUppc64ModelPtr ppc64ModelFindPVR(const struct ppc64_map *map, uint32_t pvr) { @@ -223,7 +225,7 @@ ppc64ModelFindPVR(const struct ppc64_map *map, size_t j; =20 for (i =3D 0; i < map->nmodels; i++) { - struct ppc64_model *model =3D map->models[i]; + virCPUppc64ModelPtr model =3D map->models[i]; for (j =3D 0; j < model->data.len; j++) { if ((pvr & model->data.pvr[j].mask) =3D=3D model->data.pvr[j].= value) return model; @@ -233,11 +235,11 @@ ppc64ModelFindPVR(const struct ppc64_map *map, return NULL; } =20 -static struct ppc64_model * +static virCPUppc64ModelPtr ppc64ModelFromCPU(const virCPUDef *cpu, const struct ppc64_map *map) { - struct ppc64_model *model; + virCPUppc64ModelPtr model; =20 if (!cpu->model) { virReportError(VIR_ERR_INVALID_ARG, "%s", @@ -305,7 +307,7 @@ ppc64ModelParse(xmlXPathContextPtr ctxt, void *data) { struct ppc64_map *map =3D data; - struct ppc64_model *model; + virCPUppc64ModelPtr model; xmlNodePtr *nodes =3D NULL; char *vendor =3D NULL; unsigned long pvr; @@ -428,8 +430,8 @@ ppc64Compute(virCPUDefPtr host, char **message) { struct ppc64_map *map =3D NULL; - struct ppc64_model *host_model =3D NULL; - struct ppc64_model *guest_model =3D NULL; + virCPUppc64ModelPtr host_model =3D NULL; + virCPUppc64ModelPtr guest_model =3D NULL; virCPUDefPtr cpu =3D NULL; virCPUCompareResult ret =3D VIR_CPU_COMPARE_ERROR; virArch arch; @@ -588,7 +590,7 @@ ppc64DriverDecode(virCPUDefPtr cpu, { int ret =3D -1; struct ppc64_map *map; - const struct ppc64_model *model; + const virCPUppc64Model *model; =20 if (!data || !(map =3D ppc64LoadMap())) return -1; @@ -688,7 +690,7 @@ virCPUppc64Baseline(virCPUDefPtr *cpus, bool migratable G_GNUC_UNUSED) { struct ppc64_map *map; - const struct ppc64_model *model; + const virCPUppc64Model *model; const virCPUppc64Vendor *vendor =3D NULL; virCPUDefPtr cpu =3D NULL; size_t i; --=20 2.26.2