From nobody Mon Nov 25 17:39:19 2024 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=1600868051; cv=none; d=zohomail.com; s=zohoarc; b=GM9gBMRZ9NAns95HmQUgAg7kCVIcwV+WTDrtyx0NgAvOQZw947VSfqTI+zQXbOcDhsRgRcehzhixKGGlXxl1lCl2Bx7Ht8A2ik8GuoIjBBb456rrAQ39ecuUT0+HQDHBN8Vx5OA7S7v6x/J/ST4HYWptPiitRpOu2JZl5EeheSY= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1600868051; 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=S6N6QNaICngVmM1NzTy4V66ApqZOAs+Cs93kWDoDAfU=; b=WG5kcUCJr3LL+2rQX+iY+W9AvKoiLOXqrO0iNUZ6p/ZOSc03GCMtLEGL1bZRyDWrFjXcchrilRTUZsS0hD8bZygk/LV/l5hEAzmxMeP/PxHvD+cSRJCEKo5Clwl3nnQLzol6R+3Om3QUi+lDjnSrCmriaymqd8YsD+cbiivFr9w= 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 1600868051261628.264317578537; Wed, 23 Sep 2020 06:34:11 -0700 (PDT) Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-568-SJN2D5xdOnWXwwxcRg4Ynw-1; Wed, 23 Sep 2020 09:34:07 -0400 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 6E58718BA284; Wed, 23 Sep 2020 13:34:02 +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 4E69078816; Wed, 23 Sep 2020 13:34:02 +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 178968C7CE; Wed, 23 Sep 2020 13:34:02 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx07.intmail.prod.int.phx2.redhat.com [10.5.11.22]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 08NDXuQP013906 for ; Wed, 23 Sep 2020 09:33:56 -0400 Received: by smtp.corp.redhat.com (Postfix) id 671161002C05; Wed, 23 Sep 2020 13:33:56 +0000 (UTC) Received: from speedmetal.redhat.com (unknown [10.40.208.55]) by smtp.corp.redhat.com (Postfix) with ESMTP id AB5AB1002C04 for ; Wed, 23 Sep 2020 13:33:55 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1600868049; 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=S6N6QNaICngVmM1NzTy4V66ApqZOAs+Cs93kWDoDAfU=; b=KP0JQSrExp2zbGBUaTcErRwKTFyItmgmCPv0E7K/yYvwzS4ntQA26rbN8h85kd1wuCmtQP iKcWuuWbPezLiZvS6WRwKEiKgsLw7n9tOBiCFzc1X+e6NOPaBU8hiG5UpW2AZ2tBCCU3C/ u9HOBT/WXXLJcsAewKeBRmmUZ0U0ZK4= X-MC-Unique: SJN2D5xdOnWXwwxcRg4Ynw-1 From: Peter Krempa To: libvir-list@redhat.com Subject: [PATCH 06/13] virDomainSnapshotAlignDisks: Rename 'def' -> 'snapdef' Date: Wed, 23 Sep 2020 15:33:37 +0200 Message-Id: In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.84 on 10.5.11.22 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.11 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" While this function resides in the snapshot config module the 'def' variable is referencing the VM definition in most places. Change the name to 'snapdef' to avoid ambiguity especially since we are also dealing with the domain definition in this function. Signed-off-by: Peter Krempa Reviewed-by: J=C3=A1n Tomko --- src/conf/snapshot_conf.c | 42 ++++++++++++++++++++-------------------- 1 file changed, 21 insertions(+), 21 deletions(-) diff --git a/src/conf/snapshot_conf.c b/src/conf/snapshot_conf.c index 160f2054a4..77f53c4a1d 100644 --- a/src/conf/snapshot_conf.c +++ b/src/conf/snapshot_conf.c @@ -645,7 +645,7 @@ virDomainSnapshotCompareDiskIndex(const void *a, const = void *b) * dom->disks. If require_match, also ensure that there is no * conflicting requests for both internal and external snapshots. */ int -virDomainSnapshotAlignDisks(virDomainSnapshotDefPtr def, +virDomainSnapshotAlignDisks(virDomainSnapshotDefPtr snapdef, int default_snapshot, bool require_match) { @@ -653,29 +653,29 @@ virDomainSnapshotAlignDisks(virDomainSnapshotDefPtr d= ef, size_t i; int ndisks; - if (!def->parent.dom) { + if (!snapdef->parent.dom) { virReportError(VIR_ERR_INTERNAL_ERROR, "%s", _("missing domain in snapshot")); return -1; } - if (def->ndisks > def->parent.dom->ndisks) { + if (snapdef->ndisks > snapdef->parent.dom->ndisks) { virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s", _("too many disk snapshot requests for domain")); return -1; } /* Unlikely to have a guest without disks but technically possible. */ - if (!def->parent.dom->ndisks) + if (!snapdef->parent.dom->ndisks) return 0; - if (!(map =3D virBitmapNew(def->parent.dom->ndisks))) + if (!(map =3D virBitmapNew(snapdef->parent.dom->ndisks))) return -1; /* Double check requested disks. */ - for (i =3D 0; i < def->ndisks; i++) { - virDomainSnapshotDiskDefPtr disk =3D &def->disks[i]; - int idx =3D virDomainDiskIndexByName(def->parent.dom, disk->name, = false); + for (i =3D 0; i < snapdef->ndisks; i++) { + virDomainSnapshotDiskDefPtr disk =3D &snapdef->disks[i]; + int idx =3D virDomainDiskIndexByName(snapdef->parent.dom, disk->na= me, false); int disk_snapshot; if (idx < 0) { @@ -693,7 +693,7 @@ virDomainSnapshotAlignDisks(virDomainSnapshotDefPtr def, ignore_value(virBitmapSetBit(map, idx)); disk->idx =3D idx; - disk_snapshot =3D def->parent.dom->disks[idx]->snapshot; + disk_snapshot =3D snapdef->parent.dom->disks[idx]->snapshot; if (!disk->snapshot) { if (disk_snapshot && (!require_match || @@ -721,44 +721,44 @@ virDomainSnapshotAlignDisks(virDomainSnapshotDefPtr d= ef, disk->src->path, disk->name); return -1; } - if (STRNEQ(disk->name, def->parent.dom->disks[idx]->dst)) { + if (STRNEQ(disk->name, snapdef->parent.dom->disks[idx]->dst)) { VIR_FREE(disk->name); - disk->name =3D g_strdup(def->parent.dom->disks[idx]->dst); + disk->name =3D g_strdup(snapdef->parent.dom->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) + ndisks =3D snapdef->ndisks; + if (VIR_EXPAND_N(snapdef->disks, snapdef->ndisks, + snapdef->parent.dom->ndisks - snapdef->ndisks) < 0) return -1; - for (i =3D 0; i < def->parent.dom->ndisks; i++) { + for (i =3D 0; i < snapdef->parent.dom->ndisks; i++) { virDomainSnapshotDiskDefPtr disk; if (virBitmapIsBitSet(map, i)) continue; - disk =3D &def->disks[ndisks++]; + disk =3D &snapdef->disks[ndisks++]; disk->src =3D virStorageSourceNew(); - disk->name =3D g_strdup(def->parent.dom->disks[i]->dst); + disk->name =3D g_strdup(snapdef->parent.dom->disks[i]->dst); disk->idx =3D i; /* Don't snapshot empty drives */ - if (virStorageSourceIsEmpty(def->parent.dom->disks[i]->src)) + if (virStorageSourceIsEmpty(snapdef->parent.dom->disks[i]->src)) disk->snapshot =3D VIR_DOMAIN_SNAPSHOT_LOCATION_NONE; else - disk->snapshot =3D def->parent.dom->disks[i]->snapshot; + disk->snapshot =3D snapdef->parent.dom->disks[i]->snapshot; disk->src->type =3D VIR_STORAGE_TYPE_FILE; if (!disk->snapshot) disk->snapshot =3D default_snapshot; } - qsort(&def->disks[0], def->ndisks, sizeof(def->disks[0]), + qsort(&snapdef->disks[0], snapdef->ndisks, sizeof(snapdef->disks[0]), virDomainSnapshotCompareDiskIndex); /* Generate default external file names for external snapshot location= s */ - if (virDomainSnapshotDefAssignExternalNames(def) < 0) + if (virDomainSnapshotDefAssignExternalNames(snapdef) < 0) return -1; return 0; --=20 2.26.2