qemu-devel
[Top][All Lists]
Advanced

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

Re: [Qemu-devel] [Qemu-block] [PATCH] block: Make block error codes cons


From: John Snow
Subject: Re: [Qemu-devel] [Qemu-block] [PATCH] block: Make block error codes consistent
Date: Mon, 13 May 2019 11:53:57 -0400
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Thunderbird/60.6.1


On 5/12/19 11:46 AM, Wensheng Tang wrote:
> (The last email does not include signed-off-by line. Please ignoreit)
> 
> We should keep the error handling consistent. ENOMEDIUM is more meaningful 
> than ENOENT a when driver cannot be loaded.
> 

Consistent with what?

Why is it more meaningful?

I might argue that any one of ENODEV, EINVAL, ENOSYS, ENOTSUP, or
EPROTONOSUPPORT might be more meaningful than ENOENT or ENOMEDIUM, but
it depends on what people expect and why.

> Signed-off-by: Wensheng Tang <address@hidden>
> ---
>  block.c | 6 +++---
>  1 file changed, 3 insertions(+), 3 deletions(-)
> 
> diff --git a/block.c b/block.c
> index 5c2c6aa..6685be7 100644
> --- a/block.c
> +++ b/block.c
> @@ -770,7 +770,7 @@ static int find_image_format(BlockBackend *file, const 
> char *filename,
>      if (!drv) {
>          error_setg(errp, "Could not determine image format: No compatible "
>                     "driver found");
> -        ret = -ENOENT;
> +        ret = -ENOMEDIUM;
>      }
>      *pdrv = drv;
>      return ret;
> @@ -1619,7 +1619,7 @@ static int bdrv_fill_options(QDict **options, const 
> char *filename,
>          drv = bdrv_find_format(drvname);
>          if (!drv) {
>              error_setg(errp, "Unknown driver '%s'", drvname);
> -            return -ENOENT;
> +            return -ENOMEDIUM;
>          }
>          /* If the user has explicitly specified the driver, this choice 
> should
>           * override the BDRV_O_PROTOCOL flag */
> @@ -1655,7 +1655,7 @@ static int bdrv_fill_options(QDict **options, const 
> char *filename,
>          if (filename) {
>              drv = bdrv_find_protocol(filename, parse_filename, errp);
>              if (!drv) {
> -                return -EINVAL;
> +                return -ENOMEDIUM;
>              }
>  
>              drvname = drv->format_name;
> 



reply via email to

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