[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Qemu-devel] [PATCH 14/20] vvfat: correctly propagate errors
From: |
Fam Zheng |
Subject: |
Re: [Qemu-devel] [PATCH 14/20] vvfat: correctly propagate errors |
Date: |
Mon, 10 Feb 2014 16:16:26 +0800 |
User-agent: |
Mutt/1.5.22 (2013-10-16) |
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 <address@hidden>
> ---
> 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 <address@hidden>
- [Qemu-devel] [PATCH 16/20] vmdk: push vmdk_read_desc up to caller, (continued)
- [Qemu-devel] [PATCH 16/20] vmdk: push vmdk_read_desc up to caller, Paolo Bonzini, 2014/02/09
- [Qemu-devel] [PATCH 17/20] vmdk: do not try opening a file as both image and descriptor, Paolo Bonzini, 2014/02/09
- [Qemu-devel] [PATCH 19/20] block: do not abuse EMEDIUMTYPE, Paolo Bonzini, 2014/02/09
- [Qemu-devel] [PATCH 20/20] vdi: say why an image is bad, Paolo Bonzini, 2014/02/09
- [Qemu-devel] [PATCH 14/20] vvfat: correctly propagate errors, Paolo Bonzini, 2014/02/09
- Re: [Qemu-devel] [PATCH 14/20] vvfat: correctly propagate errors,
Fam Zheng <=
- [Qemu-devel] [PATCH 18/20] vmdk: correctly propagate errors, Paolo Bonzini, 2014/02/09