void backup_start(BlockDriverState *bs, BlockDriverState *target,

                  int64_t speed,

                  BlockdevOnError on_source_error,

                  BlockdevOnError on_target_error,

                  BlockDriverCompletionFunc *cb, void *opaque,

                  Error **errp)

{

    int64_t len;



    assert(bs);

    assert(target);

    assert(cb);



    if ((on_source_error == BLOCKDEV_ON_ERROR_STOP ||

         on_source_error == BLOCKDEV_ON_ERROR_ENOSPC) &&

        !bdrv_iostatus_is_enabled(bs)) {

        error_set(errp, QERR_INVALID_PARAMETER, "on-source-error");

        return;

    }



    len = bdrv_getlength(bs);

    if (len < 0) {

        error_setg_errno(errp, -len, "unable to get length for '%s'",

                         bdrv_get_device_name(bs));

        return;

    }



    BackupBlockJob *job = block_job_create(&backup_job_type, bs, speed,

                                           cb, opaque, errp);

    if (!job) {

        return;

    }



    job->on_source_error = on_source_error;

    job->on_target_error = on_target_error;

    job->target = target;

    job->common.len = len;

    job->common.co = qemu_coroutine_create(backup_run);

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

}

void backup_start(BlockDriverState *bs, BlockDriverState *target,

                  int64_t speed,

                  BlockdevOnError on_source_error,

                  BlockdevOnError on_target_error,

                  BlockDriverCompletionFunc *cb, void *opaque,

                  Error **errp)

{

    int64_t len;



    assert(bs);

    assert(target);

    assert(cb);



    if ((on_source_error == BLOCKDEV_ON_ERROR_STOP ||

         on_source_error == BLOCKDEV_ON_ERROR_ENOSPC) &&

        !bdrv_iostatus_is_enabled(bs)) {

        error_set(errp, QERR_INVALID_PARAMETER, "on-source-error");

        return;

    }



    len = bdrv_getlength(bs);

    if (len < 0) {

        error_setg_errno(errp, -len, "unable to get length for '%s'",

                         bdrv_get_device_name(bs));

        return;

    }



    BackupBlockJob *job = block_job_create(&backup_job_type, bs, speed,

                                           cb, opaque, errp);

    if (!job) {

        return;

    }



    job->on_source_error = on_source_error;

    job->on_target_error = on_target_error;

    job->target = target;

    job->common.len = len;

    job->common.co = qemu_coroutine_create(backup_run);

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

}

void FUNC_0(BlockDriverState *VAR_0, BlockDriverState *VAR_1,

                  int64_t VAR_2,

                  BlockdevOnError VAR_3,

                  BlockdevOnError VAR_4,

                  BlockDriverCompletionFunc *VAR_5, void *VAR_6,

                  Error **VAR_7)

{

    int64_t len;



    assert(VAR_0);

    assert(VAR_1);

    assert(VAR_5);



    if ((VAR_3 == BLOCKDEV_ON_ERROR_STOP ||

         VAR_3 == BLOCKDEV_ON_ERROR_ENOSPC) &&

        !bdrv_iostatus_is_enabled(VAR_0)) {

        error_set(VAR_7, QERR_INVALID_PARAMETER, "on-source-error");

        return;

    }



    len = bdrv_getlength(VAR_0);

    if (len < 0) {

        error_setg_errno(VAR_7, -len, "unable to get length for '%s'",

                         bdrv_get_device_name(VAR_0));

        return;

    }



    BackupBlockJob *job = block_job_create(&backup_job_type, VAR_0, VAR_2,

                                           VAR_5, VAR_6, VAR_7);

    if (!job) {

        return;

    }



    job->VAR_3 = VAR_3;

    job->VAR_4 = VAR_4;

    job->VAR_1 = VAR_1;

    job->common.len = len;

    job->common.co = qemu_coroutine_create(backup_run);

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

}

void FUNC_0(BlockDriverState *VAR_0, BlockDriverState *VAR_1,
int64_t VAR_2,
BlockdevOnError VAR_3,
BlockdevOnError VAR_4,
BlockDriverCompletionFunc *VAR_5, void *VAR_6,
Error **VAR_7)
{ int64_t len; assert(VAR_0); assert(VAR_1); assert(VAR_5); if ((VAR_3 == BLOCKDEV_ON_ERROR_STOP ||
VAR_3 == BLOCKDEV_ON_ERROR_ENOSPC) &&
!bdrv_iostatus_is_enabled(VAR_0)) { error_set(VAR_7, QERR_INVALID_PARAMETER, "on-source-error"); return; } len = bdrv_getlength(VAR_0); if (len < 0) { error_setg_errno(VAR_7, -len, "unable to get length for '%s'",
bdrv_get_device_name(VAR_0)); return; } BackupBlockJob *job = block_job_create(&backup_job_type, VAR_0, VAR_2,
VAR_5, VAR_6, VAR_7); if (!job) { return; } job->VAR_3 = VAR_3; job->VAR_4 = VAR_4; job->VAR_1 = VAR_1; job->common.len = len; job->common.co = qemu_coroutine_create(backup_run); qemu_coroutine_enter(job->common.co, job); }