void qmp_block_stream(const char *device,

                      bool has_base, const char *base,

                      bool has_backing_file, const char *backing_file,

                      bool has_speed, int64_t speed,

                      bool has_on_error, BlockdevOnError on_error,

                      Error **errp)

{

    BlockDriverState *bs;

    BlockDriverState *base_bs = NULL;

    Error *local_err = NULL;

    const char *base_name = NULL;



    if (!has_on_error) {

        on_error = BLOCKDEV_ON_ERROR_REPORT;

    }



    bs = bdrv_find(device);

    if (!bs) {

        error_set(errp, QERR_DEVICE_NOT_FOUND, device);

        return;

    }



    if (bdrv_op_is_blocked(bs, BLOCK_OP_TYPE_STREAM, errp)) {

        return;

    }



    if (has_base) {

        base_bs = bdrv_find_backing_image(bs, base);

        if (base_bs == NULL) {

            error_set(errp, QERR_BASE_NOT_FOUND, base);

            return;

        }

        base_name = base;

    }



    /* if we are streaming the entire chain, the result will have no backing

     * file, and specifying one is therefore an error */

    if (base_bs == NULL && has_backing_file) {

        error_setg(errp, "backing file specified, but streaming the "

                         "entire chain");

        return;

    }



    /* backing_file string overrides base bs filename */

    base_name = has_backing_file ? backing_file : base_name;



    stream_start(bs, base_bs, base_name, has_speed ? speed : 0,

                 on_error, block_job_cb, bs, &local_err);

    if (local_err) {

        error_propagate(errp, local_err);

        return;

    }



    trace_qmp_block_stream(bs, bs->job);

}

void qmp_block_stream(const char *device,

                      bool has_base, const char *base,

                      bool has_backing_file, const char *backing_file,

                      bool has_speed, int64_t speed,

                      bool has_on_error, BlockdevOnError on_error,

                      Error **errp)

{

    BlockDriverState *bs;

    BlockDriverState *base_bs = NULL;

    Error *local_err = NULL;

    const char *base_name = NULL;



    if (!has_on_error) {

        on_error = BLOCKDEV_ON_ERROR_REPORT;

    }



    bs = bdrv_find(device);

    if (!bs) {

        error_set(errp, QERR_DEVICE_NOT_FOUND, device);

        return;

    }



    if (bdrv_op_is_blocked(bs, BLOCK_OP_TYPE_STREAM, errp)) {

        return;

    }



    if (has_base) {

        base_bs = bdrv_find_backing_image(bs, base);

        if (base_bs == NULL) {

            error_set(errp, QERR_BASE_NOT_FOUND, base);

            return;

        }

        base_name = base;

    }



    



    if (base_bs == NULL && has_backing_file) {

        error_setg(errp, "backing file specified, but streaming the "

                         "entire chain");

        return;

    }



    

    base_name = has_backing_file ? backing_file : base_name;



    stream_start(bs, base_bs, base_name, has_speed ? speed : 0,

                 on_error, block_job_cb, bs, &local_err);

    if (local_err) {

        error_propagate(errp, local_err);

        return;

    }



    trace_qmp_block_stream(bs, bs->job);

}

void FUNC_0(const char *VAR_0,

                      bool VAR_1, const char *VAR_2,

                      bool VAR_3, const char *VAR_4,

                      bool VAR_5, int64_t VAR_6,

                      bool VAR_7, BlockdevOnError VAR_8,

                      Error **VAR_9)

{

    BlockDriverState *bs;

    BlockDriverState *base_bs = NULL;

    Error *local_err = NULL;

    const char *VAR_10 = NULL;



    if (!VAR_7) {

        VAR_8 = BLOCKDEV_ON_ERROR_REPORT;

    }



    bs = bdrv_find(VAR_0);

    if (!bs) {

        error_set(VAR_9, QERR_DEVICE_NOT_FOUND, VAR_0);

        return;

    }



    if (bdrv_op_is_blocked(bs, BLOCK_OP_TYPE_STREAM, VAR_9)) {

        return;

    }



    if (VAR_1) {

        base_bs = bdrv_find_backing_image(bs, VAR_2);

        if (base_bs == NULL) {

            error_set(VAR_9, QERR_BASE_NOT_FOUND, VAR_2);

            return;

        }

        VAR_10 = VAR_2;

    }



    



    if (base_bs == NULL && VAR_3) {

        error_setg(VAR_9, "backing file specified, but streaming the "

                         "entire chain");

        return;

    }



    

    VAR_10 = VAR_3 ? VAR_4 : VAR_10;



    stream_start(bs, base_bs, VAR_10, VAR_5 ? VAR_6 : 0,

                 VAR_8, block_job_cb, bs, &local_err);

    if (local_err) {

        error_propagate(VAR_9, local_err);

        return;

    }



    trace_qmp_block_stream(bs, bs->job);

}

void FUNC_0(const char *VAR_0,
bool VAR_1, const char *VAR_2,
bool VAR_3, const char *VAR_4,
bool VAR_5, int64_t VAR_6,
bool VAR_7, BlockdevOnError VAR_8,
Error **VAR_9)
{ BlockDriverState *bs; BlockDriverState *base_bs = NULL; Error *local_err = NULL; const char *VAR_10 = NULL; if (!VAR_7) { VAR_8 = BLOCKDEV_ON_ERROR_REPORT; } bs = bdrv_find(VAR_0); if (!bs) { error_set(VAR_9, QERR_DEVICE_NOT_FOUND, VAR_0); return; } if (bdrv_op_is_blocked(bs, BLOCK_OP_TYPE_STREAM, VAR_9)) { return; } if (VAR_1) { base_bs = bdrv_find_backing_image(bs, VAR_2); if (base_bs == NULL) { error_set(VAR_9, QERR_BASE_NOT_FOUND, VAR_2); return; } VAR_10 = VAR_2; } if (base_bs == NULL && VAR_3) { error_setg(VAR_9, "backing file specified, but streaming the "
"entire chain"); return; } VAR_10 = VAR_3 ? VAR_4 : VAR_10; stream_start(bs, base_bs, VAR_10, VAR_5 ? VAR_6 : 0,
VAR_8, block_job_cb, bs, &local_err); if (local_err) { error_propagate(VAR_9, local_err); return; } trace_qmp_block_stream(bs, bs->job); }