From nobody Sat Feb 7 18:40:40 2026 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 63.128.21.124 as permitted sender) client-ip=63.128.21.124; envelope-from=libvir-list-bounces@redhat.com; helo=us-smtp-delivery-124.mimecast.com; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 63.128.21.124 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=1606911323; cv=none; d=zohomail.com; s=zohoarc; b=EeTv+VUvPGmYDb/36f5PD73pFm9vn1dONAa/3Tvt2U3aJe9e92swnS5GH2CHv3BbN0n5KxIX7ubFgV2mjoUBGT+PotyLT4MkXDccnLWcSwy1AczJssSSoHZj2oE6iW7DEdpXDZVcM0ZSxMqGJk/dTL2JzOTj3RSYv6MaUivoeNo= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1606911323; 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=ZmU6pgGi7Sr1Cmvg+ctdQHyApjGsI3R42oBaSgUPUw0=; b=WwMKaAQ76JQcXgEWLzJd3Tao6EcVn09MJckEGTPZY3L57ShI7weuJpu+tVbdimeK43DaIgsO5HJTPxN7dk4K76maYnPLG+2eqyXsS+CXLcJqjwDxaR526602CrmV4EETY/VvrmtwyELpAOSNJvIDMsqZZWEciHbxpXLHfgZ+h1k= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 63.128.21.124 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-124.mimecast.com (us-smtp-delivery-124.mimecast.com [63.128.21.124]) by mx.zohomail.com with SMTPS id 1606911323520822.9190528619414; Wed, 2 Dec 2020 04:15:23 -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-162-VWe7Z2PoOhqosivJKLQ0RA-1; Wed, 02 Dec 2020 07:15:19 -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 C9B8910151F9; Wed, 2 Dec 2020 12:15:13 +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 A3FBA60C6B; Wed, 2 Dec 2020 12:15:13 +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 686311809CA4; Wed, 2 Dec 2020 12:15:13 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 0B2CF9jV031747 for ; Wed, 2 Dec 2020 07:15:09 -0500 Received: by smtp.corp.redhat.com (Postfix) id B1D4C189B6; Wed, 2 Dec 2020 12:15:09 +0000 (UTC) Received: from speedmetal.lan (unknown [10.40.208.3]) by smtp.corp.redhat.com (Postfix) with ESMTP id 17D07189A5 for ; Wed, 2 Dec 2020 12:15:08 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1606911322; 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=ZmU6pgGi7Sr1Cmvg+ctdQHyApjGsI3R42oBaSgUPUw0=; b=OkN99v14yeCM62zt4gTw2IFXRxjxyIzdx8dy2GhuReGFiQpyinIAlWcoSRQEWgb4ToJo57 ojXHHjwAdfKnG5A23P9NQo6K/R8VUmeIr6LrnQPv01cwOa5JeOW8KNHpFa9Ndh45m6EgkL hRCRkX4QwqdfG6ROTxxZfAZSiQQdSFg= X-MC-Unique: VWe7Z2PoOhqosivJKLQ0RA-1 From: Peter Krempa To: libvir-list@redhat.com Subject: [PATCH 01/11] virDomainCheckpointAlignDisks: Refactor cleanup Date: Wed, 2 Dec 2020 13:14:51 +0100 Message-Id: <55ca728d2f7d42e9dd523c77f00f3a0afccce035.1606911231.git.pkrempa@redhat.com> In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.11 X-loop: libvir-list@redhat.com 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 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=libvir-list-bounces@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @redhat.com) Content-Type: text/plain; charset="utf-8" Use g_autoptr for virBitmap and get rid of the 'cleanup:' label and ret variable. Signed-off-by: Peter Krempa Reviewed-by: J=C3=A1n Tomko --- src/conf/checkpoint_conf.c | 25 ++++++++++--------------- 1 file changed, 10 insertions(+), 15 deletions(-) diff --git a/src/conf/checkpoint_conf.c b/src/conf/checkpoint_conf.c index a8d18928de..795c6f93c4 100644 --- a/src/conf/checkpoint_conf.c +++ b/src/conf/checkpoint_conf.c @@ -292,8 +292,7 @@ virDomainCheckpointCompareDiskIndex(const void *a, cons= t void *b) int virDomainCheckpointAlignDisks(virDomainCheckpointDefPtr def) { - int ret =3D -1; - virBitmapPtr map =3D NULL; + g_autoptr(virBitmap) map =3D NULL; size_t i; int ndisks; int checkpoint_default =3D VIR_DOMAIN_CHECKPOINT_TYPE_NONE; @@ -301,13 +300,13 @@ virDomainCheckpointAlignDisks(virDomainCheckpointDefP= tr def) if (!def->parent.dom) { virReportError(VIR_ERR_INTERNAL_ERROR, "%s", _("missing domain in checkpoint")); - goto cleanup; + return -1; } if (def->ndisks > def->parent.dom->ndisks) { virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s", _("too many disk checkpoint requests for domain")); - goto cleanup; + return -1; } /* Unlikely to have a guest without disks but technically possible. */ @@ -315,7 +314,7 @@ virDomainCheckpointAlignDisks(virDomainCheckpointDefPtr= def) virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s", _("domain must have at least one disk to perform " "checkpoints")); - goto cleanup; + return -1; } /* If omitted, do bitmap on all writeable disks; @@ -333,14 +332,14 @@ virDomainCheckpointAlignDisks(virDomainCheckpointDefP= tr def) if (idx < 0) { virReportError(VIR_ERR_CONFIG_UNSUPPORTED, _("no disk named '%s'"), disk->name); - goto cleanup; + return -1; } if (virBitmapIsBitSet(map, idx)) { virReportError(VIR_ERR_CONFIG_UNSUPPORTED, _("disk '%s' specified twice"), disk->name); - goto cleanup; + return -1; } if ((virStorageSourceIsEmpty(def->parent.dom->disks[idx]->src) || def->parent.dom->disks[idx]->src->readonly) && @@ -348,7 +347,7 @@ virDomainCheckpointAlignDisks(virDomainCheckpointDefPtr= def) virReportError(VIR_ERR_CONFIG_UNSUPPORTED, _("disk '%s' is empty or readonly"), disk->name); - goto cleanup; + return -1; } ignore_value(virBitmapSetBit(map, idx)); disk->idx =3D idx; @@ -363,7 +362,7 @@ virDomainCheckpointAlignDisks(virDomainCheckpointDefPtr= def) ndisks =3D def->ndisks; if (VIR_EXPAND_N(def->disks, def->ndisks, def->parent.dom->ndisks - def->ndisks) < 0) - goto cleanup; + return -1; for (i =3D 0; i < def->parent.dom->ndisks; i++) { virDomainCheckpointDiskDefPtr disk; @@ -387,13 +386,9 @@ virDomainCheckpointAlignDisks(virDomainCheckpointDefPt= r def) /* Generate default bitmap names for checkpoint */ if (virDomainCheckpointDefAssignBitmapNames(def) < 0) - goto cleanup; - - ret =3D 0; + return -1; - cleanup: - virBitmapFree(map); - return ret; + return 0; } --=20 2.28.0 From nobody Sat Feb 7 18:40:40 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; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 216.205.24.124 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=1606911326; cv=none; d=zohomail.com; s=zohoarc; b=VLB50r9IE4lYH3eEdxhdD8ll64eHBDiR/0dwT/tPF+i3X46wwVHtnaOvoCZbhQ2vEa9yVeGp9rPLcqXJWj3EE4RUsDtykWw5tdCIFFRzKgdMMIHzNGGPjm9Xldn2fTYh94HclT292lFo7bdtPIVyals7lY9+mtzYRm1Vt3WcfJU= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1606911326; 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=/Qf8UcaKJ1Cgc3KzifpFz88s/9Ahpnhjj0mAwaRPjL4=; b=GSES9i6ZZyMMIr2EUy/JIymmyJ9BBfCrY/R+Bhs6bpcz4DCfkWc6LcU8R0sR9BpVjQ877asrrJ26j5dNu76Z+BCnKDC5RpqJ4JopDqlf+cKFKxhv4xLS8WuA6sVeObSFvvA/wJjmM++0jpiWSfp+29UsSd3HDNjsdJ6EWj7MB2o= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 216.205.24.124 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-124.mimecast.com (us-smtp-delivery-124.mimecast.com [216.205.24.124]) by mx.zohomail.com with SMTPS id 1606911326469108.44067996980743; Wed, 2 Dec 2020 04:15:26 -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-181-d-CVGWJuMhyZ0zybMGbbIg-1; Wed, 02 Dec 2020 07:15:23 -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 F3EDD817BA6; Wed, 2 Dec 2020 12:15:16 +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 CEBA31A7D9; Wed, 2 Dec 2020 12:15:16 +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 92CDE85CC; Wed, 2 Dec 2020 12:15:16 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 0B2CFAmK031760 for ; Wed, 2 Dec 2020 07:15:10 -0500 Received: by smtp.corp.redhat.com (Postfix) id C42D0189A5; Wed, 2 Dec 2020 12:15:10 +0000 (UTC) Received: from speedmetal.lan (unknown [10.40.208.3]) by smtp.corp.redhat.com (Postfix) with ESMTP id 206D518A2F for ; Wed, 2 Dec 2020 12:15:09 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1606911325; 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=/Qf8UcaKJ1Cgc3KzifpFz88s/9Ahpnhjj0mAwaRPjL4=; b=FHV4R6Z72+yheEW+CBRIhDFiJxrujSS6wSc2O3igTyUn4rJ0l04x0s8ISvn3XwCz4mpbeV JEK5z7rUYXkjn0kvpRWScnqX6kig0Pve81J+VakkcNorW7RdVoNBSDe91zT68kG2qXYfOE 223Bafdy1FvoxT066vEGhMA+CyE83FI= X-MC-Unique: d-CVGWJuMhyZ0zybMGbbIg-1 From: Peter Krempa To: libvir-list@redhat.com Subject: [PATCH 02/11] virDomainCheckpointAlignDisks: Unbreak error message Date: Wed, 2 Dec 2020 13:14:52 +0100 Message-Id: <0beffc5e3440d0cbdf6c84de5b6e509c8ee8368e.1606911231.git.pkrempa@redhat.com> In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.11 X-loop: libvir-list@redhat.com 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 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=libvir-list-bounces@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com 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/checkpoint_conf.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/conf/checkpoint_conf.c b/src/conf/checkpoint_conf.c index 795c6f93c4..914deb41f2 100644 --- a/src/conf/checkpoint_conf.c +++ b/src/conf/checkpoint_conf.c @@ -312,8 +312,7 @@ virDomainCheckpointAlignDisks(virDomainCheckpointDefPtr= def) /* Unlikely to have a guest without disks but technically possible. */ if (!def->parent.dom->ndisks) { virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s", - _("domain must have at least one disk to perform " - "checkpoints")); + _("domain must have at least one disk to perform ch= eckpoints")); return -1; } --=20 2.28.0 From nobody Sat Feb 7 18:40:40 2026 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 63.128.21.124 as permitted sender) client-ip=63.128.21.124; envelope-from=libvir-list-bounces@redhat.com; helo=us-smtp-delivery-124.mimecast.com; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 63.128.21.124 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=1606911330; cv=none; d=zohomail.com; s=zohoarc; b=P5M3q+pppi22To4VbjfcSI6TjC478Ccn/6o/a1NHy6GrWHaEPAkyggcQabyuxGbALTMg4ez2zjTapp4IKW1fBnxn3njsVwPIneva/gugNRpPbS1tIabXWEOShDOhjdc9F0Hzk5RNP8qRQt8+wPRKElqNYcLNC4j64buCFz4c0II= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1606911330; 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=swAQPro/JSKNGvj8ZZ3H8ZIiqhros1I4vV1aCZOJIjE=; b=DHGMDK7sPVqVtWjUcWY8IAe2V0rS+M7Vi3e9WjV/uAn2/uucn3WGEi98TCYgTo1STEyi/0DOk5wux8FDzSY4P+q29psCd6xJ+vm5DDK68GuAfcfaoFJsTVyqtGGAtLzF3t2/XoMNDVi83vnK1sAS2EcHsfxNAVuCa1OCOo3SMIs= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 63.128.21.124 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-124.mimecast.com (us-smtp-delivery-124.mimecast.com [63.128.21.124]) by mx.zohomail.com with SMTPS id 1606911330425876.2998659792146; Wed, 2 Dec 2020 04:15: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-102-FBmwuxKdOQeIJAkTf_2ibw-1; Wed, 02 Dec 2020 07:15:26 -0500 Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.phx2.redhat.com [10.5.11.13]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 018C4805BEF; Wed, 2 Dec 2020 12:15:20 +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 D09D560854; Wed, 2 Dec 2020 12:15:19 +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 97B211809CA6; Wed, 2 Dec 2020 12:15:19 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 0B2CFExV031804 for ; Wed, 2 Dec 2020 07:15:14 -0500 Received: by smtp.corp.redhat.com (Postfix) id D9748189A5; Wed, 2 Dec 2020 12:15:14 +0000 (UTC) Received: from speedmetal.lan (unknown [10.40.208.3]) by smtp.corp.redhat.com (Postfix) with ESMTP id 3C80163B8C for ; Wed, 2 Dec 2020 12:15:11 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1606911329; 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=swAQPro/JSKNGvj8ZZ3H8ZIiqhros1I4vV1aCZOJIjE=; b=RMHQ23EIYhlZaxl4F+zWjWBJ/oe5U87Lxva298Khh/R9i2nyvEai0Gi6BjVn/2BwehIndj pAh9RWJtyMACWvWLcgKCBmJXW5gwOOSN6MBM7/U5bNQlSvffUNNdwXXnh9DZbWUeYg780x LTbjD8m1y5v3CaNALl6D55Hvs1VVVvM= X-MC-Unique: FBmwuxKdOQeIJAkTf_2ibw-1 From: Peter Krempa To: libvir-list@redhat.com Subject: [PATCH 03/11] virDomainCheckpointAlignDisks: Use 'domdef' for domain definition Date: Wed, 2 Dec 2020 13:14:53 +0100 Message-Id: <615cc74529ecac014d2c5f26420b5b7df579cd53.1606911231.git.pkrempa@redhat.com> In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.11 X-loop: libvir-list@redhat.com 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.13 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=libvir-list-bounces@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @redhat.com) Content-Type: text/plain; charset="utf-8" Extract the pointer and use a local variable throughout the function. Signed-off-by: Peter Krempa Reviewed-by: J=C3=A1n Tomko --- src/conf/checkpoint_conf.c | 29 +++++++++++++++-------------- 1 file changed, 15 insertions(+), 14 deletions(-) diff --git a/src/conf/checkpoint_conf.c b/src/conf/checkpoint_conf.c index 914deb41f2..2375c78b92 100644 --- a/src/conf/checkpoint_conf.c +++ b/src/conf/checkpoint_conf.c @@ -292,25 +292,26 @@ virDomainCheckpointCompareDiskIndex(const void *a, co= nst void *b) int virDomainCheckpointAlignDisks(virDomainCheckpointDefPtr def) { + virDomainDefPtr domdef =3D def->parent.dom; g_autoptr(virBitmap) map =3D NULL; size_t i; int ndisks; int checkpoint_default =3D VIR_DOMAIN_CHECKPOINT_TYPE_NONE; - if (!def->parent.dom) { + if (!domdef) { virReportError(VIR_ERR_INTERNAL_ERROR, "%s", _("missing domain in checkpoint")); return -1; } - if (def->ndisks > def->parent.dom->ndisks) { + if (def->ndisks > domdef->ndisks) { virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s", _("too many disk checkpoint requests for domain")); return -1; } /* Unlikely to have a guest without disks but technically possible. */ - if (!def->parent.dom->ndisks) { + if (!domdef->ndisks) { virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s", _("domain must have at least one disk to perform ch= eckpoints")); return -1; @@ -321,12 +322,12 @@ virDomainCheckpointAlignDisks(virDomainCheckpointDefP= tr def) if (!def->ndisks) checkpoint_default =3D VIR_DOMAIN_CHECKPOINT_TYPE_BITMAP; - map =3D virBitmapNew(def->parent.dom->ndisks); + map =3D virBitmapNew(domdef->ndisks); /* Double check requested disks. */ for (i =3D 0; i < def->ndisks; i++) { virDomainCheckpointDiskDefPtr disk =3D &def->disks[i]; - int idx =3D virDomainDiskIndexByName(def->parent.dom, disk->name, = false); + int idx =3D virDomainDiskIndexByName(domdef, disk->name, false); if (idx < 0) { virReportError(VIR_ERR_CONFIG_UNSUPPORTED, @@ -340,8 +341,8 @@ virDomainCheckpointAlignDisks(virDomainCheckpointDefPtr= def) disk->name); return -1; } - if ((virStorageSourceIsEmpty(def->parent.dom->disks[idx]->src) || - def->parent.dom->disks[idx]->src->readonly) && + if ((virStorageSourceIsEmpty(domdef->disks[idx]->src) || + domdef->disks[idx]->src->readonly) && disk->type !=3D VIR_DOMAIN_CHECKPOINT_TYPE_NONE) { virReportError(VIR_ERR_CONFIG_UNSUPPORTED, _("disk '%s' is empty or readonly"), @@ -351,30 +352,30 @@ virDomainCheckpointAlignDisks(virDomainCheckpointDefP= tr def) ignore_value(virBitmapSetBit(map, idx)); disk->idx =3D idx; - if (STRNEQ(disk->name, def->parent.dom->disks[idx]->dst)) { + if (STRNEQ(disk->name, domdef->disks[idx]->dst)) { VIR_FREE(disk->name); - disk->name =3D g_strdup(def->parent.dom->disks[idx]->dst); + disk->name =3D g_strdup(domdef->disks[idx]->dst); } } /* Provide defaults for all remaining disks. */ ndisks =3D def->ndisks; if (VIR_EXPAND_N(def->disks, def->ndisks, - def->parent.dom->ndisks - def->ndisks) < 0) + domdef->ndisks - def->ndisks) < 0) return -1; - for (i =3D 0; i < def->parent.dom->ndisks; i++) { + for (i =3D 0; i < domdef->ndisks; i++) { virDomainCheckpointDiskDefPtr disk; if (virBitmapIsBitSet(map, i)) continue; disk =3D &def->disks[ndisks++]; - disk->name =3D g_strdup(def->parent.dom->disks[i]->dst); + disk->name =3D g_strdup(domdef->disks[i]->dst); disk->idx =3D i; /* Don't checkpoint empty or readonly drives */ - if (virStorageSourceIsEmpty(def->parent.dom->disks[i]->src) || - def->parent.dom->disks[i]->src->readonly) + if (virStorageSourceIsEmpty(domdef->disks[i]->src) || + domdef->disks[i]->src->readonly) disk->type =3D VIR_DOMAIN_CHECKPOINT_TYPE_NONE; else disk->type =3D checkpoint_default; --=20 2.28.0 From nobody Sat Feb 7 18:40:40 2026 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 63.128.21.124 as permitted sender) client-ip=63.128.21.124; envelope-from=libvir-list-bounces@redhat.com; helo=us-smtp-delivery-124.mimecast.com; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 63.128.21.124 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=1606911326; cv=none; d=zohomail.com; s=zohoarc; b=Cqla6vu4w6F6K7MNMFh/1iscMTJEYvhORfaG71MpVnj2YIsI4WckgTiEn7rw0p/GZ4td17CyNscT6AeCvHphCvz99aQ0Bw8dALgkXmL9bbykdxoTrZ0Nqu6xmvw5APX9NV5phK/yzLefeqM9Md8pm3o7WyImqDywnERtKbegjo8= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1606911326; 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=/lmv++MdCc7H2pHUOtYpfGKUzz0tjLcwbGlKnDrzSLw=; b=aL1UCBHmyJbzUj1TUhukRDvZFGa5XaRjS4Q+t0Tv7DZsYfCy/pr9g4rbtQf+M7OMieyhIUmRd3o6ydV61y8BdYE22AFiZbe4PYSEzg+XMo//z0gybajqPPinbEvFHQRA2XYYGpUWxi8ntlwHzvuXKt3O07KA0HQTRyTXqBuDU3o= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 63.128.21.124 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-124.mimecast.com (us-smtp-delivery-124.mimecast.com [63.128.21.124]) by mx.zohomail.com with SMTPS id 1606911326361422.9942654513676; Wed, 2 Dec 2020 04:15:26 -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-436-QpGAvZhlOwSlYGBTXfR8jg-1; Wed, 02 Dec 2020 07:15:23 -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 EE64C805BEB; Wed, 2 Dec 2020 12:15:17 +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 C607219D9C; Wed, 2 Dec 2020 12:15:17 +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 88E895002E; Wed, 2 Dec 2020 12:15:17 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 0B2CFG7k031811 for ; Wed, 2 Dec 2020 07:15:16 -0500 Received: by smtp.corp.redhat.com (Postfix) id 16C72189A5; Wed, 2 Dec 2020 12:15:16 +0000 (UTC) Received: from speedmetal.lan (unknown [10.40.208.3]) by smtp.corp.redhat.com (Postfix) with ESMTP id 60A0F18A9D for ; Wed, 2 Dec 2020 12:15:15 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1606911325; 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=/lmv++MdCc7H2pHUOtYpfGKUzz0tjLcwbGlKnDrzSLw=; b=MrillhFQ1i8GhbMI6GqI78OqvoKYRL7Ue619qyrxMhCoLjyasa+GxhRceTcONIHIl87NLx qQevpTDAFAZ4W78QLyVvyDLZe7wbJFPEyOftyeIoT1TfRLsvw9iYMblNv2BdMKrlWActV3 NUfwkmtGf3FfCjhpzhR3khFXI/D+v4k= X-MC-Unique: QpGAvZhlOwSlYGBTXfR8jg-1 From: Peter Krempa To: libvir-list@redhat.com Subject: [PATCH 04/11] virDomainCheckpointAlignDisks: rename 'def' to 'chkdef' Date: Wed, 2 Dec 2020 13:14:54 +0100 Message-Id: <520b67b9da25102f5b0c772c3a04e94692e42a20.1606911231.git.pkrempa@redhat.com> In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.11 X-loop: libvir-list@redhat.com 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 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=libvir-list-bounces@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @redhat.com) Content-Type: text/plain; charset="utf-8" In most cases 'def' is used for the domain definition. Rename it to chkdef to prevent confusion. Signed-off-by: Peter Krempa Reviewed-by: J=C3=A1n Tomko --- src/conf/checkpoint_conf.c | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/src/conf/checkpoint_conf.c b/src/conf/checkpoint_conf.c index 2375c78b92..1881c93e09 100644 --- a/src/conf/checkpoint_conf.c +++ b/src/conf/checkpoint_conf.c @@ -290,9 +290,9 @@ virDomainCheckpointCompareDiskIndex(const void *a, cons= t void *b) * if any def->disks[n]->name appears more than once or does not map * to dom->disks. */ int -virDomainCheckpointAlignDisks(virDomainCheckpointDefPtr def) +virDomainCheckpointAlignDisks(virDomainCheckpointDefPtr chkdef) { - virDomainDefPtr domdef =3D def->parent.dom; + virDomainDefPtr domdef =3D chkdef->parent.dom; g_autoptr(virBitmap) map =3D NULL; size_t i; int ndisks; @@ -304,7 +304,7 @@ virDomainCheckpointAlignDisks(virDomainCheckpointDefPtr= def) return -1; } - if (def->ndisks > domdef->ndisks) { + if (chkdef->ndisks > domdef->ndisks) { virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s", _("too many disk checkpoint requests for domain")); return -1; @@ -319,14 +319,14 @@ virDomainCheckpointAlignDisks(virDomainCheckpointDefP= tr def) /* If omitted, do bitmap on all writeable disks; * otherwise, do nothing for omitted disks */ - if (!def->ndisks) + if (!chkdef->ndisks) checkpoint_default =3D VIR_DOMAIN_CHECKPOINT_TYPE_BITMAP; map =3D virBitmapNew(domdef->ndisks); /* Double check requested disks. */ - for (i =3D 0; i < def->ndisks; i++) { - virDomainCheckpointDiskDefPtr disk =3D &def->disks[i]; + for (i =3D 0; i < chkdef->ndisks; i++) { + virDomainCheckpointDiskDefPtr disk =3D &chkdef->disks[i]; int idx =3D virDomainDiskIndexByName(domdef, disk->name, false); if (idx < 0) { @@ -359,9 +359,9 @@ virDomainCheckpointAlignDisks(virDomainCheckpointDefPtr= def) } /* Provide defaults for all remaining disks. */ - ndisks =3D def->ndisks; - if (VIR_EXPAND_N(def->disks, def->ndisks, - domdef->ndisks - def->ndisks) < 0) + ndisks =3D chkdef->ndisks; + if (VIR_EXPAND_N(chkdef->disks, chkdef->ndisks, + domdef->ndisks - chkdef->ndisks) < 0) return -1; for (i =3D 0; i < domdef->ndisks; i++) { @@ -369,7 +369,7 @@ virDomainCheckpointAlignDisks(virDomainCheckpointDefPtr= def) if (virBitmapIsBitSet(map, i)) continue; - disk =3D &def->disks[ndisks++]; + disk =3D &chkdef->disks[ndisks++]; disk->name =3D g_strdup(domdef->disks[i]->dst); disk->idx =3D i; @@ -381,11 +381,11 @@ virDomainCheckpointAlignDisks(virDomainCheckpointDefP= tr def) disk->type =3D checkpoint_default; } - qsort(&def->disks[0], def->ndisks, sizeof(def->disks[0]), + qsort(&chkdef->disks[0], chkdef->ndisks, sizeof(chkdef->disks[0]), virDomainCheckpointCompareDiskIndex); /* Generate default bitmap names for checkpoint */ - if (virDomainCheckpointDefAssignBitmapNames(def) < 0) + if (virDomainCheckpointDefAssignBitmapNames(chkdef) < 0) return -1; return 0; --=20 2.28.0 From nobody Sat Feb 7 18:40:40 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; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 216.205.24.124 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=1606911329; cv=none; d=zohomail.com; s=zohoarc; b=gBLfQki2VFmL/EUK7T97zxxkFsmgyKYYKt/V7Q0WX0gej59/0O3RyTrAh7mS8UVdNyAIzgGNOtB2Dwc2Hka91R41r0T5vaZV+qRGeDYPVYNLigYWMcH+D9HRN+j7Kktv481d5V/+K4F3fu1cOCAYMdOyeRUXt7wH+CtjOFbQh10= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1606911329; 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=ytXk2ekpAj8gRFp9hGOTEmTzTospgzkJstvJO6D2ot8=; b=kI0HfJ7Tm+ZBaZgCY/rjaR1ybylNZnRznkWBMvexAsAfjkx26d/HR6sDD3De2tFq3CgESwUoVvxGZ+2UhR4vrmyAyaUtsZWdeDN9CnXjUgujhU06vnruNkGvUJJq3QFkaZ5cKXhKHod78v0KcB7TabxhQTKtHekqEPzJ0O0FbnE= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 216.205.24.124 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-124.mimecast.com (us-smtp-delivery-124.mimecast.com [216.205.24.124]) by mx.zohomail.com with SMTPS id 1606911329476496.19922457348275; Wed, 2 Dec 2020 04:15:29 -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-499-hwO6UAG5PBOuLnQXtAO7rA-1; Wed, 02 Dec 2020 07:15:25 -0500 Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.phx2.redhat.com [10.5.11.13]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id B5A1810151EF; Wed, 2 Dec 2020 12:15:19 +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 83AA4608DB; Wed, 2 Dec 2020 12:15:19 +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 01AE85002F; Wed, 2 Dec 2020 12:15:19 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 0B2CFHf5031841 for ; Wed, 2 Dec 2020 07:15:17 -0500 Received: by smtp.corp.redhat.com (Postfix) id 2EFBC18A9D; Wed, 2 Dec 2020 12:15:17 +0000 (UTC) Received: from speedmetal.lan (unknown [10.40.208.3]) by smtp.corp.redhat.com (Postfix) with ESMTP id 84E3B63BA7 for ; Wed, 2 Dec 2020 12:15:16 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1606911328; 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=ytXk2ekpAj8gRFp9hGOTEmTzTospgzkJstvJO6D2ot8=; b=iOCKVzTg1pMeIPFZ9DkM6oXE1Q3mv28Gxj0ImhDm36nGelGblyeVL6qn8S50qSEO85hgXG GfNKj49hXhCPfTteyirCx7hJndVxnXzwQ2tcjD+tvb130HREHiptbZ9IzLPXzry8YJtJeT PpPFhKUSitn1XYQegQHLzEJm24+LdFM= X-MC-Unique: hwO6UAG5PBOuLnQXtAO7rA-1 From: Peter Krempa To: libvir-list@redhat.com Subject: [PATCH 05/11] virDomainCheckpointAlignDisks: Use 'chkdisk' instead of 'disk' Date: Wed, 2 Dec 2020 13:14:55 +0100 Message-Id: <28fdce2e2e946d697ccadc688a0f70db7382f85c.1606911231.git.pkrempa@redhat.com> In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.11 X-loop: libvir-list@redhat.com 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.13 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=libvir-list-bounces@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @redhat.com) Content-Type: text/plain; charset="utf-8" Clarify that the variable refers to the definition of the disk from the checkpoint definition. Signed-off-by: Peter Krempa Reviewed-by: J=C3=A1n Tomko --- src/conf/checkpoint_conf.c | 32 ++++++++++++++++---------------- 1 file changed, 16 insertions(+), 16 deletions(-) diff --git a/src/conf/checkpoint_conf.c b/src/conf/checkpoint_conf.c index 1881c93e09..22757d148f 100644 --- a/src/conf/checkpoint_conf.c +++ b/src/conf/checkpoint_conf.c @@ -326,35 +326,35 @@ virDomainCheckpointAlignDisks(virDomainCheckpointDefP= tr chkdef) /* Double check requested disks. */ for (i =3D 0; i < chkdef->ndisks; i++) { - virDomainCheckpointDiskDefPtr disk =3D &chkdef->disks[i]; - int idx =3D virDomainDiskIndexByName(domdef, disk->name, false); + virDomainCheckpointDiskDefPtr chkdisk =3D &chkdef->disks[i]; + int idx =3D virDomainDiskIndexByName(domdef, chkdisk->name, false); if (idx < 0) { virReportError(VIR_ERR_CONFIG_UNSUPPORTED, - _("no disk named '%s'"), disk->name); + _("no disk named '%s'"), chkdisk->name); return -1; } if (virBitmapIsBitSet(map, idx)) { virReportError(VIR_ERR_CONFIG_UNSUPPORTED, _("disk '%s' specified twice"), - disk->name); + chkdisk->name); return -1; } if ((virStorageSourceIsEmpty(domdef->disks[idx]->src) || domdef->disks[idx]->src->readonly) && - disk->type !=3D VIR_DOMAIN_CHECKPOINT_TYPE_NONE) { + chkdisk->type !=3D VIR_DOMAIN_CHECKPOINT_TYPE_NONE) { virReportError(VIR_ERR_CONFIG_UNSUPPORTED, _("disk '%s' is empty or readonly"), - disk->name); + chkdisk->name); return -1; } ignore_value(virBitmapSetBit(map, idx)); - disk->idx =3D idx; + chkdisk->idx =3D idx; - if (STRNEQ(disk->name, domdef->disks[idx]->dst)) { - VIR_FREE(disk->name); - disk->name =3D g_strdup(domdef->disks[idx]->dst); + if (STRNEQ(chkdisk->name, domdef->disks[idx]->dst)) { + VIR_FREE(chkdisk->name); + chkdisk->name =3D g_strdup(domdef->disks[idx]->dst); } } @@ -365,20 +365,20 @@ virDomainCheckpointAlignDisks(virDomainCheckpointDefP= tr chkdef) return -1; for (i =3D 0; i < domdef->ndisks; i++) { - virDomainCheckpointDiskDefPtr disk; + virDomainCheckpointDiskDefPtr chkdisk; if (virBitmapIsBitSet(map, i)) continue; - disk =3D &chkdef->disks[ndisks++]; - disk->name =3D g_strdup(domdef->disks[i]->dst); - disk->idx =3D i; + chkdisk =3D &chkdef->disks[ndisks++]; + chkdisk->name =3D g_strdup(domdef->disks[i]->dst); + chkdisk->idx =3D i; /* Don't checkpoint empty or readonly drives */ if (virStorageSourceIsEmpty(domdef->disks[i]->src) || domdef->disks[i]->src->readonly) - disk->type =3D VIR_DOMAIN_CHECKPOINT_TYPE_NONE; + chkdisk->type =3D VIR_DOMAIN_CHECKPOINT_TYPE_NONE; else - disk->type =3D checkpoint_default; + chkdisk->type =3D checkpoint_default; } qsort(&chkdef->disks[0], chkdef->ndisks, sizeof(chkdef->disks[0]), --=20 2.28.0 From nobody Sat Feb 7 18:40:40 2026 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 63.128.21.124 as permitted sender) client-ip=63.128.21.124; envelope-from=libvir-list-bounces@redhat.com; helo=us-smtp-delivery-124.mimecast.com; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 63.128.21.124 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=1606911378; cv=none; d=zohomail.com; s=zohoarc; b=MBPgo9v4EJaB8j3xHZ2BUKi9iBUjpg4O8HLBQ/fi8h/j6fDb0mn8OYfqnwD6iOM+f84OKnfhnUCNz88ZApK0oVERvX/HcHeHuP978MwhpUq4oHGJF/06Qs3QKUK1KFkH9pNeWEDdIEkUDhnoMRtG7fMxJeCXpt6d4EfF/C4iHds= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1606911378; 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=gcXGnxrqn+UWjY4C9ZF5FghZH8dSY0tLIt60Nk492yc=; b=cCnOIeczxsKwiTLm2PW4Qpz1BEon577zBpmqK0M7MwGzQexDN/awcNec4eURrOHQBMfKbazjBEVoKlnzXVMe/asfejty92ZvDfi5RxW5TN6UzPyLVpRYCEAvWD6ZqQ2EVvjiSUzXJB4mG4wQezv6knzxSUG++QFoUxGSDZeERB8= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 63.128.21.124 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-124.mimecast.com (us-smtp-delivery-124.mimecast.com [63.128.21.124]) by mx.zohomail.com with SMTPS id 1606911378788362.04036259933673; Wed, 2 Dec 2020 04:16:18 -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-424-azBlltAUMW6YLJnau_I11Q-1; Wed, 02 Dec 2020 07:15:27 -0500 Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.phx2.redhat.com [10.5.11.13]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id CFC01100C60D; Wed, 2 Dec 2020 12:15: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 AD47A6086F; Wed, 2 Dec 2020 12:15: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 791BD1809CAA; Wed, 2 Dec 2020 12:15:21 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 0B2CFKDh031893 for ; Wed, 2 Dec 2020 07:15:20 -0500 Received: by smtp.corp.redhat.com (Postfix) id B44CC189A5; Wed, 2 Dec 2020 12:15:20 +0000 (UTC) Received: from speedmetal.lan (unknown [10.40.208.3]) by smtp.corp.redhat.com (Postfix) with ESMTP id 08F7863BA7 for ; Wed, 2 Dec 2020 12:15:17 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1606911377; 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=gcXGnxrqn+UWjY4C9ZF5FghZH8dSY0tLIt60Nk492yc=; b=f+e3WxH1+gziZD3FL3Zq5jwPvelLYuWqQCCkDRu2fpnx3eeENNjTJylkb5yEteDjS3Jmqo XtYX0ic2ybgvqaoeApwnWp8csieiIcjwycYIZzkkbzsbB7HiNiJlksRgKVQPuO9qZgMoxt uUq2XKxVLd8Tk4VoEnpMrZR43Yb2wyk= X-MC-Unique: azBlltAUMW6YLJnau_I11Q-1 From: Peter Krempa To: libvir-list@redhat.com Subject: [PATCH 06/11] virDomainCheckpointAlignDisks: Extract domain disk def pointer to 'domdisk' Date: Wed, 2 Dec 2020 13:14:56 +0100 Message-Id: <3405a80b3b3836ee7c32c07659103f06519605c3.1606911231.git.pkrempa@redhat.com> In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.11 X-loop: libvir-list@redhat.com 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.13 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=libvir-list-bounces@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @redhat.com) Content-Type: text/plain; charset="utf-8" Add a local variable holding the pointer instead of indexing the array multiple times. Signed-off-by: Peter Krempa Reviewed-by: J=C3=A1n Tomko --- src/conf/checkpoint_conf.c | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/src/conf/checkpoint_conf.c b/src/conf/checkpoint_conf.c index 22757d148f..3213097f4f 100644 --- a/src/conf/checkpoint_conf.c +++ b/src/conf/checkpoint_conf.c @@ -328,6 +328,7 @@ virDomainCheckpointAlignDisks(virDomainCheckpointDefPtr= chkdef) for (i =3D 0; i < chkdef->ndisks; i++) { virDomainCheckpointDiskDefPtr chkdisk =3D &chkdef->disks[i]; int idx =3D virDomainDiskIndexByName(domdef, chkdisk->name, false); + virDomainDiskDefPtr domdisk; if (idx < 0) { virReportError(VIR_ERR_CONFIG_UNSUPPORTED, @@ -335,14 +336,17 @@ virDomainCheckpointAlignDisks(virDomainCheckpointDefP= tr chkdef) return -1; } + domdisk =3D domdef->disks[idx]; + if (virBitmapIsBitSet(map, idx)) { virReportError(VIR_ERR_CONFIG_UNSUPPORTED, _("disk '%s' specified twice"), chkdisk->name); return -1; } - if ((virStorageSourceIsEmpty(domdef->disks[idx]->src) || - domdef->disks[idx]->src->readonly) && + + if ((virStorageSourceIsEmpty(domdisk->src) || + domdisk->src->readonly) && chkdisk->type !=3D VIR_DOMAIN_CHECKPOINT_TYPE_NONE) { virReportError(VIR_ERR_CONFIG_UNSUPPORTED, _("disk '%s' is empty or readonly"), @@ -352,9 +356,9 @@ virDomainCheckpointAlignDisks(virDomainCheckpointDefPtr= chkdef) ignore_value(virBitmapSetBit(map, idx)); chkdisk->idx =3D idx; - if (STRNEQ(chkdisk->name, domdef->disks[idx]->dst)) { + if (STRNEQ(chkdisk->name, domdisk->dst)) { VIR_FREE(chkdisk->name); - chkdisk->name =3D g_strdup(domdef->disks[idx]->dst); + chkdisk->name =3D g_strdup(domdisk->dst); } } --=20 2.28.0 From nobody Sat Feb 7 18:40:40 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; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 216.205.24.124 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=1606911363; cv=none; d=zohomail.com; s=zohoarc; b=AmnxlnAo3F7Xa2DJwusvwKaa1FidbD2kMn+RH2F3Ass0ps7ydM5NZt7H0sJCWXYA2mnhJFy29iay7b8Fi0pfdHVtcqhTmHLbNXfJ9urrGt8thNC8MCkA4xuxOCuoJArD0Tcr5cN+lNsYRlnbGCeuoxJ+w5PHY5UTf1MpBEWH2z8= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1606911363; 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=gC9vc+pMl5s2JI48te2ku0XF633ZI0atHZNfm7x2sqc=; b=L1pNyVMxkQQHqPfH7f96nez0Zxpd69pXQcgp+Xbppoce4n8PgPEY4FdijYwY5s44xbdobY7y+sXCrYUVJ/RPn6dlydcMdma8g36fIy/KTmdGeM2x8uqZGTzP+rYEUAdiThCCAt81FlWISuMexV/AKFeNlhRRCDI3pw1iaWhZg+I= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 216.205.24.124 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-124.mimecast.com (us-smtp-delivery-124.mimecast.com [216.205.24.124]) by mx.zohomail.com with SMTPS id 1606911363609462.4871498529259; Wed, 2 Dec 2020 04:16:03 -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-244-O64Is5KJNC622nQuDw0QEQ-1; Wed, 02 Dec 2020 07:15:32 -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 55617805BEC; Wed, 2 Dec 2020 12:15:24 +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 341995C224; Wed, 2 Dec 2020 12:15:24 +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 F2EFA5002F; Wed, 2 Dec 2020 12:15:23 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 0B2CFLrT031899 for ; Wed, 2 Dec 2020 07:15:21 -0500 Received: by smtp.corp.redhat.com (Postfix) id D5A4E189B6; Wed, 2 Dec 2020 12:15:21 +0000 (UTC) Received: from speedmetal.lan (unknown [10.40.208.3]) by smtp.corp.redhat.com (Postfix) with ESMTP id 24BB9189A5 for ; Wed, 2 Dec 2020 12:15:20 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1606911362; 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=gC9vc+pMl5s2JI48te2ku0XF633ZI0atHZNfm7x2sqc=; b=CxFrfXCPna5U0M9mhxVqODfFPDvR2qizXsouMG8i9g+slWXGf+j1OxRtXvaWlyr2acMdvE U8Sk1U7AUGbys+CzU9PioAzewYc0MtcN0wm8yXcvX8tMO+SPbsvPORfAg1JYZmHqCMnBxO xUyfGqDLlFtWRT+nOnvCJRBwJ4elp24= X-MC-Unique: O64Is5KJNC622nQuDw0QEQ-1 From: Peter Krempa To: libvir-list@redhat.com Subject: [PATCH 07/11] virDomainCheckpointAlignDisks: refactor extension to all disks Date: Wed, 2 Dec 2020 13:14:57 +0100 Message-Id: <3256daf81945e97af35e2939a298eb302381728b.1606911231.git.pkrempa@redhat.com> In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.11 X-loop: libvir-list@redhat.com 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 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=libvir-list-bounces@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @redhat.com) Content-Type: text/plain; charset="utf-8" Similarly to d3c029bb105 where we've refactored virDomainSnapshotAlignDisks, modify the extension algorithm to avoid use of the 'idx' variable and sorting of the array. Signed-off-by: Peter Krempa Reviewed-by: J=C3=A1n Tomko --- src/conf/checkpoint_conf.c | 53 +++++++++++++++----------------------- 1 file changed, 21 insertions(+), 32 deletions(-) diff --git a/src/conf/checkpoint_conf.c b/src/conf/checkpoint_conf.c index 3213097f4f..bd0a673757 100644 --- a/src/conf/checkpoint_conf.c +++ b/src/conf/checkpoint_conf.c @@ -274,16 +274,6 @@ virDomainCheckpointDefAssignBitmapNames(virDomainCheck= pointDefPtr def) } -static int -virDomainCheckpointCompareDiskIndex(const void *a, const void *b) -{ - const virDomainCheckpointDiskDef *diska =3D a; - const virDomainCheckpointDiskDef *diskb =3D b; - - /* Integer overflow shouldn't be a problem here. */ - return diska->idx - diskb->idx; -} - /* Align def->disks to def->domain. Sort the list of def->disks, * filling in any missing disks with appropriate default. Convert * paths to disk targets for uniformity. Issue an error and return -1 @@ -293,9 +283,9 @@ int virDomainCheckpointAlignDisks(virDomainCheckpointDefPtr chkdef) { virDomainDefPtr domdef =3D chkdef->parent.dom; - g_autoptr(virBitmap) map =3D NULL; + g_autoptr(GHashTable) map =3D virHashNew(NULL); + g_autofree virDomainCheckpointDiskDefPtr olddisks =3D NULL; size_t i; - int ndisks; int checkpoint_default =3D VIR_DOMAIN_CHECKPOINT_TYPE_NONE; if (!domdef) { @@ -322,8 +312,6 @@ virDomainCheckpointAlignDisks(virDomainCheckpointDefPtr= chkdef) if (!chkdef->ndisks) checkpoint_default =3D VIR_DOMAIN_CHECKPOINT_TYPE_BITMAP; - map =3D virBitmapNew(domdef->ndisks); - /* Double check requested disks. */ for (i =3D 0; i < chkdef->ndisks; i++) { virDomainCheckpointDiskDefPtr chkdisk =3D &chkdef->disks[i]; @@ -338,13 +326,16 @@ virDomainCheckpointAlignDisks(virDomainCheckpointDefP= tr chkdef) domdisk =3D domdef->disks[idx]; - if (virBitmapIsBitSet(map, idx)) { + if (virHashHasEntry(map, domdisk->dst)) { virReportError(VIR_ERR_CONFIG_UNSUPPORTED, _("disk '%s' specified twice"), chkdisk->name); return -1; } + if (virHashAddEntry(map, domdisk->dst, chkdisk) < 0) + return -1; + if ((virStorageSourceIsEmpty(domdisk->src) || domdisk->src->readonly) && chkdisk->type !=3D VIR_DOMAIN_CHECKPOINT_TYPE_NONE) { @@ -353,8 +344,6 @@ virDomainCheckpointAlignDisks(virDomainCheckpointDefPtr= chkdef) chkdisk->name); return -1; } - ignore_value(virBitmapSetBit(map, idx)); - chkdisk->idx =3D idx; if (STRNEQ(chkdisk->name, domdisk->dst)) { VIR_FREE(chkdisk->name); @@ -362,32 +351,32 @@ virDomainCheckpointAlignDisks(virDomainCheckpointDefP= tr chkdef) } } - /* Provide defaults for all remaining disks. */ - ndisks =3D chkdef->ndisks; - if (VIR_EXPAND_N(chkdef->disks, chkdef->ndisks, - domdef->ndisks - chkdef->ndisks) < 0) - return -1; + olddisks =3D g_steal_pointer(&chkdef->disks); + chkdef->disks =3D g_new0(virDomainCheckpointDiskDef, domdef->ndisks); + chkdef->ndisks =3D domdef->ndisks; for (i =3D 0; i < domdef->ndisks; i++) { - virDomainCheckpointDiskDefPtr chkdisk; + virDomainDiskDefPtr domdisk =3D domdef->disks[i]; + virDomainCheckpointDiskDefPtr chkdisk =3D chkdef->disks + i; + virDomainCheckpointDiskDefPtr existing; - if (virBitmapIsBitSet(map, i)) + /* copy existing disks */ + if ((existing =3D virHashLookup(map, domdisk->dst))) { + memcpy(chkdisk, existing, sizeof(*chkdisk)); continue; - chkdisk =3D &chkdef->disks[ndisks++]; - chkdisk->name =3D g_strdup(domdef->disks[i]->dst); - chkdisk->idx =3D i; + } + + /* Provide defaults for all remaining disks. */ + chkdisk->name =3D g_strdup(domdisk->dst); /* Don't checkpoint empty or readonly drives */ - if (virStorageSourceIsEmpty(domdef->disks[i]->src) || - domdef->disks[i]->src->readonly) + if (virStorageSourceIsEmpty(domdisk->src) || + domdisk->src->readonly) chkdisk->type =3D VIR_DOMAIN_CHECKPOINT_TYPE_NONE; else chkdisk->type =3D checkpoint_default; } - qsort(&chkdef->disks[0], chkdef->ndisks, sizeof(chkdef->disks[0]), - virDomainCheckpointCompareDiskIndex); - /* Generate default bitmap names for checkpoint */ if (virDomainCheckpointDefAssignBitmapNames(chkdef) < 0) return -1; --=20 2.28.0 From nobody Sat Feb 7 18:40:40 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; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 216.205.24.124 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=1606911340; cv=none; d=zohomail.com; s=zohoarc; b=gEQBEKF+r3wanjz81fnlKjqwiegHgu9vBi51WGWckwrrMt/sVjezPJTOGSl2rZBGuMYkYb5EKTR/wTb+Ak763nK+qh4uJrfqxSrz2lXX7qDDdVTu1IgHJWr+etBYNjMKpN175w05uE4r4cLjDwqoGHK8VjkG0t+x1XOE4D8nUvE= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1606911340; 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=gsh60fzQlZ+xwrWoYOSD+JYgH19G6GD4Lxp1QYjttlI=; b=V71tAUadUfZnZDOJJ5ux+uM7hKMXzFlE4MKSIyG15pvYJN7sttjHpV+DPDggpLDe6XlK/znVCRWTOv5wtx5uKtbtnVi90EzgbAeEcNCagH9pkX2YwhX47WbKc5hlsXS0UclluThFbFPvfcy8DhmqGSS5BPn6N7UKVKpG00dJ9ms= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 216.205.24.124 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-124.mimecast.com (us-smtp-delivery-124.mimecast.com [216.205.24.124]) by mx.zohomail.com with SMTPS id 1606911340936733.9974907626286; Wed, 2 Dec 2020 04:15: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-481-TKQURTSUP2Sr4iWaTz7EiA-1; Wed, 02 Dec 2020 07:15:37 -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 2FA2C9A22F; Wed, 2 Dec 2020 12:15:31 +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 08AD45D72E; Wed, 2 Dec 2020 12:15:31 +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 BB9EC50034; Wed, 2 Dec 2020 12:15:30 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 0B2CFTjO031947 for ; Wed, 2 Dec 2020 07:15:29 -0500 Received: by smtp.corp.redhat.com (Postfix) id E5E56189A5; Wed, 2 Dec 2020 12:15:29 +0000 (UTC) Received: from speedmetal.lan (unknown [10.40.208.3]) by smtp.corp.redhat.com (Postfix) with ESMTP id 5015318AA1 for ; Wed, 2 Dec 2020 12:15:22 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1606911340; 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=gsh60fzQlZ+xwrWoYOSD+JYgH19G6GD4Lxp1QYjttlI=; b=OosVbvOwMipof9wMQCF2AIvUBLOrihEk0RvfXV1OofiocLS+spVAb9SMFbFM0iwgG6bmtN ccPW2mo1rFHoAqAkioZELKXjTi5AvsQGeg9fMwCNagp7InseR0lTpzX5DF6/DoQZNXkswU ArYWRoujqjxUJq7J/3Ty7+GGCIVWsYI= X-MC-Unique: TKQURTSUP2Sr4iWaTz7EiA-1 From: Peter Krempa To: libvir-list@redhat.com Subject: [PATCH 08/11] virDomainCheckpointDiskDef: Remove unused 'idx' field Date: Wed, 2 Dec 2020 13:14:58 +0100 Message-Id: In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.11 X-loop: libvir-list@redhat.com 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 X-Mimecast-Originator: redhat.com 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/checkpoint_conf.h | 1 - 1 file changed, 1 deletion(-) diff --git a/src/conf/checkpoint_conf.h b/src/conf/checkpoint_conf.h index 631f863151..5997e07ff9 100644 --- a/src/conf/checkpoint_conf.h +++ b/src/conf/checkpoint_conf.h @@ -42,7 +42,6 @@ typedef struct _virDomainCheckpointDiskDef virDomainCheck= pointDiskDef; typedef virDomainCheckpointDiskDef *virDomainCheckpointDiskDefPtr; struct _virDomainCheckpointDiskDef { char *name; /* name matching the dom->disks that matches na= me */ int type; /* virDomainCheckpointType */ char *bitmap; /* bitmap name, if type is bitmap */ unsigned long long size; /* current checkpoint size in bytes */ --=20 2.28.0 From nobody Sat Feb 7 18:40:40 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; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 216.205.24.124 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=1606911438; cv=none; d=zohomail.com; s=zohoarc; b=JvAoxUCfennGmh0E3FNefYTw+O7xEZMYthfbUSZi3UEiJuaL5A6DUZdGQfkwt9h2cNT4P+V5gubaAJdmtCLVwRDXjXe5yop6UlcILC/GIrVkjC361Wtj/Q1MDgKxGcMGByL6sToBXvoWdJqUfNVaZA4o4kefSs11yKr7hHn4HNU= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1606911438; 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=62xJs/CapoBGcS+XfCX7+9iLEKDagV8dgiNs2KyQ2ls=; b=bI4aeyvhNub8nzX34fTMKqP5zjpVAN3PIth5w7dm7Zf6n4XYpum/n2JlmzJmRrQ2DC5b4sV/vrhPEGv5U7qX+V9m2QZy0TEZQ4HgulCbRpYwytj4LjqfQ/Wz93BZM62KNblogl1ia/H5badPcxtjripxuHk1FAk80ovqnoHnLYI= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 216.205.24.124 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-124.mimecast.com (us-smtp-delivery-124.mimecast.com [216.205.24.124]) by mx.zohomail.com with SMTPS id 1606911438350812.6326070861704; Wed, 2 Dec 2020 04:17:18 -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-217-ruQVmLJBNuq8KOBwWO6rEQ-1; Wed, 02 Dec 2020 07:15: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 2FEFE9A22E; Wed, 2 Dec 2020 12:15: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 0712C19D9B; Wed, 2 Dec 2020 12:15: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 C635D50037; Wed, 2 Dec 2020 12:15:32 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 0B2CFVj4031974 for ; Wed, 2 Dec 2020 07:15:31 -0500 Received: by smtp.corp.redhat.com (Postfix) id 11C3E189B6; Wed, 2 Dec 2020 12:15:31 +0000 (UTC) Received: from speedmetal.lan (unknown [10.40.208.3]) by smtp.corp.redhat.com (Postfix) with ESMTP id 628EF189A5 for ; Wed, 2 Dec 2020 12:15:30 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1606911437; 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=62xJs/CapoBGcS+XfCX7+9iLEKDagV8dgiNs2KyQ2ls=; b=f1t6vC5yo2jBHcxw2KIqx5buZj224IxUzN5Xoi/iPoqu+S3Qo2c9qMBCrvJ2jt5BxBWBcu hbHFk5G6OiiXBTplwyB/4yKCCO55kk3aAGttR98qlSnJ9U6beq2QyFX7SJYwmOu/R8tx+B g8+RdvkBy0q9osBk/cLS4OpBGD2r2DY= X-MC-Unique: ruQVmLJBNuq8KOBwWO6rEQ-1 From: Peter Krempa To: libvir-list@redhat.com Subject: [PATCH 09/11] virDomainDiskByName: Remove ternary operator Date: Wed, 2 Dec 2020 13:14:59 +0100 Message-Id: <3d7cc3eb74eb22726eea375ffb1d82616af79e9a.1606911231.git.pkrempa@redhat.com> In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.11 X-loop: libvir-list@redhat.com 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 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=libvir-list-bounces@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com 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 | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c index 49b68c2c68..6922ebf407 100644 --- a/src/conf/domain_conf.c +++ b/src/conf/domain_conf.c @@ -17649,7 +17649,11 @@ virDomainDiskByName(virDomainDefPtr def, bool allow_ambiguous) { int idx =3D virDomainDiskIndexByName(def, name, allow_ambiguous); - return idx < 0 ? NULL : def->disks[idx]; + + if (idx < 0) + return NULL; + + return def->disks[idx]; } --=20 2.28.0 From nobody Sat Feb 7 18:40:40 2026 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 63.128.21.124 as permitted sender) client-ip=63.128.21.124; envelope-from=libvir-list-bounces@redhat.com; helo=us-smtp-delivery-124.mimecast.com; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 63.128.21.124 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=1606911345; cv=none; d=zohomail.com; s=zohoarc; b=i4KNXy0GwhNB6Ypzm94h/8UuKUoniX7kK3uZoVSBn8LtrSlqUSyF+nJkq+My/ItK3v5bbAqHCZ05kRUteD03ouzppMQIGl2ttisDlOzWD25+dLlozRW2fizuqI7rAlPqQ7NFhXRpcIMEBbQ9Zi4snV0IgCSwFaP59sZFjejO/zA= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1606911345; 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=T2Bqp12Ruqbsz9tAC9rcxRofvUgOvIkYEOwBKcrED60=; b=CisrbWL/qFALWyu0+HuGgnDL+0VCxseDG5ehK5A5R6NnpW+PZ2HrK3QJqtirshRA1VLUMpEkHWQPuS1DvlpetKyYw+u8lGFJeuB/VD3V+jD8R5vpZ6lvlopZDwfZzqok0gPHE4Lm8yplSmzIKz3kPXb+L64njXaueWFRfKgod8s= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 63.128.21.124 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-124.mimecast.com (us-smtp-delivery-124.mimecast.com [63.128.21.124]) by mx.zohomail.com with SMTPS id 1606911345857643.4353092457233; Wed, 2 Dec 2020 04:15:45 -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-108-sECXqWvnN-Gmg0YGcLqZlA-1; Wed, 02 Dec 2020 07:15:41 -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 B75BB10151EB; Wed, 2 Dec 2020 12:15:35 +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 9515C60BFA; Wed, 2 Dec 2020 12:15:35 +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 5FF035003B; Wed, 2 Dec 2020 12:15:35 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 0B2CFW5u032010 for ; Wed, 2 Dec 2020 07:15:32 -0500 Received: by smtp.corp.redhat.com (Postfix) id 2CCD1189B6; Wed, 2 Dec 2020 12:15:32 +0000 (UTC) Received: from speedmetal.lan (unknown [10.40.208.3]) by smtp.corp.redhat.com (Postfix) with ESMTP id 8846D189A5 for ; Wed, 2 Dec 2020 12:15:31 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1606911344; 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=T2Bqp12Ruqbsz9tAC9rcxRofvUgOvIkYEOwBKcrED60=; b=bytB6+g9ijDnHMsErnckHgiE10gwCFOqsnLrKMDtYiQ7sSfwGs1mGOs/Q4OH+rK7ENxyk0 EfWA+n6ayMZSbNfFYzFizRK/fXYkWmIQFtget/kr2LszhDX/2mbZhAbVTLWT7aUJC92sjx w8zFvhkZIbSzRMKqvczBHbc2JQqXyxw= X-MC-Unique: sECXqWvnN-Gmg0YGcLqZlA-1 From: Peter Krempa To: libvir-list@redhat.com Subject: [PATCH 10/11] virDomainCheckpointAlignDisks: Use virDomainDiskByName Date: Wed, 2 Dec 2020 13:15:00 +0100 Message-Id: <7b8b0d794a1652b39109773c065c3c97c317d04d.1606911231.git.pkrempa@redhat.com> In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.11 X-loop: libvir-list@redhat.com 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 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=libvir-list-bounces@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @redhat.com) Content-Type: text/plain; charset="utf-8" We don't need the index that virDomainDiskIndexByName returns. Signed-off-by: Peter Krempa Reviewed-by: J=C3=A1n Tomko --- src/conf/checkpoint_conf.c | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/src/conf/checkpoint_conf.c b/src/conf/checkpoint_conf.c index bd0a673757..089488fbc6 100644 --- a/src/conf/checkpoint_conf.c +++ b/src/conf/checkpoint_conf.c @@ -315,17 +315,14 @@ virDomainCheckpointAlignDisks(virDomainCheckpointDefP= tr chkdef) /* Double check requested disks. */ for (i =3D 0; i < chkdef->ndisks; i++) { virDomainCheckpointDiskDefPtr chkdisk =3D &chkdef->disks[i]; - int idx =3D virDomainDiskIndexByName(domdef, chkdisk->name, false); - virDomainDiskDefPtr domdisk; + virDomainDiskDefPtr domdisk =3D virDomainDiskByName(domdef, chkdis= k->name, false); - if (idx < 0) { + if (!domdisk) { virReportError(VIR_ERR_CONFIG_UNSUPPORTED, _("no disk named '%s'"), chkdisk->name); return -1; } - domdisk =3D domdef->disks[idx]; - if (virHashHasEntry(map, domdisk->dst)) { virReportError(VIR_ERR_CONFIG_UNSUPPORTED, _("disk '%s' specified twice"), --=20 2.28.0 From nobody Sat Feb 7 18:40:40 2026 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 63.128.21.124 as permitted sender) client-ip=63.128.21.124; envelope-from=libvir-list-bounces@redhat.com; helo=us-smtp-delivery-124.mimecast.com; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 63.128.21.124 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=1606911347; cv=none; d=zohomail.com; s=zohoarc; b=PzODYmlfVzpCM6+oBbrLyJ5bTQegXWskWmKWjgfWYxwlHgDaxqtqBmqeK6GTmd8nQYQbIL7HSPZFRnAVWRBs5kvQoUrk7U6RgzoSZ5oU1kHdgQg9RT4hnqYl0nzo8P76YvROMy9HFFG25b4D3Ngw12TOuBP0iCbNRUk4Fn8D0gA= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1606911347; 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=AGSqDOb9roGPS6i8Mtp4tHJWizohuiDMSMpKTLMiCfk=; b=AMahQ0CaORUVu1X0F41uKGgTOpM26AS246s3M1LppVRrEZhjD+Y696405IvQKpJejRBNvAHb7R62NtfexwU6QhzqXGIHSkHkFNoI9giwgfnSImnNvqsawGsi+b0fKThMfTVXDVYuwJC7gBZkdmEk9NQWMa/fG0pQw9nLZpFsJPY= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 63.128.21.124 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-124.mimecast.com (us-smtp-delivery-124.mimecast.com [63.128.21.124]) by mx.zohomail.com with SMTPS id 1606911347460225.69061296861912; Wed, 2 Dec 2020 04:15:47 -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-390-t07AiVQ5P4KGVz1QznTRiw-1; Wed, 02 Dec 2020 07:15:43 -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 74B249A22F; Wed, 2 Dec 2020 12:15:38 +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 4DD395D705; Wed, 2 Dec 2020 12:15:38 +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 19CA01809CA1; Wed, 2 Dec 2020 12:15:38 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 0B2CFXvF032029 for ; Wed, 2 Dec 2020 07:15:33 -0500 Received: by smtp.corp.redhat.com (Postfix) id 4C782189A5; Wed, 2 Dec 2020 12:15:33 +0000 (UTC) Received: from speedmetal.lan (unknown [10.40.208.3]) by smtp.corp.redhat.com (Postfix) with ESMTP id 9D35618AA1 for ; Wed, 2 Dec 2020 12:15:32 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1606911346; 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=AGSqDOb9roGPS6i8Mtp4tHJWizohuiDMSMpKTLMiCfk=; b=QGdIIe8ww4IqSYpE7rqThG915ZLakZF2RCIa+4iE8AsAr4uKCubC1UD+7y0Jwzx2pA8GVy ZFRsK91Bk7+UMmbbsyP9W9dpOvCVxu/eYA1/wY4LYv/xFHvfhE8anA18CQLBrNvp8+ooXW oo92wEYB1CTgO7BkN/gaH/1pxAyzsyA= X-MC-Unique: t07AiVQ5P4KGVz1QznTRiw-1 From: Peter Krempa To: libvir-list@redhat.com Subject: [PATCH 11/11] virDomainSnapshotAlignDisks: Use virDomainDiskByName Date: Wed, 2 Dec 2020 13:15:01 +0100 Message-Id: <1198b29a5c46a32a59cbff30b383b35f6986ce03.1606911231.git.pkrempa@redhat.com> In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.11 X-loop: libvir-list@redhat.com 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 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @redhat.com) Content-Type: text/plain; charset="utf-8" We don't need the index that virDomainDiskIndexByName returns. Signed-off-by: Peter Krempa Reviewed-by: J=C3=A1n Tomko --- src/conf/snapshot_conf.c | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/src/conf/snapshot_conf.c b/src/conf/snapshot_conf.c index 8ef9708c72..f896fd1cf2 100644 --- a/src/conf/snapshot_conf.c +++ b/src/conf/snapshot_conf.c @@ -663,17 +663,14 @@ virDomainSnapshotAlignDisks(virDomainSnapshotDefPtr s= napdef, /* Double check requested disks. */ for (i =3D 0; i < snapdef->ndisks; i++) { virDomainSnapshotDiskDefPtr snapdisk =3D &snapdef->disks[i]; - int idx =3D virDomainDiskIndexByName(domdef, snapdisk->name, false= ); - virDomainDiskDefPtr domdisk =3D NULL; + virDomainDiskDefPtr domdisk =3D virDomainDiskByName(domdef, snapdi= sk->name, false); - if (idx < 0) { + if (!domdisk) { virReportError(VIR_ERR_CONFIG_UNSUPPORTED, _("no disk named '%s'"), snapdisk->name); return -1; } - domdisk =3D domdef->disks[idx]; - if (virHashHasEntry(map, domdisk->dst)) { virReportError(VIR_ERR_CONFIG_UNSUPPORTED, _("disk '%s' specified twice"), --=20 2.28.0