void bdrv_add_key(BlockDriverState *bs, const char *key, Error **errp)

{

    if (key) {

        if (!bdrv_is_encrypted(bs)) {

            error_setg(errp, "Node '%s' is not encrypted",

                      bdrv_get_device_or_node_name(bs));

        } else if (bdrv_set_key(bs, key) < 0) {

            error_set(errp, QERR_INVALID_PASSWORD);

        }

    } else {

        if (bdrv_key_required(bs)) {

            error_set(errp, ERROR_CLASS_DEVICE_ENCRYPTED,

                      "'%s' (%s) is encrypted",

                      bdrv_get_device_or_node_name(bs),

                      bdrv_get_encrypted_filename(bs));

        }

    }

}

void bdrv_add_key(BlockDriverState *bs, const char *key, Error **errp)

{

    if (key) {

        if (!bdrv_is_encrypted(bs)) {

            error_setg(errp, "Node '%s' is not encrypted",

                      bdrv_get_device_or_node_name(bs));

        } else if (bdrv_set_key(bs, key) < 0) {

            error_set(errp, QERR_INVALID_PASSWORD);

        }

    } else {

        if (bdrv_key_required(bs)) {

            error_set(errp, ERROR_CLASS_DEVICE_ENCRYPTED,

                      "'%s' (%s) is encrypted",

                      bdrv_get_device_or_node_name(bs),

                      bdrv_get_encrypted_filename(bs));

        }

    }

}

void FUNC_0(BlockDriverState *VAR_0, const char *VAR_1, Error **VAR_2)

{

    if (VAR_1) {

        if (!bdrv_is_encrypted(VAR_0)) {

            error_setg(VAR_2, "Node '%s' is not encrypted",

                      bdrv_get_device_or_node_name(VAR_0));

        } else if (bdrv_set_key(VAR_0, VAR_1) < 0) {

            error_set(VAR_2, QERR_INVALID_PASSWORD);

        }

    } else {

        if (bdrv_key_required(VAR_0)) {

            error_set(VAR_2, ERROR_CLASS_DEVICE_ENCRYPTED,

                      "'%s' (%s) is encrypted",

                      bdrv_get_device_or_node_name(VAR_0),

                      bdrv_get_encrypted_filename(VAR_0));

        }

    }

}

void FUNC_0(BlockDriverState *VAR_0, const char *VAR_1, Error **VAR_2)
{ if (VAR_1) { if (!bdrv_is_encrypted(VAR_0)) { error_setg(VAR_2, "Node '%s' is not encrypted",
bdrv_get_device_or_node_name(VAR_0)); } else if (bdrv_set_key(VAR_0, VAR_1) < 0) { error_set(VAR_2, QERR_INVALID_PASSWORD); } } else { if (bdrv_key_required(VAR_0)) { error_set(VAR_2, ERROR_CLASS_DEVICE_ENCRYPTED,
"'%s' (%s) is encrypted",
bdrv_get_device_or_node_name(VAR_0),
bdrv_get_encrypted_filename(VAR_0)); } } }