[Qemu-devel] [RFC v1 0/3] Implement a warning_report function

Alistair Francis posted 3 patches 6 years, 9 months ago
Patches applied successfully (tree, apply log)
git fetch https://github.com/patchew-project/qemu tags/patchew/cover.1498596157.git.alistair.francis@xilinx.com
Test FreeBSD passed
Test checkpatch passed
Test s390x passed
There is a newer version of this series
chardev/char-socket.c       |  2 +-
include/qemu/error-report.h |  2 ++
util/qemu-error.c           | 36 ++++++++++++++++++++++++++++++++++--
3 files changed, 37 insertions(+), 3 deletions(-)
[Qemu-devel] [RFC v1 0/3] Implement a warning_report function
Posted by Alistair Francis 6 years, 9 months ago
QEMU currently has a standard method to report errors with
error_repot(). This ensure a sane and standard format when printing
errors. This series is attempting to add the same functionality for
warnings.

At the moment only one error is being converted, I wanted to get the
implementation nailed down a little bit before I started converting
others.

This patch renames error_print_loc() function to be more clear, but I
didn't bother renaming the others. It seems silly to change
error_printf() to error_warning_printf() and printf is already taken so
I just left it as is.

I also didn't change the current error output as that would probably
break backwards compatibilty for anyone who is parsing logs.

Alistair Francis (3):
  util/qemu-error: Rename error_print_loc() to be more generic
  util/qemu-error: Add a warning_report() function
  char-socket: Report TCP socket waiting as a warning

 chardev/char-socket.c       |  2 +-
 include/qemu/error-report.h |  2 ++
 util/qemu-error.c           | 36 ++++++++++++++++++++++++++++++++++--
 3 files changed, 37 insertions(+), 3 deletions(-)

-- 
2.11.0


Re: [Qemu-devel] [RFC v1 0/3] Implement a warning_report function
Posted by Daniel P. Berrange 6 years, 9 months ago
On Tue, Jun 27, 2017 at 01:45:41PM -0700, Alistair Francis wrote:
> QEMU currently has a standard method to report errors with
> error_repot(). This ensure a sane and standard format when printing
> errors. This series is attempting to add the same functionality for
> warnings.

I'm not seeing the obvious benefit in this change. Despite its name
'error_report' is ultimately just a clever way to run printf()
on a text string. It can be used for errors, warnings, information
alike. If anything the current method is simply misnamed, and could
be changed to 'message_report'.

Regards,
Daniel
-- 
|: https://berrange.com      -o-    https://www.flickr.com/photos/dberrange :|
|: https://libvirt.org         -o-            https://fstop138.berrange.com :|
|: https://entangle-photo.org    -o-    https://www.instagram.com/dberrange :|

Re: [Qemu-devel] [RFC v1 0/3] Implement a warning_report function
Posted by Alistair Francis 6 years, 9 months ago
On Wed, Jun 28, 2017 at 2:07 AM, Daniel P. Berrange <berrange@redhat.com> wrote:
> On Tue, Jun 27, 2017 at 01:45:41PM -0700, Alistair Francis wrote:
>> QEMU currently has a standard method to report errors with
>> error_repot(). This ensure a sane and standard format when printing
>> errors. This series is attempting to add the same functionality for
>> warnings.
>
> I'm not seeing the obvious benefit in this change. Despite its name
> 'error_report' is ultimately just a clever way to run printf()
> on a text string. It can be used for errors, warnings, information
> alike. If anything the current method is simply misnamed, and could
> be changed to 'message_report'.

I agree that this new method results in the same information being
printed to the same place as error_report(). What I am trying to
achieve though is a consistent structure for messages. So that every
error, warning and information message that QEMU prints looks the same
and are all obvious. The final end goal is that when including QEMU in
other systems (like an Eclipse GUI) all of the different messages can
be clearly understood and automatically parsed.

The problem I think we have now is that some messages just showing
information to the user (like in patch 3) are treated the same as
errors, when they really are not errors. I have seen a lot of
confusion caused by QEMU printing errors and information to stderr
with no obvious way to differentiate which is which.

Thanks,
Alistair

>
> Regards,
> Daniel
> --
> |: https://berrange.com      -o-    https://www.flickr.com/photos/dberrange :|
> |: https://libvirt.org         -o-            https://fstop138.berrange.com :|
> |: https://entangle-photo.org    -o-    https://www.instagram.com/dberrange :|