[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Qemu-devel] [RFC PATCH 3/7] error reporting: Use error_report_errno
From: |
Eric Blake |
Subject: |
Re: [Qemu-devel] [RFC PATCH 3/7] error reporting: Use error_report_errno in obvious places |
Date: |
Thu, 26 Apr 2018 12:37:45 -0500 |
User-agent: |
Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.7.0 |
On 04/26/2018 11:53 AM, Ian Jackson wrote:
> This patch is the result of
>
> git-grep -l 'error_report.*strerror' | xargs perl -p -i~ ../t
>
> with ../t containing
>
> s{error_report\("(.*): \%s"(, .*)?,
> strerror\(errno\)\)\;}{error_report_errno\("$1"$2)\;}
>
> Since this is an automatically generated patch, it does not contain
> any cleanups of the occasional idiosyncratic messages. That is left
> to the future.
>
> No functional change, since error_report_errno does exactly what this
> previous open-coded pattern does.
>
> Signed-off-by: Ian Jackson <address@hidden>
> ---
> audio/wavcapture.c | 2 +-
> hw/i386/xen/xen-hvm.c | 2 +-
> hw/tpm/tpm_emulator.c | 2 +-
> hw/xen/xen_pt_load_rom.c | 4 ++--
> migration/postcopy-ram.c | 12 ++++++------
> net/tap-linux.c | 2 +-
> os-posix.c | 8 ++++----
> qemu-nbd.c | 4 ++--
> scsi/qemu-pr-helper.c | 4 ++--
> slirp/misc.c | 4 ++--
> util/osdep.c | 2 +-
> vl.c | 6 +++---
> 12 files changed, 26 insertions(+), 26 deletions(-)
See my other emails about whether this should be
error_report_errno(errno, "...").
Misses a lot of two-line instances, such as:
$ git grep -A1 error_report | grep -C1 strerror.errno
...
block/file-posix.c: error_report("Failed to restore old file
length:
%s",
block/file-posix.c- strerror(errno));
...
If we're going to clean up these instances, we might as well look harder
for them. Can Coccinelle be coaxed into helping us (at least for
identifying callsites, even if I can't figure out how to make it
slice-and-dice format strings)?
--
Eric Blake, Principal Software Engineer
Red Hat, Inc. +1-919-301-3266
Virtualization: qemu.org | libvirt.org
signature.asc
Description: OpenPGP digital signature
[Qemu-devel] [RFC PATCH 7/7] error reporting: HACKING: Say to use error_report_errno, Ian Jackson, 2018/04/26