From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([208.118.235.92]:51647) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UPZ6S-0006u8-6a for qemu-devel@nongnu.org; Tue, 09 Apr 2013 10:00:53 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1UPZ6N-0005LL-E2 for qemu-devel@nongnu.org; Tue, 09 Apr 2013 10:00:52 -0400 Received: from mx1.redhat.com ([209.132.183.28]:10101) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UPZ6N-0005LD-0e for qemu-devel@nongnu.org; Tue, 09 Apr 2013 10:00:47 -0400 Received: from int-mx11.intmail.prod.int.phx2.redhat.com (int-mx11.intmail.prod.int.phx2.redhat.com [10.5.11.24]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id r39E0k9R010890 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK) for ; Tue, 9 Apr 2013 10:00:46 -0400 From: Markus Armbruster References: <526c35ec91fa726b6788453392a66ded5be91230.1364565637.git.phrdina@redhat.com> Date: Tue, 09 Apr 2013 16:00:17 +0200 In-Reply-To: <526c35ec91fa726b6788453392a66ded5be91230.1364565637.git.phrdina@redhat.com> (Pavel Hrdina's message of "Fri, 29 Mar 2013 15:12:33 +0100") Message-ID: <87ehej953i.fsf@blackfin.pond.sub.org> MIME-Version: 1.0 Content-Type: text/plain Subject: Re: [Qemu-devel] [PATCH v4 06/11] savevm: add error parameter to qemu_savevm_state() List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Pavel Hrdina Cc: qemu-devel@nongnu.org, lcapitulino@redhat.com Pavel Hrdina writes: > Signed-off-by: Pavel Hrdina > Reviewed-by: Eric Blake > --- > savevm.c | 12 ++++++------ > 1 file changed, 6 insertions(+), 6 deletions(-) > > diff --git a/savevm.c b/savevm.c > index 7598934..3c1ac9e 100644 > --- a/savevm.c > +++ b/savevm.c > @@ -1910,7 +1910,7 @@ void qemu_savevm_state_cancel(void) > } > } > > -static int qemu_savevm_state(QEMUFile *f) > +static int qemu_savevm_state(QEMUFile *f, Error **errp) > { > int ret; > MigrationParams params = { > @@ -1918,23 +1918,23 @@ static int qemu_savevm_state(QEMUFile *f) > .shared = 0 > }; > > - if (qemu_savevm_state_blocked(NULL)) { > + if (qemu_savevm_state_blocked(errp)) { > return -EINVAL; > } > > qemu_mutex_unlock_iothread(); > - qemu_savevm_state_begin(f, ¶ms, NULL); > + qemu_savevm_state_begin(f, ¶ms, errp); > qemu_mutex_lock_iothread(); > > while (qemu_file_get_error(f) == 0) { > - if (qemu_savevm_state_iterate(f, NULL) > 0) { > + if (qemu_savevm_state_iterate(f, errp) > 0) { > break; > } > } > > ret = qemu_file_get_error(f); > if (ret == 0) { > - qemu_savevm_state_complete(f, NULL); > + qemu_savevm_state_complete(f, errp); > ret = qemu_file_get_error(f); > } > if (ret != 0) { > @@ -2321,7 +2321,7 @@ void do_savevm(Monitor *mon, const QDict *qdict) > monitor_printf(mon, "Could not open VM state file\n"); > goto the_end; > } > - ret = qemu_savevm_state(f); > + ret = qemu_savevm_state(f, NULL); > vm_state_size = qemu_ftell(f); > qemu_fclose(f); > if (ret < 0) { monitor_printf(mon, "Error %d while writing VM\n", ret); goto the_end; } First you go all the trouble to create detailed error reports deep down in savevm.c, then you ignore them, and simply report (numeric!) errno instead :)