mirror of
https://github.com/yuzu-emu/unicorn.git
synced 2024-12-23 09:35:40 +00:00
qapi: rename QmpOutputVisitor to QObjectOutputVisitor
The QmpOutputVisitor has no direct dependency on QMP. It is valid to use it anywhere that one wants a QObject. Rename it to better reflect its functionality as a generic QAPI to QObject converter. The commit before previous renamed the files, this one renames C identifiers. Backports commit 7d5e199ade76c53ec316ab6779800581bb47c50a from qemu
This commit is contained in:
parent
2949a90977
commit
83a5bf2d25
|
@ -2494,24 +2494,24 @@
|
||||||
#define qobject_input_visitor_cleanup qobject_input_visitor_cleanup_aarch64
|
#define qobject_input_visitor_cleanup qobject_input_visitor_cleanup_aarch64
|
||||||
#define qobject_input_visitor_new qobject_input_visitor_new_aarch64
|
#define qobject_input_visitor_new qobject_input_visitor_new_aarch64
|
||||||
#define qobject_input_visitor_new_strict qobject_input_visitor_new_strict_aarch64
|
#define qobject_input_visitor_new_strict qobject_input_visitor_new_strict_aarch64
|
||||||
#define qmp_output_add_obj qmp_output_add_obj_aarch64
|
#define qobject_output_add_obj qobject_output_add_obj_aarch64
|
||||||
#define qmp_output_end_list qmp_output_end_list_aarch64
|
#define qobject_output_end_list qobject_output_end_list_aarch64
|
||||||
#define qmp_output_end_struct qmp_output_end_struct_aarch64
|
#define qobject_output_end_struct qobject_output_end_struct_aarch64
|
||||||
#define qmp_output_first qmp_output_first_aarch64
|
#define qobject_output_first qobject_output_first_aarch64
|
||||||
#define qmp_output_get_qobject qmp_output_get_qobject_aarch64
|
#define qobject_output_get_qobject qobject_output_get_qobject_aarch64
|
||||||
#define qmp_output_get_visitor qmp_output_get_visitor_aarch64
|
#define qobject_output_get_visitor qobject_output_get_visitor_aarch64
|
||||||
#define qmp_output_last qmp_output_last_aarch64
|
#define qobject_output_last qobject_output_last_aarch64
|
||||||
#define qmp_output_next_list qmp_output_next_list_aarch64
|
#define qobject_output_next_list qobject_output_next_list_aarch64
|
||||||
#define qmp_output_pop qmp_output_pop_aarch64
|
#define qobject_output_pop qobject_output_pop_aarch64
|
||||||
#define qmp_output_push_obj qmp_output_push_obj_aarch64
|
#define qobject_output_push_obj qobject_output_push_obj_aarch64
|
||||||
#define qmp_output_start_list qmp_output_start_list_aarch64
|
#define qobject_output_start_list qobject_output_start_list_aarch64
|
||||||
#define qmp_output_start_struct qmp_output_start_struct_aarch64
|
#define qobject_output_start_struct qobject_output_start_struct_aarch64
|
||||||
#define qmp_output_type_bool qmp_output_type_bool_aarch64
|
#define qobject_output_type_bool qobject_output_type_bool_aarch64
|
||||||
#define qmp_output_type_int qmp_output_type_int_aarch64
|
#define qobject_output_type_int qobject_output_type_int_aarch64
|
||||||
#define qmp_output_type_number qmp_output_type_number_aarch64
|
#define qobject_output_type_number qobject_output_type_number_aarch64
|
||||||
#define qmp_output_type_str qmp_output_type_str_aarch64
|
#define qobject_output_type_str qobject_output_type_str_aarch64
|
||||||
#define qmp_output_visitor_cleanup qmp_output_visitor_cleanup_aarch64
|
#define qobject_output_visitor_cleanup qobject_output_visitor_cleanup_aarch64
|
||||||
#define qmp_output_visitor_new qmp_output_visitor_new_aarch64
|
#define qobject_output_visitor_new qobject_output_visitor_new_aarch64
|
||||||
#define qobject_decref qobject_decref_aarch64
|
#define qobject_decref qobject_decref_aarch64
|
||||||
#define qobject_to_qbool qobject_to_qbool_aarch64
|
#define qobject_to_qbool qobject_to_qbool_aarch64
|
||||||
#define qobject_to_qdict qobject_to_qdict_aarch64
|
#define qobject_to_qdict qobject_to_qdict_aarch64
|
||||||
|
|
|
@ -2494,24 +2494,24 @@
|
||||||
#define qobject_input_visitor_cleanup qobject_input_visitor_cleanup_aarch64eb
|
#define qobject_input_visitor_cleanup qobject_input_visitor_cleanup_aarch64eb
|
||||||
#define qobject_input_visitor_new qobject_input_visitor_new_aarch64eb
|
#define qobject_input_visitor_new qobject_input_visitor_new_aarch64eb
|
||||||
#define qobject_input_visitor_new_strict qobject_input_visitor_new_strict_aarch64eb
|
#define qobject_input_visitor_new_strict qobject_input_visitor_new_strict_aarch64eb
|
||||||
#define qmp_output_add_obj qmp_output_add_obj_aarch64eb
|
#define qobject_output_add_obj qobject_output_add_obj_aarch64eb
|
||||||
#define qmp_output_end_list qmp_output_end_list_aarch64eb
|
#define qobject_output_end_list qobject_output_end_list_aarch64eb
|
||||||
#define qmp_output_end_struct qmp_output_end_struct_aarch64eb
|
#define qobject_output_end_struct qobject_output_end_struct_aarch64eb
|
||||||
#define qmp_output_first qmp_output_first_aarch64eb
|
#define qobject_output_first qobject_output_first_aarch64eb
|
||||||
#define qmp_output_get_qobject qmp_output_get_qobject_aarch64eb
|
#define qobject_output_get_qobject qobject_output_get_qobject_aarch64eb
|
||||||
#define qmp_output_get_visitor qmp_output_get_visitor_aarch64eb
|
#define qobject_output_get_visitor qobject_output_get_visitor_aarch64eb
|
||||||
#define qmp_output_last qmp_output_last_aarch64eb
|
#define qobject_output_last qobject_output_last_aarch64eb
|
||||||
#define qmp_output_next_list qmp_output_next_list_aarch64eb
|
#define qobject_output_next_list qobject_output_next_list_aarch64eb
|
||||||
#define qmp_output_pop qmp_output_pop_aarch64eb
|
#define qobject_output_pop qobject_output_pop_aarch64eb
|
||||||
#define qmp_output_push_obj qmp_output_push_obj_aarch64eb
|
#define qobject_output_push_obj qobject_output_push_obj_aarch64eb
|
||||||
#define qmp_output_start_list qmp_output_start_list_aarch64eb
|
#define qobject_output_start_list qobject_output_start_list_aarch64eb
|
||||||
#define qmp_output_start_struct qmp_output_start_struct_aarch64eb
|
#define qobject_output_start_struct qobject_output_start_struct_aarch64eb
|
||||||
#define qmp_output_type_bool qmp_output_type_bool_aarch64eb
|
#define qobject_output_type_bool qobject_output_type_bool_aarch64eb
|
||||||
#define qmp_output_type_int qmp_output_type_int_aarch64eb
|
#define qobject_output_type_int qobject_output_type_int_aarch64eb
|
||||||
#define qmp_output_type_number qmp_output_type_number_aarch64eb
|
#define qobject_output_type_number qobject_output_type_number_aarch64eb
|
||||||
#define qmp_output_type_str qmp_output_type_str_aarch64eb
|
#define qobject_output_type_str qobject_output_type_str_aarch64eb
|
||||||
#define qmp_output_visitor_cleanup qmp_output_visitor_cleanup_aarch64eb
|
#define qobject_output_visitor_cleanup qobject_output_visitor_cleanup_aarch64eb
|
||||||
#define qmp_output_visitor_new qmp_output_visitor_new_aarch64eb
|
#define qobject_output_visitor_new qobject_output_visitor_new_aarch64eb
|
||||||
#define qobject_decref qobject_decref_aarch64eb
|
#define qobject_decref qobject_decref_aarch64eb
|
||||||
#define qobject_to_qbool qobject_to_qbool_aarch64eb
|
#define qobject_to_qbool qobject_to_qbool_aarch64eb
|
||||||
#define qobject_to_qdict qobject_to_qdict_aarch64eb
|
#define qobject_to_qdict qobject_to_qdict_aarch64eb
|
||||||
|
|
36
qemu/arm.h
36
qemu/arm.h
|
@ -2494,24 +2494,24 @@
|
||||||
#define qobject_input_visitor_cleanup qobject_input_visitor_cleanup_arm
|
#define qobject_input_visitor_cleanup qobject_input_visitor_cleanup_arm
|
||||||
#define qobject_input_visitor_new qobject_input_visitor_new_arm
|
#define qobject_input_visitor_new qobject_input_visitor_new_arm
|
||||||
#define qobject_input_visitor_new_strict qobject_input_visitor_new_strict_arm
|
#define qobject_input_visitor_new_strict qobject_input_visitor_new_strict_arm
|
||||||
#define qmp_output_add_obj qmp_output_add_obj_arm
|
#define qobject_output_add_obj qobject_output_add_obj_arm
|
||||||
#define qmp_output_end_list qmp_output_end_list_arm
|
#define qobject_output_end_list qobject_output_end_list_arm
|
||||||
#define qmp_output_end_struct qmp_output_end_struct_arm
|
#define qobject_output_end_struct qobject_output_end_struct_arm
|
||||||
#define qmp_output_first qmp_output_first_arm
|
#define qobject_output_first qobject_output_first_arm
|
||||||
#define qmp_output_get_qobject qmp_output_get_qobject_arm
|
#define qobject_output_get_qobject qobject_output_get_qobject_arm
|
||||||
#define qmp_output_get_visitor qmp_output_get_visitor_arm
|
#define qobject_output_get_visitor qobject_output_get_visitor_arm
|
||||||
#define qmp_output_last qmp_output_last_arm
|
#define qobject_output_last qobject_output_last_arm
|
||||||
#define qmp_output_next_list qmp_output_next_list_arm
|
#define qobject_output_next_list qobject_output_next_list_arm
|
||||||
#define qmp_output_pop qmp_output_pop_arm
|
#define qobject_output_pop qobject_output_pop_arm
|
||||||
#define qmp_output_push_obj qmp_output_push_obj_arm
|
#define qobject_output_push_obj qobject_output_push_obj_arm
|
||||||
#define qmp_output_start_list qmp_output_start_list_arm
|
#define qobject_output_start_list qobject_output_start_list_arm
|
||||||
#define qmp_output_start_struct qmp_output_start_struct_arm
|
#define qobject_output_start_struct qobject_output_start_struct_arm
|
||||||
#define qmp_output_type_bool qmp_output_type_bool_arm
|
#define qobject_output_type_bool qobject_output_type_bool_arm
|
||||||
#define qmp_output_type_int qmp_output_type_int_arm
|
#define qobject_output_type_int qobject_output_type_int_arm
|
||||||
#define qmp_output_type_number qmp_output_type_number_arm
|
#define qobject_output_type_number qobject_output_type_number_arm
|
||||||
#define qmp_output_type_str qmp_output_type_str_arm
|
#define qobject_output_type_str qobject_output_type_str_arm
|
||||||
#define qmp_output_visitor_cleanup qmp_output_visitor_cleanup_arm
|
#define qobject_output_visitor_cleanup qobject_output_visitor_cleanup_arm
|
||||||
#define qmp_output_visitor_new qmp_output_visitor_new_arm
|
#define qobject_output_visitor_new qobject_output_visitor_new_arm
|
||||||
#define qobject_decref qobject_decref_arm
|
#define qobject_decref qobject_decref_arm
|
||||||
#define qobject_to_qbool qobject_to_qbool_arm
|
#define qobject_to_qbool qobject_to_qbool_arm
|
||||||
#define qobject_to_qdict qobject_to_qdict_arm
|
#define qobject_to_qdict qobject_to_qdict_arm
|
||||||
|
|
36
qemu/armeb.h
36
qemu/armeb.h
|
@ -2494,24 +2494,24 @@
|
||||||
#define qobject_input_visitor_cleanup qobject_input_visitor_cleanup_armeb
|
#define qobject_input_visitor_cleanup qobject_input_visitor_cleanup_armeb
|
||||||
#define qobject_input_visitor_new qobject_input_visitor_new_armeb
|
#define qobject_input_visitor_new qobject_input_visitor_new_armeb
|
||||||
#define qobject_input_visitor_new_strict qobject_input_visitor_new_strict_armeb
|
#define qobject_input_visitor_new_strict qobject_input_visitor_new_strict_armeb
|
||||||
#define qmp_output_add_obj qmp_output_add_obj_armeb
|
#define qobject_output_add_obj qobject_output_add_obj_armeb
|
||||||
#define qmp_output_end_list qmp_output_end_list_armeb
|
#define qobject_output_end_list qobject_output_end_list_armeb
|
||||||
#define qmp_output_end_struct qmp_output_end_struct_armeb
|
#define qobject_output_end_struct qobject_output_end_struct_armeb
|
||||||
#define qmp_output_first qmp_output_first_armeb
|
#define qobject_output_first qobject_output_first_armeb
|
||||||
#define qmp_output_get_qobject qmp_output_get_qobject_armeb
|
#define qobject_output_get_qobject qobject_output_get_qobject_armeb
|
||||||
#define qmp_output_get_visitor qmp_output_get_visitor_armeb
|
#define qobject_output_get_visitor qobject_output_get_visitor_armeb
|
||||||
#define qmp_output_last qmp_output_last_armeb
|
#define qobject_output_last qobject_output_last_armeb
|
||||||
#define qmp_output_next_list qmp_output_next_list_armeb
|
#define qobject_output_next_list qobject_output_next_list_armeb
|
||||||
#define qmp_output_pop qmp_output_pop_armeb
|
#define qobject_output_pop qobject_output_pop_armeb
|
||||||
#define qmp_output_push_obj qmp_output_push_obj_armeb
|
#define qobject_output_push_obj qobject_output_push_obj_armeb
|
||||||
#define qmp_output_start_list qmp_output_start_list_armeb
|
#define qobject_output_start_list qobject_output_start_list_armeb
|
||||||
#define qmp_output_start_struct qmp_output_start_struct_armeb
|
#define qobject_output_start_struct qobject_output_start_struct_armeb
|
||||||
#define qmp_output_type_bool qmp_output_type_bool_armeb
|
#define qobject_output_type_bool qobject_output_type_bool_armeb
|
||||||
#define qmp_output_type_int qmp_output_type_int_armeb
|
#define qobject_output_type_int qobject_output_type_int_armeb
|
||||||
#define qmp_output_type_number qmp_output_type_number_armeb
|
#define qobject_output_type_number qobject_output_type_number_armeb
|
||||||
#define qmp_output_type_str qmp_output_type_str_armeb
|
#define qobject_output_type_str qobject_output_type_str_armeb
|
||||||
#define qmp_output_visitor_cleanup qmp_output_visitor_cleanup_armeb
|
#define qobject_output_visitor_cleanup qobject_output_visitor_cleanup_armeb
|
||||||
#define qmp_output_visitor_new qmp_output_visitor_new_armeb
|
#define qobject_output_visitor_new qobject_output_visitor_new_armeb
|
||||||
#define qobject_decref qobject_decref_armeb
|
#define qobject_decref qobject_decref_armeb
|
||||||
#define qobject_to_qbool qobject_to_qbool_armeb
|
#define qobject_to_qbool qobject_to_qbool_armeb
|
||||||
#define qobject_to_qdict qobject_to_qdict_armeb
|
#define qobject_to_qdict qobject_to_qdict_armeb
|
||||||
|
|
|
@ -2500,24 +2500,24 @@ symbols = (
|
||||||
'qobject_input_visitor_cleanup',
|
'qobject_input_visitor_cleanup',
|
||||||
'qobject_input_visitor_new',
|
'qobject_input_visitor_new',
|
||||||
'qobject_input_visitor_new_strict',
|
'qobject_input_visitor_new_strict',
|
||||||
'qmp_output_add_obj',
|
'qobject_output_add_obj',
|
||||||
'qmp_output_end_list',
|
'qobject_output_end_list',
|
||||||
'qmp_output_end_struct',
|
'qobject_output_end_struct',
|
||||||
'qmp_output_first',
|
'qobject_output_first',
|
||||||
'qmp_output_get_qobject',
|
'qobject_output_get_qobject',
|
||||||
'qmp_output_get_visitor',
|
'qobject_output_get_visitor',
|
||||||
'qmp_output_last',
|
'qobject_output_last',
|
||||||
'qmp_output_next_list',
|
'qobject_output_next_list',
|
||||||
'qmp_output_pop',
|
'qobject_output_pop',
|
||||||
'qmp_output_push_obj',
|
'qobject_output_push_obj',
|
||||||
'qmp_output_start_list',
|
'qobject_output_start_list',
|
||||||
'qmp_output_start_struct',
|
'qobject_output_start_struct',
|
||||||
'qmp_output_type_bool',
|
'qobject_output_type_bool',
|
||||||
'qmp_output_type_int',
|
'qobject_output_type_int',
|
||||||
'qmp_output_type_number',
|
'qobject_output_type_number',
|
||||||
'qmp_output_type_str',
|
'qobject_output_type_str',
|
||||||
'qmp_output_visitor_cleanup',
|
'qobject_output_visitor_cleanup',
|
||||||
'qmp_output_visitor_new',
|
'qobject_output_visitor_new',
|
||||||
'qobject_decref',
|
'qobject_decref',
|
||||||
'qobject_to_qbool',
|
'qobject_to_qbool',
|
||||||
'qobject_to_qdict',
|
'qobject_to_qdict',
|
||||||
|
|
|
@ -70,6 +70,7 @@ void qdict_flatten(QDict *qdict);
|
||||||
|
|
||||||
void qdict_extract_subqdict(QDict *src, QDict **dst, const char *start);
|
void qdict_extract_subqdict(QDict *src, QDict **dst, const char *start);
|
||||||
void qdict_array_split(QDict *src, QList **dst);
|
void qdict_array_split(QDict *src, QList **dst);
|
||||||
|
QObject *qdict_crumple(const QDict *src, Error **errp);
|
||||||
|
|
||||||
void qdict_join(QDict *dest, QDict *src, bool overwrite);
|
void qdict_join(QDict *dest, QDict *src, bool overwrite);
|
||||||
|
|
||||||
|
|
|
@ -17,7 +17,7 @@
|
||||||
#include "qapi/visitor.h"
|
#include "qapi/visitor.h"
|
||||||
#include "qapi/qmp/qobject.h"
|
#include "qapi/qmp/qobject.h"
|
||||||
|
|
||||||
typedef struct QmpOutputVisitor QmpOutputVisitor;
|
typedef struct QObjectOutputVisitor QObjectOutputVisitor;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Create a new QMP output visitor.
|
* Create a new QMP output visitor.
|
||||||
|
@ -25,6 +25,6 @@ typedef struct QmpOutputVisitor QmpOutputVisitor;
|
||||||
* If everything else succeeds, pass @result to visit_complete() to
|
* If everything else succeeds, pass @result to visit_complete() to
|
||||||
* collect the result of the visit.
|
* collect the result of the visit.
|
||||||
*/
|
*/
|
||||||
Visitor *qmp_output_visitor_new(QObject **result);
|
Visitor *qobject_output_visitor_new(QObject **result);
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
36
qemu/m68k.h
36
qemu/m68k.h
|
@ -2494,24 +2494,24 @@
|
||||||
#define qobject_input_visitor_cleanup qobject_input_visitor_cleanup_m68k
|
#define qobject_input_visitor_cleanup qobject_input_visitor_cleanup_m68k
|
||||||
#define qobject_input_visitor_new qobject_input_visitor_new_m68k
|
#define qobject_input_visitor_new qobject_input_visitor_new_m68k
|
||||||
#define qobject_input_visitor_new_strict qobject_input_visitor_new_strict_m68k
|
#define qobject_input_visitor_new_strict qobject_input_visitor_new_strict_m68k
|
||||||
#define qmp_output_add_obj qmp_output_add_obj_m68k
|
#define qobject_output_add_obj qobject_output_add_obj_m68k
|
||||||
#define qmp_output_end_list qmp_output_end_list_m68k
|
#define qobject_output_end_list qobject_output_end_list_m68k
|
||||||
#define qmp_output_end_struct qmp_output_end_struct_m68k
|
#define qobject_output_end_struct qobject_output_end_struct_m68k
|
||||||
#define qmp_output_first qmp_output_first_m68k
|
#define qobject_output_first qobject_output_first_m68k
|
||||||
#define qmp_output_get_qobject qmp_output_get_qobject_m68k
|
#define qobject_output_get_qobject qobject_output_get_qobject_m68k
|
||||||
#define qmp_output_get_visitor qmp_output_get_visitor_m68k
|
#define qobject_output_get_visitor qobject_output_get_visitor_m68k
|
||||||
#define qmp_output_last qmp_output_last_m68k
|
#define qobject_output_last qobject_output_last_m68k
|
||||||
#define qmp_output_next_list qmp_output_next_list_m68k
|
#define qobject_output_next_list qobject_output_next_list_m68k
|
||||||
#define qmp_output_pop qmp_output_pop_m68k
|
#define qobject_output_pop qobject_output_pop_m68k
|
||||||
#define qmp_output_push_obj qmp_output_push_obj_m68k
|
#define qobject_output_push_obj qobject_output_push_obj_m68k
|
||||||
#define qmp_output_start_list qmp_output_start_list_m68k
|
#define qobject_output_start_list qobject_output_start_list_m68k
|
||||||
#define qmp_output_start_struct qmp_output_start_struct_m68k
|
#define qobject_output_start_struct qobject_output_start_struct_m68k
|
||||||
#define qmp_output_type_bool qmp_output_type_bool_m68k
|
#define qobject_output_type_bool qobject_output_type_bool_m68k
|
||||||
#define qmp_output_type_int qmp_output_type_int_m68k
|
#define qobject_output_type_int qobject_output_type_int_m68k
|
||||||
#define qmp_output_type_number qmp_output_type_number_m68k
|
#define qobject_output_type_number qobject_output_type_number_m68k
|
||||||
#define qmp_output_type_str qmp_output_type_str_m68k
|
#define qobject_output_type_str qobject_output_type_str_m68k
|
||||||
#define qmp_output_visitor_cleanup qmp_output_visitor_cleanup_m68k
|
#define qobject_output_visitor_cleanup qobject_output_visitor_cleanup_m68k
|
||||||
#define qmp_output_visitor_new qmp_output_visitor_new_m68k
|
#define qobject_output_visitor_new qobject_output_visitor_new_m68k
|
||||||
#define qobject_decref qobject_decref_m68k
|
#define qobject_decref qobject_decref_m68k
|
||||||
#define qobject_to_qbool qobject_to_qbool_m68k
|
#define qobject_to_qbool qobject_to_qbool_m68k
|
||||||
#define qobject_to_qdict qobject_to_qdict_m68k
|
#define qobject_to_qdict qobject_to_qdict_m68k
|
||||||
|
|
36
qemu/mips.h
36
qemu/mips.h
|
@ -2494,24 +2494,24 @@
|
||||||
#define qobject_input_visitor_cleanup qobject_input_visitor_cleanup_mips
|
#define qobject_input_visitor_cleanup qobject_input_visitor_cleanup_mips
|
||||||
#define qobject_input_visitor_new qobject_input_visitor_new_mips
|
#define qobject_input_visitor_new qobject_input_visitor_new_mips
|
||||||
#define qobject_input_visitor_new_strict qobject_input_visitor_new_strict_mips
|
#define qobject_input_visitor_new_strict qobject_input_visitor_new_strict_mips
|
||||||
#define qmp_output_add_obj qmp_output_add_obj_mips
|
#define qobject_output_add_obj qobject_output_add_obj_mips
|
||||||
#define qmp_output_end_list qmp_output_end_list_mips
|
#define qobject_output_end_list qobject_output_end_list_mips
|
||||||
#define qmp_output_end_struct qmp_output_end_struct_mips
|
#define qobject_output_end_struct qobject_output_end_struct_mips
|
||||||
#define qmp_output_first qmp_output_first_mips
|
#define qobject_output_first qobject_output_first_mips
|
||||||
#define qmp_output_get_qobject qmp_output_get_qobject_mips
|
#define qobject_output_get_qobject qobject_output_get_qobject_mips
|
||||||
#define qmp_output_get_visitor qmp_output_get_visitor_mips
|
#define qobject_output_get_visitor qobject_output_get_visitor_mips
|
||||||
#define qmp_output_last qmp_output_last_mips
|
#define qobject_output_last qobject_output_last_mips
|
||||||
#define qmp_output_next_list qmp_output_next_list_mips
|
#define qobject_output_next_list qobject_output_next_list_mips
|
||||||
#define qmp_output_pop qmp_output_pop_mips
|
#define qobject_output_pop qobject_output_pop_mips
|
||||||
#define qmp_output_push_obj qmp_output_push_obj_mips
|
#define qobject_output_push_obj qobject_output_push_obj_mips
|
||||||
#define qmp_output_start_list qmp_output_start_list_mips
|
#define qobject_output_start_list qobject_output_start_list_mips
|
||||||
#define qmp_output_start_struct qmp_output_start_struct_mips
|
#define qobject_output_start_struct qobject_output_start_struct_mips
|
||||||
#define qmp_output_type_bool qmp_output_type_bool_mips
|
#define qobject_output_type_bool qobject_output_type_bool_mips
|
||||||
#define qmp_output_type_int qmp_output_type_int_mips
|
#define qobject_output_type_int qobject_output_type_int_mips
|
||||||
#define qmp_output_type_number qmp_output_type_number_mips
|
#define qobject_output_type_number qobject_output_type_number_mips
|
||||||
#define qmp_output_type_str qmp_output_type_str_mips
|
#define qobject_output_type_str qobject_output_type_str_mips
|
||||||
#define qmp_output_visitor_cleanup qmp_output_visitor_cleanup_mips
|
#define qobject_output_visitor_cleanup qobject_output_visitor_cleanup_mips
|
||||||
#define qmp_output_visitor_new qmp_output_visitor_new_mips
|
#define qobject_output_visitor_new qobject_output_visitor_new_mips
|
||||||
#define qobject_decref qobject_decref_mips
|
#define qobject_decref qobject_decref_mips
|
||||||
#define qobject_to_qbool qobject_to_qbool_mips
|
#define qobject_to_qbool qobject_to_qbool_mips
|
||||||
#define qobject_to_qdict qobject_to_qdict_mips
|
#define qobject_to_qdict qobject_to_qdict_mips
|
||||||
|
|
|
@ -2494,24 +2494,24 @@
|
||||||
#define qobject_input_visitor_cleanup qobject_input_visitor_cleanup_mips64
|
#define qobject_input_visitor_cleanup qobject_input_visitor_cleanup_mips64
|
||||||
#define qobject_input_visitor_new qobject_input_visitor_new_mips64
|
#define qobject_input_visitor_new qobject_input_visitor_new_mips64
|
||||||
#define qobject_input_visitor_new_strict qobject_input_visitor_new_strict_mips64
|
#define qobject_input_visitor_new_strict qobject_input_visitor_new_strict_mips64
|
||||||
#define qmp_output_add_obj qmp_output_add_obj_mips64
|
#define qobject_output_add_obj qobject_output_add_obj_mips64
|
||||||
#define qmp_output_end_list qmp_output_end_list_mips64
|
#define qobject_output_end_list qobject_output_end_list_mips64
|
||||||
#define qmp_output_end_struct qmp_output_end_struct_mips64
|
#define qobject_output_end_struct qobject_output_end_struct_mips64
|
||||||
#define qmp_output_first qmp_output_first_mips64
|
#define qobject_output_first qobject_output_first_mips64
|
||||||
#define qmp_output_get_qobject qmp_output_get_qobject_mips64
|
#define qobject_output_get_qobject qobject_output_get_qobject_mips64
|
||||||
#define qmp_output_get_visitor qmp_output_get_visitor_mips64
|
#define qobject_output_get_visitor qobject_output_get_visitor_mips64
|
||||||
#define qmp_output_last qmp_output_last_mips64
|
#define qobject_output_last qobject_output_last_mips64
|
||||||
#define qmp_output_next_list qmp_output_next_list_mips64
|
#define qobject_output_next_list qobject_output_next_list_mips64
|
||||||
#define qmp_output_pop qmp_output_pop_mips64
|
#define qobject_output_pop qobject_output_pop_mips64
|
||||||
#define qmp_output_push_obj qmp_output_push_obj_mips64
|
#define qobject_output_push_obj qobject_output_push_obj_mips64
|
||||||
#define qmp_output_start_list qmp_output_start_list_mips64
|
#define qobject_output_start_list qobject_output_start_list_mips64
|
||||||
#define qmp_output_start_struct qmp_output_start_struct_mips64
|
#define qobject_output_start_struct qobject_output_start_struct_mips64
|
||||||
#define qmp_output_type_bool qmp_output_type_bool_mips64
|
#define qobject_output_type_bool qobject_output_type_bool_mips64
|
||||||
#define qmp_output_type_int qmp_output_type_int_mips64
|
#define qobject_output_type_int qobject_output_type_int_mips64
|
||||||
#define qmp_output_type_number qmp_output_type_number_mips64
|
#define qobject_output_type_number qobject_output_type_number_mips64
|
||||||
#define qmp_output_type_str qmp_output_type_str_mips64
|
#define qobject_output_type_str qobject_output_type_str_mips64
|
||||||
#define qmp_output_visitor_cleanup qmp_output_visitor_cleanup_mips64
|
#define qobject_output_visitor_cleanup qobject_output_visitor_cleanup_mips64
|
||||||
#define qmp_output_visitor_new qmp_output_visitor_new_mips64
|
#define qobject_output_visitor_new qobject_output_visitor_new_mips64
|
||||||
#define qobject_decref qobject_decref_mips64
|
#define qobject_decref qobject_decref_mips64
|
||||||
#define qobject_to_qbool qobject_to_qbool_mips64
|
#define qobject_to_qbool qobject_to_qbool_mips64
|
||||||
#define qobject_to_qdict qobject_to_qdict_mips64
|
#define qobject_to_qdict qobject_to_qdict_mips64
|
||||||
|
|
|
@ -2494,24 +2494,24 @@
|
||||||
#define qobject_input_visitor_cleanup qobject_input_visitor_cleanup_mips64el
|
#define qobject_input_visitor_cleanup qobject_input_visitor_cleanup_mips64el
|
||||||
#define qobject_input_visitor_new qobject_input_visitor_new_mips64el
|
#define qobject_input_visitor_new qobject_input_visitor_new_mips64el
|
||||||
#define qobject_input_visitor_new_strict qobject_input_visitor_new_strict_mips64el
|
#define qobject_input_visitor_new_strict qobject_input_visitor_new_strict_mips64el
|
||||||
#define qmp_output_add_obj qmp_output_add_obj_mips64el
|
#define qobject_output_add_obj qobject_output_add_obj_mips64el
|
||||||
#define qmp_output_end_list qmp_output_end_list_mips64el
|
#define qobject_output_end_list qobject_output_end_list_mips64el
|
||||||
#define qmp_output_end_struct qmp_output_end_struct_mips64el
|
#define qobject_output_end_struct qobject_output_end_struct_mips64el
|
||||||
#define qmp_output_first qmp_output_first_mips64el
|
#define qobject_output_first qobject_output_first_mips64el
|
||||||
#define qmp_output_get_qobject qmp_output_get_qobject_mips64el
|
#define qobject_output_get_qobject qobject_output_get_qobject_mips64el
|
||||||
#define qmp_output_get_visitor qmp_output_get_visitor_mips64el
|
#define qobject_output_get_visitor qobject_output_get_visitor_mips64el
|
||||||
#define qmp_output_last qmp_output_last_mips64el
|
#define qobject_output_last qobject_output_last_mips64el
|
||||||
#define qmp_output_next_list qmp_output_next_list_mips64el
|
#define qobject_output_next_list qobject_output_next_list_mips64el
|
||||||
#define qmp_output_pop qmp_output_pop_mips64el
|
#define qobject_output_pop qobject_output_pop_mips64el
|
||||||
#define qmp_output_push_obj qmp_output_push_obj_mips64el
|
#define qobject_output_push_obj qobject_output_push_obj_mips64el
|
||||||
#define qmp_output_start_list qmp_output_start_list_mips64el
|
#define qobject_output_start_list qobject_output_start_list_mips64el
|
||||||
#define qmp_output_start_struct qmp_output_start_struct_mips64el
|
#define qobject_output_start_struct qobject_output_start_struct_mips64el
|
||||||
#define qmp_output_type_bool qmp_output_type_bool_mips64el
|
#define qobject_output_type_bool qobject_output_type_bool_mips64el
|
||||||
#define qmp_output_type_int qmp_output_type_int_mips64el
|
#define qobject_output_type_int qobject_output_type_int_mips64el
|
||||||
#define qmp_output_type_number qmp_output_type_number_mips64el
|
#define qobject_output_type_number qobject_output_type_number_mips64el
|
||||||
#define qmp_output_type_str qmp_output_type_str_mips64el
|
#define qobject_output_type_str qobject_output_type_str_mips64el
|
||||||
#define qmp_output_visitor_cleanup qmp_output_visitor_cleanup_mips64el
|
#define qobject_output_visitor_cleanup qobject_output_visitor_cleanup_mips64el
|
||||||
#define qmp_output_visitor_new qmp_output_visitor_new_mips64el
|
#define qobject_output_visitor_new qobject_output_visitor_new_mips64el
|
||||||
#define qobject_decref qobject_decref_mips64el
|
#define qobject_decref qobject_decref_mips64el
|
||||||
#define qobject_to_qbool qobject_to_qbool_mips64el
|
#define qobject_to_qbool qobject_to_qbool_mips64el
|
||||||
#define qobject_to_qdict qobject_to_qdict_mips64el
|
#define qobject_to_qdict qobject_to_qdict_mips64el
|
||||||
|
|
|
@ -2494,24 +2494,24 @@
|
||||||
#define qobject_input_visitor_cleanup qobject_input_visitor_cleanup_mipsel
|
#define qobject_input_visitor_cleanup qobject_input_visitor_cleanup_mipsel
|
||||||
#define qobject_input_visitor_new qobject_input_visitor_new_mipsel
|
#define qobject_input_visitor_new qobject_input_visitor_new_mipsel
|
||||||
#define qobject_input_visitor_new_strict qobject_input_visitor_new_strict_mipsel
|
#define qobject_input_visitor_new_strict qobject_input_visitor_new_strict_mipsel
|
||||||
#define qmp_output_add_obj qmp_output_add_obj_mipsel
|
#define qobject_output_add_obj qobject_output_add_obj_mipsel
|
||||||
#define qmp_output_end_list qmp_output_end_list_mipsel
|
#define qobject_output_end_list qobject_output_end_list_mipsel
|
||||||
#define qmp_output_end_struct qmp_output_end_struct_mipsel
|
#define qobject_output_end_struct qobject_output_end_struct_mipsel
|
||||||
#define qmp_output_first qmp_output_first_mipsel
|
#define qobject_output_first qobject_output_first_mipsel
|
||||||
#define qmp_output_get_qobject qmp_output_get_qobject_mipsel
|
#define qobject_output_get_qobject qobject_output_get_qobject_mipsel
|
||||||
#define qmp_output_get_visitor qmp_output_get_visitor_mipsel
|
#define qobject_output_get_visitor qobject_output_get_visitor_mipsel
|
||||||
#define qmp_output_last qmp_output_last_mipsel
|
#define qobject_output_last qobject_output_last_mipsel
|
||||||
#define qmp_output_next_list qmp_output_next_list_mipsel
|
#define qobject_output_next_list qobject_output_next_list_mipsel
|
||||||
#define qmp_output_pop qmp_output_pop_mipsel
|
#define qobject_output_pop qobject_output_pop_mipsel
|
||||||
#define qmp_output_push_obj qmp_output_push_obj_mipsel
|
#define qobject_output_push_obj qobject_output_push_obj_mipsel
|
||||||
#define qmp_output_start_list qmp_output_start_list_mipsel
|
#define qobject_output_start_list qobject_output_start_list_mipsel
|
||||||
#define qmp_output_start_struct qmp_output_start_struct_mipsel
|
#define qobject_output_start_struct qobject_output_start_struct_mipsel
|
||||||
#define qmp_output_type_bool qmp_output_type_bool_mipsel
|
#define qobject_output_type_bool qobject_output_type_bool_mipsel
|
||||||
#define qmp_output_type_int qmp_output_type_int_mipsel
|
#define qobject_output_type_int qobject_output_type_int_mipsel
|
||||||
#define qmp_output_type_number qmp_output_type_number_mipsel
|
#define qobject_output_type_number qobject_output_type_number_mipsel
|
||||||
#define qmp_output_type_str qmp_output_type_str_mipsel
|
#define qobject_output_type_str qobject_output_type_str_mipsel
|
||||||
#define qmp_output_visitor_cleanup qmp_output_visitor_cleanup_mipsel
|
#define qobject_output_visitor_cleanup qobject_output_visitor_cleanup_mipsel
|
||||||
#define qmp_output_visitor_new qmp_output_visitor_new_mipsel
|
#define qobject_output_visitor_new qobject_output_visitor_new_mipsel
|
||||||
#define qobject_decref qobject_decref_mipsel
|
#define qobject_decref qobject_decref_mipsel
|
||||||
#define qobject_to_qbool qobject_to_qbool_mipsel
|
#define qobject_to_qbool qobject_to_qbool_mipsel
|
||||||
#define qobject_to_qdict qobject_to_qdict_mipsel
|
#define qobject_to_qdict qobject_to_qdict_mipsel
|
||||||
|
|
|
@ -2494,24 +2494,24 @@
|
||||||
#define qobject_input_visitor_cleanup qobject_input_visitor_cleanup_powerpc
|
#define qobject_input_visitor_cleanup qobject_input_visitor_cleanup_powerpc
|
||||||
#define qobject_input_visitor_new qobject_input_visitor_new_powerpc
|
#define qobject_input_visitor_new qobject_input_visitor_new_powerpc
|
||||||
#define qobject_input_visitor_new_strict qobject_input_visitor_new_strict_powerpc
|
#define qobject_input_visitor_new_strict qobject_input_visitor_new_strict_powerpc
|
||||||
#define qmp_output_add_obj qmp_output_add_obj_powerpc
|
#define qobject_output_add_obj qobject_output_add_obj_powerpc
|
||||||
#define qmp_output_end_list qmp_output_end_list_powerpc
|
#define qobject_output_end_list qobject_output_end_list_powerpc
|
||||||
#define qmp_output_end_struct qmp_output_end_struct_powerpc
|
#define qobject_output_end_struct qobject_output_end_struct_powerpc
|
||||||
#define qmp_output_first qmp_output_first_powerpc
|
#define qobject_output_first qobject_output_first_powerpc
|
||||||
#define qmp_output_get_qobject qmp_output_get_qobject_powerpc
|
#define qobject_output_get_qobject qobject_output_get_qobject_powerpc
|
||||||
#define qmp_output_get_visitor qmp_output_get_visitor_powerpc
|
#define qobject_output_get_visitor qobject_output_get_visitor_powerpc
|
||||||
#define qmp_output_last qmp_output_last_powerpc
|
#define qobject_output_last qobject_output_last_powerpc
|
||||||
#define qmp_output_next_list qmp_output_next_list_powerpc
|
#define qobject_output_next_list qobject_output_next_list_powerpc
|
||||||
#define qmp_output_pop qmp_output_pop_powerpc
|
#define qobject_output_pop qobject_output_pop_powerpc
|
||||||
#define qmp_output_push_obj qmp_output_push_obj_powerpc
|
#define qobject_output_push_obj qobject_output_push_obj_powerpc
|
||||||
#define qmp_output_start_list qmp_output_start_list_powerpc
|
#define qobject_output_start_list qobject_output_start_list_powerpc
|
||||||
#define qmp_output_start_struct qmp_output_start_struct_powerpc
|
#define qobject_output_start_struct qobject_output_start_struct_powerpc
|
||||||
#define qmp_output_type_bool qmp_output_type_bool_powerpc
|
#define qobject_output_type_bool qobject_output_type_bool_powerpc
|
||||||
#define qmp_output_type_int qmp_output_type_int_powerpc
|
#define qobject_output_type_int qobject_output_type_int_powerpc
|
||||||
#define qmp_output_type_number qmp_output_type_number_powerpc
|
#define qobject_output_type_number qobject_output_type_number_powerpc
|
||||||
#define qmp_output_type_str qmp_output_type_str_powerpc
|
#define qobject_output_type_str qobject_output_type_str_powerpc
|
||||||
#define qmp_output_visitor_cleanup qmp_output_visitor_cleanup_powerpc
|
#define qobject_output_visitor_cleanup qobject_output_visitor_cleanup_powerpc
|
||||||
#define qmp_output_visitor_new qmp_output_visitor_new_powerpc
|
#define qobject_output_visitor_new qobject_output_visitor_new_powerpc
|
||||||
#define qobject_decref qobject_decref_powerpc
|
#define qobject_decref qobject_decref_powerpc
|
||||||
#define qobject_to_qbool qobject_to_qbool_powerpc
|
#define qobject_to_qbool qobject_to_qbool_powerpc
|
||||||
#define qobject_to_qdict qobject_to_qdict_powerpc
|
#define qobject_to_qdict qobject_to_qdict_powerpc
|
||||||
|
|
|
@ -27,7 +27,7 @@ typedef struct QStackEntry
|
||||||
QSLIST_ENTRY(QStackEntry) node;
|
QSLIST_ENTRY(QStackEntry) node;
|
||||||
} QStackEntry;
|
} QStackEntry;
|
||||||
|
|
||||||
struct QmpOutputVisitor
|
struct QObjectOutputVisitor
|
||||||
{
|
{
|
||||||
Visitor visitor;
|
Visitor visitor;
|
||||||
QSLIST_HEAD(, QStackEntry) stack; /* Stack of unfinished containers */
|
QSLIST_HEAD(, QStackEntry) stack; /* Stack of unfinished containers */
|
||||||
|
@ -35,19 +35,19 @@ struct QmpOutputVisitor
|
||||||
QObject **result; /* User's storage location for result */
|
QObject **result; /* User's storage location for result */
|
||||||
};
|
};
|
||||||
|
|
||||||
#define qmp_output_add(qov, name, value) \
|
#define qobject_output_add(qov, name, value) \
|
||||||
qmp_output_add_obj(qov, name, QOBJECT(value))
|
qobject_output_add_obj(qov, name, QOBJECT(value))
|
||||||
#define qmp_output_push(qov, value, qapi) \
|
#define qobject_output_push(qov, value, qapi) \
|
||||||
qmp_output_push_obj(qov, QOBJECT(value), qapi)
|
qobject_output_push_obj(qov, QOBJECT(value), qapi)
|
||||||
|
|
||||||
static QmpOutputVisitor *to_qov(Visitor *v)
|
static QObjectOutputVisitor *to_qov(Visitor *v)
|
||||||
{
|
{
|
||||||
return container_of(v, QmpOutputVisitor, visitor);
|
return container_of(v, QObjectOutputVisitor, visitor);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Push @value onto the stack of current QObjects being built */
|
/* Push @value onto the stack of current QObjects being built */
|
||||||
static void qmp_output_push_obj(QmpOutputVisitor *qov, QObject *value,
|
static void qobject_output_push_obj(QObjectOutputVisitor *qov, QObject *value,
|
||||||
void *qapi)
|
void *qapi)
|
||||||
{
|
{
|
||||||
QStackEntry *e = g_malloc0(sizeof(*e));
|
QStackEntry *e = g_malloc0(sizeof(*e));
|
||||||
|
|
||||||
|
@ -59,7 +59,7 @@ static void qmp_output_push_obj(QmpOutputVisitor *qov, QObject *value,
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Pop a value off the stack of QObjects being built, and return it. */
|
/* Pop a value off the stack of QObjects being built, and return it. */
|
||||||
static QObject *qmp_output_pop(QmpOutputVisitor *qov, void *qapi)
|
static QObject *qobject_output_pop(QObjectOutputVisitor *qov, void *qapi)
|
||||||
{
|
{
|
||||||
QStackEntry *e = QSLIST_FIRST(&qov->stack);
|
QStackEntry *e = QSLIST_FIRST(&qov->stack);
|
||||||
QObject *value;
|
QObject *value;
|
||||||
|
@ -76,8 +76,8 @@ static QObject *qmp_output_pop(QmpOutputVisitor *qov, void *qapi)
|
||||||
/* Add @value to the current QObject being built.
|
/* Add @value to the current QObject being built.
|
||||||
* If the stack is visiting a dictionary or list, @value is now owned
|
* If the stack is visiting a dictionary or list, @value is now owned
|
||||||
* by that container. Otherwise, @value is now the root. */
|
* by that container. Otherwise, @value is now the root. */
|
||||||
static void qmp_output_add_obj(QmpOutputVisitor *qov, const char *name,
|
static void qobject_output_add_obj(QObjectOutputVisitor *qov, const char *name,
|
||||||
QObject *value)
|
QObject *value)
|
||||||
{
|
{
|
||||||
QStackEntry *e = QSLIST_FIRST(&qov->stack);
|
QStackEntry *e = QSLIST_FIRST(&qov->stack);
|
||||||
QObject *cur = e ? e->value : NULL;
|
QObject *cur = e ? e->value : NULL;
|
||||||
|
@ -102,107 +102,107 @@ static void qmp_output_add_obj(QmpOutputVisitor *qov, const char *name,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static void qmp_output_start_struct(Visitor *v, const char *name, void **obj,
|
static void qobject_output_start_struct(Visitor *v, const char *name, void **obj,
|
||||||
size_t unused, Error **errp)
|
size_t unused, Error **errp)
|
||||||
{
|
{
|
||||||
QmpOutputVisitor *qov = to_qov(v);
|
QObjectOutputVisitor *qov = to_qov(v);
|
||||||
QDict *dict = qdict_new();
|
QDict *dict = qdict_new();
|
||||||
|
|
||||||
qmp_output_add(qov, name, dict);
|
qobject_output_add(qov, name, dict);
|
||||||
qmp_output_push(qov, dict, obj);
|
qobject_output_push(qov, dict, obj);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void qmp_output_end_struct(Visitor *v, void **obj)
|
static void qobject_output_end_struct(Visitor *v, void **obj)
|
||||||
{
|
{
|
||||||
QmpOutputVisitor *qov = to_qov(v);
|
QObjectOutputVisitor *qov = to_qov(v);
|
||||||
QObject *value = qmp_output_pop(qov, obj);
|
QObject *value = qobject_output_pop(qov, obj);
|
||||||
assert(qobject_type(value) == QTYPE_QDICT);
|
assert(qobject_type(value) == QTYPE_QDICT);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void qmp_output_start_list(Visitor *v, const char *name,
|
static void qobject_output_start_list(Visitor *v, const char *name,
|
||||||
GenericList **listp, size_t size,
|
GenericList **listp, size_t size,
|
||||||
Error **errp)
|
Error **errp)
|
||||||
{
|
{
|
||||||
QmpOutputVisitor *qov = to_qov(v);
|
QObjectOutputVisitor *qov = to_qov(v);
|
||||||
QList *list = qlist_new();
|
QList *list = qlist_new();
|
||||||
|
|
||||||
qmp_output_add(qov, name, list);
|
qobject_output_add(qov, name, list);
|
||||||
qmp_output_push(qov, list, listp);
|
qobject_output_push(qov, list, listp);
|
||||||
}
|
}
|
||||||
|
|
||||||
static GenericList *qmp_output_next_list(Visitor *v, GenericList *tail,
|
static GenericList *qobject_output_next_list(Visitor *v, GenericList *tail,
|
||||||
size_t size)
|
size_t size)
|
||||||
{
|
{
|
||||||
return tail->next;
|
return tail->next;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void qmp_output_end_list(Visitor *v, void **obj)
|
static void qobject_output_end_list(Visitor *v, void **obj)
|
||||||
{
|
{
|
||||||
QmpOutputVisitor *qov = to_qov(v);
|
QObjectOutputVisitor *qov = to_qov(v);
|
||||||
QObject *value = qmp_output_pop(qov, obj);
|
QObject *value = qobject_output_pop(qov, obj);
|
||||||
assert(qobject_type(value) == QTYPE_QLIST);
|
assert(qobject_type(value) == QTYPE_QLIST);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void qmp_output_type_int64(Visitor *v, const char *name, int64_t *obj,
|
static void qobject_output_type_int64(Visitor *v, const char *name, int64_t *obj,
|
||||||
Error **errp)
|
Error **errp)
|
||||||
{
|
{
|
||||||
QmpOutputVisitor *qov = to_qov(v);
|
QObjectOutputVisitor *qov = to_qov(v);
|
||||||
qmp_output_add(qov, name, qint_from_int(*obj));
|
qobject_output_add(qov, name, qint_from_int(*obj));
|
||||||
}
|
}
|
||||||
|
|
||||||
static void qmp_output_type_uint64(Visitor *v, const char *name, uint64_t *obj,
|
static void qobject_output_type_uint64(Visitor *v, const char *name, uint64_t *obj,
|
||||||
Error **errp)
|
Error **errp)
|
||||||
{
|
{
|
||||||
/* FIXME: QMP outputs values larger than INT64_MAX as negative */
|
/* FIXME: QMP outputs values larger than INT64_MAX as negative */
|
||||||
QmpOutputVisitor *qov = to_qov(v);
|
QObjectOutputVisitor *qov = to_qov(v);
|
||||||
qmp_output_add(qov, name, qint_from_int(*obj));
|
qobject_output_add(qov, name, qint_from_int(*obj));
|
||||||
}
|
}
|
||||||
|
|
||||||
static void qmp_output_type_bool(Visitor *v, const char *name, bool *obj,
|
static void qobject_output_type_bool(Visitor *v, const char *name, bool *obj,
|
||||||
Error **errp)
|
Error **errp)
|
||||||
{
|
{
|
||||||
QmpOutputVisitor *qov = to_qov(v);
|
QObjectOutputVisitor *qov = to_qov(v);
|
||||||
qmp_output_add(qov, name, qbool_from_bool(*obj));
|
qobject_output_add(qov, name, qbool_from_bool(*obj));
|
||||||
}
|
}
|
||||||
|
|
||||||
static void qmp_output_type_str(Visitor *v, const char *name, char **obj,
|
static void qobject_output_type_str(Visitor *v, const char *name, char **obj,
|
||||||
Error **errp)
|
Error **errp)
|
||||||
{
|
{
|
||||||
QmpOutputVisitor *qov = to_qov(v);
|
QObjectOutputVisitor *qov = to_qov(v);
|
||||||
if (*obj) {
|
if (*obj) {
|
||||||
qmp_output_add(qov, name, qstring_from_str(*obj));
|
qobject_output_add(qov, name, qstring_from_str(*obj));
|
||||||
} else {
|
} else {
|
||||||
qmp_output_add(qov, name, qstring_from_str(""));
|
qobject_output_add(qov, name, qstring_from_str(""));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static void qmp_output_type_number(Visitor *v, const char *name, double *obj,
|
static void qobject_output_type_number(Visitor *v, const char *name, double *obj,
|
||||||
Error **errp)
|
Error **errp)
|
||||||
{
|
{
|
||||||
QmpOutputVisitor *qov = to_qov(v);
|
QObjectOutputVisitor *qov = to_qov(v);
|
||||||
qmp_output_add(qov, name, qfloat_from_double(*obj));
|
qobject_output_add(qov, name, qfloat_from_double(*obj));
|
||||||
}
|
}
|
||||||
|
|
||||||
static void qmp_output_type_any(Visitor *v, const char *name, QObject **obj,
|
static void qobject_output_type_any(Visitor *v, const char *name, QObject **obj,
|
||||||
Error **errp)
|
Error **errp)
|
||||||
{
|
{
|
||||||
QmpOutputVisitor *qov = to_qov(v);
|
QObjectOutputVisitor *qov = to_qov(v);
|
||||||
qobject_incref(*obj);
|
qobject_incref(*obj);
|
||||||
qmp_output_add_obj(qov, name, *obj);
|
qobject_output_add_obj(qov, name, *obj);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void qmp_output_type_null(Visitor *v, const char *name, Error **errp)
|
static void qobject_output_type_null(Visitor *v, const char *name, Error **errp)
|
||||||
{
|
{
|
||||||
QmpOutputVisitor *qov = to_qov(v);
|
QObjectOutputVisitor *qov = to_qov(v);
|
||||||
qmp_output_add_obj(qov, name, qnull());
|
qobject_output_add_obj(qov, name, qnull());
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Finish building, and return the root object.
|
/* Finish building, and return the root object.
|
||||||
* The root object is never null. The caller becomes the object's
|
* The root object is never null. The caller becomes the object's
|
||||||
* owner, and should use qobject_decref() when done with it. */
|
* owner, and should use qobject_decref() when done with it. */
|
||||||
static void qmp_output_complete(Visitor *v, void *opaque)
|
static void qobject_output_complete(Visitor *v, void *opaque)
|
||||||
{
|
{
|
||||||
QmpOutputVisitor *qov = to_qov(v);
|
QObjectOutputVisitor *qov = to_qov(v);
|
||||||
|
|
||||||
/* A visit must have occurred, with each start paired with end. */
|
/* A visit must have occurred, with each start paired with end. */
|
||||||
assert(qov->root && QSLIST_EMPTY(&qov->stack));
|
assert(qov->root && QSLIST_EMPTY(&qov->stack));
|
||||||
|
@ -212,9 +212,9 @@ static void qmp_output_complete(Visitor *v, void *opaque)
|
||||||
qov->result = NULL;
|
qov->result = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void qmp_output_free(Visitor *v)
|
static void qobject_output_free(Visitor *v)
|
||||||
{
|
{
|
||||||
QmpOutputVisitor *qov = to_qov(v);
|
QObjectOutputVisitor *qov = to_qov(v);
|
||||||
QStackEntry *e;
|
QStackEntry *e;
|
||||||
|
|
||||||
while (!QSLIST_EMPTY(&qov->stack)) {
|
while (!QSLIST_EMPTY(&qov->stack)) {
|
||||||
|
@ -227,27 +227,27 @@ static void qmp_output_free(Visitor *v)
|
||||||
g_free(qov);
|
g_free(qov);
|
||||||
}
|
}
|
||||||
|
|
||||||
Visitor *qmp_output_visitor_new(QObject **result)
|
Visitor *qobject_output_visitor_new(QObject **result)
|
||||||
{
|
{
|
||||||
QmpOutputVisitor *v;
|
QObjectOutputVisitor *v;
|
||||||
|
|
||||||
v = g_malloc0(sizeof(*v));
|
v = g_malloc0(sizeof(*v));
|
||||||
|
|
||||||
v->visitor.type = VISITOR_OUTPUT;
|
v->visitor.type = VISITOR_OUTPUT;
|
||||||
v->visitor.start_struct = qmp_output_start_struct;
|
v->visitor.start_struct = qobject_output_start_struct;
|
||||||
v->visitor.end_struct = qmp_output_end_struct;
|
v->visitor.end_struct = qobject_output_end_struct;
|
||||||
v->visitor.start_list = qmp_output_start_list;
|
v->visitor.start_list = qobject_output_start_list;
|
||||||
v->visitor.next_list = qmp_output_next_list;
|
v->visitor.next_list = qobject_output_next_list;
|
||||||
v->visitor.end_list = qmp_output_end_list;
|
v->visitor.end_list = qobject_output_end_list;
|
||||||
v->visitor.type_int64 = qmp_output_type_int64;
|
v->visitor.type_int64 = qobject_output_type_int64;
|
||||||
v->visitor.type_uint64 = qmp_output_type_uint64;
|
v->visitor.type_uint64 = qobject_output_type_uint64;
|
||||||
v->visitor.type_bool = qmp_output_type_bool;
|
v->visitor.type_bool = qobject_output_type_bool;
|
||||||
v->visitor.type_str = qmp_output_type_str;
|
v->visitor.type_str = qobject_output_type_str;
|
||||||
v->visitor.type_number = qmp_output_type_number;
|
v->visitor.type_number = qobject_output_type_number;
|
||||||
v->visitor.type_any = qmp_output_type_any;
|
v->visitor.type_any = qobject_output_type_any;
|
||||||
v->visitor.type_null = qmp_output_type_null;
|
v->visitor.type_null = qobject_output_type_null;
|
||||||
v->visitor.complete = qmp_output_complete;
|
v->visitor.complete = qobject_output_complete;
|
||||||
v->visitor.free = qmp_output_free;
|
v->visitor.free = qobject_output_free;
|
||||||
|
|
||||||
*result = NULL;
|
*result = NULL;
|
||||||
v->result = result;
|
v->result = result;
|
||||||
|
|
|
@ -17,6 +17,7 @@
|
||||||
#include "qapi/qmp/qbool.h"
|
#include "qapi/qmp/qbool.h"
|
||||||
#include "qapi/qmp/qstring.h"
|
#include "qapi/qmp/qstring.h"
|
||||||
#include "qapi/qmp/qobject.h"
|
#include "qapi/qmp/qobject.h"
|
||||||
|
#include "qapi/error.h"
|
||||||
#include "qemu/queue.h"
|
#include "qemu/queue.h"
|
||||||
#include "qemu-common.h"
|
#include "qemu-common.h"
|
||||||
#include "qemu/cutils.h"
|
#include "qemu/cutils.h"
|
||||||
|
@ -645,6 +646,282 @@ void qdict_array_split(QDict *src, QList **dst)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* qdict_split_flat_key:
|
||||||
|
* @key: the key string to split
|
||||||
|
* @prefix: non-NULL pointer to hold extracted prefix
|
||||||
|
* @suffix: non-NULL pointer to remaining suffix
|
||||||
|
*
|
||||||
|
* Given a flattened key such as 'foo.0.bar', split it into two parts
|
||||||
|
* at the first '.' separator. Allows double dot ('..') to escape the
|
||||||
|
* normal separator.
|
||||||
|
*
|
||||||
|
* e.g.
|
||||||
|
* 'foo.0.bar' -> prefix='foo' and suffix='0.bar'
|
||||||
|
* 'foo..0.bar' -> prefix='foo.0' and suffix='bar'
|
||||||
|
*
|
||||||
|
* The '..' sequence will be unescaped in the returned 'prefix'
|
||||||
|
* string. The 'suffix' string will be left in escaped format, so it
|
||||||
|
* can be fed back into the qdict_split_flat_key() key as the input
|
||||||
|
* later.
|
||||||
|
*
|
||||||
|
* The caller is responsible for freeing the string returned in @prefix
|
||||||
|
* using g_free().
|
||||||
|
*/
|
||||||
|
static void qdict_split_flat_key(const char *key, char **prefix,
|
||||||
|
const char **suffix)
|
||||||
|
{
|
||||||
|
const char *separator;
|
||||||
|
size_t i, j;
|
||||||
|
|
||||||
|
/* Find first '.' separator, but if there is a pair '..'
|
||||||
|
* that acts as an escape, so skip over '..' */
|
||||||
|
separator = NULL;
|
||||||
|
do {
|
||||||
|
if (separator) {
|
||||||
|
separator += 2;
|
||||||
|
} else {
|
||||||
|
separator = key;
|
||||||
|
}
|
||||||
|
separator = strchr(separator, '.');
|
||||||
|
} while (separator && separator[1] == '.');
|
||||||
|
|
||||||
|
if (separator) {
|
||||||
|
*prefix = g_strndup(key, separator - key);
|
||||||
|
*suffix = separator + 1;
|
||||||
|
} else {
|
||||||
|
*prefix = g_strdup(key);
|
||||||
|
*suffix = NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Unescape the '..' sequence into '.' */
|
||||||
|
for (i = 0, j = 0; (*prefix)[i] != '\0'; i++, j++) {
|
||||||
|
if ((*prefix)[i] == '.') {
|
||||||
|
assert((*prefix)[i + 1] == '.');
|
||||||
|
i++;
|
||||||
|
}
|
||||||
|
(*prefix)[j] = (*prefix)[i];
|
||||||
|
}
|
||||||
|
(*prefix)[j] = '\0';
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* qdict_is_list:
|
||||||
|
* @maybe_list: dict to check if keys represent list elements.
|
||||||
|
*
|
||||||
|
* Determine whether all keys in @maybe_list are valid list elements.
|
||||||
|
* If @maybe_list is non-zero in length and all the keys look like
|
||||||
|
* valid list indexes, this will return 1. If @maybe_list is zero
|
||||||
|
* length or all keys are non-numeric then it will return 0 to indicate
|
||||||
|
* it is a normal qdict. If there is a mix of numeric and non-numeric
|
||||||
|
* keys, or the list indexes are non-contiguous, an error is reported.
|
||||||
|
*
|
||||||
|
* Returns: 1 if a valid list, 0 if a dict, -1 on error
|
||||||
|
*/
|
||||||
|
static int qdict_is_list(QDict *maybe_list, Error **errp)
|
||||||
|
{
|
||||||
|
const QDictEntry *ent;
|
||||||
|
ssize_t len = 0;
|
||||||
|
ssize_t max = -1;
|
||||||
|
int is_list = -1;
|
||||||
|
int64_t val;
|
||||||
|
|
||||||
|
for (ent = qdict_first(maybe_list); ent != NULL;
|
||||||
|
ent = qdict_next(maybe_list, ent)) {
|
||||||
|
|
||||||
|
if (qemu_strtoll(ent->key, NULL, 10, &val) == 0) {
|
||||||
|
if (is_list == -1) {
|
||||||
|
is_list = 1;
|
||||||
|
} else if (!is_list) {
|
||||||
|
error_setg(errp,
|
||||||
|
"Cannot mix list and non-list keys");
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
len++;
|
||||||
|
if (val > max) {
|
||||||
|
max = val;
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
if (is_list == -1) {
|
||||||
|
is_list = 0;
|
||||||
|
} else if (is_list) {
|
||||||
|
error_setg(errp,
|
||||||
|
"Cannot mix list and non-list keys");
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (is_list == -1) {
|
||||||
|
assert(!qdict_size(maybe_list));
|
||||||
|
is_list = 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* NB this isn't a perfect check - e.g. it won't catch
|
||||||
|
* a list containing '1', '+1', '01', '3', but that
|
||||||
|
* does not matter - we've still proved that the
|
||||||
|
* input is a list. It is up the caller to do a
|
||||||
|
* stricter check if desired */
|
||||||
|
if (len != (max + 1)) {
|
||||||
|
error_setg(errp, "List indices are not contiguous, "
|
||||||
|
"saw %zd elements but %zd largest index",
|
||||||
|
len, max);
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
|
||||||
|
return is_list;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* qdict_crumple:
|
||||||
|
* @src: the original flat dictionary (only scalar values) to crumple
|
||||||
|
*
|
||||||
|
* Takes a flat dictionary whose keys use '.' separator to indicate
|
||||||
|
* nesting, and values are scalars, and crumples it into a nested
|
||||||
|
* structure.
|
||||||
|
*
|
||||||
|
* To include a literal '.' in a key name, it must be escaped as '..'
|
||||||
|
*
|
||||||
|
* For example, an input of:
|
||||||
|
*
|
||||||
|
* { 'foo.0.bar': 'one', 'foo.0.wizz': '1',
|
||||||
|
* 'foo.1.bar': 'two', 'foo.1.wizz': '2' }
|
||||||
|
*
|
||||||
|
* will result in an output of:
|
||||||
|
*
|
||||||
|
* {
|
||||||
|
* 'foo': [
|
||||||
|
* { 'bar': 'one', 'wizz': '1' },
|
||||||
|
* { 'bar': 'two', 'wizz': '2' }
|
||||||
|
* ],
|
||||||
|
* }
|
||||||
|
*
|
||||||
|
* The following scenarios in the input dict will result in an
|
||||||
|
* error being returned:
|
||||||
|
*
|
||||||
|
* - Any values in @src are non-scalar types
|
||||||
|
* - If keys in @src imply that a particular level is both a
|
||||||
|
* list and a dict. e.g., "foo.0.bar" and "foo.eek.bar".
|
||||||
|
* - If keys in @src imply that a particular level is a list,
|
||||||
|
* but the indices are non-contiguous. e.g. "foo.0.bar" and
|
||||||
|
* "foo.2.bar" without any "foo.1.bar" present.
|
||||||
|
* - If keys in @src represent list indexes, but are not in
|
||||||
|
* the "%zu" format. e.g. "foo.+0.bar"
|
||||||
|
*
|
||||||
|
* Returns: either a QDict or QList for the nested data structure, or NULL
|
||||||
|
* on error
|
||||||
|
*/
|
||||||
|
QObject *qdict_crumple(const QDict *src, Error **errp)
|
||||||
|
{
|
||||||
|
const QDictEntry *ent;
|
||||||
|
QDict *two_level, *multi_level = NULL;
|
||||||
|
QObject *dst = NULL, *child;
|
||||||
|
size_t i;
|
||||||
|
char *prefix = NULL;
|
||||||
|
const char *suffix = NULL;
|
||||||
|
int is_list;
|
||||||
|
|
||||||
|
two_level = qdict_new();
|
||||||
|
|
||||||
|
/* Step 1: split our totally flat dict into a two level dict */
|
||||||
|
for (ent = qdict_first(src); ent != NULL; ent = qdict_next(src, ent)) {
|
||||||
|
if (qobject_type(ent->value) == QTYPE_QDICT ||
|
||||||
|
qobject_type(ent->value) == QTYPE_QLIST) {
|
||||||
|
error_setg(errp, "Value %s is not a scalar",
|
||||||
|
ent->key);
|
||||||
|
goto error;
|
||||||
|
}
|
||||||
|
|
||||||
|
qdict_split_flat_key(ent->key, &prefix, &suffix);
|
||||||
|
|
||||||
|
child = qdict_get(two_level, prefix);
|
||||||
|
if (suffix) {
|
||||||
|
if (child) {
|
||||||
|
if (qobject_type(child) != QTYPE_QDICT) {
|
||||||
|
error_setg(errp, "Key %s prefix is already set as a scalar",
|
||||||
|
prefix);
|
||||||
|
goto error;
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
child = QOBJECT(qdict_new());
|
||||||
|
qdict_put_obj(two_level, prefix, child);
|
||||||
|
}
|
||||||
|
qobject_incref(ent->value);
|
||||||
|
qdict_put_obj(qobject_to_qdict(child), suffix, ent->value);
|
||||||
|
} else {
|
||||||
|
if (child) {
|
||||||
|
error_setg(errp, "Key %s prefix is already set as a dict",
|
||||||
|
prefix);
|
||||||
|
goto error;
|
||||||
|
}
|
||||||
|
qobject_incref(ent->value);
|
||||||
|
qdict_put_obj(two_level, prefix, ent->value);
|
||||||
|
}
|
||||||
|
|
||||||
|
g_free(prefix);
|
||||||
|
prefix = NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Step 2: optionally process the two level dict recursively
|
||||||
|
* into a multi-level dict */
|
||||||
|
multi_level = qdict_new();
|
||||||
|
for (ent = qdict_first(two_level); ent != NULL;
|
||||||
|
ent = qdict_next(two_level, ent)) {
|
||||||
|
|
||||||
|
if (qobject_type(ent->value) == QTYPE_QDICT) {
|
||||||
|
child = qdict_crumple(qobject_to_qdict(ent->value), errp);
|
||||||
|
if (!child) {
|
||||||
|
goto error;
|
||||||
|
}
|
||||||
|
|
||||||
|
qdict_put_obj(multi_level, ent->key, child);
|
||||||
|
} else {
|
||||||
|
qobject_incref(ent->value);
|
||||||
|
qdict_put_obj(multi_level, ent->key, ent->value);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
QDECREF(two_level);
|
||||||
|
two_level = NULL;
|
||||||
|
|
||||||
|
/* Step 3: detect if we need to turn our dict into list */
|
||||||
|
is_list = qdict_is_list(multi_level, errp);
|
||||||
|
if (is_list < 0) {
|
||||||
|
goto error;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (is_list) {
|
||||||
|
dst = QOBJECT(qlist_new());
|
||||||
|
|
||||||
|
for (i = 0; i < qdict_size(multi_level); i++) {
|
||||||
|
char *key = g_strdup_printf("%zu", i);
|
||||||
|
|
||||||
|
child = qdict_get(multi_level, key);
|
||||||
|
g_free(key);
|
||||||
|
|
||||||
|
if (!child) {
|
||||||
|
error_setg(errp, "Missing list index %zu", i);
|
||||||
|
goto error;
|
||||||
|
}
|
||||||
|
|
||||||
|
qobject_incref(child);
|
||||||
|
qlist_append_obj(qobject_to_qlist(dst), child);
|
||||||
|
}
|
||||||
|
QDECREF(multi_level);
|
||||||
|
multi_level = NULL;
|
||||||
|
} else {
|
||||||
|
dst = QOBJECT(multi_level);
|
||||||
|
}
|
||||||
|
|
||||||
|
return dst;
|
||||||
|
|
||||||
|
error:
|
||||||
|
g_free(prefix);
|
||||||
|
QDECREF(multi_level);
|
||||||
|
QDECREF(two_level);
|
||||||
|
qobject_decref(dst);
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* qdict_join(): Absorb the src QDict into the dest QDict, that is, move all
|
* qdict_join(): Absorb the src QDict into the dest QDict, that is, move all
|
||||||
* elements from src to dest.
|
* elements from src to dest.
|
||||||
|
|
|
@ -35,7 +35,7 @@ QObject *object_property_get_qobject(struct uc_struct *uc, Object *obj, const ch
|
||||||
Error *local_err = NULL;
|
Error *local_err = NULL;
|
||||||
Visitor *v;
|
Visitor *v;
|
||||||
|
|
||||||
v = qmp_output_visitor_new(&ret);
|
v = qobject_output_visitor_new(&ret);
|
||||||
object_property_get(uc, obj, v, name, &local_err);
|
object_property_get(uc, obj, v, name, &local_err);
|
||||||
if (!local_err) {
|
if (!local_err) {
|
||||||
visit_complete(v, &ret);
|
visit_complete(v, &ret);
|
||||||
|
|
|
@ -98,7 +98,7 @@ def gen_event_send(name, arg_type, boxed):
|
||||||
|
|
||||||
if arg_type and not arg_type.is_empty():
|
if arg_type and not arg_type.is_empty():
|
||||||
ret += mcgen('''
|
ret += mcgen('''
|
||||||
v = qmp_output_visitor_new(&obj);
|
v = qobject_output_visitor_new(&obj);
|
||||||
''')
|
''')
|
||||||
if not arg_type.is_implicit():
|
if not arg_type.is_implicit():
|
||||||
ret += mcgen('''
|
ret += mcgen('''
|
||||||
|
|
36
qemu/sparc.h
36
qemu/sparc.h
|
@ -2494,24 +2494,24 @@
|
||||||
#define qobject_input_visitor_cleanup qobject_input_visitor_cleanup_sparc
|
#define qobject_input_visitor_cleanup qobject_input_visitor_cleanup_sparc
|
||||||
#define qobject_input_visitor_new qobject_input_visitor_new_sparc
|
#define qobject_input_visitor_new qobject_input_visitor_new_sparc
|
||||||
#define qobject_input_visitor_new_strict qobject_input_visitor_new_strict_sparc
|
#define qobject_input_visitor_new_strict qobject_input_visitor_new_strict_sparc
|
||||||
#define qmp_output_add_obj qmp_output_add_obj_sparc
|
#define qobject_output_add_obj qobject_output_add_obj_sparc
|
||||||
#define qmp_output_end_list qmp_output_end_list_sparc
|
#define qobject_output_end_list qobject_output_end_list_sparc
|
||||||
#define qmp_output_end_struct qmp_output_end_struct_sparc
|
#define qobject_output_end_struct qobject_output_end_struct_sparc
|
||||||
#define qmp_output_first qmp_output_first_sparc
|
#define qobject_output_first qobject_output_first_sparc
|
||||||
#define qmp_output_get_qobject qmp_output_get_qobject_sparc
|
#define qobject_output_get_qobject qobject_output_get_qobject_sparc
|
||||||
#define qmp_output_get_visitor qmp_output_get_visitor_sparc
|
#define qobject_output_get_visitor qobject_output_get_visitor_sparc
|
||||||
#define qmp_output_last qmp_output_last_sparc
|
#define qobject_output_last qobject_output_last_sparc
|
||||||
#define qmp_output_next_list qmp_output_next_list_sparc
|
#define qobject_output_next_list qobject_output_next_list_sparc
|
||||||
#define qmp_output_pop qmp_output_pop_sparc
|
#define qobject_output_pop qobject_output_pop_sparc
|
||||||
#define qmp_output_push_obj qmp_output_push_obj_sparc
|
#define qobject_output_push_obj qobject_output_push_obj_sparc
|
||||||
#define qmp_output_start_list qmp_output_start_list_sparc
|
#define qobject_output_start_list qobject_output_start_list_sparc
|
||||||
#define qmp_output_start_struct qmp_output_start_struct_sparc
|
#define qobject_output_start_struct qobject_output_start_struct_sparc
|
||||||
#define qmp_output_type_bool qmp_output_type_bool_sparc
|
#define qobject_output_type_bool qobject_output_type_bool_sparc
|
||||||
#define qmp_output_type_int qmp_output_type_int_sparc
|
#define qobject_output_type_int qobject_output_type_int_sparc
|
||||||
#define qmp_output_type_number qmp_output_type_number_sparc
|
#define qobject_output_type_number qobject_output_type_number_sparc
|
||||||
#define qmp_output_type_str qmp_output_type_str_sparc
|
#define qobject_output_type_str qobject_output_type_str_sparc
|
||||||
#define qmp_output_visitor_cleanup qmp_output_visitor_cleanup_sparc
|
#define qobject_output_visitor_cleanup qobject_output_visitor_cleanup_sparc
|
||||||
#define qmp_output_visitor_new qmp_output_visitor_new_sparc
|
#define qobject_output_visitor_new qobject_output_visitor_new_sparc
|
||||||
#define qobject_decref qobject_decref_sparc
|
#define qobject_decref qobject_decref_sparc
|
||||||
#define qobject_to_qbool qobject_to_qbool_sparc
|
#define qobject_to_qbool qobject_to_qbool_sparc
|
||||||
#define qobject_to_qdict qobject_to_qdict_sparc
|
#define qobject_to_qdict qobject_to_qdict_sparc
|
||||||
|
|
|
@ -2494,24 +2494,24 @@
|
||||||
#define qobject_input_visitor_cleanup qobject_input_visitor_cleanup_sparc64
|
#define qobject_input_visitor_cleanup qobject_input_visitor_cleanup_sparc64
|
||||||
#define qobject_input_visitor_new qobject_input_visitor_new_sparc64
|
#define qobject_input_visitor_new qobject_input_visitor_new_sparc64
|
||||||
#define qobject_input_visitor_new_strict qobject_input_visitor_new_strict_sparc64
|
#define qobject_input_visitor_new_strict qobject_input_visitor_new_strict_sparc64
|
||||||
#define qmp_output_add_obj qmp_output_add_obj_sparc64
|
#define qobject_output_add_obj qobject_output_add_obj_sparc64
|
||||||
#define qmp_output_end_list qmp_output_end_list_sparc64
|
#define qobject_output_end_list qobject_output_end_list_sparc64
|
||||||
#define qmp_output_end_struct qmp_output_end_struct_sparc64
|
#define qobject_output_end_struct qobject_output_end_struct_sparc64
|
||||||
#define qmp_output_first qmp_output_first_sparc64
|
#define qobject_output_first qobject_output_first_sparc64
|
||||||
#define qmp_output_get_qobject qmp_output_get_qobject_sparc64
|
#define qobject_output_get_qobject qobject_output_get_qobject_sparc64
|
||||||
#define qmp_output_get_visitor qmp_output_get_visitor_sparc64
|
#define qobject_output_get_visitor qobject_output_get_visitor_sparc64
|
||||||
#define qmp_output_last qmp_output_last_sparc64
|
#define qobject_output_last qobject_output_last_sparc64
|
||||||
#define qmp_output_next_list qmp_output_next_list_sparc64
|
#define qobject_output_next_list qobject_output_next_list_sparc64
|
||||||
#define qmp_output_pop qmp_output_pop_sparc64
|
#define qobject_output_pop qobject_output_pop_sparc64
|
||||||
#define qmp_output_push_obj qmp_output_push_obj_sparc64
|
#define qobject_output_push_obj qobject_output_push_obj_sparc64
|
||||||
#define qmp_output_start_list qmp_output_start_list_sparc64
|
#define qobject_output_start_list qobject_output_start_list_sparc64
|
||||||
#define qmp_output_start_struct qmp_output_start_struct_sparc64
|
#define qobject_output_start_struct qobject_output_start_struct_sparc64
|
||||||
#define qmp_output_type_bool qmp_output_type_bool_sparc64
|
#define qobject_output_type_bool qobject_output_type_bool_sparc64
|
||||||
#define qmp_output_type_int qmp_output_type_int_sparc64
|
#define qobject_output_type_int qobject_output_type_int_sparc64
|
||||||
#define qmp_output_type_number qmp_output_type_number_sparc64
|
#define qobject_output_type_number qobject_output_type_number_sparc64
|
||||||
#define qmp_output_type_str qmp_output_type_str_sparc64
|
#define qobject_output_type_str qobject_output_type_str_sparc64
|
||||||
#define qmp_output_visitor_cleanup qmp_output_visitor_cleanup_sparc64
|
#define qobject_output_visitor_cleanup qobject_output_visitor_cleanup_sparc64
|
||||||
#define qmp_output_visitor_new qmp_output_visitor_new_sparc64
|
#define qobject_output_visitor_new qobject_output_visitor_new_sparc64
|
||||||
#define qobject_decref qobject_decref_sparc64
|
#define qobject_decref qobject_decref_sparc64
|
||||||
#define qobject_to_qbool qobject_to_qbool_sparc64
|
#define qobject_to_qbool qobject_to_qbool_sparc64
|
||||||
#define qobject_to_qdict qobject_to_qdict_sparc64
|
#define qobject_to_qdict qobject_to_qdict_sparc64
|
||||||
|
|
|
@ -207,3 +207,154 @@ int64_t qemu_strtosz(const char *nptr, char **end)
|
||||||
{
|
{
|
||||||
return qemu_strtosz_suffix(nptr, end, QEMU_STRTOSZ_DEFSUFFIX_MB);
|
return qemu_strtosz_suffix(nptr, end, QEMU_STRTOSZ_DEFSUFFIX_MB);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Helper function for qemu_strto*l() functions.
|
||||||
|
*/
|
||||||
|
static int check_strtox_error(const char *p, char *endptr, const char **next,
|
||||||
|
int err)
|
||||||
|
{
|
||||||
|
/* If no conversion was performed, prefer BSD behavior over glibc
|
||||||
|
* behavior.
|
||||||
|
*/
|
||||||
|
if (err == 0 && endptr == p) {
|
||||||
|
err = EINVAL;
|
||||||
|
}
|
||||||
|
if (!next && *endptr) {
|
||||||
|
return -EINVAL;
|
||||||
|
}
|
||||||
|
if (next) {
|
||||||
|
*next = endptr;
|
||||||
|
}
|
||||||
|
return -err;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* QEMU wrappers for strtol(), strtoll(), strtoul(), strotull() C functions.
|
||||||
|
*
|
||||||
|
* Convert ASCII string @nptr to a long integer value
|
||||||
|
* from the given @base. Parameters @nptr, @endptr, @base
|
||||||
|
* follows same semantics as strtol() C function.
|
||||||
|
*
|
||||||
|
* Unlike from strtol() function, if @endptr is not NULL, this
|
||||||
|
* function will return -EINVAL whenever it cannot fully convert
|
||||||
|
* the string in @nptr with given @base to a long. This function returns
|
||||||
|
* the result of the conversion only through the @result parameter.
|
||||||
|
*
|
||||||
|
* If NULL is passed in @endptr, then the whole string in @ntpr
|
||||||
|
* is a number otherwise it returns -EINVAL.
|
||||||
|
*
|
||||||
|
* RETURN VALUE
|
||||||
|
* Unlike from strtol() function, this wrapper returns either
|
||||||
|
* -EINVAL or the errno set by strtol() function (e.g -ERANGE).
|
||||||
|
* If the conversion overflows, -ERANGE is returned, and @result
|
||||||
|
* is set to the max value of the desired type
|
||||||
|
* (e.g. LONG_MAX, LLONG_MAX, ULONG_MAX, ULLONG_MAX). If the case
|
||||||
|
* of underflow, -ERANGE is returned, and @result is set to the min
|
||||||
|
* value of the desired type. For strtol(), strtoll(), @result is set to
|
||||||
|
* LONG_MIN, LLONG_MIN, respectively, and for strtoul(), strtoull() it
|
||||||
|
* is set to 0.
|
||||||
|
*/
|
||||||
|
int qemu_strtol(const char *nptr, const char **endptr, int base,
|
||||||
|
long *result)
|
||||||
|
{
|
||||||
|
char *p;
|
||||||
|
int err = 0;
|
||||||
|
if (!nptr) {
|
||||||
|
if (endptr) {
|
||||||
|
*endptr = nptr;
|
||||||
|
}
|
||||||
|
err = -EINVAL;
|
||||||
|
} else {
|
||||||
|
errno = 0;
|
||||||
|
*result = strtol(nptr, &p, base);
|
||||||
|
err = check_strtox_error(nptr, p, endptr, errno);
|
||||||
|
}
|
||||||
|
return err;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Converts ASCII string to an unsigned long integer.
|
||||||
|
*
|
||||||
|
* If string contains a negative number, value will be converted to
|
||||||
|
* the unsigned representation of the signed value, unless the original
|
||||||
|
* (nonnegated) value would overflow, in this case, it will set @result
|
||||||
|
* to ULONG_MAX, and return ERANGE.
|
||||||
|
*
|
||||||
|
* The same behavior holds, for qemu_strtoull() but sets @result to
|
||||||
|
* ULLONG_MAX instead of ULONG_MAX.
|
||||||
|
*
|
||||||
|
* See qemu_strtol() documentation for more info.
|
||||||
|
*/
|
||||||
|
int qemu_strtoul(const char *nptr, const char **endptr, int base,
|
||||||
|
unsigned long *result)
|
||||||
|
{
|
||||||
|
char *p;
|
||||||
|
int err = 0;
|
||||||
|
if (!nptr) {
|
||||||
|
if (endptr) {
|
||||||
|
*endptr = nptr;
|
||||||
|
}
|
||||||
|
err = -EINVAL;
|
||||||
|
} else {
|
||||||
|
errno = 0;
|
||||||
|
*result = strtoul(nptr, &p, base);
|
||||||
|
/* Windows returns 1 for negative out-of-range values. */
|
||||||
|
if (errno == ERANGE) {
|
||||||
|
*result = -1;
|
||||||
|
}
|
||||||
|
err = check_strtox_error(nptr, p, endptr, errno);
|
||||||
|
}
|
||||||
|
return err;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Converts ASCII string to a long long integer.
|
||||||
|
*
|
||||||
|
* See qemu_strtol() documentation for more info.
|
||||||
|
*/
|
||||||
|
int qemu_strtoll(const char *nptr, const char **endptr, int base,
|
||||||
|
int64_t *result)
|
||||||
|
{
|
||||||
|
char *p;
|
||||||
|
int err = 0;
|
||||||
|
if (!nptr) {
|
||||||
|
if (endptr) {
|
||||||
|
*endptr = nptr;
|
||||||
|
}
|
||||||
|
err = -EINVAL;
|
||||||
|
} else {
|
||||||
|
errno = 0;
|
||||||
|
*result = strtoll(nptr, &p, base);
|
||||||
|
err = check_strtox_error(nptr, p, endptr, errno);
|
||||||
|
}
|
||||||
|
return err;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Converts ASCII string to an unsigned long long integer.
|
||||||
|
*
|
||||||
|
* See qemu_strtol() documentation for more info.
|
||||||
|
*/
|
||||||
|
int qemu_strtoull(const char *nptr, const char **endptr, int base,
|
||||||
|
uint64_t *result)
|
||||||
|
{
|
||||||
|
char *p;
|
||||||
|
int err = 0;
|
||||||
|
if (!nptr) {
|
||||||
|
if (endptr) {
|
||||||
|
*endptr = nptr;
|
||||||
|
}
|
||||||
|
err = -EINVAL;
|
||||||
|
} else {
|
||||||
|
errno = 0;
|
||||||
|
*result = strtoull(nptr, &p, base);
|
||||||
|
/* Windows returns 1 for negative out-of-range values. */
|
||||||
|
if (errno == ERANGE) {
|
||||||
|
*result = -1;
|
||||||
|
}
|
||||||
|
err = check_strtox_error(nptr, p, endptr, errno);
|
||||||
|
}
|
||||||
|
return err;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
|
@ -2494,24 +2494,24 @@
|
||||||
#define qobject_input_visitor_cleanup qobject_input_visitor_cleanup_x86_64
|
#define qobject_input_visitor_cleanup qobject_input_visitor_cleanup_x86_64
|
||||||
#define qobject_input_visitor_new qobject_input_visitor_new_x86_64
|
#define qobject_input_visitor_new qobject_input_visitor_new_x86_64
|
||||||
#define qobject_input_visitor_new_strict qobject_input_visitor_new_strict_x86_64
|
#define qobject_input_visitor_new_strict qobject_input_visitor_new_strict_x86_64
|
||||||
#define qmp_output_add_obj qmp_output_add_obj_x86_64
|
#define qobject_output_add_obj qobject_output_add_obj_x86_64
|
||||||
#define qmp_output_end_list qmp_output_end_list_x86_64
|
#define qobject_output_end_list qobject_output_end_list_x86_64
|
||||||
#define qmp_output_end_struct qmp_output_end_struct_x86_64
|
#define qobject_output_end_struct qobject_output_end_struct_x86_64
|
||||||
#define qmp_output_first qmp_output_first_x86_64
|
#define qobject_output_first qobject_output_first_x86_64
|
||||||
#define qmp_output_get_qobject qmp_output_get_qobject_x86_64
|
#define qobject_output_get_qobject qobject_output_get_qobject_x86_64
|
||||||
#define qmp_output_get_visitor qmp_output_get_visitor_x86_64
|
#define qobject_output_get_visitor qobject_output_get_visitor_x86_64
|
||||||
#define qmp_output_last qmp_output_last_x86_64
|
#define qobject_output_last qobject_output_last_x86_64
|
||||||
#define qmp_output_next_list qmp_output_next_list_x86_64
|
#define qobject_output_next_list qobject_output_next_list_x86_64
|
||||||
#define qmp_output_pop qmp_output_pop_x86_64
|
#define qobject_output_pop qobject_output_pop_x86_64
|
||||||
#define qmp_output_push_obj qmp_output_push_obj_x86_64
|
#define qobject_output_push_obj qobject_output_push_obj_x86_64
|
||||||
#define qmp_output_start_list qmp_output_start_list_x86_64
|
#define qobject_output_start_list qobject_output_start_list_x86_64
|
||||||
#define qmp_output_start_struct qmp_output_start_struct_x86_64
|
#define qobject_output_start_struct qobject_output_start_struct_x86_64
|
||||||
#define qmp_output_type_bool qmp_output_type_bool_x86_64
|
#define qobject_output_type_bool qobject_output_type_bool_x86_64
|
||||||
#define qmp_output_type_int qmp_output_type_int_x86_64
|
#define qobject_output_type_int qobject_output_type_int_x86_64
|
||||||
#define qmp_output_type_number qmp_output_type_number_x86_64
|
#define qobject_output_type_number qobject_output_type_number_x86_64
|
||||||
#define qmp_output_type_str qmp_output_type_str_x86_64
|
#define qobject_output_type_str qobject_output_type_str_x86_64
|
||||||
#define qmp_output_visitor_cleanup qmp_output_visitor_cleanup_x86_64
|
#define qobject_output_visitor_cleanup qobject_output_visitor_cleanup_x86_64
|
||||||
#define qmp_output_visitor_new qmp_output_visitor_new_x86_64
|
#define qobject_output_visitor_new qobject_output_visitor_new_x86_64
|
||||||
#define qobject_decref qobject_decref_x86_64
|
#define qobject_decref qobject_decref_x86_64
|
||||||
#define qobject_to_qbool qobject_to_qbool_x86_64
|
#define qobject_to_qbool qobject_to_qbool_x86_64
|
||||||
#define qobject_to_qdict qobject_to_qdict_x86_64
|
#define qobject_to_qdict qobject_to_qdict_x86_64
|
||||||
|
|
Loading…
Reference in a new issue