int bdrv_open_image(BlockDriverState **pbs, const char *filename,

                    QDict *options, const char *bdref_key, int flags,

                    bool allow_none, Error **errp)

{

    QDict *image_options;

    int ret;

    char *bdref_key_dot;

    const char *reference;



    assert(pbs);

    assert(*pbs == NULL);



    bdref_key_dot = g_strdup_printf("%s.", bdref_key);

    qdict_extract_subqdict(options, &image_options, bdref_key_dot);

    g_free(bdref_key_dot);



    reference = qdict_get_try_str(options, bdref_key);

    if (!filename && !reference && !qdict_size(image_options)) {

        if (allow_none) {

            ret = 0;

        } else {

            error_setg(errp, "A block device must be specified for \"%s\"",

                       bdref_key);

            ret = -EINVAL;

        }


        goto done;

    }



    ret = bdrv_open(pbs, filename, reference, image_options, flags, NULL, errp);



done:

    qdict_del(options, bdref_key);

    return ret;

}
int bdrv_open_image(BlockDriverState **pbs, const char *filename,

                    QDict *options, const char *bdref_key, int flags,

                    bool allow_none, Error **errp)

{

    QDict *image_options;

    int ret;

    char *bdref_key_dot;

    const char *reference;



    assert(pbs);

    assert(*pbs == NULL);



    bdref_key_dot = g_strdup_printf("%s.", bdref_key);

    qdict_extract_subqdict(options, &image_options, bdref_key_dot);

    g_free(bdref_key_dot);



    reference = qdict_get_try_str(options, bdref_key);

    if (!filename && !reference && !qdict_size(image_options)) {

        if (allow_none) {

            ret = 0;

        } else {

            error_setg(errp, "A block device must be specified for \"%s\"",

                       bdref_key);

            ret = -EINVAL;

        }


        goto done;

    }



    ret = bdrv_open(pbs, filename, reference, image_options, flags, NULL, errp);



done:

    qdict_del(options, bdref_key);

    return ret;

}
int FUNC_0(BlockDriverState **VAR_0, const char *VAR_1,

                    QDict *VAR_2, const char *VAR_3, int VAR_4,

                    bool VAR_5, Error **VAR_6)

{

    QDict *image_options;

    int VAR_7;

    char *VAR_8;

    const char *VAR_9;



    assert(VAR_0);

    assert(*VAR_0 == NULL);



    VAR_8 = g_strdup_printf("%s.", VAR_3);

    qdict_extract_subqdict(VAR_2, &image_options, VAR_8);

    g_free(VAR_8);



    VAR_9 = qdict_get_try_str(VAR_2, VAR_3);

    if (!VAR_1 && !VAR_9 && !qdict_size(image_options)) {

        if (VAR_5) {

            VAR_7 = 0;

        } else {

            error_setg(VAR_6, "A block device must be specified for \"%s\"",

                       VAR_3);

            VAR_7 = -EINVAL;

        }


        goto done;

    }



    VAR_7 = bdrv_open(VAR_0, VAR_1, VAR_9, image_options, VAR_4, NULL, VAR_6);



done:

    qdict_del(VAR_2, VAR_3);

    return VAR_7;

}
int FUNC_0(BlockDriverState **VAR_0, const char *VAR_1,
QDict *VAR_2, const char *VAR_3, int VAR_4,
bool VAR_5, Error **VAR_6)
{ QDict *image_options; int VAR_7; char *VAR_8; const char *VAR_9; assert(VAR_0); assert(*VAR_0 == NULL); VAR_8 = g_strdup_printf("%s.", VAR_3); qdict_extract_subqdict(VAR_2, &image_options, VAR_8); g_free(VAR_8); VAR_9 = qdict_get_try_str(VAR_2, VAR_3); if (!VAR_1 && !VAR_9 && !qdict_size(image_options)) { if (VAR_5) { VAR_7 = 0; } else { error_setg(VAR_6, "A block device must be specified for \"%s\"",
VAR_3); VAR_7 = -EINVAL; } goto done; } VAR_7 = bdrv_open(VAR_0, VAR_1, VAR_9, image_options, VAR_4, NULL, VAR_6); done:
qdict_del(VAR_2, VAR_3); return VAR_7; }