From 3d3e9b1f669b60d9d3cb857edbfc3d54cbb9c0ef Mon Sep 17 00:00:00 2001 From: Daniel P. Berrangé Date: Thu, 4 Feb 2021 12:48:28 +0000 Subject: block: rename and alter bdrv_all_find_snapshot semantics Currently bdrv_all_find_snapshot() will return 0 if it finds a snapshot, -1 if an error occurs, or if it fails to find a snapshot. New callers to be added want to distinguish between the error scenario and failing to find a snapshot. Rename it to bdrv_all_has_snapshot and make it return -1 on error, 0 if no snapshot is found and 1 if snapshot is found. Reviewed-by: Eric Blake Signed-off-by: Daniel P. Berrangé Message-Id: <20210204124834.774401-7-berrange@redhat.com> Signed-off-by: Dr. David Alan Gilbert --- replay/replay-debugging.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'replay') diff --git a/replay/replay-debugging.c b/replay/replay-debugging.c index ca37cf4025..098ef8e0f5 100644 --- a/replay/replay-debugging.c +++ b/replay/replay-debugging.c @@ -143,6 +143,7 @@ static char *replay_find_nearest_snapshot(int64_t icount, QEMUSnapshotInfo *sn_tab; QEMUSnapshotInfo *nearest = NULL; char *ret = NULL; + int rv; int nb_sns, i; AioContext *aio_context; @@ -159,7 +160,10 @@ static char *replay_find_nearest_snapshot(int64_t icount, aio_context_release(aio_context); for (i = 0; i < nb_sns; i++) { - if (bdrv_all_find_snapshot(sn_tab[i].name, false, NULL, NULL) == 0) { + rv = bdrv_all_has_snapshot(sn_tab[i].name, false, NULL, NULL); + if (rv < 0) + goto fail; + if (rv == 1) { if (sn_tab[i].icount != -1ULL && sn_tab[i].icount <= icount && (!nearest || nearest->icount < sn_tab[i].icount)) { -- cgit v1.2.3-55-g7522