void qmp_block_passwd(bool has_device, const char *device,

                      bool has_node_name, const char *node_name,

                      const char *password, Error **errp)

{

    Error *local_err = NULL;

    BlockDriverState *bs;

    int err;



    bs = bdrv_lookup_bs(has_device ? device : NULL,

                        has_node_name ? node_name : NULL,

                        &local_err);

    if (local_err) {

        error_propagate(errp, local_err);

        return;

    }



    err = bdrv_set_key(bs, password);

    if (err == -EINVAL) {

        error_set(errp, QERR_DEVICE_NOT_ENCRYPTED, bdrv_get_device_name(bs));

        return;

    } else if (err < 0) {

        error_set(errp, QERR_INVALID_PASSWORD);

        return;

    }

}

void qmp_block_passwd(bool has_device, const char *device,

                      bool has_node_name, const char *node_name,

                      const char *password, Error **errp)

{

    Error *local_err = NULL;

    BlockDriverState *bs;

    int err;



    bs = bdrv_lookup_bs(has_device ? device : NULL,

                        has_node_name ? node_name : NULL,

                        &local_err);

    if (local_err) {

        error_propagate(errp, local_err);

        return;

    }



    err = bdrv_set_key(bs, password);

    if (err == -EINVAL) {

        error_set(errp, QERR_DEVICE_NOT_ENCRYPTED, bdrv_get_device_name(bs));

        return;

    } else if (err < 0) {

        error_set(errp, QERR_INVALID_PASSWORD);

        return;

    }

}

void FUNC_0(bool VAR_0, const char *VAR_1,

                      bool VAR_2, const char *VAR_3,

                      const char *VAR_4, Error **VAR_5)

{

    Error *local_err = NULL;

    BlockDriverState *bs;

    int VAR_6;



    bs = bdrv_lookup_bs(VAR_0 ? VAR_1 : NULL,

                        VAR_2 ? VAR_3 : NULL,

                        &local_err);

    if (local_err) {

        error_propagate(VAR_5, local_err);

        return;

    }



    VAR_6 = bdrv_set_key(bs, VAR_4);

    if (VAR_6 == -EINVAL) {

        error_set(VAR_5, QERR_DEVICE_NOT_ENCRYPTED, bdrv_get_device_name(bs));

        return;

    } else if (VAR_6 < 0) {

        error_set(VAR_5, QERR_INVALID_PASSWORD);

        return;

    }

}

void FUNC_0(bool VAR_0, const char *VAR_1,
bool VAR_2, const char *VAR_3,
const char *VAR_4, Error **VAR_5)
{ Error *local_err = NULL; BlockDriverState *bs; int VAR_6; bs = bdrv_lookup_bs(VAR_0 ? VAR_1 : NULL,
VAR_2 ? VAR_3 : NULL,
&local_err); if (local_err) { error_propagate(VAR_5, local_err); return; } VAR_6 = bdrv_set_key(bs, VAR_4); if (VAR_6 == -EINVAL) { error_set(VAR_5, QERR_DEVICE_NOT_ENCRYPTED, bdrv_get_device_name(bs)); return; } else if (VAR_6 < 0) { error_set(VAR_5, QERR_INVALID_PASSWORD); return; } }