Received: from eggs.gnu.org ([2001:4830:134:3::10]:47983) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1a9qjZ-0003FP-NC for qemu-devel@nongnu.org; Fri, 18 Dec 2015 03:49:54 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1a9qjU-0004WE-J2 for qemu-devel@nongnu.org; Fri, 18 Dec 2015 03:49:53 -0500 Received: from mx1.redhat.com ([209.132.183.28]:33409) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1a9qjU-0004W5-Dp for qemu-devel@nongnu.org; Fri, 18 Dec 2015 03:49:48 -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 (Postfix) with ESMTPS id D65E3693D7 for ; Fri, 18 Dec 2015 08:49:46 +0000 (UTC) From: Markus Armbruster References: <1450371004-26866-1-git-send-email-armbru@redhat.com> <1450371004-26866-5-git-send-email-armbru@redhat.com> <567316B8.5080301@redhat.com> Date: Fri, 18 Dec 2015 09:49:42 +0100 In-Reply-To: <567316B8.5080301@redhat.com> (Eric Blake's message of "Thu, 17 Dec 2015 13:10:32 -0700") Message-ID: <87fuz0jg49.fsf@blackfin.pond.sub.org> MIME-Version: 1.0 Content-Type: text/plain Subject: Re: [Qemu-devel] [PATCH v2 04/23] error: Use error_report_err() instead of ad hoc prints List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Eric Blake Cc: qemu-devel@nongnu.org Eric Blake writes: > On 12/17/2015 09:49 AM, Markus Armbruster wrote: >> Signed-off-by: Markus Armbruster >> --- >> contrib/ivshmem-server/main.c | 4 +--- >> qdev-monitor.c | 3 +-- >> qemu-nbd.c | 3 +-- >> 3 files changed, 3 insertions(+), 7 deletions(-) >> >> diff --git a/contrib/ivshmem-server/main.c b/contrib/ivshmem-server/main.c >> index 54ff001..00508b5 100644 >> --- a/contrib/ivshmem-server/main.c >> +++ b/contrib/ivshmem-server/main.c >> @@ -106,9 +106,7 @@ ivshmem_server_parse_args(IvshmemServerArgs *args, int argc, char *argv[]) >> case 'l': /* shm_size */ >> parse_option_size("shm_size", optarg, &args->shm_size, &errp); > > Idea for a followup patch: The name 'errp' is most often associated with > type 'Error **'; but here it is 'Error *', which is confusing. Yes. Another round of these: e940f54 qmp hmp: Consistently name Error * objects err, and not errp 2f719f1 hw: Consistently name Error * objects err, and not errp 4399c43 qemu-img: Consistently name Error * objects err, and not errp > Other offenders in hmp.c, hw/core/nmi.c, include/qemu/sockets.h, and > tests/test-string-output-visitor.c. > >> if (errp) { >> - fprintf(stderr, "cannot parse shm size: %s\n", >> - error_get_pretty(errp)); >> - error_free(errp); >> + error_report_err(errp); > > This loses the "cannot parse shm size: " prefix; but I don't think that > hurts. Could use a mention in the commit message, though. Losing the prefix is fine, because the error messages always mention the parameter name. For instance, cannot parse shm size: Parameter 'shm_size' expects a size becomes Parameter 'shm_size' expects a size You may use k, M, G or T suffixes for kilobytes, megabytes, gigabytes and terabytes. Note we now get the hint. Including the error location would be even nicer, but is out of scope for this series. The program shows its complete usage help afterwards, which is annoying, but out of scope for this series. I'll amend the commit message. > Reviewed-by: Eric Blake Thanks!