Received: from eggs.gnu.org ([2001:4830:134:3::10]:55259) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WCm2U-0002VY-CI for qemu-devel@nongnu.org; Mon, 10 Feb 2014 03:16:32 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1WCm2O-0002j5-8F for qemu-devel@nongnu.org; Mon, 10 Feb 2014 03:16:26 -0500 Received: from mx1.redhat.com ([209.132.183.28]:12527) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WCm2N-0002iz-OW for qemu-devel@nongnu.org; Mon, 10 Feb 2014 03:16:19 -0500 Received: from int-mx01.intmail.prod.int.phx2.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id s1A8GICI006990 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK) for ; Mon, 10 Feb 2014 03:16:19 -0500 Date: Mon, 10 Feb 2014 16:16:26 +0800 From: Fam Zheng Message-ID: <20140210081626.GP15707@T430.nay.redhat.com> References: <1391939335-31580-1-git-send-email-pbonzini@redhat.com> <1391939335-31580-15-git-send-email-pbonzini@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1391939335-31580-15-git-send-email-pbonzini@redhat.com> Subject: Re: [Qemu-devel] [PATCH 14/20] vvfat: correctly propagate errors List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Paolo Bonzini Cc: kwolf@redhat.com, qemu-devel@nongnu.org, stefanha@redhat.com, mreitz@redhat.com On Sun, 02/09 10:48, Paolo Bonzini wrote: > Before: > $ ./qemu-io-old > qemu-io-old> open -r -o driver=vvfat,fat-type=24,dir=i386-softmmu > Valid FAT types are only 12, 16 and 32 > qemu-io-old: can't open device (null): Could not open image: Invalid argument > > After: > $ ./qemu-io > qemu-io> open -r -o driver=vvfat,fat-type=24,dir=i386-softmmu > qemu-io: can't open device (null): Valid FAT types are only 12, 16 and 32 > > Signed-off-by: Paolo Bonzini > --- > block/vvfat.c | 9 +++------ > 1 file changed, 3 insertions(+), 6 deletions(-) > > diff --git a/block/vvfat.c b/block/vvfat.c > index 664941c..7c3521a 100644 > --- a/block/vvfat.c > +++ b/block/vvfat.c > @@ -1086,16 +1086,14 @@ DLOG(if (stderr == NULL) { > opts = qemu_opts_create(&runtime_opts, NULL, 0, &error_abort); > qemu_opts_absorb_qdict(opts, options, &local_err); > if (error_is_set(&local_err)) { > - qerror_report_err(local_err); > - error_free(local_err); > + error_propagate(errp, local_err); > ret = -EINVAL; > goto fail; > } > > dirname = qemu_opt_get(opts, "dir"); > if (!dirname) { > - qerror_report(ERROR_CLASS_GENERIC_ERROR, "vvfat block driver requires " > - "a 'dir' option"); > + error_setg(errp, "vvfat block driver requires a 'dir' option"); > ret = -EINVAL; > goto fail; > } > @@ -1135,8 +1133,7 @@ DLOG(if (stderr == NULL) { > case 12: > break; > default: > - qerror_report(ERROR_CLASS_GENERIC_ERROR, "Valid FAT types are only " > - "12, 16 and 32"); > + error_setg(errp, "Valid FAT types are only 12, 16 and 32"); > ret = -EINVAL; > goto fail; > } > -- > 1.8.5.3 > > Reviewed-by: Fam Zheng