]> Git Repo - qemu.git/blob - block/qapi.c
block/qapi: Add cache information to query-block
[qemu.git] / block / qapi.c
1 /*
2  * Block layer qmp and info dump related functions
3  *
4  * Copyright (c) 2003-2008 Fabrice Bellard
5  *
6  * Permission is hereby granted, free of charge, to any person obtaining a copy
7  * of this software and associated documentation files (the "Software"), to deal
8  * in the Software without restriction, including without limitation the rights
9  * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
10  * copies of the Software, and to permit persons to whom the Software is
11  * furnished to do so, subject to the following conditions:
12  *
13  * The above copyright notice and this permission notice shall be included in
14  * all copies or substantial portions of the Software.
15  *
16  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17  * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18  * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
19  * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20  * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
21  * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
22  * THE SOFTWARE.
23  */
24
25 #include "block/qapi.h"
26 #include "block/block_int.h"
27 #include "qmp-commands.h"
28 #include "qapi-visit.h"
29 #include "qapi/qmp-output-visitor.h"
30 #include "qapi/qmp/types.h"
31 #include "sysemu/block-backend.h"
32
33 BlockDeviceInfo *bdrv_block_device_info(BlockDriverState *bs)
34 {
35     BlockDeviceInfo *info = g_malloc0(sizeof(*info));
36
37     info->file                   = g_strdup(bs->filename);
38     info->ro                     = bs->read_only;
39     info->drv                    = g_strdup(bs->drv->format_name);
40     info->encrypted              = bs->encrypted;
41     info->encryption_key_missing = bdrv_key_required(bs);
42
43     info->cache = g_new(BlockdevCacheInfo, 1);
44     *info->cache = (BlockdevCacheInfo) {
45         .writeback      = bdrv_enable_write_cache(bs),
46         .direct         = !!(bs->open_flags & BDRV_O_NOCACHE),
47         .no_flush       = !!(bs->open_flags & BDRV_O_NO_FLUSH),
48     };
49
50     if (bs->node_name[0]) {
51         info->has_node_name = true;
52         info->node_name = g_strdup(bs->node_name);
53     }
54
55     if (bs->backing_file[0]) {
56         info->has_backing_file = true;
57         info->backing_file = g_strdup(bs->backing_file);
58     }
59
60     info->backing_file_depth = bdrv_get_backing_file_depth(bs);
61     info->detect_zeroes = bs->detect_zeroes;
62
63     if (bs->io_limits_enabled) {
64         ThrottleConfig cfg;
65         throttle_get_config(&bs->throttle_state, &cfg);
66         info->bps     = cfg.buckets[THROTTLE_BPS_TOTAL].avg;
67         info->bps_rd  = cfg.buckets[THROTTLE_BPS_READ].avg;
68         info->bps_wr  = cfg.buckets[THROTTLE_BPS_WRITE].avg;
69
70         info->iops    = cfg.buckets[THROTTLE_OPS_TOTAL].avg;
71         info->iops_rd = cfg.buckets[THROTTLE_OPS_READ].avg;
72         info->iops_wr = cfg.buckets[THROTTLE_OPS_WRITE].avg;
73
74         info->has_bps_max     = cfg.buckets[THROTTLE_BPS_TOTAL].max;
75         info->bps_max         = cfg.buckets[THROTTLE_BPS_TOTAL].max;
76         info->has_bps_rd_max  = cfg.buckets[THROTTLE_BPS_READ].max;
77         info->bps_rd_max      = cfg.buckets[THROTTLE_BPS_READ].max;
78         info->has_bps_wr_max  = cfg.buckets[THROTTLE_BPS_WRITE].max;
79         info->bps_wr_max      = cfg.buckets[THROTTLE_BPS_WRITE].max;
80
81         info->has_iops_max    = cfg.buckets[THROTTLE_OPS_TOTAL].max;
82         info->iops_max        = cfg.buckets[THROTTLE_OPS_TOTAL].max;
83         info->has_iops_rd_max = cfg.buckets[THROTTLE_OPS_READ].max;
84         info->iops_rd_max     = cfg.buckets[THROTTLE_OPS_READ].max;
85         info->has_iops_wr_max = cfg.buckets[THROTTLE_OPS_WRITE].max;
86         info->iops_wr_max     = cfg.buckets[THROTTLE_OPS_WRITE].max;
87
88         info->has_iops_size = cfg.op_size;
89         info->iops_size = cfg.op_size;
90     }
91
92     return info;
93 }
94
95 /*
96  * Returns 0 on success, with *p_list either set to describe snapshot
97  * information, or NULL because there are no snapshots.  Returns -errno on
98  * error, with *p_list untouched.
99  */
100 int bdrv_query_snapshot_info_list(BlockDriverState *bs,
101                                   SnapshotInfoList **p_list,
102                                   Error **errp)
103 {
104     int i, sn_count;
105     QEMUSnapshotInfo *sn_tab = NULL;
106     SnapshotInfoList *info_list, *cur_item = NULL, *head = NULL;
107     SnapshotInfo *info;
108
109     sn_count = bdrv_snapshot_list(bs, &sn_tab);
110     if (sn_count < 0) {
111         const char *dev = bdrv_get_device_name(bs);
112         switch (sn_count) {
113         case -ENOMEDIUM:
114             error_setg(errp, "Device '%s' is not inserted", dev);
115             break;
116         case -ENOTSUP:
117             error_setg(errp,
118                        "Device '%s' does not support internal snapshots",
119                        dev);
120             break;
121         default:
122             error_setg_errno(errp, -sn_count,
123                              "Can't list snapshots of device '%s'", dev);
124             break;
125         }
126         return sn_count;
127     }
128
129     for (i = 0; i < sn_count; i++) {
130         info = g_new0(SnapshotInfo, 1);
131         info->id            = g_strdup(sn_tab[i].id_str);
132         info->name          = g_strdup(sn_tab[i].name);
133         info->vm_state_size = sn_tab[i].vm_state_size;
134         info->date_sec      = sn_tab[i].date_sec;
135         info->date_nsec     = sn_tab[i].date_nsec;
136         info->vm_clock_sec  = sn_tab[i].vm_clock_nsec / 1000000000;
137         info->vm_clock_nsec = sn_tab[i].vm_clock_nsec % 1000000000;
138
139         info_list = g_new0(SnapshotInfoList, 1);
140         info_list->value = info;
141
142         /* XXX: waiting for the qapi to support qemu-queue.h types */
143         if (!cur_item) {
144             head = cur_item = info_list;
145         } else {
146             cur_item->next = info_list;
147             cur_item = info_list;
148         }
149
150     }
151
152     g_free(sn_tab);
153     *p_list = head;
154     return 0;
155 }
156
157 /**
158  * bdrv_query_image_info:
159  * @bs: block device to examine
160  * @p_info: location to store image information
161  * @errp: location to store error information
162  *
163  * Store "flat" image information in @p_info.
164  *
165  * "Flat" means it does *not* query backing image information,
166  * i.e. (*pinfo)->has_backing_image will be set to false and
167  * (*pinfo)->backing_image to NULL even when the image does in fact have
168  * a backing image.
169  *
170  * @p_info will be set only on success. On error, store error in @errp.
171  */
172 void bdrv_query_image_info(BlockDriverState *bs,
173                            ImageInfo **p_info,
174                            Error **errp)
175 {
176     int64_t size;
177     const char *backing_filename;
178     char backing_filename2[1024];
179     BlockDriverInfo bdi;
180     int ret;
181     Error *err = NULL;
182     ImageInfo *info;
183
184     size = bdrv_getlength(bs);
185     if (size < 0) {
186         error_setg_errno(errp, -size, "Can't get size of device '%s'",
187                          bdrv_get_device_name(bs));
188         return;
189     }
190
191     info = g_new0(ImageInfo, 1);
192     info->filename        = g_strdup(bs->filename);
193     info->format          = g_strdup(bdrv_get_format_name(bs));
194     info->virtual_size    = size;
195     info->actual_size     = bdrv_get_allocated_file_size(bs);
196     info->has_actual_size = info->actual_size >= 0;
197     if (bdrv_is_encrypted(bs)) {
198         info->encrypted = true;
199         info->has_encrypted = true;
200     }
201     if (bdrv_get_info(bs, &bdi) >= 0) {
202         if (bdi.cluster_size != 0) {
203             info->cluster_size = bdi.cluster_size;
204             info->has_cluster_size = true;
205         }
206         info->dirty_flag = bdi.is_dirty;
207         info->has_dirty_flag = true;
208     }
209     info->format_specific     = bdrv_get_specific_info(bs);
210     info->has_format_specific = info->format_specific != NULL;
211
212     backing_filename = bs->backing_file;
213     if (backing_filename[0] != '\0') {
214         info->backing_filename = g_strdup(backing_filename);
215         info->has_backing_filename = true;
216         bdrv_get_full_backing_filename(bs, backing_filename2,
217                                        sizeof(backing_filename2));
218
219         if (strcmp(backing_filename, backing_filename2) != 0) {
220             info->full_backing_filename =
221                         g_strdup(backing_filename2);
222             info->has_full_backing_filename = true;
223         }
224
225         if (bs->backing_format[0]) {
226             info->backing_filename_format = g_strdup(bs->backing_format);
227             info->has_backing_filename_format = true;
228         }
229     }
230
231     ret = bdrv_query_snapshot_info_list(bs, &info->snapshots, &err);
232     switch (ret) {
233     case 0:
234         if (info->snapshots) {
235             info->has_snapshots = true;
236         }
237         break;
238     /* recoverable error */
239     case -ENOMEDIUM:
240     case -ENOTSUP:
241         error_free(err);
242         break;
243     default:
244         error_propagate(errp, err);
245         qapi_free_ImageInfo(info);
246         return;
247     }
248
249     *p_info = info;
250 }
251
252 /* @p_info will be set only on success. */
253 static void bdrv_query_info(BlockBackend *blk, BlockInfo **p_info,
254                             Error **errp)
255 {
256     BlockInfo *info = g_malloc0(sizeof(*info));
257     BlockDriverState *bs = blk_bs(blk);
258     BlockDriverState *bs0;
259     ImageInfo **p_image_info;
260     Error *local_err = NULL;
261     info->device = g_strdup(blk_name(blk));
262     info->type = g_strdup("unknown");
263     info->locked = blk_dev_is_medium_locked(blk);
264     info->removable = blk_dev_has_removable_media(blk);
265
266     if (blk_dev_has_removable_media(blk)) {
267         info->has_tray_open = true;
268         info->tray_open = blk_dev_is_tray_open(blk);
269     }
270
271     if (bdrv_iostatus_is_enabled(bs)) {
272         info->has_io_status = true;
273         info->io_status = bs->iostatus;
274     }
275
276     if (!QLIST_EMPTY(&bs->dirty_bitmaps)) {
277         info->has_dirty_bitmaps = true;
278         info->dirty_bitmaps = bdrv_query_dirty_bitmaps(bs);
279     }
280
281     if (bs->drv) {
282         info->has_inserted = true;
283         info->inserted = bdrv_block_device_info(bs);
284
285         bs0 = bs;
286         p_image_info = &info->inserted->image;
287         while (1) {
288             bdrv_query_image_info(bs0, p_image_info, &local_err);
289             if (local_err) {
290                 error_propagate(errp, local_err);
291                 goto err;
292             }
293             if (bs0->drv && bs0->backing_hd) {
294                 bs0 = bs0->backing_hd;
295                 (*p_image_info)->has_backing_image = true;
296                 p_image_info = &((*p_image_info)->backing_image);
297             } else {
298                 break;
299             }
300         }
301     }
302
303     *p_info = info;
304     return;
305
306  err:
307     qapi_free_BlockInfo(info);
308 }
309
310 static BlockStats *bdrv_query_stats(const BlockDriverState *bs,
311                                     bool query_backing)
312 {
313     BlockStats *s;
314
315     s = g_malloc0(sizeof(*s));
316
317     if (bdrv_get_device_name(bs)[0]) {
318         s->has_device = true;
319         s->device = g_strdup(bdrv_get_device_name(bs));
320     }
321
322     if (bdrv_get_node_name(bs)[0]) {
323         s->has_node_name = true;
324         s->node_name = g_strdup(bdrv_get_node_name(bs));
325     }
326
327     s->stats = g_malloc0(sizeof(*s->stats));
328     s->stats->rd_bytes = bs->stats.nr_bytes[BLOCK_ACCT_READ];
329     s->stats->wr_bytes = bs->stats.nr_bytes[BLOCK_ACCT_WRITE];
330     s->stats->rd_operations = bs->stats.nr_ops[BLOCK_ACCT_READ];
331     s->stats->wr_operations = bs->stats.nr_ops[BLOCK_ACCT_WRITE];
332     s->stats->wr_highest_offset =
333         bs->stats.wr_highest_sector * BDRV_SECTOR_SIZE;
334     s->stats->flush_operations = bs->stats.nr_ops[BLOCK_ACCT_FLUSH];
335     s->stats->wr_total_time_ns = bs->stats.total_time_ns[BLOCK_ACCT_WRITE];
336     s->stats->rd_total_time_ns = bs->stats.total_time_ns[BLOCK_ACCT_READ];
337     s->stats->flush_total_time_ns = bs->stats.total_time_ns[BLOCK_ACCT_FLUSH];
338
339     if (bs->file) {
340         s->has_parent = true;
341         s->parent = bdrv_query_stats(bs->file, query_backing);
342     }
343
344     if (query_backing && bs->backing_hd) {
345         s->has_backing = true;
346         s->backing = bdrv_query_stats(bs->backing_hd, query_backing);
347     }
348
349     return s;
350 }
351
352 BlockInfoList *qmp_query_block(Error **errp)
353 {
354     BlockInfoList *head = NULL, **p_next = &head;
355     BlockBackend *blk;
356     Error *local_err = NULL;
357
358     for (blk = blk_next(NULL); blk; blk = blk_next(blk)) {
359         BlockInfoList *info = g_malloc0(sizeof(*info));
360         bdrv_query_info(blk, &info->value, &local_err);
361         if (local_err) {
362             error_propagate(errp, local_err);
363             goto err;
364         }
365
366         *p_next = info;
367         p_next = &info->next;
368     }
369
370     return head;
371
372  err:
373     qapi_free_BlockInfoList(head);
374     return NULL;
375 }
376
377 BlockStatsList *qmp_query_blockstats(bool has_query_nodes,
378                                      bool query_nodes,
379                                      Error **errp)
380 {
381     BlockStatsList *head = NULL, **p_next = &head;
382     BlockDriverState *bs = NULL;
383
384     /* Just to be safe if query_nodes is not always initialized */
385     query_nodes = has_query_nodes && query_nodes;
386
387     while ((bs = query_nodes ? bdrv_next_node(bs) : bdrv_next(bs))) {
388         BlockStatsList *info = g_malloc0(sizeof(*info));
389         AioContext *ctx = bdrv_get_aio_context(bs);
390
391         aio_context_acquire(ctx);
392         info->value = bdrv_query_stats(bs, !query_nodes);
393         aio_context_release(ctx);
394
395         *p_next = info;
396         p_next = &info->next;
397     }
398
399     return head;
400 }
401
402 #define NB_SUFFIXES 4
403
404 static char *get_human_readable_size(char *buf, int buf_size, int64_t size)
405 {
406     static const char suffixes[NB_SUFFIXES] = "KMGT";
407     int64_t base;
408     int i;
409
410     if (size <= 999) {
411         snprintf(buf, buf_size, "%" PRId64, size);
412     } else {
413         base = 1024;
414         for (i = 0; i < NB_SUFFIXES; i++) {
415             if (size < (10 * base)) {
416                 snprintf(buf, buf_size, "%0.1f%c",
417                          (double)size / base,
418                          suffixes[i]);
419                 break;
420             } else if (size < (1000 * base) || i == (NB_SUFFIXES - 1)) {
421                 snprintf(buf, buf_size, "%" PRId64 "%c",
422                          ((size + (base >> 1)) / base),
423                          suffixes[i]);
424                 break;
425             }
426             base = base * 1024;
427         }
428     }
429     return buf;
430 }
431
432 void bdrv_snapshot_dump(fprintf_function func_fprintf, void *f,
433                         QEMUSnapshotInfo *sn)
434 {
435     char buf1[128], date_buf[128], clock_buf[128];
436     struct tm tm;
437     time_t ti;
438     int64_t secs;
439
440     if (!sn) {
441         func_fprintf(f,
442                      "%-10s%-20s%7s%20s%15s",
443                      "ID", "TAG", "VM SIZE", "DATE", "VM CLOCK");
444     } else {
445         ti = sn->date_sec;
446         localtime_r(&ti, &tm);
447         strftime(date_buf, sizeof(date_buf),
448                  "%Y-%m-%d %H:%M:%S", &tm);
449         secs = sn->vm_clock_nsec / 1000000000;
450         snprintf(clock_buf, sizeof(clock_buf),
451                  "%02d:%02d:%02d.%03d",
452                  (int)(secs / 3600),
453                  (int)((secs / 60) % 60),
454                  (int)(secs % 60),
455                  (int)((sn->vm_clock_nsec / 1000000) % 1000));
456         func_fprintf(f,
457                      "%-10s%-20s%7s%20s%15s",
458                      sn->id_str, sn->name,
459                      get_human_readable_size(buf1, sizeof(buf1),
460                                              sn->vm_state_size),
461                      date_buf,
462                      clock_buf);
463     }
464 }
465
466 static void dump_qdict(fprintf_function func_fprintf, void *f, int indentation,
467                        QDict *dict);
468 static void dump_qlist(fprintf_function func_fprintf, void *f, int indentation,
469                        QList *list);
470
471 static void dump_qobject(fprintf_function func_fprintf, void *f,
472                          int comp_indent, QObject *obj)
473 {
474     switch (qobject_type(obj)) {
475         case QTYPE_QINT: {
476             QInt *value = qobject_to_qint(obj);
477             func_fprintf(f, "%" PRId64, qint_get_int(value));
478             break;
479         }
480         case QTYPE_QSTRING: {
481             QString *value = qobject_to_qstring(obj);
482             func_fprintf(f, "%s", qstring_get_str(value));
483             break;
484         }
485         case QTYPE_QDICT: {
486             QDict *value = qobject_to_qdict(obj);
487             dump_qdict(func_fprintf, f, comp_indent, value);
488             break;
489         }
490         case QTYPE_QLIST: {
491             QList *value = qobject_to_qlist(obj);
492             dump_qlist(func_fprintf, f, comp_indent, value);
493             break;
494         }
495         case QTYPE_QFLOAT: {
496             QFloat *value = qobject_to_qfloat(obj);
497             func_fprintf(f, "%g", qfloat_get_double(value));
498             break;
499         }
500         case QTYPE_QBOOL: {
501             QBool *value = qobject_to_qbool(obj);
502             func_fprintf(f, "%s", qbool_get_int(value) ? "true" : "false");
503             break;
504         }
505         case QTYPE_QERROR: {
506             QString *value = qerror_human((QError *)obj);
507             func_fprintf(f, "%s", qstring_get_str(value));
508             QDECREF(value);
509             break;
510         }
511         case QTYPE_NONE:
512             break;
513         case QTYPE_MAX:
514         default:
515             abort();
516     }
517 }
518
519 static void dump_qlist(fprintf_function func_fprintf, void *f, int indentation,
520                        QList *list)
521 {
522     const QListEntry *entry;
523     int i = 0;
524
525     for (entry = qlist_first(list); entry; entry = qlist_next(entry), i++) {
526         qtype_code type = qobject_type(entry->value);
527         bool composite = (type == QTYPE_QDICT || type == QTYPE_QLIST);
528         const char *format = composite ? "%*s[%i]:\n" : "%*s[%i]: ";
529
530         func_fprintf(f, format, indentation * 4, "", i);
531         dump_qobject(func_fprintf, f, indentation + 1, entry->value);
532         if (!composite) {
533             func_fprintf(f, "\n");
534         }
535     }
536 }
537
538 static void dump_qdict(fprintf_function func_fprintf, void *f, int indentation,
539                        QDict *dict)
540 {
541     const QDictEntry *entry;
542
543     for (entry = qdict_first(dict); entry; entry = qdict_next(dict, entry)) {
544         qtype_code type = qobject_type(entry->value);
545         bool composite = (type == QTYPE_QDICT || type == QTYPE_QLIST);
546         const char *format = composite ? "%*s%s:\n" : "%*s%s: ";
547         char key[strlen(entry->key) + 1];
548         int i;
549
550         /* replace dashes with spaces in key (variable) names */
551         for (i = 0; entry->key[i]; i++) {
552             key[i] = entry->key[i] == '-' ? ' ' : entry->key[i];
553         }
554         key[i] = 0;
555
556         func_fprintf(f, format, indentation * 4, "", key);
557         dump_qobject(func_fprintf, f, indentation + 1, entry->value);
558         if (!composite) {
559             func_fprintf(f, "\n");
560         }
561     }
562 }
563
564 void bdrv_image_info_specific_dump(fprintf_function func_fprintf, void *f,
565                                    ImageInfoSpecific *info_spec)
566 {
567     QmpOutputVisitor *ov = qmp_output_visitor_new();
568     QObject *obj, *data;
569
570     visit_type_ImageInfoSpecific(qmp_output_get_visitor(ov), &info_spec, NULL,
571                                  &error_abort);
572     obj = qmp_output_get_qobject(ov);
573     assert(qobject_type(obj) == QTYPE_QDICT);
574     data = qdict_get(qobject_to_qdict(obj), "data");
575     dump_qobject(func_fprintf, f, 1, data);
576     qmp_output_visitor_cleanup(ov);
577 }
578
579 void bdrv_image_info_dump(fprintf_function func_fprintf, void *f,
580                           ImageInfo *info)
581 {
582     char size_buf[128], dsize_buf[128];
583     if (!info->has_actual_size) {
584         snprintf(dsize_buf, sizeof(dsize_buf), "unavailable");
585     } else {
586         get_human_readable_size(dsize_buf, sizeof(dsize_buf),
587                                 info->actual_size);
588     }
589     get_human_readable_size(size_buf, sizeof(size_buf), info->virtual_size);
590     func_fprintf(f,
591                  "image: %s\n"
592                  "file format: %s\n"
593                  "virtual size: %s (%" PRId64 " bytes)\n"
594                  "disk size: %s\n",
595                  info->filename, info->format, size_buf,
596                  info->virtual_size,
597                  dsize_buf);
598
599     if (info->has_encrypted && info->encrypted) {
600         func_fprintf(f, "encrypted: yes\n");
601     }
602
603     if (info->has_cluster_size) {
604         func_fprintf(f, "cluster_size: %" PRId64 "\n",
605                        info->cluster_size);
606     }
607
608     if (info->has_dirty_flag && info->dirty_flag) {
609         func_fprintf(f, "cleanly shut down: no\n");
610     }
611
612     if (info->has_backing_filename) {
613         func_fprintf(f, "backing file: %s", info->backing_filename);
614         if (info->has_full_backing_filename) {
615             func_fprintf(f, " (actual path: %s)", info->full_backing_filename);
616         }
617         func_fprintf(f, "\n");
618         if (info->has_backing_filename_format) {
619             func_fprintf(f, "backing file format: %s\n",
620                          info->backing_filename_format);
621         }
622     }
623
624     if (info->has_snapshots) {
625         SnapshotInfoList *elem;
626
627         func_fprintf(f, "Snapshot list:\n");
628         bdrv_snapshot_dump(func_fprintf, f, NULL);
629         func_fprintf(f, "\n");
630
631         /* Ideally bdrv_snapshot_dump() would operate on SnapshotInfoList but
632          * we convert to the block layer's native QEMUSnapshotInfo for now.
633          */
634         for (elem = info->snapshots; elem; elem = elem->next) {
635             QEMUSnapshotInfo sn = {
636                 .vm_state_size = elem->value->vm_state_size,
637                 .date_sec = elem->value->date_sec,
638                 .date_nsec = elem->value->date_nsec,
639                 .vm_clock_nsec = elem->value->vm_clock_sec * 1000000000ULL +
640                                  elem->value->vm_clock_nsec,
641             };
642
643             pstrcpy(sn.id_str, sizeof(sn.id_str), elem->value->id);
644             pstrcpy(sn.name, sizeof(sn.name), elem->value->name);
645             bdrv_snapshot_dump(func_fprintf, f, &sn);
646             func_fprintf(f, "\n");
647         }
648     }
649
650     if (info->has_format_specific) {
651         func_fprintf(f, "Format specific information:\n");
652         bdrv_image_info_specific_dump(func_fprintf, f, info->format_specific);
653     }
654 }
This page took 0.063058 seconds and 4 git commands to generate.