[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Qemu-devel] [PATCH 02/14] qerror: add new errors

From: Luiz Capitulino
Subject: Re: [Qemu-devel] [PATCH 02/14] qerror: add new errors
Date: Thu, 31 May 2012 11:06:08 -0300

On Thu, 31 May 2012 12:42:34 +0200
Paolo Bonzini <address@hidden> wrote:

> Il 30/05/2012 16:14, Luiz Capitulino ha scritto:
> > New errors for write() and open() failures. Will be used by the
> > next commits.
> Ouch.  We have already these errors:
>     "{ 'class': 'OpenFileFailed', 'data': { 'filename': %s } }"
>     "{ 'class': 'SockConnectFailed', 'data': {} }"
>     "{ 'class': 'SockListenFailed', 'data': {} }"
>     "{ 'class': 'SockBindFailed', 'data': {} }"
>     "{ 'class': 'SockCreateFailed', 'data': {} }"
> So let's just add QERR_FILE_WRITE_FAILED.

All of them are bad because they don't tell why the operation has failed (more
on errno below). Honestly, I don't remember seeing these. I would have opposed
to merging them.

> What about errno values?  Let's add an enum QemuErrno and convert host
> errnos to that enum.  Enums are sent as strings, so they are neutral to
> the OS of the host and client.  And the client (if it desires) can
> convert back to an errno value and use strerror to provide a
> human-readable, easily internationalizable error message.

That's more or less what this patch does and the path we're taking with
qerror. For errors that have an errno correspondent we're adding classes
with errno names and this can be converted to an enum or whatever you wish.

Now, using strerror() as a human description has been debated a lot in the
past and has been declined (mostly by Anthony). I'm in favor of it, but I'm
afraid I'm not the one to be convinced.

> Errors are not QAPI-ized yet, so we can add errno values to the above
> five errors too.

We've preferred adding new errors instead of adding errno values to
existing errors. I don't remember exactly why, but I personally don't care.

> What more can you ask for?

I'm not asking for anything :)

reply via email to

[Prev in Thread] Current Thread [Next in Thread]