From nobody Fri May 16 03:46:25 2025 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) client-ip=209.132.183.28; envelope-from=libvir-list-bounces@redhat.com; helo=mx1.redhat.com; Authentication-Results: mx.zoho.com; spf=pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; Return-Path: Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28]) by mx.zohomail.com with SMTPS id 1498675805963856.2248594455853; Wed, 28 Jun 2017 11:50:05 -0700 (PDT) Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.phx2.redhat.com [10.5.11.16]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 329A4C04B329; Wed, 28 Jun 2017 18:50:04 +0000 (UTC) Received: from colo-mx.corp.redhat.com (colo-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.20]) by smtp.corp.redhat.com (Postfix) with ESMTPS id EE4EF81F37; Wed, 28 Jun 2017 18:50:03 +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 99DE41853E34; Wed, 28 Jun 2017 18:50:02 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.phx2.redhat.com [10.5.11.15]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id v5SInhLO031259 for ; Wed, 28 Jun 2017 14:49:43 -0400 Received: by smtp.corp.redhat.com (Postfix) id A737C62930; Wed, 28 Jun 2017 18:49:43 +0000 (UTC) Received: from worklaptop.redhat.com (ovpn-116-174.phx2.redhat.com [10.3.116.174]) by smtp.corp.redhat.com (Postfix) with ESMTP id 510E75D6A6; Wed, 28 Jun 2017 18:49:43 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mx1.redhat.com 329A4C04B329 Authentication-Results: ext-mx07.extmail.prod.ext.phx2.redhat.com; dmarc=none (p=none dis=none) header.from=redhat.com Authentication-Results: ext-mx07.extmail.prod.ext.phx2.redhat.com; spf=pass smtp.mailfrom=libvir-list-bounces@redhat.com DKIM-Filter: OpenDKIM Filter v2.11.0 mx1.redhat.com 329A4C04B329 From: Cole Robinson To: libvir-list@redhat.com Date: Wed, 28 Jun 2017 14:49:30 -0400 Message-Id: <661a663f7482b57c85f3c590bbe2d714bb992b8d.1498675591.git.crobinso@redhat.com> In-Reply-To: References: In-Reply-To: References: X-Scanned-By: MIMEDefang 2.79 on 10.5.11.15 X-loop: libvir-list@redhat.com Subject: [libvirt] [PATCH 4/8] conf: add virDomainVideoDefNew 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: , MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Sender: libvir-list-bounces@redhat.com Errors-To: libvir-list-bounces@redhat.com X-Scanned-By: MIMEDefang 2.79 on 10.5.11.16 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.31]); Wed, 28 Jun 2017 18:50:04 +0000 (UTC) X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Type: text/plain; charset="utf-8" To handle setting a default heads value. Convert callers that were doing it by hand Signed-off-by: Cole Robinson Reviewed-by: John Ferlan --- src/conf/domain_conf.c | 21 ++++++++++++++++----- src/conf/domain_conf.h | 1 + src/libvirt_private.syms | 1 + src/qemu/qemu_parse_command.c | 3 +-- src/vz/vz_sdk.c | 3 +-- 5 files changed, 20 insertions(+), 9 deletions(-) diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c index c3149f976..47b668dc1 100644 --- a/src/conf/domain_conf.c +++ b/src/conf/domain_conf.c @@ -2351,6 +2351,20 @@ void virDomainShmemDefFree(virDomainShmemDefPtr def) VIR_FREE(def); } =20 + +virDomainVideoDefPtr +virDomainVideoDefNew(void) +{ + virDomainVideoDefPtr def; + + if (VIR_ALLOC(def) < 0) + return NULL; + + def->heads =3D 1; + return def; +} + + void virDomainVideoDefFree(virDomainVideoDefPtr def) { if (!def) @@ -13660,7 +13674,7 @@ virDomainVideoDefParseXML(xmlNodePtr node, =20 ctxt->node =3D node; =20 - if (VIR_ALLOC(def) < 0) + if (!(def =3D virDomainVideoDefNew())) return NULL; =20 cur =3D node->children; @@ -13754,8 +13768,6 @@ virDomainVideoDefParseXML(xmlNodePtr node, _("cannot parse video heads '%s'"), heads); goto error; } - } else { - def->heads =3D 1; } =20 if (virDomainDeviceInfoParseXML(node, NULL, &def->info, flags) < 0) @@ -20944,7 +20956,7 @@ virDomainDefAddImplicitVideo(virDomainDefPtr def) if (def->ngraphics =3D=3D 0 || def->nvideos > 0) return 0; =20 - if (VIR_ALLOC(video) < 0) + if (!(video =3D virDomainVideoDefNew())) goto cleanup; video->type =3D virDomainVideoDefaultType(def); if (video->type < 0) { @@ -20952,7 +20964,6 @@ virDomainDefAddImplicitVideo(virDomainDefPtr def) _("cannot determine default video type")); goto cleanup; } - video->heads =3D 1; if (VIR_APPEND_ELEMENT(def->videos, def->nvideos, video) < 0) goto cleanup; =20 diff --git a/src/conf/domain_conf.h b/src/conf/domain_conf.h index 964bc02f9..db89ffa97 100644 --- a/src/conf/domain_conf.h +++ b/src/conf/domain_conf.h @@ -2683,6 +2683,7 @@ void virDomainSoundDefFree(virDomainSoundDefPtr def); void virDomainMemballoonDefFree(virDomainMemballoonDefPtr def); void virDomainNVRAMDefFree(virDomainNVRAMDefPtr def); void virDomainWatchdogDefFree(virDomainWatchdogDefPtr def); +virDomainVideoDefPtr virDomainVideoDefNew(void); void virDomainVideoDefFree(virDomainVideoDefPtr def); virDomainHostdevDefPtr virDomainHostdevDefAlloc(virDomainXMLOptionPtr xmlo= pt); void virDomainHostdevDefClear(virDomainHostdevDefPtr def); diff --git a/src/libvirt_private.syms b/src/libvirt_private.syms index 888412ac7..248237c4a 100644 --- a/src/libvirt_private.syms +++ b/src/libvirt_private.syms @@ -528,6 +528,7 @@ virDomainUSBDeviceDefForeach; virDomainVideoDefaultRAM; virDomainVideoDefaultType; virDomainVideoDefFree; +virDomainVideoDefNew; virDomainVideoTypeFromString; virDomainVideoTypeToString; virDomainVideoVGAConfTypeFromString; diff --git a/src/qemu/qemu_parse_command.c b/src/qemu/qemu_parse_command.c index 60c81f0ca..6751868a6 100644 --- a/src/qemu/qemu_parse_command.c +++ b/src/qemu/qemu_parse_command.c @@ -2606,10 +2606,9 @@ qemuParseCommandLine(virCapsPtr caps, =20 if (def->ngraphics) { virDomainVideoDefPtr vid; - if (VIR_ALLOC(vid) < 0) + if (!(vid =3D virDomainVideoDefNew())) goto error; vid->type =3D video; - vid->heads =3D 1; =20 if (VIR_APPEND_ELEMENT(def->videos, def->nvideos, vid) < 0) { virDomainVideoDefFree(vid); diff --git a/src/vz/vz_sdk.c b/src/vz/vz_sdk.c index a62b31079..950eeaa34 100644 --- a/src/vz/vz_sdk.c +++ b/src/vz/vz_sdk.c @@ -552,12 +552,11 @@ prlsdkAddDomainVideoInfoCt(virDomainDefPtr def) if (def->ngraphics =3D=3D 0) return 0; =20 - if (VIR_ALLOC(video) < 0) + if (!(video =3D virDomainVideoDefNew())) goto cleanup; =20 video->type =3D VIR_DOMAIN_VIDEO_TYPE_PARALLELS; video->vram =3D 0; - video->heads =3D 1; =20 if (VIR_APPEND_ELEMENT(def->videos, def->nvideos, video) < 0) goto cleanup; --=20 2.13.0 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list