void hmp_change(Monitor *mon, const QDict *qdict)

{

    const char *device = qdict_get_str(qdict, "device");

    const char *target = qdict_get_str(qdict, "target");

    const char *arg = qdict_get_try_str(qdict, "arg");

    const char *read_only = qdict_get_try_str(qdict, "read-only-mode");

    BlockdevChangeReadOnlyMode read_only_mode = 0;

    Error *err = NULL;



    if (strcmp(device, "vnc") == 0) {

        if (read_only) {

            monitor_printf(mon,

                           "Parameter 'read-only-mode' is invalid for VNC\n");

            return;

        }

        if (strcmp(target, "passwd") == 0 ||

            strcmp(target, "password") == 0) {

            if (!arg) {

                monitor_read_password(mon, hmp_change_read_arg, NULL);

                return;

            }

        }

        qmp_change("vnc", target, !!arg, arg, &err);

    } else {

        if (read_only) {

            read_only_mode =

                qapi_enum_parse(BlockdevChangeReadOnlyMode_lookup,

                                read_only, BLOCKDEV_CHANGE_READ_ONLY_MODE__MAX,

                                BLOCKDEV_CHANGE_READ_ONLY_MODE_RETAIN, &err);

            if (err) {

                hmp_handle_error(mon, &err);

                return;

            }

        }



        qmp_blockdev_change_medium(true, device, false, NULL, target,

                                   !!arg, arg, !!read_only, read_only_mode,

                                   &err);

        if (err &&

            error_get_class(err) == ERROR_CLASS_DEVICE_ENCRYPTED) {

            error_free(err);

            monitor_read_block_device_key(mon, device, NULL, NULL);

            return;

        }

    }



    hmp_handle_error(mon, &err);

}

void hmp_change(Monitor *mon, const QDict *qdict)

{

    const char *device = qdict_get_str(qdict, "device");

    const char *target = qdict_get_str(qdict, "target");

    const char *arg = qdict_get_try_str(qdict, "arg");

    const char *read_only = qdict_get_try_str(qdict, "read-only-mode");

    BlockdevChangeReadOnlyMode read_only_mode = 0;

    Error *err = NULL;



    if (strcmp(device, "vnc") == 0) {

        if (read_only) {

            monitor_printf(mon,

                           "Parameter 'read-only-mode' is invalid for VNC\n");

            return;

        }

        if (strcmp(target, "passwd") == 0 ||

            strcmp(target, "password") == 0) {

            if (!arg) {

                monitor_read_password(mon, hmp_change_read_arg, NULL);

                return;

            }

        }

        qmp_change("vnc", target, !!arg, arg, &err);

    } else {

        if (read_only) {

            read_only_mode =

                qapi_enum_parse(BlockdevChangeReadOnlyMode_lookup,

                                read_only, BLOCKDEV_CHANGE_READ_ONLY_MODE__MAX,

                                BLOCKDEV_CHANGE_READ_ONLY_MODE_RETAIN, &err);

            if (err) {

                hmp_handle_error(mon, &err);

                return;

            }

        }



        qmp_blockdev_change_medium(true, device, false, NULL, target,

                                   !!arg, arg, !!read_only, read_only_mode,

                                   &err);

        if (err &&

            error_get_class(err) == ERROR_CLASS_DEVICE_ENCRYPTED) {

            error_free(err);

            monitor_read_block_device_key(mon, device, NULL, NULL);

            return;

        }

    }



    hmp_handle_error(mon, &err);

}

        if (err &&             error_get_class(err) == ERROR_CLASS_DEVICE_ENCRYPTED) {             error_free(err);             monitor_read_block_device_key(mon, device, NULL, NULL);     Error *err = NULL;
void FUNC_0(Monitor *VAR_0, const QDict *VAR_1)

{

    const char *VAR_2 = qdict_get_str(VAR_1, "VAR_2");

    const char *VAR_3 = qdict_get_str(VAR_1, "VAR_3");

    const char *VAR_4 = qdict_get_try_str(VAR_1, "VAR_4");

    const char *VAR_5 = qdict_get_try_str(VAR_1, "read-only-mode");

    BlockdevChangeReadOnlyMode read_only_mode = 0;

    Error *err = NULL;



    if (strcmp(VAR_2, "vnc") == 0) {

        if (VAR_5) {

            monitor_printf(VAR_0,

                           "Parameter 'read-only-mode' is invalid for VNC\n");

            return;

        }

        if (strcmp(VAR_3, "passwd") == 0 ||

            strcmp(VAR_3, "password") == 0) {

            if (!VAR_4) {

                monitor_read_password(VAR_0, hmp_change_read_arg, NULL);

                return;

            }

        }

        qmp_change("vnc", VAR_3, !!VAR_4, VAR_4, &err);

    } else {

        if (VAR_5) {

            read_only_mode =

                qapi_enum_parse(BlockdevChangeReadOnlyMode_lookup,

                                VAR_5, BLOCKDEV_CHANGE_READ_ONLY_MODE__MAX,

                                BLOCKDEV_CHANGE_READ_ONLY_MODE_RETAIN, &err);

            if (err) {

                hmp_handle_error(VAR_0, &err);

                return;

            }

        }



        qmp_blockdev_change_medium(true, VAR_2, false, NULL, VAR_3,

                                   !!VAR_4, VAR_4, !!VAR_5, read_only_mode,

                                   &err);

        if (err &&

            error_get_class(err) == ERROR_CLASS_DEVICE_ENCRYPTED) {

            error_free(err);

            monitor_read_block_device_key(VAR_0, VAR_2, NULL, NULL);

            return;

        }

    }



    hmp_handle_error(VAR_0, &err);

}

void FUNC_0(Monitor *VAR_0, const QDict *VAR_1)
{ const char *VAR_2 = qdict_get_str(VAR_1, "VAR_2"); const char *VAR_3 = qdict_get_str(VAR_1, "VAR_3"); const char *VAR_4 = qdict_get_try_str(VAR_1, "VAR_4"); const char *VAR_5 = qdict_get_try_str(VAR_1, "read-only-mode"); BlockdevChangeReadOnlyMode read_only_mode = 0; Error *err = NULL; if (strcmp(VAR_2, "vnc") == 0) { if (VAR_5) { monitor_printf(VAR_0,
"Parameter 'read-only-mode' is invalid for VNC\n"); return; } if (strcmp(VAR_3, "passwd") == 0 ||
strcmp(VAR_3, "password") == 0) { if (!VAR_4) { monitor_read_password(VAR_0, hmp_change_read_arg, NULL); return; } } qmp_change("vnc", VAR_3, !!VAR_4, VAR_4, &err); } else { if (VAR_5) { read_only_mode =
qapi_enum_parse(BlockdevChangeReadOnlyMode_lookup,
VAR_5, BLOCKDEV_CHANGE_READ_ONLY_MODE__MAX,
BLOCKDEV_CHANGE_READ_ONLY_MODE_RETAIN, &err); if (err) { hmp_handle_error(VAR_0, &err); return; } } qmp_blockdev_change_medium(true, VAR_2, false, NULL, VAR_3,
!!VAR_4, VAR_4, !!VAR_5, read_only_mode,
&err); if (err &&
error_get_class(err) == ERROR_CLASS_DEVICE_ENCRYPTED) { error_free(err); monitor_read_block_device_key(VAR_0, VAR_2, NULL, NULL); return; } } hmp_handle_error(VAR_0, &err); }