From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:42738) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YNdT4-0006Ee-8H for qemu-devel@nongnu.org; Tue, 17 Feb 2015 03:25:19 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1YNdT0-000584-7z for qemu-devel@nongnu.org; Tue, 17 Feb 2015 03:25:18 -0500 Received: from mx1.redhat.com ([209.132.183.28]:39379) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YNdSz-00057y-Vt for qemu-devel@nongnu.org; Tue, 17 Feb 2015 03:25:14 -0500 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 t1H8PCMw009020 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=FAIL) for ; Tue, 17 Feb 2015 03:25:13 -0500 From: Markus Armbruster References: <1424097865-3973-1-git-send-email-armbru@redhat.com> <1424097865-3973-10-git-send-email-armbru@redhat.com> <54E27F6F.8070204@redhat.com> Date: Tue, 17 Feb 2015 09:25:09 +0100 In-Reply-To: <54E27F6F.8070204@redhat.com> (Eric Blake's message of "Mon, 16 Feb 2015 16:38:23 -0700") Message-ID: <874mqlndwa.fsf@blackfin.pond.sub.org> MIME-Version: 1.0 Content-Type: text/plain Subject: Re: [Qemu-devel] [PATCH 09/13] qemu-img: Suppress unhelpful extra errors in convert, amend List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Eric Blake Cc: kwolf@redhat.com, qemu-devel@nongnu.org, stefanha@redhat.com, kraxel@redhat.com Eric Blake writes: > On 02/16/2015 07:44 AM, Markus Armbruster wrote: >> img_convert() and img_amend() use qemu_opts_do_parse(), which reports >> errors with qerror_report_err(). Its error messages aren't helpful >> here, the caller reports one that actually makes sense. Reproducer: >> >> $ qemu-img convert -o backing_format=raw in.img out.img >> qemu-img: Invalid parameter 'backing_format' >> qemu-img: Invalid options for file format 'raw' >> >> To fix, propagate errors through qemu_opts_do_parse(). This lifts the >> error reporting into callers. Drop it from img_convert() and >> img_amend(), keep it in qemu_chr_parse_compat(), bdrv_img_create(). >> >> Since I'm touching qemu_opts_do_parse() anyway, write a function >> comment for it. >> >> Signed-off-by: Markus Armbruster >> --- >> block.c | 5 ++++- >> include/qemu/option.h | 3 ++- >> qemu-char.c | 10 ++++++++-- >> qemu-img.c | 25 +++++++++++++++++-------- >> util/qemu-option.c | 19 +++++++++---------- >> 5 files changed, 40 insertions(+), 22 deletions(-) >> > >> -int qemu_opts_do_parse(QemuOpts *opts, const char *params, const char *firstname) >> +/** >> + * Store into @opts options parsed from @params. > > Reads a bit awkwardly; maybe: > > Store options parsed from @params into @opts. Mentioning parameters in order. Old habits die hard... >> + * If @firstname is non-null, the first key=value in @params may omit >> + * key=, and is treated as if key was @firstname. >> + * On error, store an error object through @errp if non-null. >> + */ >> +void qemu_opts_do_parse(QemuOpts *opts, const char *params, >> + const char *firstname, Error **errp) >> { > > Up to you if you want to improve that; either way, it's in a comment, so > it doesn't affect correctness, so: > > Reviewed-by: Eric Blake Thanks!