qemu-block
[Top][All Lists]
Advanced

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

Re: [Qemu-block] [PATCH v7 for-2.12 21/25] block: Purify .bdrv_refresh_f


From: Alberto Garcia
Subject: Re: [Qemu-block] [PATCH v7 for-2.12 21/25] block: Purify .bdrv_refresh_filename()
Date: Mon, 04 Dec 2017 17:37:07 +0100
User-agent: Notmuch/0.18.2 (http://notmuchmail.org) Emacs/24.4.1 (i586-pc-linux-gnu)

On Mon 20 Nov 2017 09:10:00 PM CET, Max Reitz wrote:
> -static void blkdebug_refresh_filename(BlockDriverState *bs, QDict *options)
> +static void blkdebug_refresh_filename(BlockDriverState *bs)
>  {
>      BDRVBlkdebugState *s = bs->opaque;
> -    QDict *opts;
>      const QDictEntry *e;
> -    bool force_json = false;
> -
> -    for (e = qdict_first(options); e; e = qdict_next(options, e)) {
> -        if (strcmp(qdict_entry_key(e), "config") &&
> -            strcmp(qdict_entry_key(e), "x-image"))
> -        {
> -            force_json = true;
> -            break;
> -        }
> -    }
> +    int ret;
>  
> -    if (force_json && !bs->file->bs->full_open_options) {
> -        /* The config file cannot be recreated, so creating a plain filename
> -         * is impossible */
> +    if (!bs->file->bs->exact_filename[0]) {
>          return;
>      }
>  
> -    if (!force_json && bs->file->bs->exact_filename[0]) {
> -        int ret = snprintf(bs->exact_filename, sizeof(bs->exact_filename),
> -                           "blkdebug:%s:%s", s->config_file ?: "",
> -                           bs->file->bs->exact_filename);
> -        if (ret >= sizeof(bs->exact_filename)) {
> -            /* An overflow makes the filename unusable, so do not report any 
> */
> -            bs->exact_filename[0] = 0;
> +    for (e = qdict_first(bs->full_open_options); e;
> +         e = qdict_next(bs->full_open_options, e))
> +    {
> +        if (strcmp(qdict_entry_key(e), "config") &&
> +            strcmp(qdict_entry_key(e), "image") &&

Shouldn't this be "x-image" ?

Berto



reply via email to

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