void backup_start(BlockDriverState *bs, BlockDriverState *target,
                  int64_t speed, MirrorSyncMode sync_mode,
                  BlockdevOnError on_source_error,
                  BlockdevOnError on_target_error,
                  BlockCompletionFunc *cb, void *opaque,
                  Error **errp)
{
    int64_t len;
    assert(bs);
    assert(target);
    assert(cb);
    if (bs == target) {
        error_setg(errp, "Source and target cannot be the same");
    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");
    len = bdrv_getlength(bs);
    if (len < 0) {
        error_setg_errno(errp, -len, "unable to get length for '%s'",
    BackupBlockJob *job = block_job_create(&backup_job_driver, bs, speed,
                                           cb, opaque, errp);
    if (!job) {
    bdrv_op_block_all(target, job->common.blocker);
    job->on_source_error = on_source_error;
    job->on_target_error = on_target_error;
    job->target = target;
    job->sync_mode = sync_mode;
    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, MirrorSyncMode sync_mode,
                  BlockdevOnError on_source_error,
                  BlockdevOnError on_target_error,
                  BlockCompletionFunc *cb, void *opaque,
                  Error **errp)
{
    int64_t len;
    assert(bs);
    assert(target);
    assert(cb);
    if (bs == target) {
        error_setg(errp, "Source and target cannot be the same");
    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");
    len = bdrv_getlength(bs);
    if (len < 0) {
        error_setg_errno(errp, -len, "unable to get length for '%s'",
    BackupBlockJob *job = block_job_create(&backup_job_driver, bs, speed,
                                           cb, opaque, errp);
    if (!job) {
    bdrv_op_block_all(target, job->common.blocker);
    job->on_source_error = on_source_error;
    job->on_target_error = on_target_error;
    job->target = target;
    job->sync_mode = sync_mode;
    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, MirrorSyncMode VAR_3,
                  BlockdevOnError VAR_4,
                  BlockdevOnError VAR_5,
                  BlockCompletionFunc *VAR_6, void *VAR_7,
                  Error **VAR_8)
{
    int64_t len;
    assert(VAR_0);
    assert(VAR_1);
    assert(VAR_6);
    if (VAR_0 == VAR_1) {
        error_setg(VAR_8, "Source and VAR_1 cannot be the same");
    if ((VAR_4 == BLOCKDEV_ON_ERROR_STOP ||
         VAR_4 == BLOCKDEV_ON_ERROR_ENOSPC) &&
        !bdrv_iostatus_is_enabled(VAR_0)) {
        error_set(VAR_8, QERR_INVALID_PARAMETER, "on-source-error");
    len = bdrv_getlength(VAR_0);
    if (len < 0) {
        error_setg_errno(VAR_8, -len, "unable to get length for '%s'",
    BackupBlockJob *job = block_job_create(&backup_job_driver, VAR_0, VAR_2,
                                           VAR_6, VAR_7, VAR_8);
    if (!job) {
    bdrv_op_block_all(VAR_1, job->common.blocker);
    job->VAR_4 = VAR_4;
    job->VAR_5 = VAR_5;
    job->VAR_1 = VAR_1;
    job->VAR_3 = VAR_3;
    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, MirrorSyncMode VAR_3,
BlockdevOnError VAR_4,
BlockdevOnError VAR_5,
BlockCompletionFunc *VAR_6, void *VAR_7,
Error **VAR_8)
{ int64_t len; assert(VAR_0); assert(VAR_1); assert(VAR_6); if (VAR_0 == VAR_1) { error_setg(VAR_8, "Source and VAR_1 cannot be the same"); if ((VAR_4 == BLOCKDEV_ON_ERROR_STOP ||
VAR_4 == BLOCKDEV_ON_ERROR_ENOSPC) &&
!bdrv_iostatus_is_enabled(VAR_0)) { error_set(VAR_8, QERR_INVALID_PARAMETER, "on-source-error"); len = bdrv_getlength(VAR_0); if (len < 0) { error_setg_errno(VAR_8, -len, "unable to get length for '%s'",
BackupBlockJob *job = block_job_create(&backup_job_driver, VAR_0, VAR_2,
VAR_6, VAR_7, VAR_8); if (!job) { bdrv_op_block_all(VAR_1, job->common.blocker); job->VAR_4 = VAR_4; job->VAR_5 = VAR_5; job->VAR_1 = VAR_1; job->VAR_3 = VAR_3; job->common.len = len; job->common.co = qemu_coroutine_create(backup_run); qemu_coroutine_enter(job->common.co, job);