void commit_start(const char *job_id, BlockDriverState *bs,

                  BlockDriverState *base, BlockDriverState *top, int64_t speed,

                  BlockdevOnError on_error, BlockCompletionFunc *cb,

                  void *opaque, const char *backing_file_str, Error **errp)

{

    CommitBlockJob *s;

    BlockReopenQueue *reopen_queue = NULL;

    int orig_overlay_flags;

    int orig_base_flags;

    BlockDriverState *overlay_bs;

    Error *local_err = NULL;



    assert(top != bs);

    if (top == base) {

        error_setg(errp, "Invalid files for merge: top and base are the same");

        return;

    }



    overlay_bs = bdrv_find_overlay(bs, top);



    if (overlay_bs == NULL) {

        error_setg(errp, "Could not find overlay image for %s:", top->filename);

        return;

    }



    s = block_job_create(job_id, &commit_job_driver, bs, speed,

                         cb, opaque, errp);

    if (!s) {

        return;

    }



    orig_base_flags    = bdrv_get_flags(base);

    orig_overlay_flags = bdrv_get_flags(overlay_bs);



    /* convert base & overlay_bs to r/w, if necessary */

    if (!(orig_overlay_flags & BDRV_O_RDWR)) {

        reopen_queue = bdrv_reopen_queue(reopen_queue, overlay_bs, NULL,

                                         orig_overlay_flags | BDRV_O_RDWR);

    }

    if (!(orig_base_flags & BDRV_O_RDWR)) {

        reopen_queue = bdrv_reopen_queue(reopen_queue, base, NULL,

                                         orig_base_flags | BDRV_O_RDWR);

    }

    if (reopen_queue) {

        bdrv_reopen_multiple(reopen_queue, &local_err);

        if (local_err != NULL) {

            error_propagate(errp, local_err);

            block_job_unref(&s->common);

            return;

        }

    }





    s->base = blk_new();

    blk_insert_bs(s->base, base);



    s->top = blk_new();

    blk_insert_bs(s->top, top);



    s->active = bs;



    s->base_flags          = orig_base_flags;

    s->orig_overlay_flags  = orig_overlay_flags;



    s->backing_file_str = g_strdup(backing_file_str);



    s->on_error = on_error;

    s->common.co = qemu_coroutine_create(commit_run);



    trace_commit_start(bs, base, top, s, s->common.co, opaque);

    qemu_coroutine_enter(s->common.co, s);

}

void commit_start(const char *job_id, BlockDriverState *bs,

                  BlockDriverState *base, BlockDriverState *top, int64_t speed,

                  BlockdevOnError on_error, BlockCompletionFunc *cb,

                  void *opaque, const char *backing_file_str, Error **errp)

{

    CommitBlockJob *s;

    BlockReopenQueue *reopen_queue = NULL;

    int orig_overlay_flags;

    int orig_base_flags;

    BlockDriverState *overlay_bs;

    Error *local_err = NULL;



    assert(top != bs);

    if (top == base) {

        error_setg(errp, "Invalid files for merge: top and base are the same");

        return;

    }



    overlay_bs = bdrv_find_overlay(bs, top);



    if (overlay_bs == NULL) {

        error_setg(errp, "Could not find overlay image for %s:", top->filename);

        return;

    }



    s = block_job_create(job_id, &commit_job_driver, bs, speed,

                         cb, opaque, errp);

    if (!s) {

        return;

    }



    orig_base_flags    = bdrv_get_flags(base);

    orig_overlay_flags = bdrv_get_flags(overlay_bs);



    

    if (!(orig_overlay_flags & BDRV_O_RDWR)) {

        reopen_queue = bdrv_reopen_queue(reopen_queue, overlay_bs, NULL,

                                         orig_overlay_flags | BDRV_O_RDWR);

    }

    if (!(orig_base_flags & BDRV_O_RDWR)) {

        reopen_queue = bdrv_reopen_queue(reopen_queue, base, NULL,

                                         orig_base_flags | BDRV_O_RDWR);

    }

    if (reopen_queue) {

        bdrv_reopen_multiple(reopen_queue, &local_err);

        if (local_err != NULL) {

            error_propagate(errp, local_err);

            block_job_unref(&s->common);

            return;

        }

    }





    s->base = blk_new();

    blk_insert_bs(s->base, base);



    s->top = blk_new();

    blk_insert_bs(s->top, top);



    s->active = bs;



    s->base_flags          = orig_base_flags;

    s->orig_overlay_flags  = orig_overlay_flags;



    s->backing_file_str = g_strdup(backing_file_str);



    s->on_error = on_error;

    s->common.co = qemu_coroutine_create(commit_run);



    trace_commit_start(bs, base, top, s, s->common.co, opaque);

    qemu_coroutine_enter(s->common.co, s);

}

    s->common.co = qemu_coroutine_create(commit_run);     qemu_coroutine_enter(s->common.co, s);     qemu_coroutine_enter(s->common.co, s);     qemu_coroutine_enter(s->common.co, s);     qemu_coroutine_enter(s->common.co, s);
void FUNC_0(const char *VAR_0, BlockDriverState *VAR_1,

                  BlockDriverState *VAR_2, BlockDriverState *VAR_3, int64_t VAR_4,

                  BlockdevOnError VAR_5, BlockCompletionFunc *VAR_6,

                  void *VAR_7, const char *VAR_8, Error **VAR_9)

{

    CommitBlockJob *s;

    BlockReopenQueue *reopen_queue = NULL;

    int VAR_10;

    int VAR_11;

    BlockDriverState *overlay_bs;

    Error *local_err = NULL;



    assert(VAR_3 != VAR_1);

    if (VAR_3 == VAR_2) {

        error_setg(VAR_9, "Invalid files for merge: VAR_3 and VAR_2 are the same");

        return;

    }



    overlay_bs = bdrv_find_overlay(VAR_1, VAR_3);



    if (overlay_bs == NULL) {

        error_setg(VAR_9, "Could not find overlay image for %s:", VAR_3->filename);

        return;

    }



    s = block_job_create(VAR_0, &commit_job_driver, VAR_1, VAR_4,

                         VAR_6, VAR_7, VAR_9);

    if (!s) {

        return;

    }



    VAR_11    = bdrv_get_flags(VAR_2);

    VAR_10 = bdrv_get_flags(overlay_bs);



    

    if (!(VAR_10 & BDRV_O_RDWR)) {

        reopen_queue = bdrv_reopen_queue(reopen_queue, overlay_bs, NULL,

                                         VAR_10 | BDRV_O_RDWR);

    }

    if (!(VAR_11 & BDRV_O_RDWR)) {

        reopen_queue = bdrv_reopen_queue(reopen_queue, VAR_2, NULL,

                                         VAR_11 | BDRV_O_RDWR);

    }

    if (reopen_queue) {

        bdrv_reopen_multiple(reopen_queue, &local_err);

        if (local_err != NULL) {

            error_propagate(VAR_9, local_err);

            block_job_unref(&s->common);

            return;

        }

    }





    s->VAR_2 = blk_new();

    blk_insert_bs(s->VAR_2, VAR_2);



    s->VAR_3 = blk_new();

    blk_insert_bs(s->VAR_3, VAR_3);



    s->active = VAR_1;



    s->base_flags          = VAR_11;

    s->VAR_10  = VAR_10;



    s->VAR_8 = g_strdup(VAR_8);



    s->VAR_5 = VAR_5;

    s->common.co = qemu_coroutine_create(commit_run);



    trace_commit_start(VAR_1, VAR_2, VAR_3, s, s->common.co, VAR_7);

    qemu_coroutine_enter(s->common.co, s);

}

void FUNC_0(const char *VAR_0, BlockDriverState *VAR_1,
BlockDriverState *VAR_2, BlockDriverState *VAR_3, int64_t VAR_4,
BlockdevOnError VAR_5, BlockCompletionFunc *VAR_6,
void *VAR_7, const char *VAR_8, Error **VAR_9)
{ CommitBlockJob *s; BlockReopenQueue *reopen_queue = NULL; int VAR_10; int VAR_11; BlockDriverState *overlay_bs; Error *local_err = NULL; assert(VAR_3 != VAR_1); if (VAR_3 == VAR_2) { error_setg(VAR_9, "Invalid files for merge: VAR_3 and VAR_2 are the same"); return; } overlay_bs = bdrv_find_overlay(VAR_1, VAR_3); if (overlay_bs == NULL) { error_setg(VAR_9, "Could not find overlay image for %s:", VAR_3->filename); return; } s = block_job_create(VAR_0, &commit_job_driver, VAR_1, VAR_4,
VAR_6, VAR_7, VAR_9); if (!s) { return; } VAR_11    = bdrv_get_flags(VAR_2); VAR_10 = bdrv_get_flags(overlay_bs); if (!(VAR_10 & BDRV_O_RDWR)) { reopen_queue = bdrv_reopen_queue(reopen_queue, overlay_bs, NULL,
VAR_10 | BDRV_O_RDWR); } if (!(VAR_11 & BDRV_O_RDWR)) { reopen_queue = bdrv_reopen_queue(reopen_queue, VAR_2, NULL,
VAR_11 | BDRV_O_RDWR); } if (reopen_queue) { bdrv_reopen_multiple(reopen_queue, &local_err); if (local_err != NULL) { error_propagate(VAR_9, local_err); block_job_unref(&s->common); return; } } s->VAR_2 = blk_new(); blk_insert_bs(s->VAR_2, VAR_2); s->VAR_3 = blk_new(); blk_insert_bs(s->VAR_3, VAR_3); s->active = VAR_1; s->base_flags          = VAR_11; s->VAR_10  = VAR_10; s->VAR_8 = g_strdup(VAR_8); s->VAR_5 = VAR_5; s->common.co = qemu_coroutine_create(commit_run); trace_commit_start(VAR_1, VAR_2, VAR_3, s, s->common.co, VAR_7); qemu_coroutine_enter(s->common.co, s); }