int bdrv_create(BlockDriver *drv, const char* filename,

                QemuOpts *opts, Error **errp)

{

    int ret;



    Coroutine *co;

    CreateCo cco = {

        .drv = drv,

        .filename = g_strdup(filename),

        .opts = opts,

        .ret = NOT_DONE,

        .err = NULL,

    };



    if (!drv->bdrv_create) {

        error_setg(errp, "Driver '%s' does not support image creation", drv->format_name);

        ret = -ENOTSUP;

        goto out;

    }



    if (qemu_in_coroutine()) {

        /* Fast-path if already in coroutine context */

        bdrv_create_co_entry(&cco);

    } else {

        co = qemu_coroutine_create(bdrv_create_co_entry);

        qemu_coroutine_enter(co, &cco);

        while (cco.ret == NOT_DONE) {

            aio_poll(qemu_get_aio_context(), true);

        }

    }



    ret = cco.ret;

    if (ret < 0) {

        if (cco.err) {

            error_propagate(errp, cco.err);

        } else {

            error_setg_errno(errp, -ret, "Could not create image");

        }

    }



out:

    g_free(cco.filename);

    return ret;

}

int bdrv_create(BlockDriver *drv, const char* filename,

                QemuOpts *opts, Error **errp)

{

    int ret;



    Coroutine *co;

    CreateCo cco = {

        .drv = drv,

        .filename = g_strdup(filename),

        .opts = opts,

        .ret = NOT_DONE,

        .err = NULL,

    };



    if (!drv->bdrv_create) {

        error_setg(errp, "Driver '%s' does not support image creation", drv->format_name);

        ret = -ENOTSUP;

        goto out;

    }



    if (qemu_in_coroutine()) {

        

        bdrv_create_co_entry(&cco);

    } else {

        co = qemu_coroutine_create(bdrv_create_co_entry);

        qemu_coroutine_enter(co, &cco);

        while (cco.ret == NOT_DONE) {

            aio_poll(qemu_get_aio_context(), true);

        }

    }



    ret = cco.ret;

    if (ret < 0) {

        if (cco.err) {

            error_propagate(errp, cco.err);

        } else {

            error_setg_errno(errp, -ret, "Could not create image");

        }

    }



out:

    g_free(cco.filename);

    return ret;

}

        co = qemu_coroutine_create(bdrv_create_co_entry);         qemu_coroutine_enter(co, &cco);
int FUNC_0(BlockDriver *VAR_0, const char* VAR_1,

                QemuOpts *VAR_2, Error **VAR_3)

{

    int VAR_4;



    Coroutine *co;

    CreateCo cco = {

        .VAR_0 = VAR_0,

        .VAR_1 = g_strdup(VAR_1),

        .VAR_2 = VAR_2,

        .VAR_4 = NOT_DONE,

        .err = NULL,

    };



    if (!VAR_0->FUNC_0) {

        error_setg(VAR_3, "Driver '%s' does not support image creation", VAR_0->format_name);

        VAR_4 = -ENOTSUP;

        goto out;

    }



    if (qemu_in_coroutine()) {

        

        bdrv_create_co_entry(&cco);

    } else {

        co = qemu_coroutine_create(bdrv_create_co_entry);

        qemu_coroutine_enter(co, &cco);

        while (cco.VAR_4 == NOT_DONE) {

            aio_poll(qemu_get_aio_context(), true);

        }

    }



    VAR_4 = cco.VAR_4;

    if (VAR_4 < 0) {

        if (cco.err) {

            error_propagate(VAR_3, cco.err);

        } else {

            error_setg_errno(VAR_3, -VAR_4, "Could not create image");

        }

    }



out:

    g_free(cco.VAR_1);

    return VAR_4;

}

int FUNC_0(BlockDriver *VAR_0, const char* VAR_1,
QemuOpts *VAR_2, Error **VAR_3)
{ int VAR_4; Coroutine *co; CreateCo cco = { .VAR_0 = VAR_0,
.VAR_1 = g_strdup(VAR_1),
.VAR_2 = VAR_2,
.VAR_4 = NOT_DONE,
.err = NULL,
}; if (!VAR_0->FUNC_0) { error_setg(VAR_3, "Driver '%s' does not support image creation", VAR_0->format_name); VAR_4 = -ENOTSUP; goto out; } if (qemu_in_coroutine()) { bdrv_create_co_entry(&cco); } else { co = qemu_coroutine_create(bdrv_create_co_entry); qemu_coroutine_enter(co, &cco); while (cco.VAR_4 == NOT_DONE) { aio_poll(qemu_get_aio_context(), true); } } VAR_4 = cco.VAR_4; if (VAR_4 < 0) { if (cco.err) { error_propagate(VAR_3, cco.err); } else { error_setg_errno(VAR_3, -VAR_4, "Could not create image"); } } out:
g_free(cco.VAR_1); return VAR_4; }