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");

    Error *err = NULL;



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

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

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

        if (!arg) {

            monitor_read_password(mon, hmp_change_read_arg, NULL);

            return;

        }

    }



    qmp_change(device, target, !!arg, arg, &err);

    if (error_is_type(err, QERR_DEVICE_ENCRYPTED)) {

        monitor_printf(mon, "%s (%s) is encrypted.\n",

                       error_get_field(err, "device"),

                       error_get_field(err, "filename"));

        if (!monitor_get_rs(mon)) {

            monitor_printf(mon,

                    "terminal does not support password prompting\n");

            error_free(err);

            return;

        }

        readline_start(monitor_get_rs(mon), "Password: ", 1,

                       cb_hmp_change_bdrv_pwd, err);

        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");

    Error *err = NULL;



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

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

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

        if (!arg) {

            monitor_read_password(mon, hmp_change_read_arg, NULL);

            return;

        }

    }



    qmp_change(device, target, !!arg, arg, &err);

    if (error_is_type(err, QERR_DEVICE_ENCRYPTED)) {

        monitor_printf(mon, "%s (%s) is encrypted.\n",

                       error_get_field(err, "device"),

                       error_get_field(err, "filename"));

        if (!monitor_get_rs(mon)) {

            monitor_printf(mon,

                    "terminal does not support password prompting\n");

            error_free(err);

            return;

        }

        readline_start(monitor_get_rs(mon), "Password: ", 1,

                       cb_hmp_change_bdrv_pwd, err);

        return;

    }

    hmp_handle_error(mon, &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");

    Error *err = NULL;



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

            (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(VAR_2, VAR_3, !!VAR_4, VAR_4, &err);

    if (error_is_type(err, QERR_DEVICE_ENCRYPTED)) {

        monitor_printf(VAR_0, "%s (%s) is encrypted.\n",

                       error_get_field(err, "VAR_2"),

                       error_get_field(err, "filename"));

        if (!monitor_get_rs(VAR_0)) {

            monitor_printf(VAR_0,

                    "terminal does not support password prompting\n");

            error_free(err);

            return;

        }

        readline_start(monitor_get_rs(VAR_0), "Password: ", 1,

                       cb_hmp_change_bdrv_pwd, err);

        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"); Error *err = NULL; if (strcmp(VAR_2, "vnc") == 0 &&
(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(VAR_2, VAR_3, !!VAR_4, VAR_4, &err); if (error_is_type(err, QERR_DEVICE_ENCRYPTED)) { monitor_printf(VAR_0, "%s (%s) is encrypted.\n",
error_get_field(err, "VAR_2"),
error_get_field(err, "filename")); if (!monitor_get_rs(VAR_0)) { monitor_printf(VAR_0,
"terminal does not support password prompting\n"); error_free(err); return; } readline_start(monitor_get_rs(VAR_0), "Password: ", 1,
cb_hmp_change_bdrv_pwd, err); return; } hmp_handle_error(VAR_0, &err); }