qemu-devel
[Top][All Lists]
Advanced

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

Re: [Qemu-devel] [PATCH 4/6] fsdev: Error out when unsupported option is


From: Eric Blake
Subject: Re: [Qemu-devel] [PATCH 4/6] fsdev: Error out when unsupported option is passed
Date: Wed, 8 May 2019 11:23:46 -0500
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Thunderbird/60.6.1

On 5/7/19 3:45 AM, Greg Kurz wrote:
> Each fsdriver only supports a subset of the options that can be passed
> to -fsdev. Unsupported options are simply ignored. This could cause the
> user to erroneously think QEMU has a bug.
> 
> Enforce strict checking of supported options for all fsdrivers. This
> shouldn't impact libvirt, since it doesn't know about he synth and

s/he/the/

> proxy fsdrivers.
> 
> Signed-off-by: Greg Kurz <address@hidden>
> ---
>  fsdev/qemu-fsdev.c |   74 
> ++++++++++++++++++++++++++++++++++++++++++++++++++--
>  1 file changed, 71 insertions(+), 3 deletions(-)
> 

> 
> +#define COMMON_FS_DRIVER_OPTIONS "id", "fsdriver", "readonly"
> +
>  static FsDriverTable FsDrivers[] = {
> -    { .name = "local", .ops = &local_ops},
> -    { .name = "synth", .ops = &synth_ops},
> -    { .name = "proxy", .ops = &proxy_ops},
> +    {
> +        .name = "local",
> +        .ops = &local_ops,
> +        .opts = (const char * []) {
> +            COMMON_FS_DRIVER_OPTIONS,
> +            "security_model",


> +static int validate_opt(void *opaque, const char *name, const char *value,
> +                        Error **errp)
> +{
> +    FsDriverTable *drv = opaque;
> +    const char **opt;
> +
> +    for (opt = drv->opts; *opt; opt++) {
> +        if (!strcmp(*opt, name)) {
> +            return 0;
> +        }
> +    }
> +
> +    error_setg(errp, "'%s' is invalid for fsdriver '%s'", name, drv->name);
> +    return -1;
> +}

When we ever reach command-line QAPIfication, this might go away. In the
meantime, this is an improvement.

Reviewed-by: Eric Blake <address@hidden>

-- 
Eric Blake, Principal Software Engineer
Red Hat, Inc.           +1-919-301-3226
Virtualization:  qemu.org | libvirt.org

Attachment: signature.asc
Description: OpenPGP digital signature


reply via email to

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