From nobody Mon Feb 9 10:28:41 2026 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) client-ip=209.132.183.28; envelope-from=libvir-list-bounces@redhat.com; helo=mx1.redhat.com; Authentication-Results: mx.zohomail.com; spf=pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass(p=none dis=none) header.from=redhat.com Return-Path: Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28]) by mx.zohomail.com with SMTPS id 1553681461312941.4406308788409; Wed, 27 Mar 2019 03:11:01 -0700 (PDT) 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 mx1.redhat.com (Postfix) with ESMTPS id 30CAA307CE97; Wed, 27 Mar 2019 10:11: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 F3D1919800; Wed, 27 Mar 2019 10:10:59 +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 8549E1803387; Wed, 27 Mar 2019 10:10:59 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.phx2.redhat.com [10.5.11.13]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id x2RAAvcm022642 for ; Wed, 27 Mar 2019 06:10:57 -0400 Received: by smtp.corp.redhat.com (Postfix) id 959115798A; Wed, 27 Mar 2019 10:10:57 +0000 (UTC) Received: from blue.redhat.com (ovpn-116-59.phx2.redhat.com [10.3.116.59]) by smtp.corp.redhat.com (Postfix) with ESMTP id 216C860924; Wed, 27 Mar 2019 10:10:54 +0000 (UTC) From: Eric Blake To: libvir-list@redhat.com Date: Wed, 27 Mar 2019 05:10:32 -0500 Message-Id: <20190327101054.10648-1-eblake@redhat.com> In-Reply-To: <20190327100734.10225-1-eblake@redhat.com> References: <20190327100734.10225-1-eblake@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.13 X-loop: libvir-list@redhat.com Cc: nsoffer@redhat.com Subject: [libvirt] [PATCH v7 01/23] snapshot: Drop pointless function virDomainMomentIsCurrentName 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: , Content-Transfer-Encoding: quoted-printable Sender: libvir-list-bounces@redhat.com Errors-To: libvir-list-bounces@redhat.com X-Scanned-By: MIMEDefang 2.79 on 10.5.11.11 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.44]); Wed, 27 Mar 2019 10:11:00 +0000 (UTC) Content-Type: text/plain; charset="utf-8" The qemu driver already had a full-blown virDomainMomentObjPtr to check against, and the test driver ought to have one since we get better error checking that the user passed in a valid object. Removes a helper function added in commit commit 4819f54b. Signed-off-by: Eric Blake Reviewed-by: Daniel P. Berrang=C3=A9 --- src/conf/virdomainmomentobjlist.h | 2 -- src/conf/virdomainsnapshotobjlist.h | 2 -- src/conf/virdomainmomentobjlist.c | 9 --------- src/conf/virdomainsnapshotobjlist.c | 9 --------- src/libvirt_private.syms | 1 - src/qemu/qemu_driver.c | 2 +- src/test/test_driver.c | 7 ++++++- 7 files changed, 7 insertions(+), 25 deletions(-) diff --git a/src/conf/virdomainmomentobjlist.h b/src/conf/virdomainmomentob= jlist.h index b67af24bba..6481c771de 100644 --- a/src/conf/virdomainmomentobjlist.h +++ b/src/conf/virdomainmomentobjlist.h @@ -109,8 +109,6 @@ virDomainMomentObjPtr virDomainMomentFindByName(virDoma= inMomentObjListPtr moment int virDomainMomentObjListSize(virDomainMomentObjListPtr moments); virDomainMomentObjPtr virDomainMomentGetCurrent(virDomainMomentObjListPtr = moments); const char *virDomainMomentGetCurrentName(virDomainMomentObjListPtr moment= s); -bool virDomainMomentIsCurrentName(virDomainMomentObjListPtr moments, - const char *name); void virDomainMomentSetCurrent(virDomainMomentObjListPtr moments, virDomainMomentObjPtr moment); bool virDomainMomentObjListRemove(virDomainMomentObjListPtr moments, diff --git a/src/conf/virdomainsnapshotobjlist.h b/src/conf/virdomainsnapsh= otobjlist.h index 38d34ea010..b83f7a4ba9 100644 --- a/src/conf/virdomainsnapshotobjlist.h +++ b/src/conf/virdomainsnapshotobjlist.h @@ -44,8 +44,6 @@ virDomainMomentObjPtr virDomainSnapshotFindByName(virDoma= inSnapshotObjListPtr sn const char *name); virDomainMomentObjPtr virDomainSnapshotGetCurrent(virDomainSnapshotObjList= Ptr snapshots); const char *virDomainSnapshotGetCurrentName(virDomainSnapshotObjListPtr sn= apshots); -bool virDomainSnapshotIsCurrentName(virDomainSnapshotObjListPtr snapshots, - const char *name); void virDomainSnapshotSetCurrent(virDomainSnapshotObjListPtr snapshots, virDomainMomentObjPtr snapshot); bool virDomainSnapshotObjListRemove(virDomainSnapshotObjListPtr snapshots, diff --git a/src/conf/virdomainmomentobjlist.c b/src/conf/virdomainmomentob= jlist.c index 92cf52dd7d..b9ca5b1318 100644 --- a/src/conf/virdomainmomentobjlist.c +++ b/src/conf/virdomainmomentobjlist.c @@ -409,15 +409,6 @@ virDomainMomentGetCurrentName(virDomainMomentObjListPt= r moments) } -/* Return true if name matches the current moment */ -bool -virDomainMomentIsCurrentName(virDomainMomentObjListPtr moments, - const char *name) -{ - return moments->current && STREQ(moments->current->def->name, name); -} - - /* Update the current moment, using NULL if no current remains */ void virDomainMomentSetCurrent(virDomainMomentObjListPtr moments, diff --git a/src/conf/virdomainsnapshotobjlist.c b/src/conf/virdomainsnapsh= otobjlist.c index 04221134da..4ddc2a4b65 100644 --- a/src/conf/virdomainsnapshotobjlist.c +++ b/src/conf/virdomainsnapshotobjlist.c @@ -187,15 +187,6 @@ virDomainSnapshotGetCurrentName(virDomainSnapshotObjLi= stPtr snapshots) } -/* Return true if name matches the current snapshot */ -bool -virDomainSnapshotIsCurrentName(virDomainSnapshotObjListPtr snapshots, - const char *name) -{ - return virDomainMomentIsCurrentName(snapshots->base, name); -} - - /* Update the current snapshot, using NULL if no current remains */ void virDomainSnapshotSetCurrent(virDomainSnapshotObjListPtr snapshots, diff --git a/src/libvirt_private.syms b/src/libvirt_private.syms index 9c2d5e75fa..73ef24d66f 100644 --- a/src/libvirt_private.syms +++ b/src/libvirt_private.syms @@ -995,7 +995,6 @@ virDomainSnapshotFindByName; virDomainSnapshotForEach; virDomainSnapshotGetCurrent; virDomainSnapshotGetCurrentName; -virDomainSnapshotIsCurrentName; virDomainSnapshotObjListFree; virDomainSnapshotObjListGetNames; virDomainSnapshotObjListNew; diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c index 51b434f0d2..930ce9d401 100644 --- a/src/qemu/qemu_driver.c +++ b/src/qemu/qemu_driver.c @@ -16201,7 +16201,7 @@ qemuDomainSnapshotIsCurrent(virDomainSnapshotPtr sn= apshot, if (!(snap =3D qemuSnapObjFromSnapshot(vm, snapshot))) goto cleanup; - ret =3D virDomainSnapshotIsCurrentName(vm->snapshots, snapshot->name); + ret =3D snap =3D=3D virDomainSnapshotGetCurrent(vm->snapshots); cleanup: virDomainObjEndAPI(&vm); diff --git a/src/test/test_driver.c b/src/test/test_driver.c index b7e2bbcff4..fb0e683a06 100644 --- a/src/test/test_driver.c +++ b/src/test/test_driver.c @@ -6249,14 +6249,19 @@ testDomainSnapshotIsCurrent(virDomainSnapshotPtr sn= apshot, { virDomainObjPtr vm =3D NULL; int ret; + virDomainMomentObjPtr snap =3D NULL; virCheckFlags(0, -1); if (!(vm =3D testDomObjFromSnapshot(snapshot))) return -1; - ret =3D virDomainSnapshotIsCurrentName(vm->snapshots, snapshot->name); + if (!(snap =3D testSnapObjFromSnapshot(vm, snapshot))) + goto cleanup; + ret =3D snap =3D=3D virDomainSnapshotGetCurrent(vm->snapshots); + + cleanup: virDomainObjEndAPI(&vm); return ret; } --=20 2.20.1 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list