From nobody Fri May 3 14:52:45 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of redhat.com designates 205.139.110.61 as permitted sender) client-ip=205.139.110.61; envelope-from=libvir-list-bounces@redhat.com; helo=us-smtp-delivery-1.mimecast.com; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zoho.com: domain of redhat.com designates 205.139.110.61 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1573543689; cv=none; d=zoho.com; s=zohoarc; b=iF1AM048ZlVI6VZhjsUE5qlsyvkvaqebPvs2navPHAhtIrCBgjFWDROwpaazC3fK8OVu6aFea6tavFIRkouqxU2l6lsrVjSNXCPnFQ3ZJycOO/JyF51UKaVaNdDvzAMBFdCkhEq4FS3Rf7U76CrN2YC+s9ZcyZO1R+udl6rLWVI= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1573543689; h=Content-Type:Content-Transfer-Encoding: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=zaX00Y/LJy82g5K2FvJvfnhuP6HdgXiwvZCO/kCiqkA=; b=KtMI37fWKBeuvjYTrGVOTBcTJEqWpfYwGIkr57jKdep0UwYi7voVGk+fTJvMU0425IN5DFzJ7JHWntpBBKXUY29eKHwJT97KXkz8WXxjAmG/UnTQGW4O6C/RTTk9nJy9lKTK9UhhSUBCz1tP2ga8mI0I5PoWiKR05+GQFy8Nvyk= ARC-Authentication-Results: i=1; mx.zoho.com; dkim=pass; spf=pass (zoho.com: domain of redhat.com designates 205.139.110.61 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass header.from= (p=none dis=none) header.from= Return-Path: Received: from us-smtp-delivery-1.mimecast.com (us-smtp-1.mimecast.com [205.139.110.61]) by mx.zohomail.com with SMTPS id 1573543689087172.03796087573824; Mon, 11 Nov 2019 23:28:09 -0800 (PST) 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-386-I_qNh8ULNCiqODK1l3S6Fg-1; Tue, 12 Nov 2019 02:28:05 -0500 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 0F9CF801E4F; Tue, 12 Nov 2019 07:28:00 +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 EB0B862671; Tue, 12 Nov 2019 07:27:58 +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 5DB5418089CE; Tue, 12 Nov 2019 07:27:55 +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 xAC7RqTD011333 for ; Tue, 12 Nov 2019 02:27:52 -0500 Received: by smtp.corp.redhat.com (Postfix) id 8E8DABEA63; Tue, 12 Nov 2019 07:27:52 +0000 (UTC) Received: from angien.redhat.com (unknown [10.43.2.48]) by smtp.corp.redhat.com (Postfix) with ESMTP id 1A68D62671 for ; Tue, 12 Nov 2019 07:27:51 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1573543687; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:list-id:list-help: list-unsubscribe:list-subscribe:list-post; bh=zaX00Y/LJy82g5K2FvJvfnhuP6HdgXiwvZCO/kCiqkA=; b=WEn15ygDIKgB+btOIZ9oHjbOP8wVSKKdGcDly+e1YZ0qrOUhw0WABBGePkOP5f7q5SedQo ++09VHsSPLJGXUaz00FvMesB1eULk7GWBxE9GXSHQYB7pOP7xfDItnI5tWuz3uBeNju0Se +9/fdAdjldiScsjkkSaYpuRH9CiWzFI= From: Peter Krempa To: libvir-list@redhat.com Date: Tue, 12 Nov 2019 08:27:38 +0100 Message-Id: <93a754894e6054b08a1bc11d2d5bfbd7c3a46b21.1573543601.git.pkrempa@redhat.com> In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.15 X-loop: libvir-list@redhat.com Subject: [libvirt] [PATCH 01/10] qemu: caps: Rework memory allocation in virQEMUCapsFillDomainFeatureSEVCaps 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 X-MC-Unique: I_qNh8ULNCiqODK1l3S6Fg-1 X-Mimecast-Spam-Score: 0 Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @redhat.com) Content-Type: text/plain; charset="utf-8" Use g_new0 instead of VIR_ALLOC to avoid error cases. Signed-off-by: Peter Krempa Reviewed-by: Daniel P. Berrang=C3=A9 Reviewed-by: J=C3=A1n Tomko --- src/qemu/qemu_capabilities.c | 15 +++++---------- 1 file changed, 5 insertions(+), 10 deletions(-) diff --git a/src/qemu/qemu_capabilities.c b/src/qemu/qemu_capabilities.c index fc6473651c..02ac421067 100644 --- a/src/qemu/qemu_capabilities.c +++ b/src/qemu/qemu_capabilities.c @@ -5572,21 +5572,16 @@ virQEMUCapsFillDomainFeatureSEVCaps(virQEMUCapsPtr = qemuCaps, virDomainCapsPtr domCaps) { virSEVCapability *cap =3D qemuCaps->sevCapabilities; - g_autoptr(virSEVCapability) sev =3D NULL; if (!cap) return 0; - if (VIR_ALLOC(sev) < 0) - return -1; - - sev->pdh =3D g_strdup(cap->pdh); - - sev->cert_chain =3D g_strdup(cap->cert_chain); + domCaps->sev =3D g_new0(virSEVCapability, 1); - sev->cbitpos =3D cap->cbitpos; - sev->reduced_phys_bits =3D cap->reduced_phys_bits; - domCaps->sev =3D g_steal_pointer(&sev); + domCaps->sev->pdh =3D g_strdup(cap->pdh); + domCaps->sev->cert_chain =3D g_strdup(cap->cert_chain); + domCaps->sev->cbitpos =3D cap->cbitpos; + domCaps->sev->reduced_phys_bits =3D cap->reduced_phys_bits; return 0; } --=20 2.23.0 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list From nobody Fri May 3 14:52:45 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of redhat.com designates 205.139.110.61 as permitted sender) client-ip=205.139.110.61; envelope-from=libvir-list-bounces@redhat.com; helo=us-smtp-delivery-1.mimecast.com; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zoho.com: domain of redhat.com designates 205.139.110.61 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1573543710; cv=none; d=zoho.com; s=zohoarc; b=G8vcdw7m2Ex1gONqNvG0VGgW5+EsLh1OnDxuWR7V9oUKlwlkTtQ5Y1VoC5t3NrFChkaFi1UxLQwlXqQ7ZaG6yxGxMA1R2HBdDcpqzKaVgLkja0FxVsOlVhQ9tJtYAhcuQfWEXjakjZ2LwBX72tNBklIb61P4hKQ6pUSW1xWAX9E= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1573543710; h=Content-Type:Content-Transfer-Encoding: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=rvj63Pa74Vhc6+EU1QlxZ3rhG3Nf8dRLkyRn56Mg8es=; b=BcG4t82JXKun1F5EjTEgZEvPwvx4lC2ZMtxjTPqE4QYLky2SyBmAfCWmc2Z+GLBf473/k+gpKBg17zCHQK2oA0fBrUKw8/IUzHIAG5RKO/uonpMj/Dnc1wBag+seb/DKM60thisIK0YwDD+jwb3uMM1GPsE6XPLA5fTGQxEbYo8= ARC-Authentication-Results: i=1; mx.zoho.com; dkim=pass; spf=pass (zoho.com: domain of redhat.com designates 205.139.110.61 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass header.from= (p=none dis=none) header.from= Return-Path: Received: from us-smtp-delivery-1.mimecast.com (us-smtp-2.mimecast.com [205.139.110.61]) by mx.zohomail.com with SMTPS id 1573543710617854.9774579210585; Mon, 11 Nov 2019 23:28:30 -0800 (PST) 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-356-oUnRUvCvPXScGIsgsZxzcw-1; Tue, 12 Nov 2019 02:28:26 -0500 Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 0BC408064DC; Tue, 12 Nov 2019 07:28:22 +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 D0A3E9F5C; Tue, 12 Nov 2019 07:28:21 +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 7E63A4BB65; Tue, 12 Nov 2019 07:28:21 +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 xAC7RrBa011343 for ; Tue, 12 Nov 2019 02:27:53 -0500 Received: by smtp.corp.redhat.com (Postfix) id 5B90162671; Tue, 12 Nov 2019 07:27:53 +0000 (UTC) Received: from angien.redhat.com (unknown [10.43.2.48]) by smtp.corp.redhat.com (Postfix) with ESMTP id DB5D2627DF for ; Tue, 12 Nov 2019 07:27:52 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1573543709; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:list-id:list-help: list-unsubscribe:list-subscribe:list-post; bh=rvj63Pa74Vhc6+EU1QlxZ3rhG3Nf8dRLkyRn56Mg8es=; b=CYD8aErQM7KTrHH9WWIjfL0vnY9b2Gd1Omgmwuir5R9wxBJvIVlEnxiPKiDWO6ugTJawJQ JYv2uDl2GJFZL2E1T1DJAzGbYs/yB81vFnFWM+o5VXjFZaIaco2U0g6TFBPEv8r+Bycr/t BNhHTBMnn5VfpVSXYLmehkWekcx4tSM= From: Peter Krempa To: libvir-list@redhat.com Date: Tue, 12 Nov 2019 08:27:39 +0100 Message-Id: <58ffc51647596745a3548ea236d3bd02f383b88f.1573543601.git.pkrempa@redhat.com> In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.15 X-loop: libvir-list@redhat.com Subject: [libvirt] [PATCH 02/10] qemu: caps: Make capability filler functions void 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.12 X-MC-Unique: oUnRUvCvPXScGIsgsZxzcw-1 X-Mimecast-Spam-Score: 0 Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @redhat.com) Content-Type: text/plain; charset="utf-8" Most of them don't have anything to report so we can simplify the logic. Signed-off-by: Peter Krempa Reviewed-by: Daniel P. Berrang=C3=A9 Reviewed-by: J=C3=A1n Tomko --- src/qemu/qemu_capabilities.c | 66 ++++++++++++------------------------ 1 file changed, 22 insertions(+), 44 deletions(-) diff --git a/src/qemu/qemu_capabilities.c b/src/qemu/qemu_capabilities.c index 02ac421067..0229d7b5f8 100644 --- a/src/qemu/qemu_capabilities.c +++ b/src/qemu/qemu_capabilities.c @@ -5250,7 +5250,7 @@ virQEMUCapsFillDomainOSCaps(virDomainCapsOSPtr os, } -static int +static void virQEMUCapsFillDomainCPUCaps(virCapsPtr caps, virQEMUCapsPtr qemuCaps, virDomainCapsPtr domCaps) @@ -5287,23 +5287,19 @@ virQEMUCapsFillDomainCPUCaps(virCapsPtr caps, } domCaps->cpu.custom =3D filtered; } - - return 0; } -static int +static void virQEMUCapsFillDomainIOThreadCaps(virQEMUCapsPtr qemuCaps, virDomainCapsPtr domCaps) { domCaps->iothreads =3D virTristateBoolFromBool( virQEMUCapsGet(qemuCaps, QEMU_CAPS_OBJECT_IOTHREAD)); - - return 0; } -static int +static void virQEMUCapsFillDomainDeviceDiskCaps(virQEMUCapsPtr qemuCaps, const char *machine, virDomainCapsDeviceDiskPtr disk) @@ -5348,12 +5344,10 @@ virQEMUCapsFillDomainDeviceDiskCaps(virQEMUCapsPtr = qemuCaps, VIR_DOMAIN_CAPS_ENUM_SET(disk->model, VIR_DOMAIN_DISK_MODEL_VIRTIO_NON_TRANSITI= ONAL); } - - return 0; } -static int +static void virQEMUCapsFillDomainDeviceGraphicsCaps(virQEMUCapsPtr qemuCaps, virDomainCapsDeviceGraphicsPtr dev) { @@ -5365,12 +5359,10 @@ virQEMUCapsFillDomainDeviceGraphicsCaps(virQEMUCaps= Ptr qemuCaps, VIR_DOMAIN_CAPS_ENUM_SET(dev->type, VIR_DOMAIN_GRAPHICS_TYPE_VNC); if (virQEMUCapsGet(qemuCaps, QEMU_CAPS_SPICE)) VIR_DOMAIN_CAPS_ENUM_SET(dev->type, VIR_DOMAIN_GRAPHICS_TYPE_SPICE= ); - - return 0; } -static int +static void virQEMUCapsFillDomainDeviceVideoCaps(virQEMUCapsPtr qemuCaps, virDomainCapsDeviceVideoPtr dev) { @@ -5389,12 +5381,10 @@ virQEMUCapsFillDomainDeviceVideoCaps(virQEMUCapsPtr= qemuCaps, VIR_DOMAIN_CAPS_ENUM_SET(dev->modelType, VIR_DOMAIN_VIDEO_TYPE_VIR= TIO); if (virQEMUCapsGet(qemuCaps, QEMU_CAPS_DEVICE_BOCHS_DISPLAY)) VIR_DOMAIN_CAPS_ENUM_SET(dev->modelType, VIR_DOMAIN_VIDEO_TYPE_BOC= HS); - - return 0; } -static int +static void virQEMUCapsFillDomainDeviceHostdevCaps(virQEMUCapsPtr qemuCaps, virDomainCapsDeviceHostdevPtr hostd= ev) { @@ -5432,12 +5422,10 @@ virQEMUCapsFillDomainDeviceHostdevCaps(virQEMUCapsP= tr qemuCaps, VIR_DOMAIN_HOSTDEV_PCI_BACKEND_DEFAULT, VIR_DOMAIN_HOSTDEV_PCI_BACKEND_VFIO); } - - return 0; } -static int +static void virQEMUCapsFillDomainDeviceRNGCaps(virQEMUCapsPtr qemuCaps, virDomainCapsDeviceRNGPtr rng) { @@ -5460,8 +5448,6 @@ virQEMUCapsFillDomainDeviceRNGCaps(virQEMUCapsPtr qem= uCaps, VIR_DOMAIN_CAPS_ENUM_SET(rng->backendModel, VIR_DOMAIN_RNG_BACKEND= _EGD); if (virQEMUCapsGet(qemuCaps, QEMU_CAPS_OBJECT_RNG_RANDOM)) VIR_DOMAIN_CAPS_ENUM_SET(rng->backendModel, VIR_DOMAIN_RNG_BACKEND= _RANDOM); - - return 0; } @@ -5523,10 +5509,8 @@ virQEMUCapsSupportsGICVersion(virQEMUCapsPtr qemuCap= s, * and virtualization type. Moreover, a common format is used to store * information about enumerations in @domCaps, so further processing is * required. - * - * Returns: 0 on success, <0 on failure */ -static int +static void virQEMUCapsFillDomainFeatureGICCaps(virQEMUCapsPtr qemuCaps, virDomainCapsPtr domCaps) { @@ -5536,7 +5520,7 @@ virQEMUCapsFillDomainFeatureGICCaps(virQEMUCapsPtr qe= muCaps, gic->supported =3D VIR_TRISTATE_BOOL_NO; if (!qemuDomainMachineIsARMVirt(domCaps->machine, domCaps->arch)) - return 0; + return; for (version =3D VIR_GIC_VERSION_LAST - 1; version > VIR_GIC_VERSION_NONE; @@ -5551,8 +5535,6 @@ virQEMUCapsFillDomainFeatureGICCaps(virQEMUCapsPtr qe= muCaps, VIR_DOMAIN_CAPS_ENUM_SET(gic->version, version); } - - return 0; } @@ -5564,17 +5546,15 @@ virQEMUCapsFillDomainFeatureGICCaps(virQEMUCapsPtr = qemuCaps, * Take the information about SEV capabilities that has been obtained * using the 'query-sev-capabilities' QMP command and stored in @qemuCaps * and convert it to a form suitable for @domCaps. - * - * Returns: 0 on success, -1 on failure */ -static int +static void virQEMUCapsFillDomainFeatureSEVCaps(virQEMUCapsPtr qemuCaps, virDomainCapsPtr domCaps) { virSEVCapability *cap =3D qemuCaps->sevCapabilities; if (!cap) - return 0; + return; domCaps->sev =3D g_new0(virSEVCapability, 1); @@ -5582,8 +5562,6 @@ virQEMUCapsFillDomainFeatureSEVCaps(virQEMUCapsPtr qe= muCaps, domCaps->sev->cert_chain =3D g_strdup(cap->cert_chain); domCaps->sev->cbitpos =3D cap->cbitpos; domCaps->sev->reduced_phys_bits =3D cap->reduced_phys_bits; - - return 0; } @@ -5623,19 +5601,19 @@ virQEMUCapsFillDomainCaps(virCapsPtr caps, domCaps->machine, domCaps->arch, privileged, - firmwares, nfirmwares) < 0 || - virQEMUCapsFillDomainCPUCaps(caps, qemuCaps, domCaps) < 0 || - virQEMUCapsFillDomainIOThreadCaps(qemuCaps, domCaps) < 0 || - virQEMUCapsFillDomainDeviceDiskCaps(qemuCaps, - domCaps->machine, disk) < 0 || - virQEMUCapsFillDomainDeviceGraphicsCaps(qemuCaps, graphics) < 0 || - virQEMUCapsFillDomainDeviceVideoCaps(qemuCaps, video) < 0 || - virQEMUCapsFillDomainDeviceHostdevCaps(qemuCaps, hostdev) < 0 || - virQEMUCapsFillDomainDeviceRNGCaps(qemuCaps, rng) < 0 || - virQEMUCapsFillDomainFeatureGICCaps(qemuCaps, domCaps) < 0 || - virQEMUCapsFillDomainFeatureSEVCaps(qemuCaps, domCaps) < 0) + firmwares, nfirmwares) < 0) return -1; + virQEMUCapsFillDomainCPUCaps(caps, qemuCaps, domCaps); + virQEMUCapsFillDomainIOThreadCaps(qemuCaps, domCaps); + virQEMUCapsFillDomainDeviceDiskCaps(qemuCaps, domCaps->machine, disk); + virQEMUCapsFillDomainDeviceGraphicsCaps(qemuCaps, graphics); + virQEMUCapsFillDomainDeviceVideoCaps(qemuCaps, video); + virQEMUCapsFillDomainDeviceHostdevCaps(qemuCaps, hostdev); + virQEMUCapsFillDomainDeviceRNGCaps(qemuCaps, rng); + virQEMUCapsFillDomainFeatureGICCaps(qemuCaps, domCaps); + virQEMUCapsFillDomainFeatureSEVCaps(qemuCaps, domCaps); + return 0; } --=20 2.23.0 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list From nobody Fri May 3 14:52:45 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of redhat.com designates 205.139.110.61 as permitted sender) client-ip=205.139.110.61; envelope-from=libvir-list-bounces@redhat.com; helo=us-smtp-delivery-1.mimecast.com; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zoho.com: domain of redhat.com designates 205.139.110.61 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1573543708; cv=none; d=zoho.com; s=zohoarc; b=d3IkoCHD4LCuvjQ20ZMy5tVLCBeJxsfFqcKD5zAheGG0euMTRqAwm6llvko6YGQR5husXMdx+wCDmYgfjNkbZ7Eu9mJBIC6fkSR2r48r5JPbTL0jNzAC4Lqq+HEZSt8vBRt2YqCDg2dL2NDVfQOa1pf98tX3GmnFpLuP9AV6Il0= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1573543708; h=Content-Type:Content-Transfer-Encoding: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=UAI0m4VSt7HGmk31a/WWlk1qC8yvSg4OCBiAFHI6GLE=; b=CytlzGAjDh/Z/peW1TduMN+F17oiUI5yF2P0ybMsU/xYVmP+3e4EQPp+lvZzgbTflWYlGZ4dlYBP6c8KYL/bV4WGKU+lq5XdAkIsYP31X4omeTOm8u6kJlVOxWKlpoAFGfSQfij43tG6PHVSHPvYwClVVvKhgeVHgY0hVBOqPmc= ARC-Authentication-Results: i=1; mx.zoho.com; dkim=pass; spf=pass (zoho.com: domain of redhat.com designates 205.139.110.61 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass header.from= (p=none dis=none) header.from= Return-Path: Received: from us-smtp-delivery-1.mimecast.com (us-smtp-1.mimecast.com [205.139.110.61]) by mx.zohomail.com with SMTPS id 1573543708913103.04382488080728; Mon, 11 Nov 2019 23:28:28 -0800 (PST) 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-238-xRh5wWI8Pi27dfjPIMlm-Q-1; Tue, 12 Nov 2019 02:28:26 -0500 Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id A9613800686; Tue, 12 Nov 2019 07:28:21 +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 4628F61075; Tue, 12 Nov 2019 07:28:21 +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 C11D618089CF; Tue, 12 Nov 2019 07:28:20 +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 xAC7RsUp011348 for ; Tue, 12 Nov 2019 02:27:54 -0500 Received: by smtp.corp.redhat.com (Postfix) id 28207BEA63; Tue, 12 Nov 2019 07:27:54 +0000 (UTC) Received: from angien.redhat.com (unknown [10.43.2.48]) by smtp.corp.redhat.com (Postfix) with ESMTP id A75D162671 for ; Tue, 12 Nov 2019 07:27:53 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1573543707; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:list-id:list-help: list-unsubscribe:list-subscribe:list-post; bh=UAI0m4VSt7HGmk31a/WWlk1qC8yvSg4OCBiAFHI6GLE=; b=WT5NlVTm/CsYfE2Qy39CBlaqfahRKBQYWkANPGRIBrG0ANKkYF+WyZaTcrL2+oiFRx7h4d rxvVhaNWnLRFh7M+cua8gzC7Ng3xhEsm2XAE4zso7Pi3YP0SIu6bkTLysBsmZKc/+ttBS+ 22vySzQWqQcIg1QhbqKa2kbU4aYxJyQ= From: Peter Krempa To: libvir-list@redhat.com Date: Tue, 12 Nov 2019 08:27:40 +0100 Message-Id: In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.15 X-loop: libvir-list@redhat.com Subject: [libvirt] [PATCH 03/10] conf: domaincaps: Fix broken attempt at being const-correct 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.12 X-MC-Unique: xRh5wWI8Pi27dfjPIMlm-Q-1 X-Mimecast-Spam-Score: 0 Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @redhat.com) Content-Type: text/plain; charset="utf-8" 'virBlahPtr const blah' results into modification to the value of 'blah' triggering compilation error rather than the modification of the virBlah struct the pointer points to. All of the domain capability formatting code was broken in this regard. Signed-off-by: Peter Krempa Reviewed-by: J=C3=A1n Tomko --- src/conf/domain_capabilities.c | 32 ++++++++++++++++---------------- src/conf/domain_capabilities.h | 4 ++-- 2 files changed, 18 insertions(+), 18 deletions(-) diff --git a/src/conf/domain_capabilities.c b/src/conf/domain_capabilities.c index 09bf047647..b9de4bfe5d 100644 --- a/src/conf/domain_capabilities.c +++ b/src/conf/domain_capabilities.c @@ -321,7 +321,7 @@ virDomainCapsEnumClear(virDomainCapsEnumPtr capsEnum) static int virDomainCapsEnumFormat(virBufferPtr buf, - virDomainCapsEnumPtr capsEnum, + const virDomainCapsEnum *capsEnum, const char *capsEnumName, virDomainCapsValToStr valToStr) { @@ -362,7 +362,7 @@ virDomainCapsEnumFormat(virBufferPtr buf, static void virDomainCapsStringValuesFormat(virBufferPtr buf, - virDomainCapsStringValuesPtr values) + const virDomainCapsStringValues *values) { size_t i; @@ -406,7 +406,7 @@ virDomainCapsStringValuesFormat(virBufferPtr buf, static void virDomainCapsLoaderFormat(virBufferPtr buf, - virDomainCapsLoaderPtr loader) + const virDomainCapsLoader *loader) { FORMAT_PROLOGUE(loader); @@ -420,9 +420,9 @@ virDomainCapsLoaderFormat(virBufferPtr buf, static void virDomainCapsOSFormat(virBufferPtr buf, - virDomainCapsOSPtr os) + const virDomainCapsOS *os) { - virDomainCapsLoaderPtr loader =3D &os->loader; + const virDomainCapsLoader *loader =3D &os->loader; FORMAT_PROLOGUE(os); @@ -453,7 +453,7 @@ virDomainCapsCPUCustomFormat(virBufferPtr buf, static void virDomainCapsCPUFormat(virBufferPtr buf, - virDomainCapsCPUPtr cpu) + const virDomainCapsCPU *cpu) { virBufferAddLit(buf, "\n"); virBufferAdjustIndent(buf, 2); @@ -492,7 +492,7 @@ virDomainCapsCPUFormat(virBufferPtr buf, static void virDomainCapsDeviceDiskFormat(virBufferPtr buf, - virDomainCapsDeviceDiskPtr const disk) + const virDomainCapsDeviceDisk *disk) { FORMAT_PROLOGUE(disk); @@ -506,7 +506,7 @@ virDomainCapsDeviceDiskFormat(virBufferPtr buf, static void virDomainCapsDeviceGraphicsFormat(virBufferPtr buf, - virDomainCapsDeviceGraphicsPtr const gra= phics) + const virDomainCapsDeviceGraphics *graph= ics) { FORMAT_PROLOGUE(graphics); @@ -518,7 +518,7 @@ virDomainCapsDeviceGraphicsFormat(virBufferPtr buf, static void virDomainCapsDeviceVideoFormat(virBufferPtr buf, - virDomainCapsDeviceVideoPtr const video) + const virDomainCapsDeviceVideo *video) { FORMAT_PROLOGUE(video); @@ -530,7 +530,7 @@ virDomainCapsDeviceVideoFormat(virBufferPtr buf, static void virDomainCapsDeviceHostdevFormat(virBufferPtr buf, - virDomainCapsDeviceHostdevPtr const hostd= ev) + const virDomainCapsDeviceHostdev *hostdev) { FORMAT_PROLOGUE(hostdev); @@ -546,7 +546,7 @@ virDomainCapsDeviceHostdevFormat(virBufferPtr buf, static void virDomainCapsDeviceRNGFormat(virBufferPtr buf, - virDomainCapsDeviceRNGPtr const rng) + const virDomainCapsDeviceRNG *rng) { FORMAT_PROLOGUE(rng); @@ -575,7 +575,7 @@ virDomainCapsDeviceRNGFormat(virBufferPtr buf, */ static void virDomainCapsFeatureGICFormat(virBufferPtr buf, - virDomainCapsFeatureGICPtr const gic) + const virDomainCapsFeatureGIC *gic) { FORMAT_PROLOGUE(gic); @@ -586,7 +586,7 @@ virDomainCapsFeatureGICFormat(virBufferPtr buf, static void virDomainCapsFeatureSEVFormat(virBufferPtr buf, - virSEVCapabilityPtr const sev) + const virSEVCapability *sev) { if (!sev) { virBufferAddLit(buf, "\n"); @@ -605,7 +605,7 @@ virDomainCapsFeatureSEVFormat(virBufferPtr buf, char * -virDomainCapsFormat(virDomainCapsPtr const caps) +virDomainCapsFormat(const virDomainCaps *caps) { virBuffer buf =3D VIR_BUFFER_INITIALIZER; const char *virttype_str =3D virDomainVirtTypeToString(caps->virttype); @@ -669,7 +669,7 @@ virDomainCapsFormat(virDomainCapsPtr const caps) static int -virDomainCapsDeviceRNGDefValidate(virDomainCapsPtr const caps, +virDomainCapsDeviceRNGDefValidate(const virDomainCaps *caps, const virDomainRNGDef *dev) { if (ENUM_VALUE_MISSING(caps->rng.model, dev->model)) { @@ -683,7 +683,7 @@ virDomainCapsDeviceRNGDefValidate(virDomainCapsPtr cons= t caps, int -virDomainCapsDeviceDefValidate(virDomainCapsPtr const caps, +virDomainCapsDeviceDefValidate(const virDomainCaps *caps, const virDomainDeviceDef *dev, const virDomainDef *def G_GNUC_UNUSED) { diff --git a/src/conf/domain_capabilities.h b/src/conf/domain_capabilities.h index a31458c653..6b27eac11f 100644 --- a/src/conf/domain_capabilities.h +++ b/src/conf/domain_capabilities.h @@ -226,9 +226,9 @@ int virDomainCapsEnumSet(virDomainCapsEnumPtr capsEnum, unsigned int *values); void virDomainCapsEnumClear(virDomainCapsEnumPtr capsEnum); -char * virDomainCapsFormat(virDomainCapsPtr const caps); +char * virDomainCapsFormat(const virDomainCaps *caps); -int virDomainCapsDeviceDefValidate(virDomainCapsPtr const caps, +int virDomainCapsDeviceDefValidate(const virDomainCaps *caps, const virDomainDeviceDef *dev, const virDomainDef *def); --=20 2.23.0 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list From nobody Fri May 3 14:52:45 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of redhat.com designates 205.139.110.61 as permitted sender) client-ip=205.139.110.61; envelope-from=libvir-list-bounces@redhat.com; helo=us-smtp-delivery-1.mimecast.com; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zoho.com: domain of redhat.com designates 205.139.110.61 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1573543714; cv=none; d=zoho.com; s=zohoarc; b=lfKl76t12/lm4MXeEDm+3kTh1UQmEOPsL/4hlXyOZfPiR3Dfv2kOKKyMVzfqBnGKz7XzaYmHFSe22m+s/ZRHFKspjzjJFJ0DKdeFIohLCMZWNhUuN8K1PjiJWgCyfxWcX7IZZgVjiYKVeIosQBB2E7B+7neDewoftU7RY+Kz0Dg= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1573543714; h=Content-Type:Content-Transfer-Encoding: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=Swa3HAqMtwTk292d+bJGzE1KMCWszuHnB38JvesZTkM=; b=YQNX7ZElcxeMLq/C0bZg2x620zJ3i3kcrnlc73Gigzz7xkk7PIP8l7GkHFi28um8gy+mXFhigwPzKXXAlUgNxsJ5o34w/dhgX0uWLABY7tQZpEFGwf45HPsXSODOpPOdisF07cv1eMMF9Hg91ad3+A8dpTIEl9OQW3E/3xO5Ffk= ARC-Authentication-Results: i=1; mx.zoho.com; dkim=pass; spf=pass (zoho.com: domain of redhat.com designates 205.139.110.61 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass header.from= (p=none dis=none) header.from= Return-Path: Received: from us-smtp-delivery-1.mimecast.com (us-smtp-1.mimecast.com [205.139.110.61]) by mx.zohomail.com with SMTPS id 1573543714836329.57314410129993; Mon, 11 Nov 2019 23:28:34 -0800 (PST) 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-400-99MWchFROJyL68VS1qUG0g-1; Tue, 12 Nov 2019 02:28:31 -0500 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 mimecast-mx01.redhat.com (Postfix) with ESMTPS id E79BBDB60; Tue, 12 Nov 2019 07:28:25 +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 B906B1B472; Tue, 12 Nov 2019 07:28:25 +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 718D24E566; Tue, 12 Nov 2019 07:28:25 +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 xAC7Rsvt011353 for ; Tue, 12 Nov 2019 02:27:54 -0500 Received: by smtp.corp.redhat.com (Postfix) id E6F5462671; Tue, 12 Nov 2019 07:27:54 +0000 (UTC) Received: from angien.redhat.com (unknown [10.43.2.48]) by smtp.corp.redhat.com (Postfix) with ESMTP id 73350627DF for ; Tue, 12 Nov 2019 07:27:54 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1573543713; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:list-id:list-help: list-unsubscribe:list-subscribe:list-post; bh=Swa3HAqMtwTk292d+bJGzE1KMCWszuHnB38JvesZTkM=; b=GTMEfbYs2DMcKEw3yYJrnxNapEgqcmrYGRPujJoDoRTDOU17JYugUJZ/z+xJB2/l9mv0nl VLxRSwzroMV8SdRCC0D/eR+LKx34WjechaIUfEKUZlWnw7JCiCfe1FxSDIYQ1WBufJZsqD 6TRCJehTFuNyYMMvIv9BZYnAncGDPZQ= From: Peter Krempa To: libvir-list@redhat.com Date: Tue, 12 Nov 2019 08:27:41 +0100 Message-Id: <0c5bd4f2cf034a026cda935e2ac8376bab96fb40.1573543601.git.pkrempa@redhat.com> In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.15 X-loop: libvir-list@redhat.com Subject: [libvirt] [PATCH 04/10] conf: storagecaps: Fix broken attempt at being const-correct 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.14 X-MC-Unique: 99MWchFROJyL68VS1qUG0g-1 X-Mimecast-Spam-Score: 0 Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @redhat.com) Content-Type: text/plain; charset="utf-8" The code formatting storage capabilities faithfully copied the wrong use of 'const' from domain capabilities. Signed-off-by: Peter Krempa Reviewed-by: Daniel P. Berrang=C3=A9 Reviewed-by: J=C3=A1n Tomko --- src/conf/storage_capabilities.c | 4 ++-- src/conf/storage_capabilities.h | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/conf/storage_capabilities.c b/src/conf/storage_capabilitie= s.c index cf3ee488ac..1a3417f90b 100644 --- a/src/conf/storage_capabilities.c +++ b/src/conf/storage_capabilities.c @@ -93,7 +93,7 @@ virStoragePoolCapsIsLoaded(virCapsPtr driverCaps, static int virStoragePoolCapsFormatPool(virBufferPtr buf, int poolType, - virStoragePoolCapsPtr const caps) + const virStoragePoolCaps *caps) { bool isLoaded =3D virStoragePoolCapsIsLoaded(caps->driverCaps, poolTyp= e); @@ -115,7 +115,7 @@ virStoragePoolCapsFormatPool(virBufferPtr buf, char * -virStoragePoolCapsFormat(virStoragePoolCapsPtr const caps) +virStoragePoolCapsFormat(const virStoragePoolCaps *caps) { virBuffer buf =3D VIR_BUFFER_INITIALIZER; size_t i; diff --git a/src/conf/storage_capabilities.h b/src/conf/storage_capabilitie= s.h index 788ea227ea..377c313aa0 100644 --- a/src/conf/storage_capabilities.h +++ b/src/conf/storage_capabilities.h @@ -37,4 +37,4 @@ virStoragePoolCapsPtr virStoragePoolCapsNew(virCapsPtr driverCaps); char * -virStoragePoolCapsFormat(virStoragePoolCapsPtr const caps); +virStoragePoolCapsFormat(const virStoragePoolCaps *caps); --=20 2.23.0 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list From nobody Fri May 3 14:52:45 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of redhat.com designates 207.211.31.81 as permitted sender) client-ip=207.211.31.81; envelope-from=libvir-list-bounces@redhat.com; helo=us-smtp-delivery-1.mimecast.com; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zoho.com: domain of redhat.com designates 207.211.31.81 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1573543715; cv=none; d=zoho.com; s=zohoarc; b=Lg476vLfwbyyGjB+vHlUavNgWWeEAB3YXOm5R7yrBVGe+d0KvE0jB096cRdhAlo74o498LdFMGK6tgTcZMQITBU8g5asVCisqW55ZQo6hBrUAfnwYVPY3Bp3HIoaVN5vBFcIrTcDgtUCodkoRmH8Jd+bNxtbYGxFanPPWd1245s= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1573543715; h=Content-Type:Content-Transfer-Encoding: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=hOTmr230LccF7pXhSPJuivLATa3jvBjOpnCUd50YWM0=; b=frgEt1Np6B5Liqr6lH/H8V2+eb9LCNEETuwpKH6vjj/cKIRFJrd6Bjht3yhWoCfeD4v+M8b/OJtqiZzkluKKhB8lKulIx1k0YjSYoalORW+hU4az8XxOqtMW5JKNa1PImZaWh7FBsFrGu15CAv7HsFWdzwwb7NqmCgEIQYYCSDI= ARC-Authentication-Results: i=1; mx.zoho.com; dkim=pass; spf=pass (zoho.com: domain of redhat.com designates 207.211.31.81 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass header.from= (p=none dis=none) header.from= Return-Path: Received: from us-smtp-delivery-1.mimecast.com (us-smtp-2.mimecast.com [207.211.31.81]) by mx.zohomail.com with SMTPS id 1573543715946833.1104547363016; Mon, 11 Nov 2019 23:28:35 -0800 (PST) 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-235-rZodp6DtNEePVh-E7Xzwng-1; Tue, 12 Nov 2019 02:28:33 -0500 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 mimecast-mx01.redhat.com (Postfix) with ESMTPS id 55C5C801E4F; Tue, 12 Nov 2019 07:28:26 +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 31BA95C1D8; Tue, 12 Nov 2019 07:28:26 +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 DA5974E56C; Tue, 12 Nov 2019 07:28:25 +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 xAC7RtqW011367 for ; Tue, 12 Nov 2019 02:27:55 -0500 Received: by smtp.corp.redhat.com (Postfix) id B4B44BEA63; Tue, 12 Nov 2019 07:27:55 +0000 (UTC) Received: from angien.redhat.com (unknown [10.43.2.48]) by smtp.corp.redhat.com (Postfix) with ESMTP id 3FF8B62671 for ; Tue, 12 Nov 2019 07:27:55 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1573543714; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:list-id:list-help: list-unsubscribe:list-subscribe:list-post; bh=hOTmr230LccF7pXhSPJuivLATa3jvBjOpnCUd50YWM0=; b=bQ1DcdpGaTGNGIuFe7N7Hp9gbvpPtSaLYniWNF5nnVj9FZuEV27Dgg7hNfXMJkndnV/H0G Hwb+ah7LRxt2Xr1cW9o18k+Wk5RZGUZX2/crR/xZHPkGhvr+u2KxbUES3wECHuTxisrzY9 YsaorA1m88mwpX+tZmm6bqpWEbpeyQE= From: Peter Krempa To: libvir-list@redhat.com Date: Tue, 12 Nov 2019 08:27:42 +0100 Message-Id: <9e76ac196e57c91afa2a2e59141da8ff6bb3e55c.1573543601.git.pkrempa@redhat.com> In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.15 X-loop: libvir-list@redhat.com Subject: [libvirt] [PATCH 05/10] conf: Rename virDomainCapsFeature to virDomainProcessCapsFeature 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.16 X-MC-Unique: rZodp6DtNEePVh-E7Xzwng-1 X-Mimecast-Spam-Score: 0 Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @redhat.com) Content-Type: text/plain; charset="utf-8" The enum name sounds too generic. It in fact describes the capabilities of the process, thus add 'Process' to the name. Signed-off-by: Peter Krempa Reviewed-by: J=C3=A1n Tomko --- src/conf/domain_conf.c | 12 +++--- src/conf/domain_conf.h | 82 ++++++++++++++++++++-------------------- src/libvirt_private.syms | 2 +- src/lxc/lxc_cgroup.c | 2 +- src/lxc/lxc_container.c | 20 +++++----- src/lxc/lxc_native.c | 4 +- 6 files changed, 61 insertions(+), 61 deletions(-) diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c index d5aba7336f..3e81140430 100644 --- a/src/conf/domain_conf.c +++ b/src/conf/domain_conf.c @@ -211,8 +211,8 @@ VIR_ENUM_IMPL(virDomainMsrsUnknown, "fault", ); -VIR_ENUM_IMPL(virDomainCapsFeature, - VIR_DOMAIN_CAPS_FEATURE_LAST, +VIR_ENUM_IMPL(virDomainProcessCapsFeature, + VIR_DOMAIN_PROCES_CAPS_FEATURE_LAST, "audit_control", "audit_write", "block_suspend", @@ -20616,7 +20616,7 @@ virDomainDefParseXML(xmlDocPtr xml, goto error; for (i =3D 0; i < n; i++) { - int val =3D virDomainCapsFeatureTypeFromString((const char *)nodes= [i]->name); + int val =3D virDomainProcessCapsFeatureTypeFromString((const char = *)nodes[i]->name); if (val < 0) { virReportError(VIR_ERR_CONFIG_UNSUPPORTED, _("unexpected capability feature '%s'"), nodes[= i]->name); @@ -20627,7 +20627,7 @@ virDomainDefParseXML(xmlDocPtr xml, if ((def->caps_features[val] =3D virTristateSwitchTypeFromStri= ng(tmp)) =3D=3D -1) { virReportError(VIR_ERR_CONFIG_UNSUPPORTED, _("unknown state attribute '%s' of feature = capability '%s'"), - tmp, virDomainCapsFeatureTypeToString(val)); + tmp, virDomainProcessCapsFeatureTypeToStrin= g(val)); goto error; } VIR_FREE(tmp); @@ -28295,10 +28295,10 @@ virDomainDefFormatFeatures(virBufferPtr buf, case VIR_DOMAIN_FEATURE_CAPABILITIES: virBufferSetChildIndent(&tmpChildBuf, &childBuf); - for (j =3D 0; j < VIR_DOMAIN_CAPS_FEATURE_LAST; j++) { + for (j =3D 0; j < VIR_DOMAIN_PROCES_CAPS_FEATURE_LAST; j++) { if (def->caps_features[j] !=3D VIR_TRISTATE_SWITCH_ABSENT) virBufferAsprintf(&tmpChildBuf, "<%s state=3D'%s'/>\n", - virDomainCapsFeatureTypeToString(j), + virDomainProcessCapsFeatureTypeToStr= ing(j), virTristateSwitchTypeToString(def->c= aps_features[j])); } diff --git a/src/conf/domain_conf.h b/src/conf/domain_conf.h index c69d1b7ef5..2f7a006711 100644 --- a/src/conf/domain_conf.h +++ b/src/conf/domain_conf.h @@ -1817,45 +1817,45 @@ typedef enum { /* The capabilities are ordered alphabetically to help check for new ones = */ typedef enum { - VIR_DOMAIN_CAPS_FEATURE_AUDIT_CONTROL =3D 0, - VIR_DOMAIN_CAPS_FEATURE_AUDIT_WRITE, - VIR_DOMAIN_CAPS_FEATURE_BLOCK_SUSPEND, - VIR_DOMAIN_CAPS_FEATURE_CHOWN, - VIR_DOMAIN_CAPS_FEATURE_DAC_OVERRIDE, - VIR_DOMAIN_CAPS_FEATURE_DAC_READ_SEARCH, - VIR_DOMAIN_CAPS_FEATURE_FOWNER, - VIR_DOMAIN_CAPS_FEATURE_FSETID, - VIR_DOMAIN_CAPS_FEATURE_IPC_LOCK, - VIR_DOMAIN_CAPS_FEATURE_IPC_OWNER, - VIR_DOMAIN_CAPS_FEATURE_KILL, - VIR_DOMAIN_CAPS_FEATURE_LEASE, - VIR_DOMAIN_CAPS_FEATURE_LINUX_IMMUTABLE, - VIR_DOMAIN_CAPS_FEATURE_MAC_ADMIN, - VIR_DOMAIN_CAPS_FEATURE_MAC_OVERRIDE, - VIR_DOMAIN_CAPS_FEATURE_MKNOD, - VIR_DOMAIN_CAPS_FEATURE_NET_ADMIN, - VIR_DOMAIN_CAPS_FEATURE_NET_BIND_SERVICE, - VIR_DOMAIN_CAPS_FEATURE_NET_BROADCAST, - VIR_DOMAIN_CAPS_FEATURE_NET_RAW, - VIR_DOMAIN_CAPS_FEATURE_SETGID, - VIR_DOMAIN_CAPS_FEATURE_SETFCAP, - VIR_DOMAIN_CAPS_FEATURE_SETPCAP, - VIR_DOMAIN_CAPS_FEATURE_SETUID, - VIR_DOMAIN_CAPS_FEATURE_SYS_ADMIN, - VIR_DOMAIN_CAPS_FEATURE_SYS_BOOT, - VIR_DOMAIN_CAPS_FEATURE_SYS_CHROOT, - VIR_DOMAIN_CAPS_FEATURE_SYS_MODULE, - VIR_DOMAIN_CAPS_FEATURE_SYS_NICE, - VIR_DOMAIN_CAPS_FEATURE_SYS_PACCT, - VIR_DOMAIN_CAPS_FEATURE_SYS_PTRACE, - VIR_DOMAIN_CAPS_FEATURE_SYS_RAWIO, - VIR_DOMAIN_CAPS_FEATURE_SYS_RESOURCE, - VIR_DOMAIN_CAPS_FEATURE_SYS_TIME, - VIR_DOMAIN_CAPS_FEATURE_SYS_TTY_CONFIG, - VIR_DOMAIN_CAPS_FEATURE_SYSLOG, - VIR_DOMAIN_CAPS_FEATURE_WAKE_ALARM, - VIR_DOMAIN_CAPS_FEATURE_LAST -} virDomainCapsFeature; + VIR_DOMAIN_PROCES_CAPS_FEATURE_AUDIT_CONTROL =3D 0, + VIR_DOMAIN_PROCES_CAPS_FEATURE_AUDIT_WRITE, + VIR_DOMAIN_PROCES_CAPS_FEATURE_BLOCK_SUSPEND, + VIR_DOMAIN_PROCES_CAPS_FEATURE_CHOWN, + VIR_DOMAIN_PROCES_CAPS_FEATURE_DAC_OVERRIDE, + VIR_DOMAIN_PROCES_CAPS_FEATURE_DAC_READ_SEARCH, + VIR_DOMAIN_PROCES_CAPS_FEATURE_FOWNER, + VIR_DOMAIN_PROCES_CAPS_FEATURE_FSETID, + VIR_DOMAIN_PROCES_CAPS_FEATURE_IPC_LOCK, + VIR_DOMAIN_PROCES_CAPS_FEATURE_IPC_OWNER, + VIR_DOMAIN_PROCES_CAPS_FEATURE_KILL, + VIR_DOMAIN_PROCES_CAPS_FEATURE_LEASE, + VIR_DOMAIN_PROCES_CAPS_FEATURE_LINUX_IMMUTABLE, + VIR_DOMAIN_PROCES_CAPS_FEATURE_MAC_ADMIN, + VIR_DOMAIN_PROCES_CAPS_FEATURE_MAC_OVERRIDE, + VIR_DOMAIN_PROCES_CAPS_FEATURE_MKNOD, + VIR_DOMAIN_PROCES_CAPS_FEATURE_NET_ADMIN, + VIR_DOMAIN_PROCES_CAPS_FEATURE_NET_BIND_SERVICE, + VIR_DOMAIN_PROCES_CAPS_FEATURE_NET_BROADCAST, + VIR_DOMAIN_PROCES_CAPS_FEATURE_NET_RAW, + VIR_DOMAIN_PROCES_CAPS_FEATURE_SETGID, + VIR_DOMAIN_PROCES_CAPS_FEATURE_SETFCAP, + VIR_DOMAIN_PROCES_CAPS_FEATURE_SETPCAP, + VIR_DOMAIN_PROCES_CAPS_FEATURE_SETUID, + VIR_DOMAIN_PROCES_CAPS_FEATURE_SYS_ADMIN, + VIR_DOMAIN_PROCES_CAPS_FEATURE_SYS_BOOT, + VIR_DOMAIN_PROCES_CAPS_FEATURE_SYS_CHROOT, + VIR_DOMAIN_PROCES_CAPS_FEATURE_SYS_MODULE, + VIR_DOMAIN_PROCES_CAPS_FEATURE_SYS_NICE, + VIR_DOMAIN_PROCES_CAPS_FEATURE_SYS_PACCT, + VIR_DOMAIN_PROCES_CAPS_FEATURE_SYS_PTRACE, + VIR_DOMAIN_PROCES_CAPS_FEATURE_SYS_RAWIO, + VIR_DOMAIN_PROCES_CAPS_FEATURE_SYS_RESOURCE, + VIR_DOMAIN_PROCES_CAPS_FEATURE_SYS_TIME, + VIR_DOMAIN_PROCES_CAPS_FEATURE_SYS_TTY_CONFIG, + VIR_DOMAIN_PROCES_CAPS_FEATURE_SYSLOG, + VIR_DOMAIN_PROCES_CAPS_FEATURE_WAKE_ALARM, + VIR_DOMAIN_PROCES_CAPS_FEATURE_LAST +} virDomainProcessCapsFeature; typedef enum { VIR_DOMAIN_LOCK_FAILURE_DEFAULT, @@ -2420,7 +2420,7 @@ struct _virDomainDef { * to handle support. A few assign specific data values to the option. * See virDomainDefFeaturesCheckABIStability() for details. */ int features[VIR_DOMAIN_FEATURE_LAST]; - int caps_features[VIR_DOMAIN_CAPS_FEATURE_LAST]; + int caps_features[VIR_DOMAIN_PROCES_CAPS_FEATURE_LAST]; int hyperv_features[VIR_DOMAIN_HYPERV_LAST]; int kvm_features[VIR_DOMAIN_KVM_LAST]; int msrs_features[VIR_DOMAIN_MSRS_LAST]; @@ -3394,7 +3394,7 @@ VIR_ENUM_DECL(virDomainVirt); VIR_ENUM_DECL(virDomainBoot); VIR_ENUM_DECL(virDomainFeature); VIR_ENUM_DECL(virDomainCapabilitiesPolicy); -VIR_ENUM_DECL(virDomainCapsFeature); +VIR_ENUM_DECL(virDomainProcessCapsFeature); VIR_ENUM_DECL(virDomainLifecycle); VIR_ENUM_DECL(virDomainLifecycleAction); VIR_ENUM_DECL(virDomainDevice); diff --git a/src/libvirt_private.syms b/src/libvirt_private.syms index 94509d6f43..0a5431b50b 100644 --- a/src/libvirt_private.syms +++ b/src/libvirt_private.syms @@ -217,7 +217,6 @@ virDomainBlockedReasonTypeToString; virDomainBootTypeFromString; virDomainBootTypeToString; virDomainCapabilitiesPolicyTypeToString; -virDomainCapsFeatureTypeToString; virDomainChrConsoleTargetTypeFromString; virDomainChrConsoleTargetTypeToString; virDomainChrDefForeach; @@ -543,6 +542,7 @@ virDomainPausedReasonTypeFromString; virDomainPausedReasonTypeToString; virDomainPMSuspendedReasonTypeFromString; virDomainPMSuspendedReasonTypeToString; +virDomainProcessCapsFeatureTypeToString; virDomainRedirdevBusTypeFromString; virDomainRedirdevBusTypeToString; virDomainRedirdevDefFind; diff --git a/src/lxc/lxc_cgroup.c b/src/lxc/lxc_cgroup.c index 5efb495b56..7e8259678f 100644 --- a/src/lxc/lxc_cgroup.c +++ b/src/lxc/lxc_cgroup.c @@ -306,7 +306,7 @@ virLXCTeardownHostUSBDeviceCgroup(virUSBDevicePtr dev G= _GNUC_UNUSED, static int virLXCCgroupSetupDeviceACL(virDomainDefPtr def, virCgroupPtr cgroup) { - int capMknod =3D def->caps_features[VIR_DOMAIN_CAPS_FEATURE_MKNOD]; + int capMknod =3D def->caps_features[VIR_DOMAIN_PROCES_CAPS_FEATURE_MKN= OD]; int ret =3D -1; size_t i; static virLXCCgroupDevicePolicy devices[] =3D { diff --git a/src/lxc/lxc_container.c b/src/lxc/lxc_container.c index 1fb9049c96..abad36c5aa 100644 --- a/src/lxc/lxc_container.c +++ b/src/lxc/lxc_container.c @@ -1950,7 +1950,7 @@ static int lxcContainerDropCapabilities(virDomainDefP= tr def, size_t i; int policy =3D def->features[VIR_DOMAIN_FEATURE_CAPABILITIES]; - /* Maps virDomainCapsFeature to CAPS_* */ + /* Maps virDomainProcessCapsFeature to CAPS_* */ static int capsMapping[] =3D {CAP_AUDIT_CONTROL, CAP_AUDIT_WRITE, CAP_BLOCK_SUSPEND, @@ -1996,7 +1996,7 @@ static int lxcContainerDropCapabilities(virDomainDefP= tr def, capng_clear(CAPNG_SELECT_BOTH); /* Apply all single capabilities changes */ - for (i =3D 0; i < VIR_DOMAIN_CAPS_FEATURE_LAST; i++) { + for (i =3D 0; i < VIR_DOMAIN_PROCES_CAPS_FEATURE_LAST; i++) { bool toDrop =3D false; int state =3D def->caps_features[i]; @@ -2013,21 +2013,21 @@ static int lxcContainerDropCapabilities(virDomainDe= fPtr def, capsMapping[i])) < 0) { virReportError(VIR_ERR_INTERNAL_ERROR, _("Failed to add capability %s: %d"), - virDomainCapsFeatureTypeToString(i), ret); + virDomainProcessCapsFeatureTypeToString(i),= ret); return -1; } break; case VIR_DOMAIN_CAPABILITIES_POLICY_DEFAULT: switch (i) { - case VIR_DOMAIN_CAPS_FEATURE_SYS_BOOT: /* No use of reboot */ + case VIR_DOMAIN_PROCES_CAPS_FEATURE_SYS_BOOT: /* No use of reb= oot */ toDrop =3D !keepReboot && (state !=3D VIR_TRISTATE_SWITCH_= ON); break; - case VIR_DOMAIN_CAPS_FEATURE_SYS_MODULE: /* No kernel module l= oading */ - case VIR_DOMAIN_CAPS_FEATURE_SYS_TIME: /* No changing the cloc= k */ - case VIR_DOMAIN_CAPS_FEATURE_MKNOD: /* No creating device node= s */ - case VIR_DOMAIN_CAPS_FEATURE_AUDIT_CONTROL: /* No messing with= auditing status */ - case VIR_DOMAIN_CAPS_FEATURE_MAC_ADMIN: /* No messing with LSM= config */ + case VIR_DOMAIN_PROCES_CAPS_FEATURE_SYS_MODULE: /* No kernel m= odule loading */ + case VIR_DOMAIN_PROCES_CAPS_FEATURE_SYS_TIME: /* No changing t= he clock */ + case VIR_DOMAIN_PROCES_CAPS_FEATURE_MKNOD: /* No creating devi= ce nodes */ + case VIR_DOMAIN_PROCES_CAPS_FEATURE_AUDIT_CONTROL: /* No messi= ng with auditing status */ + case VIR_DOMAIN_PROCES_CAPS_FEATURE_MAC_ADMIN: /* No messing w= ith LSM config */ toDrop =3D (state !=3D VIR_TRISTATE_SWITCH_ON); break; default: /* User specified capabilities to drop */ @@ -2045,7 +2045,7 @@ static int lxcContainerDropCapabilities(virDomainDefP= tr def, capsMapping[i])) < 0) { virReportError(VIR_ERR_INTERNAL_ERROR, _("Failed to remove capability %s: %d"), - virDomainCapsFeatureTypeToString(i), ret); + virDomainProcessCapsFeatureTypeToString(i),= ret); return -1; } break; diff --git a/src/lxc/lxc_native.c b/src/lxc/lxc_native.c index fec3b4454c..5018cf115b 100644 --- a/src/lxc/lxc_native.c +++ b/src/lxc/lxc_native.c @@ -1043,8 +1043,8 @@ lxcSetCapDrop(virDomainDefPtr def, virConfPtr propert= ies) if (virConfGetValueString(properties, "lxc.cap.drop", &value) > 0) toDrop =3D virStringSplit(value, " ", 0); - for (i =3D 0; i < VIR_DOMAIN_CAPS_FEATURE_LAST; i++) { - capString =3D virDomainCapsFeatureTypeToString(i); + for (i =3D 0; i < VIR_DOMAIN_PROCES_CAPS_FEATURE_LAST; i++) { + capString =3D virDomainProcessCapsFeatureTypeToString(i); if (toDrop !=3D NULL && virStringListHasString((const char **)toDrop, capString)) def->caps_features[i] =3D VIR_TRISTATE_SWITCH_OFF; --=20 2.23.0 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list From nobody Fri May 3 14:52:45 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of redhat.com designates 205.139.110.61 as permitted sender) client-ip=205.139.110.61; envelope-from=libvir-list-bounces@redhat.com; helo=us-smtp-delivery-1.mimecast.com; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zoho.com: domain of redhat.com designates 205.139.110.61 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1573543720; cv=none; d=zoho.com; s=zohoarc; b=QndQl0Ri/f/RYWVaRCYalZOzndAMWfwvuW5Ls3iPdP/FbEYFt34UiowLc30sOZ4faiXF5bKy5ya4JlwVlFbGFqRoWBdeYqgBuKT+1ah3YKXx/VTR4CribbE5jlraIz7g95VsTsaflHxx1ZE7I4cjKd2iL3hZiECq4SBh5FTueNI= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1573543720; h=Content-Type:Content-Transfer-Encoding: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=Vpq3jK5GQs9AG++eAq8iXUVWYkOoHjpXxvzwpL4Vrx8=; b=IjZv6qkxufgwLOp8F64fHd1N7PnC/1OaVQrdj14i+b/ame4nO5PcxS+r+8I7R+7ezjcQM68Fil6ieu4l57R/V/j0NKzQZ/dIxFPKVppTeUlOklqAxZim6DvHTqLI6LQ5Nj04a94Xu9cEVn466m2hjUz/2wj2QkVZlvbczdj1rBo= ARC-Authentication-Results: i=1; mx.zoho.com; dkim=pass; spf=pass (zoho.com: domain of redhat.com designates 205.139.110.61 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass header.from= (p=none dis=none) header.from= Return-Path: Received: from us-smtp-delivery-1.mimecast.com (us-smtp-2.mimecast.com [205.139.110.61]) by mx.zohomail.com with SMTPS id 1573543720505827.32251841629; Mon, 11 Nov 2019 23:28:40 -0800 (PST) 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-28-YFnKjapGOYSYCwRLxMPocQ-1; Tue, 12 Nov 2019 02:28:37 -0500 Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id D44CA801E69; Tue, 12 Nov 2019 07:28:29 +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 A355D60171; Tue, 12 Nov 2019 07:28:29 +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 5BF3818089CE; Tue, 12 Nov 2019 07:28:29 +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 xAC7Ruup011380 for ; Tue, 12 Nov 2019 02:27:56 -0500 Received: by smtp.corp.redhat.com (Postfix) id 80803BEA63; Tue, 12 Nov 2019 07:27:56 +0000 (UTC) Received: from angien.redhat.com (unknown [10.43.2.48]) by smtp.corp.redhat.com (Postfix) with ESMTP id 0BDC362671 for ; Tue, 12 Nov 2019 07:27:55 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1573543718; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:list-id:list-help: list-unsubscribe:list-subscribe:list-post; bh=Vpq3jK5GQs9AG++eAq8iXUVWYkOoHjpXxvzwpL4Vrx8=; b=EJRgh7JKvjuGcrq38mZQfftv+Ia9xT0axbNJBJio2OXaqVG1GlUO+2/b18JqvMDciA4Quf MEvJ+j1wje+IdIAT+AgqQzDpdKPZo5Io1hPxm5wi8261G+PYM4qWrqvs8KJejry5AGKHYT Jl9s7dLoaJm5KI2IVrRvgeFu4NgGBU8= From: Peter Krempa To: libvir-list@redhat.com Date: Tue, 12 Nov 2019 08:27:43 +0100 Message-Id: <3d4f6c7aaf7455a53a4e6ca553e7551981f2a723.1573543601.git.pkrempa@redhat.com> In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.15 X-loop: libvir-list@redhat.com Subject: [libvirt] [PATCH 06/10] conf: caps: Automaticaly free 'cpus_str' 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.11 X-MC-Unique: YFnKjapGOYSYCwRLxMPocQ-1 X-Mimecast-Spam-Score: 0 Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @redhat.com) Content-Type: text/plain; charset="utf-8" Signed-off-by: Peter Krempa Reviewed-by: J=C3=A1n Tomko --- src/conf/capabilities.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/conf/capabilities.c b/src/conf/capabilities.c index 953464b09d..0a0de447b5 100644 --- a/src/conf/capabilities.c +++ b/src/conf/capabilities.c @@ -948,7 +948,7 @@ virCapabilitiesFormatCaches(virBufferPtr buf, for (i =3D 0; i < cache->nbanks; i++) { virCapsHostCacheBankPtr bank =3D cache->banks[i]; - char *cpus_str =3D virBitmapFormat(bank->cpus); + g_autofree char *cpus_str =3D virBitmapFormat(bank->cpus); const char *unit =3D NULL; unsigned long long short_size =3D virFormatIntPretty(bank->size, &= unit); @@ -965,7 +965,6 @@ virCapabilitiesFormatCaches(virBufferPtr buf, bank->id, bank->level, virCacheTypeToString(bank->type), short_size, unit, cpus_str); - VIR_FREE(cpus_str); virBufferSetChildIndent(&childrenBuf, buf); for (j =3D 0; j < bank->ncontrols; j++) { --=20 2.23.0 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list From nobody Fri May 3 14:52:45 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of redhat.com designates 207.211.31.81 as permitted sender) client-ip=207.211.31.81; envelope-from=libvir-list-bounces@redhat.com; helo=us-smtp-delivery-1.mimecast.com; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zoho.com: domain of redhat.com designates 207.211.31.81 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1573543720; cv=none; d=zoho.com; s=zohoarc; b=I4vYi7DSVd+EAehNcirkYxPozwQlucdtrkXBROMx6L1XP94iQ0kGjGR4Z9TTnBT5xsTI0YQnpHE6l3cmxYjjTvr/qN9ovq52CJNMlpQ7XfeI+ZiDDm246mvhycnKxJNsXATgeHKhD2d4tBeAKUvngtYjObZcVcoBDyQZznqvjLk= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1573543720; h=Content-Type:Content-Transfer-Encoding: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=hT4qeQBAZTYjFLKpKA0THGyz3PO1JSHhj5mORul8gvQ=; b=g6EyAVMl26NkUNaL4azwtCx7nG1hBf948uR5zNBF+vb3jnfQ95HhJoAspQkdkZzm3ppvQZkZMAdCRreMf3xsQMFCQgI8ppW181JNNMkal0UIcR2zA+pdqRfhXIgzE9BdAT06kISByhpFDIIb9+QQyFpebMhrXk/5fbCoqNFnU8M= ARC-Authentication-Results: i=1; mx.zoho.com; dkim=pass; spf=pass (zoho.com: domain of redhat.com designates 207.211.31.81 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass header.from= (p=none dis=none) header.from= Return-Path: Received: from us-smtp-delivery-1.mimecast.com (us-smtp-2.mimecast.com [207.211.31.81]) by mx.zohomail.com with SMTPS id 1573543720530844.8925774417421; Mon, 11 Nov 2019 23:28:40 -0800 (PST) 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-419-Pyg_07_uN-ux4nqOf8VR5A-1; Tue, 12 Nov 2019 02:28:37 -0500 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 mimecast-mx01.redhat.com (Postfix) with ESMTPS id 0E769DB67; Tue, 12 Nov 2019 07:28:30 +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 D62CD1B41F; Tue, 12 Nov 2019 07:28:29 +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 8AC3618089CF; Tue, 12 Nov 2019 07:28:29 +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 xAC7Rvm0011385 for ; Tue, 12 Nov 2019 02:27:57 -0500 Received: by smtp.corp.redhat.com (Postfix) id 4E6EF62671; Tue, 12 Nov 2019 07:27:57 +0000 (UTC) Received: from angien.redhat.com (unknown [10.43.2.48]) by smtp.corp.redhat.com (Postfix) with ESMTP id CDB05627DF for ; Tue, 12 Nov 2019 07:27:56 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1573543719; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:list-id:list-help: list-unsubscribe:list-subscribe:list-post; bh=hT4qeQBAZTYjFLKpKA0THGyz3PO1JSHhj5mORul8gvQ=; b=TARBfHF+/jEl6B26JJcXswojiuutmv4ULoZJJuU7DKhQJydq5hLSU5ijG7S8STm41nMyB8 Pa3csYb8hP7luoDDzJRRBLqypkaKTUIXRRuZO1OLQ1JsAY8HJPQq+EBAwGwfzbVI88l0LZ tIlk8NQJiHIZQtXINRea97RVA7tE0yU= From: Peter Krempa To: libvir-list@redhat.com Date: Tue, 12 Nov 2019 08:27:44 +0100 Message-Id: <56df1ddf38651bc8283919ce3946941af7b45658.1573543601.git.pkrempa@redhat.com> In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.15 X-loop: libvir-list@redhat.com Subject: [libvirt] [PATCH 07/10] conf: domain: Split up formatting of and 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.14 X-MC-Unique: Pyg_07_uN-ux4nqOf8VR5A-1 X-Mimecast-Spam-Score: 0 Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @redhat.com) Content-Type: text/plain; charset="utf-8" Signed-off-by: Peter Krempa Reviewed-by: J=C3=A1n Tomko --- src/conf/domain_conf.c | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c index 3e81140430..0e774889a2 100644 --- a/src/conf/domain_conf.c +++ b/src/conf/domain_conf.c @@ -27985,6 +27985,17 @@ virDomainMemtuneFormat(virBufferPtr buf, virXMLFormatElement(buf, "memtune", NULL, &childBuf); + ret =3D 0; + return ret; +} + + +static void +virDomainMemorybackingFormat(virBufferPtr buf, + const virDomainMemtune *mem) +{ + g_auto(virBuffer) childBuf =3D VIR_BUFFER_INITIALIZER; + virBufferSetChildIndent(&childBuf, buf); if (mem->nhugepages) @@ -28006,9 +28017,6 @@ virDomainMemtuneFormat(virBufferPtr buf, virBufferAddLit(&childBuf, "\n"); virXMLFormatElement(buf, "memoryBacking", NULL, &childBuf); - - ret =3D 0; - return ret; } @@ -28484,6 +28492,8 @@ virDomainDefFormatInternalSetRootName(virDomainDefP= tr def, if (virDomainMemtuneFormat(buf, &def->mem) < 0) goto error; + virDomainMemorybackingFormat(buf, &def->mem); + if (virDomainCpuDefFormat(buf, def) < 0) goto error; --=20 2.23.0 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list From nobody Fri May 3 14:52:45 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of redhat.com designates 205.139.110.61 as permitted sender) client-ip=205.139.110.61; envelope-from=libvir-list-bounces@redhat.com; helo=us-smtp-delivery-1.mimecast.com; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zoho.com: domain of redhat.com designates 205.139.110.61 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1573543745; cv=none; d=zoho.com; s=zohoarc; b=OCuVkUkJXOOLBqPSJEC10pC5gVPuFKL/R6l1oukZfUTUX0nePOpNiYaLWcKEaKn6+7ADQK47OedVnByn2e3ljUzHO3MFuM1FGCnNy3bQ3X90PxGDBsRRAIXsLXfLawu/0DBGDIgTTFOvgWk0H4pcJGO5D7Hh7YJ/EOV86/ceWr4= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1573543745; h=Content-Type:Content-Transfer-Encoding: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=WDcWL+0bfQdZJgnR3K6WOkKgnM3bSzETpbu+U/OkUtA=; b=gVvWynv+nhMtowbstdWCKgkEYiSb1Elb5eOujbrWrd3P4SxN2EioFjoJeEwn6V7BErknFgXsu/Yfe9addostTEBt2DnUuI7akPxsBdYQaMo/jQ11/OlV2nbhelRc4K24uEbhXiD3jxjIeTXT1vSAys5zz9XTBjjBwwXTM+g6x1Q= ARC-Authentication-Results: i=1; mx.zoho.com; dkim=pass; spf=pass (zoho.com: domain of redhat.com designates 205.139.110.61 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass header.from= (p=none dis=none) header.from= Return-Path: Received: from us-smtp-delivery-1.mimecast.com (us-smtp-2.mimecast.com [205.139.110.61]) by mx.zohomail.com with SMTPS id 157354374579029.57206711178287; Mon, 11 Nov 2019 23:29:05 -0800 (PST) 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-236-NkLZu5erOkiCZmMv6rs0FA-1; Tue, 12 Nov 2019 02:28:41 -0500 Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 991F81005511; Tue, 12 Nov 2019 07:28:36 +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 6ED0D60173; Tue, 12 Nov 2019 07:28:36 +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 2FD2C18089D8; Tue, 12 Nov 2019 07:28:36 +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 xAC7Rw5t011390 for ; Tue, 12 Nov 2019 02:27:58 -0500 Received: by smtp.corp.redhat.com (Postfix) id 198A7BEA63; Tue, 12 Nov 2019 07:27:58 +0000 (UTC) Received: from angien.redhat.com (unknown [10.43.2.48]) by smtp.corp.redhat.com (Postfix) with ESMTP id 9996362671 for ; Tue, 12 Nov 2019 07:27:57 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1573543744; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:list-id:list-help: list-unsubscribe:list-subscribe:list-post; bh=WDcWL+0bfQdZJgnR3K6WOkKgnM3bSzETpbu+U/OkUtA=; b=MwDFxgdByqKpj5NQKIhPuz8G+VwO7w0lsTylhpepQnrHjVNgyNPQ89oUgm6rGUNDRyqpBQ q6daaityxSK4Kvv7PhxLdboTsSPD/qz55JYanW1F/RsWmX0o/WVxGq6DLUVhzpHgi4D5jG uE/5fafP5zekglIEo9T4VHvQG+T0DAU= From: Peter Krempa To: libvir-list@redhat.com Date: Tue, 12 Nov 2019 08:27:45 +0100 Message-Id: <0d70bf48156dcc4bf730380c4d0bd875ef023848.1573543601.git.pkrempa@redhat.com> In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.15 X-loop: libvir-list@redhat.com Subject: [libvirt] [PATCH 08/10] conf: turn virDomainMemtuneFormat void 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.11 X-MC-Unique: NkLZu5erOkiCZmMv6rs0FA-1 X-Mimecast-Spam-Score: 0 Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @redhat.com) Content-Type: text/plain; charset="utf-8" Signed-off-by: Peter Krempa Reviewed-by: J=C3=A1n Tomko --- src/conf/domain_conf.c | 10 ++-------- 1 file changed, 2 insertions(+), 8 deletions(-) diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c index 0e774889a2..81ab5eb138 100644 --- a/src/conf/domain_conf.c +++ b/src/conf/domain_conf.c @@ -27953,12 +27953,11 @@ virDomainIOMMUDefFormat(virBufferPtr buf, } -static int +static void virDomainMemtuneFormat(virBufferPtr buf, const virDomainMemtune *mem) { g_auto(virBuffer) childBuf =3D VIR_BUFFER_INITIALIZER; - int ret =3D -1; virBufferSetChildIndent(&childBuf, buf); @@ -27984,9 +27983,6 @@ virDomainMemtuneFormat(virBufferPtr buf, } virXMLFormatElement(buf, "memtune", NULL, &childBuf); - - ret =3D 0; - return ret; } @@ -28489,9 +28485,7 @@ virDomainDefFormatInternalSetRootName(virDomainDefP= tr def, if (virDomainDefFormatBlkiotune(buf, def) < 0) goto error; - if (virDomainMemtuneFormat(buf, &def->mem) < 0) - goto error; - + virDomainMemtuneFormat(buf, &def->mem); virDomainMemorybackingFormat(buf, &def->mem); if (virDomainCpuDefFormat(buf, def) < 0) --=20 2.23.0 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list From nobody Fri May 3 14:52:45 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of redhat.com designates 207.211.31.81 as permitted sender) client-ip=207.211.31.81; envelope-from=libvir-list-bounces@redhat.com; helo=us-smtp-delivery-1.mimecast.com; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zoho.com: domain of redhat.com designates 207.211.31.81 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1573543722; cv=none; d=zoho.com; s=zohoarc; b=YwqP0r7Xuj/roQpkQoF5v3qQk95LoHYuvlykRdN1xVkL4CEEePAaWSl3DNtvWNn04UQ/jel9dSu1k0We+zV1egUX/siZxUNcVts7DE25a7fFZeBf+ilqaVKIte5nn4cMdssFksUpV2aj1x7+suy66X8nuJuy0wBoht3feKcmGt8= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1573543722; h=Content-Type:Content-Transfer-Encoding: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=aG3nV3k/mYEFC1ssoqbpbZ1BIwgMn8ir6VRtDTwmUiE=; b=h90j7UftLgweNuNFXwzIJFH+NkyzOZ+1viq6SzS1kLxkHAGg/6CjLrgcjFhGnR0xWtuqk6CzjDbQZ7QO3WZtFeSZ6XqWKEzGaVEHO91sVG3ufZ+FSTIuD/7dn3cwi98wVVWm2/R/slXVemkiVtaSfZ4Wamm8bkXDsHfjxpXhIMw= ARC-Authentication-Results: i=1; mx.zoho.com; dkim=pass; spf=pass (zoho.com: domain of redhat.com designates 207.211.31.81 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass header.from= (p=none dis=none) header.from= Return-Path: Received: from us-smtp-delivery-1.mimecast.com (us-smtp-2.mimecast.com [207.211.31.81]) by mx.zohomail.com with SMTPS id 1573543722522413.55026506102126; Mon, 11 Nov 2019 23:28:42 -0800 (PST) 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-401-4wVRZ9_lN-WIY4k8G78HWA-1; Tue, 12 Nov 2019 02:28:39 -0500 Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.phx2.redhat.com [10.5.11.23]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id E5CDEDB68; Tue, 12 Nov 2019 07:28:33 +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 BF02228D19; Tue, 12 Nov 2019 07:28:33 +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 7D1604E571; Tue, 12 Nov 2019 07:28:33 +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 xAC7RwBk011403 for ; Tue, 12 Nov 2019 02:27:58 -0500 Received: by smtp.corp.redhat.com (Postfix) id D9BCCBEA63; Tue, 12 Nov 2019 07:27:58 +0000 (UTC) Received: from angien.redhat.com (unknown [10.43.2.48]) by smtp.corp.redhat.com (Postfix) with ESMTP id 6586D62671 for ; Tue, 12 Nov 2019 07:27:58 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1573543721; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:list-id:list-help: list-unsubscribe:list-subscribe:list-post; bh=aG3nV3k/mYEFC1ssoqbpbZ1BIwgMn8ir6VRtDTwmUiE=; b=hEdPVz/rp3cnLXG5ClEXuDImIkAQpYUnuKEh0rPkk7wzh9PhGc+xh6il1q5rO4jzIXx5Pi xttp+UHcqlDM11u/tQDvoUdKdbQHQxydQ8suyHEp6MwZSlJqsAbt4D0dDRE1+4Xe8OM1ie lcy8ccPrhTyJuXn3tZ53QNhWHEUqKIo= From: Peter Krempa To: libvir-list@redhat.com Date: Tue, 12 Nov 2019 08:27:46 +0100 Message-Id: In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.15 X-loop: libvir-list@redhat.com Subject: [libvirt] [PATCH 09/10] conf: caps: Modernize virCapabilitiesFormatCaches 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.84 on 10.5.11.23 X-MC-Unique: 4wVRZ9_lN-WIY4k8G78HWA-1 X-Mimecast-Spam-Score: 0 Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @redhat.com) Content-Type: text/plain; charset="utf-8" Use automatic memory freeing and use virXMLFormatElement instead of open coding it. Signed-off-by: Peter Krempa Reviewed-by: J=C3=A1n Tomko --- src/conf/capabilities.c | 15 +++++---------- 1 file changed, 5 insertions(+), 10 deletions(-) diff --git a/src/conf/capabilities.c b/src/conf/capabilities.c index 0a0de447b5..1ab389bc65 100644 --- a/src/conf/capabilities.c +++ b/src/conf/capabilities.c @@ -938,7 +938,6 @@ virCapabilitiesFormatCaches(virBufferPtr buf, { size_t i =3D 0; size_t j =3D 0; - virBuffer childrenBuf =3D VIR_BUFFER_INITIALIZER; if (!cache->nbanks) return 0; @@ -947,6 +946,8 @@ virCapabilitiesFormatCaches(virBufferPtr buf, virBufferAdjustIndent(buf, 2); for (i =3D 0; i < cache->nbanks; i++) { + g_auto(virBuffer) attrBuf =3D VIR_BUFFER_INITIALIZER; + g_auto(virBuffer) childrenBuf =3D VIR_BUFFER_INITIALIZER; virCapsHostCacheBankPtr bank =3D cache->banks[i]; g_autofree char *cpus_str =3D virBitmapFormat(bank->cpus); const char *unit =3D NULL; @@ -959,8 +960,8 @@ virCapabilitiesFormatCaches(virBufferPtr buf, * Let's just *hope* the size is aligned to KiBs so that it does n= ot * bite is back in the future */ - virBufferAsprintf(buf, - "id, bank->level, virCacheTypeToString(bank->type), @@ -1006,13 +1007,7 @@ virCapabilitiesFormatCaches(virBufferPtr buf, controls->max_allocation); } - if (virBufferUse(&childrenBuf)) { - virBufferAddLit(buf, ">\n"); - virBufferAddBuffer(buf, &childrenBuf); - virBufferAddLit(buf, "\n"); - } else { - virBufferAddLit(buf, "/>\n"); - } + virXMLFormatElement(buf, "bank", &attrBuf, &childrenBuf); } if (virCapabilitiesFormatResctrlMonitor(buf, cache->monitor) < 0) --=20 2.23.0 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list From nobody Fri May 3 14:52:45 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of redhat.com designates 207.211.31.81 as permitted sender) client-ip=207.211.31.81; envelope-from=libvir-list-bounces@redhat.com; helo=us-smtp-delivery-1.mimecast.com; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zoho.com: domain of redhat.com designates 207.211.31.81 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1573543746; cv=none; d=zoho.com; s=zohoarc; b=jHWut0FYp37BAl2BEIUjKQphUAkcl8LogsOfJLore458k9Ykwl4L0D6BMXZ0j+uqWPf5d59blwlURVNrPIpgoYsHSL9j3udl64BYt7z0TXd/FRQvQ/HPWKw1C2Fsjr8Ib9gS6xjhC6FaAHwag6Od736nUYl/WTG2LqhalGWg3Gc= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1573543746; h=Content-Type:Content-Transfer-Encoding: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=ceJHf6tqnFhHPHwGFtKJKYNN5J17AJUu0UT7ZUU5m4s=; b=aQv6TPxHbtm6kwsOCvEE7ld6kOsIvbE9McLA+t7gxJqSAKZsYWxGEuKR3maQaExc5p0KRCRTOMOKkDVW7uNFKyhD02bQG/xqL9eppsYpOywPtem40wcqRof5aDthy3gYxTF3ifoDTmRDqFwPcaXH7nzTXjH+AJtsLGBgAP58lJs= ARC-Authentication-Results: i=1; mx.zoho.com; dkim=pass; spf=pass (zoho.com: domain of redhat.com designates 207.211.31.81 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass header.from= (p=none dis=none) header.from= Return-Path: Received: from us-smtp-delivery-1.mimecast.com (us-smtp-1.mimecast.com [207.211.31.81]) by mx.zohomail.com with SMTPS id 1573543746098880.1932607312241; Mon, 11 Nov 2019 23:29:06 -0800 (PST) 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-151-cCsT453cMi-vc4Q0HMHcbQ-1; Tue, 12 Nov 2019 02:28:44 -0500 Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id E615ADB67; Tue, 12 Nov 2019 07:28:39 +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 BAC8C9F55; Tue, 12 Nov 2019 07:28:39 +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 7AF1E180880B; Tue, 12 Nov 2019 07:28:39 +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 xAC7Rx1O011418 for ; Tue, 12 Nov 2019 02:27:59 -0500 Received: by smtp.corp.redhat.com (Postfix) id A56AEBEA67; Tue, 12 Nov 2019 07:27:59 +0000 (UTC) Received: from angien.redhat.com (unknown [10.43.2.48]) by smtp.corp.redhat.com (Postfix) with ESMTP id 31338627DF for ; Tue, 12 Nov 2019 07:27:59 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1573543745; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:list-id:list-help: list-unsubscribe:list-subscribe:list-post; bh=ceJHf6tqnFhHPHwGFtKJKYNN5J17AJUu0UT7ZUU5m4s=; b=ct4HvN/IJqpPi3wrqM0Nu7qfRrE4eawdqnoqLWQfqrZs+A52zzozMX8Fqt1LVByo6kBYru wSYaPut081l52sg64bsmIwZmO6VSMC+2p30y85otMe4NUeqF91Nz4QsvgrnAmWl933x3Sh ZaAzEQ5hlQGzPzDz9ZRD14wMtTCQ2VM= From: Peter Krempa To: libvir-list@redhat.com Date: Tue, 12 Nov 2019 08:27:47 +0100 Message-Id: In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.15 X-loop: libvir-list@redhat.com Subject: [libvirt] [PATCH 10/10] conf: capabilities: Modernize virCapabilitiesFormatMemoryBandwidth 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.12 X-MC-Unique: cCsT453cMi-vc4Q0HMHcbQ-1 X-Mimecast-Spam-Score: 0 Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @redhat.com) Content-Type: text/plain; charset="utf-8" Use virXMLFormatElement and the automatic memory handlers to simplfy the code. Signed-off-by: Peter Krempa Reviewed-by: Daniel P. Berrang=C3=A9 Reviewed-by: J=C3=A1n Tomko --- src/conf/capabilities.c | 18 ++++++------------ 1 file changed, 6 insertions(+), 12 deletions(-) diff --git a/src/conf/capabilities.c b/src/conf/capabilities.c index 1ab389bc65..f3b34b7040 100644 --- a/src/conf/capabilities.c +++ b/src/conf/capabilities.c @@ -1024,7 +1024,6 @@ virCapabilitiesFormatMemoryBandwidth(virBufferPtr buf, virCapsHostMemBWPtr memBW) { size_t i =3D 0; - virBuffer childrenBuf =3D VIR_BUFFER_INITIALIZER; if (!memBW->nnodes) return 0; @@ -1033,17 +1032,18 @@ virCapabilitiesFormatMemoryBandwidth(virBufferPtr b= uf, virBufferAdjustIndent(buf, 2); for (i =3D 0; i < memBW->nnodes; i++) { + g_auto(virBuffer) attrBuf =3D VIR_BUFFER_INITIALIZER; + g_auto(virBuffer) childrenBuf =3D VIR_BUFFER_INITIALIZER; virCapsHostMemBWNodePtr node =3D memBW->nodes[i]; virResctrlInfoMemBWPerNodePtr control =3D &node->control; - char *cpus_str =3D virBitmapFormat(node->cpus); + g_autofree char *cpus_str =3D virBitmapFormat(node->cpus); if (!cpus_str) return -1; - virBufferAsprintf(buf, - "id, cpus_str); - VIR_FREE(cpus_str); virBufferSetChildIndent(&childrenBuf, buf); virBufferAsprintf(&childrenBuf, @@ -1052,13 +1052,7 @@ virCapabilitiesFormatMemoryBandwidth(virBufferPtr bu= f, control->granularity, control->min, control->max_allocation); - if (virBufferUse(&childrenBuf)) { - virBufferAddLit(buf, ">\n"); - virBufferAddBuffer(buf, &childrenBuf); - virBufferAddLit(buf, "\n"); - } else { - virBufferAddLit(buf, "/>\n"); - } + virXMLFormatElement(buf, "node", &attrBuf, &childrenBuf); } if (virCapabilitiesFormatResctrlMonitor(buf, memBW->monitor) < 0) --=20 2.23.0 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list