[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: |
Paolo Bonzini |
Subject: |
Re: [Qemu-devel] [PATCH 02/14] qerror: add new errors |
Date: |
Thu, 31 May 2012 18:10:43 +0200 |
User-agent: |
Mozilla/5.0 (X11; Linux x86_64; rv:12.0) Gecko/20120430 Thunderbird/12.0.1 |
Il 31/05/2012 18:08, Luiz Capitulino ha scritto:
> On Thu, 31 May 2012 17:49:42 +0200
> Paolo Bonzini <address@hidden> wrote:
>
>> Il 31/05/2012 17:44, Luiz Capitulino ha scritto:
>>>> One is "do not shoehorn errors into errno values". So for QOM invalid
>>>> values we
>>>> have PropertyValueBad, not a generic InvalidArgument value. We convert
>>>> everything
>>>> to Error rather than returning negative errno values and then returning
>>>> generic
>>>> error codes, because those would be ugly and non-descriptive. I agree
>>>> with that.
>>>>
>>>> The other is "when errors come straight from the OS, _do_ use errno
>>>> values".
>>>> This is for OpenFileFailed, for the new socket errors and so on. This is
>>>> what
>>>> I am proposing.
>>>>
>>>> These two rules together match what most other programs do.
>>>>
>>>> $ echo | sed p > /dev/full
>>>> sed: couldn't flush stdout: No space left on device
>>>> ^^^^^^^^^^^^^^ error type
>>>> ^^^^^^ ^^^^^^^^^^^^^^^^^^^^^^^ arguments
>>>>
>>>> That would become, in JSON:
>>>>
>>>> { 'error': 'FlushFailed',
>>>> 'file': 'stdout',
>>>> 'os_error': 'enospc' }
>>>
>>> Actually, I did propose something similar in the past but Anthony objected.
>>
>> Looks like in the meanwhile we moved closer to this mechanism
>> (OpenFileFailed, Sock*, etc.), except we have no clear way to identify
>> _what_ error actually happened rather than _where_.
>
> In fact, it's the other way around. OpenFileFailed, for example, is an old
> error. We thought it would be ok to have it that way (also because of shallow
> QMP conversion, as it would take ages to convert all possible errors). But
> today
> it's clear it's bad and we're trying to move away from it.
Is it so clear? It's bad that we do not have a way to report OS errors
precisely. But what _is_ absolutely clear, is that we need to report
the "what" (EACCES etc.), but also either the "where" (filename) or the
"when" (bind/connect/...)
Adding an errno to the *Failed errors really seems like a no-brainer to me.
Paolo
- [Qemu-devel] [PATCH 08/14] console: vga_hw_screen_dump_ptr: take an Error argument, (continued)
- [Qemu-devel] [PATCH 08/14] console: vga_hw_screen_dump_ptr: take an Error argument, Luiz Capitulino, 2012/05/30
- [Qemu-devel] [PATCH 02/14] qerror: add new errors, Luiz Capitulino, 2012/05/30
- Re: [Qemu-devel] [PATCH 02/14] qerror: add new errors, Paolo Bonzini, 2012/05/31
- Re: [Qemu-devel] [PATCH 02/14] qerror: add new errors, Luiz Capitulino, 2012/05/31
- Re: [Qemu-devel] [PATCH 02/14] qerror: add new errors, Paolo Bonzini, 2012/05/31
- Re: [Qemu-devel] [PATCH 02/14] qerror: add new errors, Luiz Capitulino, 2012/05/31
- Re: [Qemu-devel] [PATCH 02/14] qerror: add new errors, Paolo Bonzini, 2012/05/31
- Re: [Qemu-devel] [PATCH 02/14] qerror: add new errors, Luiz Capitulino, 2012/05/31
- Re: [Qemu-devel] [PATCH 02/14] qerror: add new errors, Paolo Bonzini, 2012/05/31
- Re: [Qemu-devel] [PATCH 02/14] qerror: add new errors, Luiz Capitulino, 2012/05/31
- Re: [Qemu-devel] [PATCH 02/14] qerror: add new errors,
Paolo Bonzini <=
- Re: [Qemu-devel] [PATCH 02/14] qerror: add new errors, Kevin Wolf, 2012/05/31
[Qemu-devel] [PATCH 07/14] omap_lcdc: rename ppm_save() to omap_ppm_save(), Luiz Capitulino, 2012/05/30
[Qemu-devel] [PATCH 10/14] omap_lcdc: omap_ppm_save(): add error handling, Luiz Capitulino, 2012/05/30
[Qemu-devel] [PATCH 12/14] tcx: tcx24_screen_dump(): add error handling, Luiz Capitulino, 2012/05/30
[Qemu-devel] [PATCH 13/14] tcx: tcx_screen_dump(): add error handling, Luiz Capitulino, 2012/05/30
[Qemu-devel] [PATCH 14/14] qapi: convert screendump, Luiz Capitulino, 2012/05/30
[Qemu-devel] [PATCH 01/14] qerror: extend QERR_TOO_MANY_FILES, Luiz Capitulino, 2012/05/30
[Qemu-devel] [PATCH 09/14] vga: ppm_save(): add error handling, Luiz Capitulino, 2012/05/30