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

{

    BlockInfoList *block_list, *info;

    ImageInfo *image_info;

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

    bool verbose = qdict_get_try_bool(qdict, "verbose", 0);



    block_list = qmp_query_block(NULL);



    for (info = block_list; info; info = info->next) {

        if (device && strcmp(device, info->value->device)) {

            continue;

        }

        monitor_printf(mon, "%s: removable=%d",

                       info->value->device, info->value->removable);



        if (info->value->removable) {

            monitor_printf(mon, " locked=%d", info->value->locked);

            monitor_printf(mon, " tray-open=%d", info->value->tray_open);

        }



        if (info->value->has_io_status) {

            monitor_printf(mon, " io-status=%s",

                           BlockDeviceIoStatus_lookup[info->value->io_status]);

        }



        if (info->value->has_inserted) {

            monitor_printf(mon, " file=");

            monitor_print_filename(mon, info->value->inserted->file);



            if (info->value->inserted->has_backing_file) {

                monitor_printf(mon, " backing_file=");

                monitor_print_filename(mon, info->value->inserted->backing_file);

                monitor_printf(mon, " backing_file_depth=%" PRId64,

                    info->value->inserted->backing_file_depth);

            }

            monitor_printf(mon, " ro=%d drv=%s encrypted=%d",

                           info->value->inserted->ro,

                           info->value->inserted->drv,

                           info->value->inserted->encrypted);



            monitor_printf(mon, " bps=%" PRId64 " bps_rd=%" PRId64

                            " bps_wr=%" PRId64 " iops=%" PRId64

                            " iops_rd=%" PRId64 " iops_wr=%" PRId64,

                            info->value->inserted->bps,

                            info->value->inserted->bps_rd,

                            info->value->inserted->bps_wr,

                            info->value->inserted->iops,

                            info->value->inserted->iops_rd,

                            info->value->inserted->iops_wr);



            if (verbose) {

                monitor_printf(mon, " images:\n");

                image_info = info->value->inserted->image;

                while (1) {

                        bdrv_image_info_dump((fprintf_function)monitor_printf,

                                             mon, image_info);

                    if (image_info->has_backing_image) {

                        image_info = image_info->backing_image;

                    } else {

                        break;

                    }

                }

            }

        } else {

            monitor_printf(mon, " [not inserted]");

        }



        monitor_printf(mon, "\n");

    }



    qapi_free_BlockInfoList(block_list);

}

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

{

    BlockInfoList *block_list, *info;

    ImageInfo *image_info;

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

    bool verbose = qdict_get_try_bool(qdict, "verbose", 0);



    block_list = qmp_query_block(NULL);



    for (info = block_list; info; info = info->next) {

        if (device && strcmp(device, info->value->device)) {

            continue;

        }

        monitor_printf(mon, "%s: removable=%d",

                       info->value->device, info->value->removable);



        if (info->value->removable) {

            monitor_printf(mon, " locked=%d", info->value->locked);

            monitor_printf(mon, " tray-open=%d", info->value->tray_open);

        }



        if (info->value->has_io_status) {

            monitor_printf(mon, " io-status=%s",

                           BlockDeviceIoStatus_lookup[info->value->io_status]);

        }



        if (info->value->has_inserted) {

            monitor_printf(mon, " file=");

            monitor_print_filename(mon, info->value->inserted->file);



            if (info->value->inserted->has_backing_file) {

                monitor_printf(mon, " backing_file=");

                monitor_print_filename(mon, info->value->inserted->backing_file);

                monitor_printf(mon, " backing_file_depth=%" PRId64,

                    info->value->inserted->backing_file_depth);

            }

            monitor_printf(mon, " ro=%d drv=%s encrypted=%d",

                           info->value->inserted->ro,

                           info->value->inserted->drv,

                           info->value->inserted->encrypted);



            monitor_printf(mon, " bps=%" PRId64 " bps_rd=%" PRId64

                            " bps_wr=%" PRId64 " iops=%" PRId64

                            " iops_rd=%" PRId64 " iops_wr=%" PRId64,

                            info->value->inserted->bps,

                            info->value->inserted->bps_rd,

                            info->value->inserted->bps_wr,

                            info->value->inserted->iops,

                            info->value->inserted->iops_rd,

                            info->value->inserted->iops_wr);



            if (verbose) {

                monitor_printf(mon, " images:\n");

                image_info = info->value->inserted->image;

                while (1) {

                        bdrv_image_info_dump((fprintf_function)monitor_printf,

                                             mon, image_info);

                    if (image_info->has_backing_image) {

                        image_info = image_info->backing_image;

                    } else {

                        break;

                    }

                }

            }

        } else {

            monitor_printf(mon, " [not inserted]");

        }



        monitor_printf(mon, "\n");

    }



    qapi_free_BlockInfoList(block_list);

}

void FUNC_0(Monitor *VAR_0, const QDict *VAR_1)

{

    BlockInfoList *block_list, *info;

    ImageInfo *image_info;

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

    bool verbose = qdict_get_try_bool(VAR_1, "verbose", 0);



    block_list = qmp_query_block(NULL);



    for (info = block_list; info; info = info->next) {

        if (VAR_2 && strcmp(VAR_2, info->value->VAR_2)) {

            continue;

        }

        monitor_printf(VAR_0, "%s: removable=%d",

                       info->value->VAR_2, info->value->removable);



        if (info->value->removable) {

            monitor_printf(VAR_0, " locked=%d", info->value->locked);

            monitor_printf(VAR_0, " tray-open=%d", info->value->tray_open);

        }



        if (info->value->has_io_status) {

            monitor_printf(VAR_0, " io-status=%s",

                           BlockDeviceIoStatus_lookup[info->value->io_status]);

        }



        if (info->value->has_inserted) {

            monitor_printf(VAR_0, " file=");

            monitor_print_filename(VAR_0, info->value->inserted->file);



            if (info->value->inserted->has_backing_file) {

                monitor_printf(VAR_0, " backing_file=");

                monitor_print_filename(VAR_0, info->value->inserted->backing_file);

                monitor_printf(VAR_0, " backing_file_depth=%" PRId64,

                    info->value->inserted->backing_file_depth);

            }

            monitor_printf(VAR_0, " ro=%d drv=%s encrypted=%d",

                           info->value->inserted->ro,

                           info->value->inserted->drv,

                           info->value->inserted->encrypted);



            monitor_printf(VAR_0, " bps=%" PRId64 " bps_rd=%" PRId64

                            " bps_wr=%" PRId64 " iops=%" PRId64

                            " iops_rd=%" PRId64 " iops_wr=%" PRId64,

                            info->value->inserted->bps,

                            info->value->inserted->bps_rd,

                            info->value->inserted->bps_wr,

                            info->value->inserted->iops,

                            info->value->inserted->iops_rd,

                            info->value->inserted->iops_wr);



            if (verbose) {

                monitor_printf(VAR_0, " images:\n");

                image_info = info->value->inserted->image;

                while (1) {

                        bdrv_image_info_dump((fprintf_function)monitor_printf,

                                             VAR_0, image_info);

                    if (image_info->has_backing_image) {

                        image_info = image_info->backing_image;

                    } else {

                        break;

                    }

                }

            }

        } else {

            monitor_printf(VAR_0, " [not inserted]");

        }



        monitor_printf(VAR_0, "\n");

    }



    qapi_free_BlockInfoList(block_list);

}

void FUNC_0(Monitor *VAR_0, const QDict *VAR_1)
{ BlockInfoList *block_list, *info; ImageInfo *image_info; const char *VAR_2 = qdict_get_try_str(VAR_1, "VAR_2"); bool verbose = qdict_get_try_bool(VAR_1, "verbose", 0); block_list = qmp_query_block(NULL); for (info = block_list; info; info = info->next) { if (VAR_2 && strcmp(VAR_2, info->value->VAR_2)) { continue; } monitor_printf(VAR_0, "%s: removable=%d",
info->value->VAR_2, info->value->removable); if (info->value->removable) { monitor_printf(VAR_0, " locked=%d", info->value->locked); monitor_printf(VAR_0, " tray-open=%d", info->value->tray_open); } if (info->value->has_io_status) { monitor_printf(VAR_0, " io-status=%s",
BlockDeviceIoStatus_lookup[info->value->io_status]); } if (info->value->has_inserted) { monitor_printf(VAR_0, " file="); monitor_print_filename(VAR_0, info->value->inserted->file); if (info->value->inserted->has_backing_file) { monitor_printf(VAR_0, " backing_file="); monitor_print_filename(VAR_0, info->value->inserted->backing_file); monitor_printf(VAR_0, " backing_file_depth=%" PRId64,
info->value->inserted->backing_file_depth); } monitor_printf(VAR_0, " ro=%d drv=%s encrypted=%d",
info->value->inserted->ro,
info->value->inserted->drv,
info->value->inserted->encrypted); monitor_printf(VAR_0, " bps=%" PRId64 " bps_rd=%" PRId64
" bps_wr=%" PRId64 " iops=%" PRId64
" iops_rd=%" PRId64 " iops_wr=%" PRId64,
info->value->inserted->bps,
info->value->inserted->bps_rd,
info->value->inserted->bps_wr,
info->value->inserted->iops,
info->value->inserted->iops_rd,
info->value->inserted->iops_wr); if (verbose) { monitor_printf(VAR_0, " images:\n"); image_info = info->value->inserted->image; while (1) { bdrv_image_info_dump((fprintf_function)monitor_printf,
VAR_0, image_info); if (image_info->has_backing_image) { image_info = image_info->backing_image; } else { break; } } } } else { monitor_printf(VAR_0, " [not inserted]"); } monitor_printf(VAR_0, "\n"); } qapi_free_BlockInfoList(block_list); }