qapi.c (7fceeb190ac6fbbbec0bf904f743190708301e31) qapi.c (7dc847ebba953db90853d15f140c20eef74d4fb2)
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

--- 633 unchanged lines hidden (view full) ---

642static void dump_qlist(fprintf_function func_fprintf, void *f, int indentation,
643 QList *list);
644
645static void dump_qobject(fprintf_function func_fprintf, void *f,
646 int comp_indent, QObject *obj)
647{
648 switch (qobject_type(obj)) {
649 case QTYPE_QNUM: {
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

--- 633 unchanged lines hidden (view full) ---

642static void dump_qlist(fprintf_function func_fprintf, void *f, int indentation,
643 QList *list);
644
645static void dump_qobject(fprintf_function func_fprintf, void *f,
646 int comp_indent, QObject *obj)
647{
648 switch (qobject_type(obj)) {
649 case QTYPE_QNUM: {
650 QNum *value = qobject_to_qnum(obj);
650 QNum *value = qobject_to(QNum, obj);
651 char *tmp = qnum_to_string(value);
652 func_fprintf(f, "%s", tmp);
653 g_free(tmp);
654 break;
655 }
656 case QTYPE_QSTRING: {
651 char *tmp = qnum_to_string(value);
652 func_fprintf(f, "%s", tmp);
653 g_free(tmp);
654 break;
655 }
656 case QTYPE_QSTRING: {
657 QString *value = qobject_to_qstring(obj);
657 QString *value = qobject_to(QString, obj);
658 func_fprintf(f, "%s", qstring_get_str(value));
659 break;
660 }
661 case QTYPE_QDICT: {
658 func_fprintf(f, "%s", qstring_get_str(value));
659 break;
660 }
661 case QTYPE_QDICT: {
662 QDict *value = qobject_to_qdict(obj);
662 QDict *value = qobject_to(QDict, obj);
663 dump_qdict(func_fprintf, f, comp_indent, value);
664 break;
665 }
666 case QTYPE_QLIST: {
663 dump_qdict(func_fprintf, f, comp_indent, value);
664 break;
665 }
666 case QTYPE_QLIST: {
667 QList *value = qobject_to_qlist(obj);
667 QList *value = qobject_to(QList, obj);
668 dump_qlist(func_fprintf, f, comp_indent, value);
669 break;
670 }
671 case QTYPE_QBOOL: {
668 dump_qlist(func_fprintf, f, comp_indent, value);
669 break;
670 }
671 case QTYPE_QBOOL: {
672 QBool *value = qobject_to_qbool(obj);
672 QBool *value = qobject_to(QBool, obj);
673 func_fprintf(f, "%s", qbool_get_bool(value) ? "true" : "false");
674 break;
675 }
676 default:
677 abort();
678 }
679}
680

--- 44 unchanged lines hidden (view full) ---

725void bdrv_image_info_specific_dump(fprintf_function func_fprintf, void *f,
726 ImageInfoSpecific *info_spec)
727{
728 QObject *obj, *data;
729 Visitor *v = qobject_output_visitor_new(&obj);
730
731 visit_type_ImageInfoSpecific(v, NULL, &info_spec, &error_abort);
732 visit_complete(v, &obj);
673 func_fprintf(f, "%s", qbool_get_bool(value) ? "true" : "false");
674 break;
675 }
676 default:
677 abort();
678 }
679}
680

--- 44 unchanged lines hidden (view full) ---

725void bdrv_image_info_specific_dump(fprintf_function func_fprintf, void *f,
726 ImageInfoSpecific *info_spec)
727{
728 QObject *obj, *data;
729 Visitor *v = qobject_output_visitor_new(&obj);
730
731 visit_type_ImageInfoSpecific(v, NULL, &info_spec, &error_abort);
732 visit_complete(v, &obj);
733 data = qdict_get(qobject_to_qdict(obj), "data");
733 data = qdict_get(qobject_to(QDict, obj), "data");
734 dump_qobject(func_fprintf, f, 1, data);
735 qobject_decref(obj);
736 visit_free(v);
737}
738
739void bdrv_image_info_dump(fprintf_function func_fprintf, void *f,
740 ImageInfo *info)
741{

--- 76 unchanged lines hidden ---
734 dump_qobject(func_fprintf, f, 1, data);
735 qobject_decref(obj);
736 visit_free(v);
737}
738
739void bdrv_image_info_dump(fprintf_function func_fprintf, void *f,
740 ImageInfo *info)
741{

--- 76 unchanged lines hidden ---