From patchwork Tue Apr 16 16:05:23 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Pavel Hrdina X-Patchwork-Id: 237023 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (Client did not present a certificate) by ozlabs.org (Postfix) with ESMTPS id A88102C0099 for ; Wed, 17 Apr 2013 02:08:41 +1000 (EST) Received: from localhost ([::1]:58686 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1US8Qx-0001MY-OG for incoming@patchwork.ozlabs.org; Tue, 16 Apr 2013 12:08:39 -0400 Received: from eggs.gnu.org ([208.118.235.92]:39633) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1US8OD-0005pI-J7 for qemu-devel@nongnu.org; Tue, 16 Apr 2013 12:05:51 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1US8OC-0006wj-7g for qemu-devel@nongnu.org; Tue, 16 Apr 2013 12:05:49 -0400 Received: from mx1.redhat.com ([209.132.183.28]:20472) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1US8OB-0006wc-W4 for qemu-devel@nongnu.org; Tue, 16 Apr 2013 12:05:48 -0400 Received: from int-mx10.intmail.prod.int.phx2.redhat.com (int-mx10.intmail.prod.int.phx2.redhat.com [10.5.11.23]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id r3GG5lp1032439 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK) for ; Tue, 16 Apr 2013 12:05:47 -0400 Received: from localhost.localdomain.com ([10.34.250.241]) by int-mx10.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id r3GG5OMV019439; Tue, 16 Apr 2013 12:05:45 -0400 From: Pavel Hrdina To: qemu-devel@nongnu.org Date: Tue, 16 Apr 2013 18:05:23 +0200 Message-Id: <13b9d1e79947b89982ec51c421b9b1bd0a7b587d.1366127809.git.phrdina@redhat.com> In-Reply-To: References: In-Reply-To: References: X-Scanned-By: MIMEDefang 2.68 on 10.5.11.23 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x X-Received-From: 209.132.183.28 Cc: phrdina@redhat.com, armbru@redhat.com, lcapitulino@redhat.com Subject: [Qemu-devel] [PATCH 11/11] savevm: remove backward compatibility from bdrv_snapshot_find() X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Signed-off-by: Pavel Hrdina --- savevm.c | 33 +++++++++++---------------------- 1 file changed, 11 insertions(+), 22 deletions(-) diff --git a/savevm.c b/savevm.c index 66753da..bc829a5 100644 --- a/savevm.c +++ b/savevm.c @@ -2195,7 +2195,7 @@ out: } static int bdrv_snapshot_find(BlockDriverState *bs, QEMUSnapshotInfo *sn_info, - const char *name, const char *id, bool old_match) + const char *name, const char *id) { QEMUSnapshotInfo *sn_tab, *sn; int nb_sns, i, found = 0; @@ -2218,20 +2218,10 @@ static int bdrv_snapshot_find(BlockDriverState *bs, QEMUSnapshotInfo *sn_info, break; } } else if (name) { - /* for compatibility for old bdrv_snapshot_find call - * will be removed */ - if (old_match) { - if (!strcmp(sn->id_str, id) || !strcmp(sn->name, name)) { - *sn_info = *sn; - found = 1; - break; - } - } else { - if (!strcmp(sn->name, name)) { - *sn_info = *sn; - found = 1; - break; - } + if (!strcmp(sn->name, name)) { + *sn_info = *sn; + found = 1; + break; } } else if (id) { if (!strcmp(sn->id_str, id)) { @@ -2290,7 +2280,7 @@ SnapshotInfo *qmp_vm_snapshot_save(const char *name, Error **errp) sn->date_nsec = tv.tv_usec * 1000; sn->vm_clock_nsec = qemu_get_clock_ns(vm_clock); - if (bdrv_snapshot_find(bs, old_sn, name, NULL, false)) { + if (bdrv_snapshot_find(bs, old_sn, name, NULL)) { error_setg(errp, "snapshot '%s' exists", name); goto the_end; } else { @@ -2388,7 +2378,7 @@ SnapshotInfo *qmp_vm_snapshot_load(bool has_name, const char *name, } /* Don't even try to load empty VM states */ - if (!bdrv_snapshot_find(bs_vm_state, &sn, name, id, false)) { + if (!bdrv_snapshot_find(bs_vm_state, &sn, name, id)) { return NULL; } @@ -2413,7 +2403,7 @@ SnapshotInfo *qmp_vm_snapshot_load(bool has_name, const char *name, return NULL; } - if (!bdrv_snapshot_find(bs, &sn, name, id, false)) { + if (!bdrv_snapshot_find(bs, &sn, name, id)) { return NULL; } } @@ -2484,7 +2474,7 @@ SnapshotInfo *qmp_vm_snapshot_delete(const bool has_name, const char *name, return NULL; } - if (!bdrv_snapshot_find(bs, &sn, name, id, false)) { + if (!bdrv_snapshot_find(bs, &sn, name, id)) { /* no need to set an error if snapshot doesn't exist */ return NULL; } @@ -2501,7 +2491,7 @@ SnapshotInfo *qmp_vm_snapshot_delete(const bool has_name, const char *name, bs = NULL; while ((bs = bdrv_next(bs))) { if (bdrv_can_snapshot(bs) - && bdrv_snapshot_find(bs, &sn, name, id, false)) { + && bdrv_snapshot_find(bs, &sn, name, id)) { bdrv_snapshot_delete(bs, sn.name, errp); if (error_is_set(errp)) { return NULL; @@ -2549,8 +2539,7 @@ void do_info_snapshots(Monitor *mon, const QDict *qdict) while ((bs1 = bdrv_next(bs1))) { if (bdrv_can_snapshot(bs1) && bs1 != bs) { - if (!bdrv_snapshot_find(bs1, sn_info, sn->name, sn->id_str, - true)) { + if (!bdrv_snapshot_find(bs1, sn_info, sn->name, sn->id_str)) { available = 0; break; }