int monitor_read_bdrv_key_start(Monitor *mon, BlockDriverState *bs,

                                BlockCompletionFunc *completion_cb,

                                void *opaque)

{

    Error *local_err = NULL;

    int err;



    bdrv_add_key(bs, NULL, &local_err);

    if (!local_err) {

        if (completion_cb)

            completion_cb(opaque, 0);

        return 0;

    }



    /* Need a key for @bs */



    if (monitor_ctrl_mode(mon)) {

        qerror_report_err(local_err);


        return -1;

    }




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

                   bdrv_get_encrypted_filename(bs));



    mon->password_completion_cb = completion_cb;

    mon->password_opaque = opaque;



    err = monitor_read_password(mon, bdrv_password_cb, bs);



    if (err && completion_cb)

        completion_cb(opaque, err);



    return err;

}
int monitor_read_bdrv_key_start(Monitor *mon, BlockDriverState *bs,

                                BlockCompletionFunc *completion_cb,

                                void *opaque)

{

    Error *local_err = NULL;

    int err;



    bdrv_add_key(bs, NULL, &local_err);

    if (!local_err) {

        if (completion_cb)

            completion_cb(opaque, 0);

        return 0;

    }



    



    if (monitor_ctrl_mode(mon)) {

        qerror_report_err(local_err);


        return -1;

    }




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

                   bdrv_get_encrypted_filename(bs));



    mon->password_completion_cb = completion_cb;

    mon->password_opaque = opaque;



    err = monitor_read_password(mon, bdrv_password_cb, bs);



    if (err && completion_cb)

        completion_cb(opaque, err);



    return err;

}
int FUNC_0(Monitor *VAR_0, BlockDriverState *VAR_1,

                                BlockCompletionFunc *VAR_2,

                                void *VAR_3)

{

    Error *local_err = NULL;

    int VAR_4;



    bdrv_add_key(VAR_1, NULL, &local_err);

    if (!local_err) {

        if (VAR_2)

            VAR_2(VAR_3, 0);

        return 0;

    }



    



    if (monitor_ctrl_mode(VAR_0)) {

        qerror_report_err(local_err);


        return -1;

    }




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

                   bdrv_get_encrypted_filename(VAR_1));



    VAR_0->password_completion_cb = VAR_2;

    VAR_0->password_opaque = VAR_3;



    VAR_4 = monitor_read_password(VAR_0, bdrv_password_cb, VAR_1);



    if (VAR_4 && VAR_2)

        VAR_2(VAR_3, VAR_4);



    return VAR_4;

}
int FUNC_0(Monitor *VAR_0, BlockDriverState *VAR_1,
BlockCompletionFunc *VAR_2,
void *VAR_3)
{ Error *local_err = NULL; int VAR_4; bdrv_add_key(VAR_1, NULL, &local_err); if (!local_err) { if (VAR_2)
VAR_2(VAR_3, 0); return 0; } if (monitor_ctrl_mode(VAR_0)) { qerror_report_err(local_err); return -1; } monitor_printf(VAR_0, "%s (%s) is encrypted.\n", bdrv_get_device_name(VAR_1),
bdrv_get_encrypted_filename(VAR_1)); VAR_0->password_completion_cb = VAR_2; VAR_0->password_opaque = VAR_3; VAR_4 = monitor_read_password(VAR_0, bdrv_password_cb, VAR_1); if (VAR_4 && VAR_2)
VAR_2(VAR_3, VAR_4); return VAR_4; }