static void print_block_info(Monitor *mon, BlockInfo *info,

                             BlockDeviceInfo *inserted, bool verbose)

{

    ImageInfo *image_info;



    assert(!info || !info->has_inserted || info->inserted == inserted);



    if (info) {

        monitor_printf(mon, "%s", info->device);

        if (inserted && inserted->has_node_name) {

            monitor_printf(mon, " (%s)", inserted->node_name);

        }

    } else {

        assert(inserted);

        monitor_printf(mon, "%s",

                       inserted->has_node_name

                       ? inserted->node_name

                       : "<anonymous>");

    }



    if (inserted) {

        monitor_printf(mon, ": %s (%s%s%s)\n",

                       inserted->file,

                       inserted->drv,

                       inserted->ro ? ", read-only" : "",

                       inserted->encrypted ? ", encrypted" : "");

    } else {

        monitor_printf(mon, ": [not inserted]\n");

    }



    if (info) {

        if (info->has_io_status && info->io_status != BLOCK_DEVICE_IO_STATUS_OK) {

            monitor_printf(mon, "    I/O status:       %s\n",

                           BlockDeviceIoStatus_lookup[info->io_status]);

        }



        if (info->removable) {

            monitor_printf(mon, "    Removable device: %slocked, tray %s\n",

                           info->locked ? "" : "not ",

                           info->tray_open ? "open" : "closed");

        }

    }





    if (!inserted) {

        return;

    }



    monitor_printf(mon, "    Cache mode:       %s%s%s\n",

                   inserted->cache->writeback ? "writeback" : "writethrough",

                   inserted->cache->direct ? ", direct" : "",

                   inserted->cache->no_flush ? ", ignore flushes" : "");



    if (inserted->has_backing_file) {

        monitor_printf(mon,

                       "    Backing file:     %s "

                       "(chain depth: %" PRId64 ")\n",

                       inserted->backing_file,

                       inserted->backing_file_depth);

    }



    if (inserted->detect_zeroes != BLOCKDEV_DETECT_ZEROES_OPTIONS_OFF) {

        monitor_printf(mon, "    Detect zeroes:    %s\n",

                       BlockdevDetectZeroesOptions_lookup[inserted->detect_zeroes]);

    }



    if (inserted->bps  || inserted->bps_rd  || inserted->bps_wr  ||

        inserted->iops || inserted->iops_rd || inserted->iops_wr)

    {

        monitor_printf(mon, "    I/O throttling:   bps=%" PRId64

                        " bps_rd=%" PRId64  " bps_wr=%" PRId64

                        " bps_max=%" PRId64

                        " bps_rd_max=%" PRId64

                        " bps_wr_max=%" PRId64

                        " iops=%" PRId64 " iops_rd=%" PRId64

                        " iops_wr=%" PRId64

                        " iops_max=%" PRId64

                        " iops_rd_max=%" PRId64

                        " iops_wr_max=%" PRId64

                        " iops_size=%" PRId64 "\n",

                        inserted->bps,

                        inserted->bps_rd,

                        inserted->bps_wr,

                        inserted->bps_max,

                        inserted->bps_rd_max,

                        inserted->bps_wr_max,

                        inserted->iops,

                        inserted->iops_rd,

                        inserted->iops_wr,

                        inserted->iops_max,

                        inserted->iops_rd_max,

                        inserted->iops_wr_max,

                        inserted->iops_size);

    }



    /* TODO: inserted->image should never be null */

    if (verbose && inserted->image) {

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

        image_info = 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;

            }

        }

    }

}

static void print_block_info(Monitor *mon, BlockInfo *info,

                             BlockDeviceInfo *inserted, bool verbose)

{

    ImageInfo *image_info;



    assert(!info || !info->has_inserted || info->inserted == inserted);



    if (info) {

        monitor_printf(mon, "%s", info->device);

        if (inserted && inserted->has_node_name) {

            monitor_printf(mon, " (%s)", inserted->node_name);

        }

    } else {

        assert(inserted);

        monitor_printf(mon, "%s",

                       inserted->has_node_name

                       ? inserted->node_name

                       : "<anonymous>");

    }



    if (inserted) {

        monitor_printf(mon, ": %s (%s%s%s)\n",

                       inserted->file,

                       inserted->drv,

                       inserted->ro ? ", read-only" : "",

                       inserted->encrypted ? ", encrypted" : "");

    } else {

        monitor_printf(mon, ": [not inserted]\n");

    }



    if (info) {

        if (info->has_io_status && info->io_status != BLOCK_DEVICE_IO_STATUS_OK) {

            monitor_printf(mon, "    I/O status:       %s\n",

                           BlockDeviceIoStatus_lookup[info->io_status]);

        }



        if (info->removable) {

            monitor_printf(mon, "    Removable device: %slocked, tray %s\n",

                           info->locked ? "" : "not ",

                           info->tray_open ? "open" : "closed");

        }

    }





    if (!inserted) {

        return;

    }



    monitor_printf(mon, "    Cache mode:       %s%s%s\n",

                   inserted->cache->writeback ? "writeback" : "writethrough",

                   inserted->cache->direct ? ", direct" : "",

                   inserted->cache->no_flush ? ", ignore flushes" : "");



    if (inserted->has_backing_file) {

        monitor_printf(mon,

                       "    Backing file:     %s "

                       "(chain depth: %" PRId64 ")\n",

                       inserted->backing_file,

                       inserted->backing_file_depth);

    }



    if (inserted->detect_zeroes != BLOCKDEV_DETECT_ZEROES_OPTIONS_OFF) {

        monitor_printf(mon, "    Detect zeroes:    %s\n",

                       BlockdevDetectZeroesOptions_lookup[inserted->detect_zeroes]);

    }



    if (inserted->bps  || inserted->bps_rd  || inserted->bps_wr  ||

        inserted->iops || inserted->iops_rd || inserted->iops_wr)

    {

        monitor_printf(mon, "    I/O throttling:   bps=%" PRId64

                        " bps_rd=%" PRId64  " bps_wr=%" PRId64

                        " bps_max=%" PRId64

                        " bps_rd_max=%" PRId64

                        " bps_wr_max=%" PRId64

                        " iops=%" PRId64 " iops_rd=%" PRId64

                        " iops_wr=%" PRId64

                        " iops_max=%" PRId64

                        " iops_rd_max=%" PRId64

                        " iops_wr_max=%" PRId64

                        " iops_size=%" PRId64 "\n",

                        inserted->bps,

                        inserted->bps_rd,

                        inserted->bps_wr,

                        inserted->bps_max,

                        inserted->bps_rd_max,

                        inserted->bps_wr_max,

                        inserted->iops,

                        inserted->iops_rd,

                        inserted->iops_wr,

                        inserted->iops_max,

                        inserted->iops_rd_max,

                        inserted->iops_wr_max,

                        inserted->iops_size);

    }



    

    if (verbose && inserted->image) {

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

        image_info = 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;

            }

        }

    }

}

    if (verbose && inserted->image) {
static void FUNC_0(Monitor *VAR_0, BlockInfo *VAR_1,

                             BlockDeviceInfo *VAR_2, bool VAR_3)

{

    ImageInfo *image_info;



    assert(!VAR_1 || !VAR_1->has_inserted || VAR_1->VAR_2 == VAR_2);



    if (VAR_1) {

        monitor_printf(VAR_0, "%s", VAR_1->device);

        if (VAR_2 && VAR_2->has_node_name) {

            monitor_printf(VAR_0, " (%s)", VAR_2->node_name);

        }

    } else {

        assert(VAR_2);

        monitor_printf(VAR_0, "%s",

                       VAR_2->has_node_name

                       ? VAR_2->node_name

                       : "<anonymous>");

    }



    if (VAR_2) {

        monitor_printf(VAR_0, ": %s (%s%s%s)\n",

                       VAR_2->file,

                       VAR_2->drv,

                       VAR_2->ro ? ", read-only" : "",

                       VAR_2->encrypted ? ", encrypted" : "");

    } else {

        monitor_printf(VAR_0, ": [not VAR_2]\n");

    }



    if (VAR_1) {

        if (VAR_1->has_io_status && VAR_1->io_status != BLOCK_DEVICE_IO_STATUS_OK) {

            monitor_printf(VAR_0, "    I/O status:       %s\n",

                           BlockDeviceIoStatus_lookup[VAR_1->io_status]);

        }



        if (VAR_1->removable) {

            monitor_printf(VAR_0, "    Removable device: %slocked, tray %s\n",

                           VAR_1->locked ? "" : "not ",

                           VAR_1->tray_open ? "open" : "closed");

        }

    }





    if (!VAR_2) {

        return;

    }



    monitor_printf(VAR_0, "    Cache mode:       %s%s%s\n",

                   VAR_2->cache->writeback ? "writeback" : "writethrough",

                   VAR_2->cache->direct ? ", direct" : "",

                   VAR_2->cache->no_flush ? ", ignore flushes" : "");



    if (VAR_2->has_backing_file) {

        monitor_printf(VAR_0,

                       "    Backing file:     %s "

                       "(chain depth: %" PRId64 ")\n",

                       VAR_2->backing_file,

                       VAR_2->backing_file_depth);

    }



    if (VAR_2->detect_zeroes != BLOCKDEV_DETECT_ZEROES_OPTIONS_OFF) {

        monitor_printf(VAR_0, "    Detect zeroes:    %s\n",

                       BlockdevDetectZeroesOptions_lookup[VAR_2->detect_zeroes]);

    }



    if (VAR_2->bps  || VAR_2->bps_rd  || VAR_2->bps_wr  ||

        VAR_2->iops || VAR_2->iops_rd || VAR_2->iops_wr)

    {

        monitor_printf(VAR_0, "    I/O throttling:   bps=%" PRId64

                        " bps_rd=%" PRId64  " bps_wr=%" PRId64

                        " bps_max=%" PRId64

                        " bps_rd_max=%" PRId64

                        " bps_wr_max=%" PRId64

                        " iops=%" PRId64 " iops_rd=%" PRId64

                        " iops_wr=%" PRId64

                        " iops_max=%" PRId64

                        " iops_rd_max=%" PRId64

                        " iops_wr_max=%" PRId64

                        " iops_size=%" PRId64 "\n",

                        VAR_2->bps,

                        VAR_2->bps_rd,

                        VAR_2->bps_wr,

                        VAR_2->bps_max,

                        VAR_2->bps_rd_max,

                        VAR_2->bps_wr_max,

                        VAR_2->iops,

                        VAR_2->iops_rd,

                        VAR_2->iops_wr,

                        VAR_2->iops_max,

                        VAR_2->iops_rd_max,

                        VAR_2->iops_wr_max,

                        VAR_2->iops_size);

    }



    

    if (VAR_3 && VAR_2->image) {

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

        image_info = VAR_2->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;

            }

        }

    }

}

static void FUNC_0(Monitor *VAR_0, BlockInfo *VAR_1,
BlockDeviceInfo *VAR_2, bool VAR_3)
{ ImageInfo *image_info; assert(!VAR_1 || !VAR_1->has_inserted || VAR_1->VAR_2 == VAR_2); if (VAR_1) { monitor_printf(VAR_0, "%s", VAR_1->device); if (VAR_2 && VAR_2->has_node_name) { monitor_printf(VAR_0, " (%s)", VAR_2->node_name); } } else { assert(VAR_2); monitor_printf(VAR_0, "%s",
VAR_2->has_node_name
? VAR_2->node_name
: "<anonymous>"); } if (VAR_2) { monitor_printf(VAR_0, ": %s (%s%s%s)\n",
VAR_2->file,
VAR_2->drv,
VAR_2->ro ? ", read-only" : "",
VAR_2->encrypted ? ", encrypted" : ""); } else { monitor_printf(VAR_0, ": [not VAR_2]\n"); } if (VAR_1) { if (VAR_1->has_io_status && VAR_1->io_status != BLOCK_DEVICE_IO_STATUS_OK) { monitor_printf(VAR_0, "    I/O status:       %s\n",
BlockDeviceIoStatus_lookup[VAR_1->io_status]); } if (VAR_1->removable) { monitor_printf(VAR_0, "    Removable device: %slocked, tray %s\n",
VAR_1->locked ? "" : "not ",
VAR_1->tray_open ? "open" : "closed"); } } if (!VAR_2) { return; } monitor_printf(VAR_0, "    Cache mode:       %s%s%s\n",
VAR_2->cache->writeback ? "writeback" : "writethrough",
VAR_2->cache->direct ? ", direct" : "",
VAR_2->cache->no_flush ? ", ignore flushes" : ""); if (VAR_2->has_backing_file) { monitor_printf(VAR_0,
"    Backing file:     %s "
"(chain depth: %" PRId64 ")\n",
VAR_2->backing_file,
VAR_2->backing_file_depth); } if (VAR_2->detect_zeroes != BLOCKDEV_DETECT_ZEROES_OPTIONS_OFF) { monitor_printf(VAR_0, "    Detect zeroes:    %s\n",
BlockdevDetectZeroesOptions_lookup[VAR_2->detect_zeroes]); } if (VAR_2->bps  || VAR_2->bps_rd  || VAR_2->bps_wr  ||
VAR_2->iops || VAR_2->iops_rd || VAR_2->iops_wr)
{ monitor_printf(VAR_0, "    I/O throttling:   bps=%" PRId64
" bps_rd=%" PRId64  " bps_wr=%" PRId64
" bps_max=%" PRId64
" bps_rd_max=%" PRId64
" bps_wr_max=%" PRId64
" iops=%" PRId64 " iops_rd=%" PRId64
" iops_wr=%" PRId64
" iops_max=%" PRId64
" iops_rd_max=%" PRId64
" iops_wr_max=%" PRId64
" iops_size=%" PRId64 "\n",
VAR_2->bps,
VAR_2->bps_rd,
VAR_2->bps_wr,
VAR_2->bps_max,
VAR_2->bps_rd_max,
VAR_2->bps_wr_max,
VAR_2->iops,
VAR_2->iops_rd,
VAR_2->iops_wr,
VAR_2->iops_max,
VAR_2->iops_rd_max,
VAR_2->iops_wr_max,
VAR_2->iops_size); } if (VAR_3 && VAR_2->image) { monitor_printf(VAR_0, "\nImages:\n"); image_info = VAR_2->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; } } } }