QAPI patches for 2018-08-28
-----BEGIN PGP SIGNATURE----- iQIcBAABAgAGBQJbhXcEAAoJEDhwtADrkYZTdQQQAIPorQ9t/dae9YLeL4AgPjea SVIqXQPgqjyWxH6t/fSyWaxLbJkZwt+eHQBVlxx1gFwcx3SItK6AI2aCttOiNbOA 19nC/9XnNffZgJqch8bknjFikp0wwMemcLjo5WI1Ko7HqEhyBfREIa1il/MyCvrh m4gQGxbNDWKY12efkxFjExtkWEYi09/VgVBl4iWbsYdwv/5nJUtOGOh54gnMxGta 9J1kBvveN3XKmziKm9BRNvqQHtPLy5SvJR0m2jq8FLkovGvAjUvrI+qUdsK4DFOH aYE/swMGG4YKu314D4/AjZ9kWlWqqG39K11w2oqTuNX3WivuO0nc24KKpIIiDkOP 9zM3vwaHuunFlbtIHzLCw7I+IseU7PAc8gTKH/cjH1gGxLhdgKDNJSJTLVEOC+rU Gu0jZgqXb8ek0trjOJxTgAcJTT6G/qrYBOgor23125wduEARWgYHh0xJjktOuVem RKXVDqD6O6kiVJdCIlRyPSvICAIOHKZ4G5PSoITV+C4hsTZpMZotq8ELSMgDN1h6 D1Yl+AKC/+SSlu35AVoPJx96DL74VuGtI+LDpqDzn9gUTcFHxos0GoWGm2XnquZw EgArDgbp/NTYACeA6KstUxf43WNGzx1otgCmLWueRG6zh7g8QB/QXm5JTz33YnNP Y+V5VwMnjOovEbocB6A9 =KXCe -----END PGP SIGNATURE----- Merge remote-tracking branch 'remotes/armbru/tags/pull-qapi-2018-08-28' into staging QAPI patches for 2018-08-28 # gpg: Signature made Tue 28 Aug 2018 17:23:32 BST # gpg: using RSA key 3870B400EB918653 # gpg: Good signature from "Markus Armbruster <armbru@redhat.com>" # gpg: aka "Markus Armbruster <armbru@pond.sub.org>" # Primary key fingerprint: 354B C8B3 D7EB 2A6B 6867 4E5F 3870 B400 EB91 8653 * remotes/armbru/tags/pull-qapi-2018-08-28: qapi: Add comments to aid debugging generated introspection qapi: Minor introspect.py cleanups qapi: Update docs for generator changes since commit 9ee86b85267 qapi: Emit a blank line before dummy declaration qapi: Drop qapi_event_send_FOO()'s Error ** argument qapi: Fix build_params() for empty parameter list Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
This commit is contained in:
commit
850a8242a5
@ -980,8 +980,7 @@ void blk_dev_change_media_cb(BlockBackend *blk, bool load, Error **errp)
|
|||||||
|
|
||||||
if (tray_was_open != tray_is_open) {
|
if (tray_was_open != tray_is_open) {
|
||||||
char *id = blk_get_attached_dev_id(blk);
|
char *id = blk_get_attached_dev_id(blk);
|
||||||
qapi_event_send_device_tray_moved(blk_name(blk), id, tray_is_open,
|
qapi_event_send_device_tray_moved(blk_name(blk), id, tray_is_open);
|
||||||
&error_abort);
|
|
||||||
g_free(id);
|
g_free(id);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -1665,8 +1664,7 @@ static void send_qmp_error_event(BlockBackend *blk,
|
|||||||
qapi_event_send_block_io_error(blk_name(blk), !!bs,
|
qapi_event_send_block_io_error(blk_name(blk), !!bs,
|
||||||
bs ? bdrv_get_node_name(bs) : NULL, optype,
|
bs ? bdrv_get_node_name(bs) : NULL, optype,
|
||||||
action, blk_iostatus_is_enabled(blk),
|
action, blk_iostatus_is_enabled(blk),
|
||||||
error == ENOSPC, strerror(error),
|
error == ENOSPC, strerror(error));
|
||||||
&error_abort);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* This is done by device models because, while the block layer knows
|
/* This is done by device models because, while the block layer knows
|
||||||
@ -1782,7 +1780,7 @@ void blk_eject(BlockBackend *blk, bool eject_flag)
|
|||||||
* the frontend experienced a tray event. */
|
* the frontend experienced a tray event. */
|
||||||
id = blk_get_attached_dev_id(blk);
|
id = blk_get_attached_dev_id(blk);
|
||||||
qapi_event_send_device_tray_moved(blk_name(blk), id,
|
qapi_event_send_device_tray_moved(blk_name(blk), id,
|
||||||
eject_flag, &error_abort);
|
eject_flag);
|
||||||
g_free(id);
|
g_free(id);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -4659,7 +4659,7 @@ void qcow2_signal_corruption(BlockDriverState *bs, bool fatal, int64_t offset,
|
|||||||
*node_name != '\0', node_name,
|
*node_name != '\0', node_name,
|
||||||
message, offset >= 0, offset,
|
message, offset >= 0, offset,
|
||||||
size >= 0, size,
|
size >= 0, size,
|
||||||
fatal, &error_abort);
|
fatal);
|
||||||
g_free(message);
|
g_free(message);
|
||||||
|
|
||||||
if (fatal) {
|
if (fatal) {
|
||||||
|
@ -199,7 +199,7 @@ static void quorum_report_bad(QuorumOpType type, uint64_t offset,
|
|||||||
}
|
}
|
||||||
|
|
||||||
qapi_event_send_quorum_report_bad(type, !!msg, msg, node_name, start_sector,
|
qapi_event_send_quorum_report_bad(type, !!msg, msg, node_name, start_sector,
|
||||||
end_sector - start_sector, &error_abort);
|
end_sector - start_sector);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void quorum_report_failure(QuorumAIOCB *acb)
|
static void quorum_report_failure(QuorumAIOCB *acb)
|
||||||
@ -210,7 +210,7 @@ static void quorum_report_failure(QuorumAIOCB *acb)
|
|||||||
BDRV_SECTOR_SIZE);
|
BDRV_SECTOR_SIZE);
|
||||||
|
|
||||||
qapi_event_send_quorum_failure(reference, start_sector,
|
qapi_event_send_quorum_failure(reference, start_sector,
|
||||||
end_sector - start_sector, &error_abort);
|
end_sector - start_sector);
|
||||||
}
|
}
|
||||||
|
|
||||||
static int quorum_vote_error(QuorumAIOCB *acb);
|
static int quorum_vote_error(QuorumAIOCB *acb);
|
||||||
|
@ -63,8 +63,7 @@ static int coroutine_fn before_write_notify(NotifierWithReturn *notifier,
|
|||||||
qapi_event_send_block_write_threshold(
|
qapi_event_send_block_write_threshold(
|
||||||
bs->node_name,
|
bs->node_name,
|
||||||
amount,
|
amount,
|
||||||
bs->write_threshold_offset,
|
bs->write_threshold_offset);
|
||||||
&error_abort);
|
|
||||||
|
|
||||||
/* autodisable to avoid flooding the monitor */
|
/* autodisable to avoid flooding the monitor */
|
||||||
write_threshold_disable(bs);
|
write_threshold_disable(bs);
|
||||||
|
13
blockjob.c
13
blockjob.c
@ -315,8 +315,7 @@ static void block_job_event_cancelled(Notifier *n, void *opaque)
|
|||||||
job->job.id,
|
job->job.id,
|
||||||
job->job.progress_total,
|
job->job.progress_total,
|
||||||
job->job.progress_current,
|
job->job.progress_current,
|
||||||
job->speed,
|
job->speed);
|
||||||
&error_abort);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static void block_job_event_completed(Notifier *n, void *opaque)
|
static void block_job_event_completed(Notifier *n, void *opaque)
|
||||||
@ -338,8 +337,7 @@ static void block_job_event_completed(Notifier *n, void *opaque)
|
|||||||
job->job.progress_current,
|
job->job.progress_current,
|
||||||
job->speed,
|
job->speed,
|
||||||
!!msg,
|
!!msg,
|
||||||
msg,
|
msg);
|
||||||
&error_abort);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static void block_job_event_pending(Notifier *n, void *opaque)
|
static void block_job_event_pending(Notifier *n, void *opaque)
|
||||||
@ -351,8 +349,7 @@ static void block_job_event_pending(Notifier *n, void *opaque)
|
|||||||
}
|
}
|
||||||
|
|
||||||
qapi_event_send_block_job_pending(job_type(&job->job),
|
qapi_event_send_block_job_pending(job_type(&job->job),
|
||||||
job->job.id,
|
job->job.id);
|
||||||
&error_abort);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static void block_job_event_ready(Notifier *n, void *opaque)
|
static void block_job_event_ready(Notifier *n, void *opaque)
|
||||||
@ -367,7 +364,7 @@ static void block_job_event_ready(Notifier *n, void *opaque)
|
|||||||
job->job.id,
|
job->job.id,
|
||||||
job->job.progress_total,
|
job->job.progress_total,
|
||||||
job->job.progress_current,
|
job->job.progress_current,
|
||||||
job->speed, &error_abort);
|
job->speed);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -494,7 +491,7 @@ BlockErrorAction block_job_error_action(BlockJob *job, BlockdevOnError on_err,
|
|||||||
qapi_event_send_block_job_error(job->job.id,
|
qapi_event_send_block_job_error(job->job.id,
|
||||||
is_read ? IO_OPERATION_TYPE_READ :
|
is_read ? IO_OPERATION_TYPE_READ :
|
||||||
IO_OPERATION_TYPE_WRITE,
|
IO_OPERATION_TYPE_WRITE,
|
||||||
action, &error_abort);
|
action);
|
||||||
}
|
}
|
||||||
if (action == BLOCK_ERROR_ACTION_STOP) {
|
if (action == BLOCK_ERROR_ACTION_STOP) {
|
||||||
job_pause(&job->job);
|
job_pause(&job->job);
|
||||||
|
8
cpus.c
8
cpus.c
@ -1053,7 +1053,7 @@ static int do_vm_stop(RunState state, bool send_stop)
|
|||||||
runstate_set(state);
|
runstate_set(state);
|
||||||
vm_state_notify(0, state);
|
vm_state_notify(0, state);
|
||||||
if (send_stop) {
|
if (send_stop) {
|
||||||
qapi_event_send_stop(&error_abort);
|
qapi_event_send_stop();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -2107,13 +2107,13 @@ int vm_prepare_start(void)
|
|||||||
* the STOP event.
|
* the STOP event.
|
||||||
*/
|
*/
|
||||||
if (runstate_is_running()) {
|
if (runstate_is_running()) {
|
||||||
qapi_event_send_stop(&error_abort);
|
qapi_event_send_stop();
|
||||||
qapi_event_send_resume(&error_abort);
|
qapi_event_send_resume();
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* We are sending this now, but the CPUs will be resumed shortly later */
|
/* We are sending this now, but the CPUs will be resumed shortly later */
|
||||||
qapi_event_send_resume(&error_abort);
|
qapi_event_send_resume();
|
||||||
|
|
||||||
replay_enable_events();
|
replay_enable_events();
|
||||||
cpu_enable_ticks();
|
cpu_enable_ticks();
|
||||||
|
@ -1035,7 +1035,7 @@ Example:
|
|||||||
#ifndef EXAMPLE_QAPI_TYPES_H
|
#ifndef EXAMPLE_QAPI_TYPES_H
|
||||||
#define EXAMPLE_QAPI_TYPES_H
|
#define EXAMPLE_QAPI_TYPES_H
|
||||||
|
|
||||||
[Built-in types omitted...]
|
#include "qapi/qapi-builtin-types.h"
|
||||||
|
|
||||||
typedef struct UserDefOne UserDefOne;
|
typedef struct UserDefOne UserDefOne;
|
||||||
|
|
||||||
@ -1062,7 +1062,7 @@ Example:
|
|||||||
UserDefOneList *arg1;
|
UserDefOneList *arg1;
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif
|
#endif /* EXAMPLE_QAPI_TYPES_H */
|
||||||
$ cat qapi-generated/example-qapi-types.c
|
$ cat qapi-generated/example-qapi-types.c
|
||||||
[Uninteresting stuff omitted...]
|
[Uninteresting stuff omitted...]
|
||||||
|
|
||||||
@ -1092,6 +1092,8 @@ Example:
|
|||||||
visit_free(v);
|
visit_free(v);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
[Uninteresting stuff omitted...]
|
||||||
|
|
||||||
=== Code generated for visiting QAPI types ===
|
=== Code generated for visiting QAPI types ===
|
||||||
|
|
||||||
These are the visitor functions used to walk through and convert
|
These are the visitor functions used to walk through and convert
|
||||||
@ -1118,7 +1120,9 @@ Example:
|
|||||||
#ifndef EXAMPLE_QAPI_VISIT_H
|
#ifndef EXAMPLE_QAPI_VISIT_H
|
||||||
#define EXAMPLE_QAPI_VISIT_H
|
#define EXAMPLE_QAPI_VISIT_H
|
||||||
|
|
||||||
[Visitors for built-in types omitted...]
|
#include "qapi/qapi-builtin-visit.h"
|
||||||
|
#include "example-qapi-types.h"
|
||||||
|
|
||||||
|
|
||||||
void visit_type_UserDefOne_members(Visitor *v, UserDefOne *obj, Error **errp);
|
void visit_type_UserDefOne_members(Visitor *v, UserDefOne *obj, Error **errp);
|
||||||
void visit_type_UserDefOne(Visitor *v, const char *name, UserDefOne **obj, Error **errp);
|
void visit_type_UserDefOne(Visitor *v, const char *name, UserDefOne **obj, Error **errp);
|
||||||
@ -1126,7 +1130,7 @@ Example:
|
|||||||
|
|
||||||
void visit_type_q_obj_my_command_arg_members(Visitor *v, q_obj_my_command_arg *obj, Error **errp);
|
void visit_type_q_obj_my_command_arg_members(Visitor *v, q_obj_my_command_arg *obj, Error **errp);
|
||||||
|
|
||||||
#endif
|
#endif /* EXAMPLE_QAPI_VISIT_H */
|
||||||
$ cat qapi-generated/example-qapi-visit.c
|
$ cat qapi-generated/example-qapi-visit.c
|
||||||
[Uninteresting stuff omitted...]
|
[Uninteresting stuff omitted...]
|
||||||
|
|
||||||
@ -1219,6 +1223,8 @@ Example:
|
|||||||
error_propagate(errp, err);
|
error_propagate(errp, err);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
[Uninteresting stuff omitted...]
|
||||||
|
|
||||||
=== Code generated for commands ===
|
=== Code generated for commands ===
|
||||||
|
|
||||||
These are the marshaling/dispatch functions for the commands defined
|
These are the marshaling/dispatch functions for the commands defined
|
||||||
@ -1238,18 +1244,17 @@ Example:
|
|||||||
$ cat qapi-generated/example-qapi-commands.h
|
$ cat qapi-generated/example-qapi-commands.h
|
||||||
[Uninteresting stuff omitted...]
|
[Uninteresting stuff omitted...]
|
||||||
|
|
||||||
#ifndef EXAMPLE_QMP_COMMANDS_H
|
#ifndef EXAMPLE_QAPI_COMMANDS_H
|
||||||
#define EXAMPLE_QMP_COMMANDS_H
|
#define EXAMPLE_QAPI_COMMANDS_H
|
||||||
|
|
||||||
#include "example-qapi-types.h"
|
#include "example-qapi-types.h"
|
||||||
#include "qapi/qmp/qdict.h"
|
|
||||||
#include "qapi/qmp/dispatch.h"
|
#include "qapi/qmp/dispatch.h"
|
||||||
|
|
||||||
void example_qmp_init_marshal(QmpCommandList *cmds);
|
|
||||||
UserDefOne *qmp_my_command(UserDefOneList *arg1, Error **errp);
|
UserDefOne *qmp_my_command(UserDefOneList *arg1, Error **errp);
|
||||||
void qmp_marshal_my_command(QDict *args, QObject **ret, Error **errp);
|
void qmp_marshal_my_command(QDict *args, QObject **ret, Error **errp);
|
||||||
|
void example_qmp_init_marshal(QmpCommandList *cmds);
|
||||||
|
|
||||||
#endif
|
#endif /* EXAMPLE_QAPI_COMMANDS_H */
|
||||||
$ cat qapi-generated/example-qapi-commands.c
|
$ cat qapi-generated/example-qapi-commands.c
|
||||||
[Uninteresting stuff omitted...]
|
[Uninteresting stuff omitted...]
|
||||||
|
|
||||||
@ -1316,6 +1321,8 @@ Example:
|
|||||||
qmp_marshal_my_command, QCO_NO_OPTIONS);
|
qmp_marshal_my_command, QCO_NO_OPTIONS);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
[Uninteresting stuff omitted...]
|
||||||
|
|
||||||
=== Code generated for events ===
|
=== Code generated for events ===
|
||||||
|
|
||||||
This is the code related to events defined in the schema, providing
|
This is the code related to events defined in the schema, providing
|
||||||
@ -1333,14 +1340,14 @@ Example:
|
|||||||
$ cat qapi-generated/example-qapi-events.h
|
$ cat qapi-generated/example-qapi-events.h
|
||||||
[Uninteresting stuff omitted...]
|
[Uninteresting stuff omitted...]
|
||||||
|
|
||||||
#ifndef EXAMPLE_QAPI_EVENT_H
|
#ifndef EXAMPLE_QAPI_EVENTS_H
|
||||||
#define EXAMPLE_QAPI_EVENT_H
|
#define EXAMPLE_QAPI_EVENTS_H
|
||||||
|
|
||||||
#include "qapi/qmp/qdict.h"
|
#include "qapi/util.h"
|
||||||
#include "example-qapi-types.h"
|
#include "example-qapi-types.h"
|
||||||
|
|
||||||
|
|
||||||
void qapi_event_send_my_event(Error **errp);
|
void qapi_event_send_my_event(void);
|
||||||
|
|
||||||
typedef enum example_QAPIEvent {
|
typedef enum example_QAPIEvent {
|
||||||
EXAMPLE_QAPI_EVENT_MY_EVENT = 0,
|
EXAMPLE_QAPI_EVENT_MY_EVENT = 0,
|
||||||
@ -1348,18 +1355,17 @@ Example:
|
|||||||
} example_QAPIEvent;
|
} example_QAPIEvent;
|
||||||
|
|
||||||
#define example_QAPIEvent_str(val) \
|
#define example_QAPIEvent_str(val) \
|
||||||
qapi_enum_lookup(example_QAPIEvent_lookup, (val))
|
qapi_enum_lookup(&example_QAPIEvent_lookup, (val))
|
||||||
|
|
||||||
extern const char *const example_QAPIEvent_lookup[];
|
extern const QEnumLookup example_QAPIEvent_lookup;
|
||||||
|
|
||||||
#endif
|
#endif /* EXAMPLE_QAPI_EVENTS_H */
|
||||||
$ cat qapi-generated/example-qapi-events.c
|
$ cat qapi-generated/example-qapi-events.c
|
||||||
[Uninteresting stuff omitted...]
|
[Uninteresting stuff omitted...]
|
||||||
|
|
||||||
void qapi_event_send_my_event(Error **errp)
|
void qapi_event_send_my_event(void)
|
||||||
{
|
{
|
||||||
QDict *qmp;
|
QDict *qmp;
|
||||||
Error *err = NULL;
|
|
||||||
QMPEventFuncEmit emit;
|
QMPEventFuncEmit emit;
|
||||||
|
|
||||||
emit = qmp_event_get_func_emit();
|
emit = qmp_event_get_func_emit();
|
||||||
@ -1369,9 +1375,8 @@ Example:
|
|||||||
|
|
||||||
qmp = qmp_event_build_dict("MY_EVENT");
|
qmp = qmp_event_build_dict("MY_EVENT");
|
||||||
|
|
||||||
emit(EXAMPLE_QAPI_EVENT_MY_EVENT, qmp, &err);
|
emit(EXAMPLE_QAPI_EVENT_MY_EVENT, qmp);
|
||||||
|
|
||||||
error_propagate(errp, err);
|
|
||||||
qobject_unref(qmp);
|
qobject_unref(qmp);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1382,6 +1387,8 @@ Example:
|
|||||||
.size = EXAMPLE_QAPI_EVENT__MAX
|
.size = EXAMPLE_QAPI_EVENT__MAX
|
||||||
};
|
};
|
||||||
|
|
||||||
|
[Uninteresting stuff omitted...]
|
||||||
|
|
||||||
=== Code generated for introspection ===
|
=== Code generated for introspection ===
|
||||||
|
|
||||||
The following files are created:
|
The following files are created:
|
||||||
@ -1396,30 +1403,93 @@ Example:
|
|||||||
$ cat qapi-generated/example-qapi-introspect.h
|
$ cat qapi-generated/example-qapi-introspect.h
|
||||||
[Uninteresting stuff omitted...]
|
[Uninteresting stuff omitted...]
|
||||||
|
|
||||||
#ifndef EXAMPLE_QMP_INTROSPECT_H
|
#ifndef EXAMPLE_QAPI_INTROSPECT_H
|
||||||
#define EXAMPLE_QMP_INTROSPECT_H
|
#define EXAMPLE_QAPI_INTROSPECT_H
|
||||||
|
|
||||||
extern const QLitObject qmp_schema_qlit;
|
#include "qapi/qmp/qlit.h"
|
||||||
|
|
||||||
#endif
|
extern const QLitObject example_qmp_schema_qlit;
|
||||||
|
|
||||||
|
#endif /* EXAMPLE_QAPI_INTROSPECT_H */
|
||||||
$ cat qapi-generated/example-qapi-introspect.c
|
$ cat qapi-generated/example-qapi-introspect.c
|
||||||
[Uninteresting stuff omitted...]
|
[Uninteresting stuff omitted...]
|
||||||
|
|
||||||
const QLitObject example_qmp_schema_qlit = QLIT_QLIST(((QLitObject[]) {
|
const QLitObject example_qmp_schema_qlit = QLIT_QLIST(((QLitObject[]) {
|
||||||
QLIT_QDICT(((QLitDictEntry[]) {
|
QLIT_QDICT(((QLitDictEntry[]) {
|
||||||
{ "arg-type", QLIT_QSTR("0") },
|
{ "arg-type", QLIT_QSTR("0"), },
|
||||||
{ "meta-type", QLIT_QSTR("event") },
|
{ "meta-type", QLIT_QSTR("command"), },
|
||||||
{ "name", QLIT_QSTR("Event") },
|
{ "name", QLIT_QSTR("my-command"), },
|
||||||
{ }
|
{ "ret-type", QLIT_QSTR("1"), },
|
||||||
|
{}
|
||||||
})),
|
})),
|
||||||
QLIT_QDICT(((QLitDictEntry[]) {
|
QLIT_QDICT(((QLitDictEntry[]) {
|
||||||
{ "members", QLIT_QLIST(((QLitObject[]) {
|
{ "arg-type", QLIT_QSTR("2"), },
|
||||||
{ }
|
{ "meta-type", QLIT_QSTR("event"), },
|
||||||
})) },
|
{ "name", QLIT_QSTR("MY_EVENT"), },
|
||||||
{ "meta-type", QLIT_QSTR("object") },
|
{}
|
||||||
{ "name", QLIT_QSTR("0") },
|
|
||||||
{ }
|
|
||||||
})),
|
})),
|
||||||
...
|
/* "0" = q_obj_my-command-arg */
|
||||||
{ }
|
QLIT_QDICT(((QLitDictEntry[]) {
|
||||||
|
{ "members", QLIT_QLIST(((QLitObject[]) {
|
||||||
|
QLIT_QDICT(((QLitDictEntry[]) {
|
||||||
|
{ "name", QLIT_QSTR("arg1"), },
|
||||||
|
{ "type", QLIT_QSTR("[1]"), },
|
||||||
|
{}
|
||||||
|
})),
|
||||||
|
{}
|
||||||
|
})), },
|
||||||
|
{ "meta-type", QLIT_QSTR("object"), },
|
||||||
|
{ "name", QLIT_QSTR("0"), },
|
||||||
|
{}
|
||||||
|
})),
|
||||||
|
/* "1" = UserDefOne */
|
||||||
|
QLIT_QDICT(((QLitDictEntry[]) {
|
||||||
|
{ "members", QLIT_QLIST(((QLitObject[]) {
|
||||||
|
QLIT_QDICT(((QLitDictEntry[]) {
|
||||||
|
{ "name", QLIT_QSTR("integer"), },
|
||||||
|
{ "type", QLIT_QSTR("int"), },
|
||||||
|
{}
|
||||||
|
})),
|
||||||
|
QLIT_QDICT(((QLitDictEntry[]) {
|
||||||
|
{ "default", QLIT_QNULL, },
|
||||||
|
{ "name", QLIT_QSTR("string"), },
|
||||||
|
{ "type", QLIT_QSTR("str"), },
|
||||||
|
{}
|
||||||
|
})),
|
||||||
|
{}
|
||||||
|
})), },
|
||||||
|
{ "meta-type", QLIT_QSTR("object"), },
|
||||||
|
{ "name", QLIT_QSTR("1"), },
|
||||||
|
{}
|
||||||
|
})),
|
||||||
|
/* "2" = q_empty */
|
||||||
|
QLIT_QDICT(((QLitDictEntry[]) {
|
||||||
|
{ "members", QLIT_QLIST(((QLitObject[]) {
|
||||||
|
{}
|
||||||
|
})), },
|
||||||
|
{ "meta-type", QLIT_QSTR("object"), },
|
||||||
|
{ "name", QLIT_QSTR("2"), },
|
||||||
|
{}
|
||||||
|
})),
|
||||||
|
QLIT_QDICT(((QLitDictEntry[]) {
|
||||||
|
{ "element-type", QLIT_QSTR("1"), },
|
||||||
|
{ "meta-type", QLIT_QSTR("array"), },
|
||||||
|
{ "name", QLIT_QSTR("[1]"), },
|
||||||
|
{}
|
||||||
|
})),
|
||||||
|
QLIT_QDICT(((QLitDictEntry[]) {
|
||||||
|
{ "json-type", QLIT_QSTR("int"), },
|
||||||
|
{ "meta-type", QLIT_QSTR("builtin"), },
|
||||||
|
{ "name", QLIT_QSTR("int"), },
|
||||||
|
{}
|
||||||
|
})),
|
||||||
|
QLIT_QDICT(((QLitDictEntry[]) {
|
||||||
|
{ "json-type", QLIT_QSTR("string"), },
|
||||||
|
{ "meta-type", QLIT_QSTR("builtin"), },
|
||||||
|
{ "name", QLIT_QSTR("str"), },
|
||||||
|
{}
|
||||||
|
})),
|
||||||
|
{}
|
||||||
}));
|
}));
|
||||||
|
|
||||||
|
[Uninteresting stuff omitted...]
|
||||||
|
3
dump.c
3
dump.c
@ -1890,8 +1890,7 @@ static void dump_process(DumpState *s, Error **errp)
|
|||||||
/* should never fail */
|
/* should never fail */
|
||||||
assert(result);
|
assert(result);
|
||||||
qapi_event_send_dump_completed(result, !!local_err, (local_err ? \
|
qapi_event_send_dump_completed(result, !!local_err, (local_err ? \
|
||||||
error_get_pretty(local_err) : NULL),
|
error_get_pretty(local_err) : NULL));
|
||||||
&error_abort);
|
|
||||||
qapi_free_DumpQueryResult(result);
|
qapi_free_DumpQueryResult(result);
|
||||||
|
|
||||||
error_propagate(errp, local_err);
|
error_propagate(errp, local_err);
|
||||||
|
@ -570,7 +570,7 @@ static void acpi_pm1_cnt_write(ACPIREGS *ar, uint16_t val)
|
|||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
if (sus_typ == ar->pm1.cnt.s4_val) { /* S4 request */
|
if (sus_typ == ar->pm1.cnt.s4_val) { /* S4 request */
|
||||||
qapi_event_send_suspend_disk(&error_abort);
|
qapi_event_send_suspend_disk();
|
||||||
qemu_system_shutdown_request(SHUTDOWN_CAUSE_GUEST_SHUTDOWN);
|
qemu_system_shutdown_request(SHUTDOWN_CAUSE_GUEST_SHUTDOWN);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
@ -160,7 +160,7 @@ static void cpu_hotplug_wr(void *opaque, hwaddr addr, uint64_t data,
|
|||||||
cdev = &cpu_st->devs[cpu_st->selector];
|
cdev = &cpu_st->devs[cpu_st->selector];
|
||||||
cdev->ost_status = data;
|
cdev->ost_status = data;
|
||||||
info = acpi_cpu_device_status(cpu_st->selector, cdev);
|
info = acpi_cpu_device_status(cpu_st->selector, cdev);
|
||||||
qapi_event_send_acpi_device_ost(info, &error_abort);
|
qapi_event_send_acpi_device_ost(info);
|
||||||
qapi_free_ACPIOSTInfo(info);
|
qapi_free_ACPIOSTInfo(info);
|
||||||
trace_cpuhp_acpi_write_ost_status(cpu_st->selector,
|
trace_cpuhp_acpi_write_ost_status(cpu_st->selector,
|
||||||
cdev->ost_status);
|
cdev->ost_status);
|
||||||
|
@ -161,7 +161,7 @@ static void acpi_memory_hotplug_write(void *opaque, hwaddr addr, uint64_t data,
|
|||||||
/* TODO: implement memory removal on guest signal */
|
/* TODO: implement memory removal on guest signal */
|
||||||
|
|
||||||
info = acpi_memory_device_status(mem_st->selector, mdev);
|
info = acpi_memory_device_status(mem_st->selector, mdev);
|
||||||
qapi_event_send_acpi_device_ost(info, &error_abort);
|
qapi_event_send_acpi_device_ost(info);
|
||||||
qapi_free_ACPIOSTInfo(info);
|
qapi_free_ACPIOSTInfo(info);
|
||||||
break;
|
break;
|
||||||
case 0x14: /* set is_* fields */
|
case 0x14: /* set is_* fields */
|
||||||
@ -185,8 +185,7 @@ static void acpi_memory_hotplug_write(void *opaque, hwaddr addr, uint64_t data,
|
|||||||
if (local_err) {
|
if (local_err) {
|
||||||
trace_mhp_acpi_pc_dimm_delete_failed(mem_st->selector);
|
trace_mhp_acpi_pc_dimm_delete_failed(mem_st->selector);
|
||||||
qapi_event_send_mem_unplug_error(dev->id,
|
qapi_event_send_mem_unplug_error(dev->id,
|
||||||
error_get_pretty(local_err),
|
error_get_pretty(local_err));
|
||||||
&error_abort);
|
|
||||||
error_free(local_err);
|
error_free(local_err);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -114,8 +114,7 @@ static void set_guest_connected(VirtIOSerialPort *port, int guest_connected)
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (dev->id) {
|
if (dev->id) {
|
||||||
qapi_event_send_vserport_change(dev->id, guest_connected,
|
qapi_event_send_vserport_change(dev->id, guest_connected);
|
||||||
&error_abort);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1000,8 +1000,7 @@ static void device_finalize(Object *obj)
|
|||||||
if (dev->pending_deleted_event) {
|
if (dev->pending_deleted_event) {
|
||||||
g_assert(dev->canonical_path);
|
g_assert(dev->canonical_path);
|
||||||
|
|
||||||
qapi_event_send_device_deleted(!!dev->id, dev->id, dev->canonical_path,
|
qapi_event_send_device_deleted(!!dev->id, dev->id, dev->canonical_path);
|
||||||
&error_abort);
|
|
||||||
g_free(dev->canonical_path);
|
g_free(dev->canonical_path);
|
||||||
dev->canonical_path = NULL;
|
dev->canonical_path = NULL;
|
||||||
}
|
}
|
||||||
|
@ -329,7 +329,7 @@ static void rxfilter_notify(NetClientState *nc)
|
|||||||
if (nc->rxfilter_notify_enabled) {
|
if (nc->rxfilter_notify_enabled) {
|
||||||
gchar *path = object_get_canonical_path(OBJECT(n->qdev));
|
gchar *path = object_get_canonical_path(OBJECT(n->qdev));
|
||||||
qapi_event_send_nic_rx_filter_changed(!!n->netclient_name,
|
qapi_event_send_nic_rx_filter_changed(!!n->netclient_name,
|
||||||
n->netclient_name, path, &error_abort);
|
n->netclient_name, path);
|
||||||
g_free(path);
|
g_free(path);
|
||||||
|
|
||||||
/* disable event notification to avoid events flooding */
|
/* disable event notification to avoid events flooding */
|
||||||
|
@ -118,7 +118,7 @@ static void rtas_set_time_of_day(PowerPCCPU *cpu, sPAPRMachineState *spapr,
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* Generate a monitor event for the change */
|
/* Generate a monitor event for the change */
|
||||||
qapi_event_send_rtc_change(qemu_timedate_diff(&tm), &error_abort);
|
qapi_event_send_rtc_change(qemu_timedate_diff(&tm));
|
||||||
|
|
||||||
host_ns = qemu_clock_get_ns(rtc_clock);
|
host_ns = qemu_clock_get_ns(rtc_clock);
|
||||||
|
|
||||||
|
@ -635,7 +635,7 @@ static void rtc_set_time(RTCState *s)
|
|||||||
s->base_rtc = mktimegm(&tm);
|
s->base_rtc = mktimegm(&tm);
|
||||||
s->last_update = qemu_clock_get_ns(rtc_clock);
|
s->last_update = qemu_clock_get_ns(rtc_clock);
|
||||||
|
|
||||||
qapi_event_send_rtc_change(qemu_timedate_diff(&tm), &error_abort);
|
qapi_event_send_rtc_change(qemu_timedate_diff(&tm));
|
||||||
}
|
}
|
||||||
|
|
||||||
static void rtc_set_cmos(RTCState *s, const struct tm *tm)
|
static void rtc_set_cmos(RTCState *s, const struct tm *tm)
|
||||||
|
@ -365,8 +365,7 @@ static void virtio_balloon_set_config(VirtIODevice *vdev,
|
|||||||
dev->actual = le32_to_cpu(config.actual);
|
dev->actual = le32_to_cpu(config.actual);
|
||||||
if (dev->actual != oldactual) {
|
if (dev->actual != oldactual) {
|
||||||
qapi_event_send_balloon_change(vm_ram_size -
|
qapi_event_send_balloon_change(vm_ram_size -
|
||||||
((ram_addr_t) dev->actual << VIRTIO_BALLOON_PFN_SHIFT),
|
((ram_addr_t) dev->actual << VIRTIO_BALLOON_PFN_SHIFT));
|
||||||
&error_abort);
|
|
||||||
}
|
}
|
||||||
trace_virtio_balloon_set_config(dev->actual, oldactual);
|
trace_virtio_balloon_set_config(dev->actual, oldactual);
|
||||||
}
|
}
|
||||||
|
@ -102,17 +102,17 @@ void watchdog_perform_action(void)
|
|||||||
{
|
{
|
||||||
switch (watchdog_action) {
|
switch (watchdog_action) {
|
||||||
case WATCHDOG_ACTION_RESET: /* same as 'system_reset' in monitor */
|
case WATCHDOG_ACTION_RESET: /* same as 'system_reset' in monitor */
|
||||||
qapi_event_send_watchdog(WATCHDOG_ACTION_RESET, &error_abort);
|
qapi_event_send_watchdog(WATCHDOG_ACTION_RESET);
|
||||||
qemu_system_reset_request(SHUTDOWN_CAUSE_GUEST_RESET);
|
qemu_system_reset_request(SHUTDOWN_CAUSE_GUEST_RESET);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case WATCHDOG_ACTION_SHUTDOWN: /* same as 'system_powerdown' in monitor */
|
case WATCHDOG_ACTION_SHUTDOWN: /* same as 'system_powerdown' in monitor */
|
||||||
qapi_event_send_watchdog(WATCHDOG_ACTION_SHUTDOWN, &error_abort);
|
qapi_event_send_watchdog(WATCHDOG_ACTION_SHUTDOWN);
|
||||||
qemu_system_powerdown_request();
|
qemu_system_powerdown_request();
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case WATCHDOG_ACTION_POWEROFF: /* same as 'quit' command in monitor */
|
case WATCHDOG_ACTION_POWEROFF: /* same as 'quit' command in monitor */
|
||||||
qapi_event_send_watchdog(WATCHDOG_ACTION_POWEROFF, &error_abort);
|
qapi_event_send_watchdog(WATCHDOG_ACTION_POWEROFF);
|
||||||
exit(0);
|
exit(0);
|
||||||
|
|
||||||
case WATCHDOG_ACTION_PAUSE: /* same as 'stop' command in monitor */
|
case WATCHDOG_ACTION_PAUSE: /* same as 'stop' command in monitor */
|
||||||
@ -120,22 +120,21 @@ void watchdog_perform_action(void)
|
|||||||
* you would get a deadlock. Bypass the problem.
|
* you would get a deadlock. Bypass the problem.
|
||||||
*/
|
*/
|
||||||
qemu_system_vmstop_request_prepare();
|
qemu_system_vmstop_request_prepare();
|
||||||
qapi_event_send_watchdog(WATCHDOG_ACTION_PAUSE, &error_abort);
|
qapi_event_send_watchdog(WATCHDOG_ACTION_PAUSE);
|
||||||
qemu_system_vmstop_request(RUN_STATE_WATCHDOG);
|
qemu_system_vmstop_request(RUN_STATE_WATCHDOG);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case WATCHDOG_ACTION_DEBUG:
|
case WATCHDOG_ACTION_DEBUG:
|
||||||
qapi_event_send_watchdog(WATCHDOG_ACTION_DEBUG, &error_abort);
|
qapi_event_send_watchdog(WATCHDOG_ACTION_DEBUG);
|
||||||
fprintf(stderr, "watchdog: timer fired\n");
|
fprintf(stderr, "watchdog: timer fired\n");
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case WATCHDOG_ACTION_NONE:
|
case WATCHDOG_ACTION_NONE:
|
||||||
qapi_event_send_watchdog(WATCHDOG_ACTION_NONE, &error_abort);
|
qapi_event_send_watchdog(WATCHDOG_ACTION_NONE);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case WATCHDOG_ACTION_INJECT_NMI:
|
case WATCHDOG_ACTION_INJECT_NMI:
|
||||||
qapi_event_send_watchdog(WATCHDOG_ACTION_INJECT_NMI,
|
qapi_event_send_watchdog(WATCHDOG_ACTION_INJECT_NMI);
|
||||||
&error_abort);
|
|
||||||
nmi_monitor_handle(0, NULL);
|
nmi_monitor_handle(0, NULL);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
@ -14,8 +14,7 @@
|
|||||||
#ifndef QMP_EVENT_H
|
#ifndef QMP_EVENT_H
|
||||||
#define QMP_EVENT_H
|
#define QMP_EVENT_H
|
||||||
|
|
||||||
|
typedef void (*QMPEventFuncEmit)(unsigned event, QDict *dict);
|
||||||
typedef void (*QMPEventFuncEmit)(unsigned event, QDict *dict, Error **errp);
|
|
||||||
|
|
||||||
void qmp_event_set_func_emit(QMPEventFuncEmit emit);
|
void qmp_event_set_func_emit(QMPEventFuncEmit emit);
|
||||||
|
|
||||||
|
2
job.c
2
job.c
@ -174,7 +174,7 @@ static void job_state_transition(Job *job, JobStatus s1)
|
|||||||
job->status = s1;
|
job->status = s1;
|
||||||
|
|
||||||
if (!job_is_internal(job) && s1 != s0) {
|
if (!job_is_internal(job) && s1 != s0) {
|
||||||
qapi_event_send_job_status_change(job->id, job->status, &error_abort);
|
qapi_event_send_job_status_change(job->id, job->status);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -204,7 +204,7 @@ void migration_incoming_state_destroy(void)
|
|||||||
static void migrate_generate_event(int new_state)
|
static void migrate_generate_event(int new_state)
|
||||||
{
|
{
|
||||||
if (migrate_use_events()) {
|
if (migrate_use_events()) {
|
||||||
qapi_event_send_migration(new_state, &error_abort);
|
qapi_event_send_migration(new_state);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -302,7 +302,7 @@ void qemu_start_incoming_migration(const char *uri, Error **errp)
|
|||||||
{
|
{
|
||||||
const char *p;
|
const char *p;
|
||||||
|
|
||||||
qapi_event_send_migration(MIGRATION_STATUS_SETUP, &error_abort);
|
qapi_event_send_migration(MIGRATION_STATUS_SETUP);
|
||||||
if (!strcmp(uri, "defer")) {
|
if (!strcmp(uri, "defer")) {
|
||||||
deferred_incoming_migration(errp);
|
deferred_incoming_migration(errp);
|
||||||
} else if (strstart(uri, "tcp:", &p)) {
|
} else if (strstart(uri, "tcp:", &p)) {
|
||||||
|
@ -1670,7 +1670,7 @@ static void migration_bitmap_sync(RAMState *rs)
|
|||||||
rs->bytes_xfer_prev = bytes_xfer_now;
|
rs->bytes_xfer_prev = bytes_xfer_now;
|
||||||
}
|
}
|
||||||
if (migrate_use_events()) {
|
if (migrate_use_events()) {
|
||||||
qapi_event_send_migration_pass(ram_counters.dirty_sync_count, NULL);
|
qapi_event_send_migration_pass(ram_counters.dirty_sync_count);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -688,7 +688,7 @@ monitor_qapi_event_queue_no_reenter(QAPIEvent event, QDict *qdict)
|
|||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
monitor_qapi_event_queue(QAPIEvent event, QDict *qdict, Error **errp)
|
monitor_qapi_event_queue(QAPIEvent event, QDict *qdict)
|
||||||
{
|
{
|
||||||
/*
|
/*
|
||||||
* monitor_qapi_event_queue_no_reenter() is not reentrant: it
|
* monitor_qapi_event_queue_no_reenter() is not reentrant: it
|
||||||
@ -4316,8 +4316,7 @@ static void handle_qmp_command(void *opaque, QObject *req, Error *err)
|
|||||||
* that command was dropped.
|
* that command was dropped.
|
||||||
*/
|
*/
|
||||||
qapi_event_send_command_dropped(id,
|
qapi_event_send_command_dropped(id,
|
||||||
COMMAND_DROP_REASON_QUEUE_FULL,
|
COMMAND_DROP_REASON_QUEUE_FULL);
|
||||||
&error_abort);
|
|
||||||
qmp_request_free(req_obj);
|
qmp_request_free(req_obj);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -2070,16 +2070,14 @@ extern const QEnumLookup %(c_name)s_lookup;
|
|||||||
return ret
|
return ret
|
||||||
|
|
||||||
|
|
||||||
def build_params(arg_type, boxed, extra):
|
def build_params(arg_type, boxed, extra=None):
|
||||||
if not arg_type:
|
|
||||||
assert not boxed
|
|
||||||
return extra
|
|
||||||
ret = ''
|
ret = ''
|
||||||
sep = ''
|
sep = ''
|
||||||
if boxed:
|
if boxed:
|
||||||
|
assert arg_type
|
||||||
ret += '%s arg' % arg_type.c_param_type()
|
ret += '%s arg' % arg_type.c_param_type()
|
||||||
sep = ', '
|
sep = ', '
|
||||||
else:
|
elif arg_type:
|
||||||
assert not arg_type.variants
|
assert not arg_type.variants
|
||||||
for memb in arg_type.members:
|
for memb in arg_type.members:
|
||||||
ret += sep
|
ret += sep
|
||||||
@ -2090,7 +2088,7 @@ def build_params(arg_type, boxed, extra):
|
|||||||
c_name(memb.name))
|
c_name(memb.name))
|
||||||
if extra:
|
if extra:
|
||||||
ret += sep + extra
|
ret += sep + extra
|
||||||
return ret
|
return ret if ret else 'void'
|
||||||
|
|
||||||
|
|
||||||
#
|
#
|
||||||
@ -2220,6 +2218,7 @@ class QAPIGenC(QAPIGenCCode):
|
|||||||
|
|
||||||
def _bottom(self, fname):
|
def _bottom(self, fname):
|
||||||
return mcgen('''
|
return mcgen('''
|
||||||
|
|
||||||
/* Dummy declaration to prevent empty .o file */
|
/* Dummy declaration to prevent empty .o file */
|
||||||
char dummy_%(name)s;
|
char dummy_%(name)s;
|
||||||
''',
|
''',
|
||||||
|
@ -18,7 +18,7 @@ from qapi.common import *
|
|||||||
def build_event_send_proto(name, arg_type, boxed):
|
def build_event_send_proto(name, arg_type, boxed):
|
||||||
return 'void qapi_event_send_%(c_name)s(%(param)s)' % {
|
return 'void qapi_event_send_%(c_name)s(%(param)s)' % {
|
||||||
'c_name': c_name(name.lower()),
|
'c_name': c_name(name.lower()),
|
||||||
'param': build_params(arg_type, boxed, 'Error **errp')}
|
'param': build_params(arg_type, boxed)}
|
||||||
|
|
||||||
|
|
||||||
def gen_event_send_decl(name, arg_type, boxed):
|
def gen_event_send_decl(name, arg_type, boxed):
|
||||||
@ -70,7 +70,6 @@ def gen_event_send(name, arg_type, boxed, event_enum_name):
|
|||||||
%(proto)s
|
%(proto)s
|
||||||
{
|
{
|
||||||
QDict *qmp;
|
QDict *qmp;
|
||||||
Error *err = NULL;
|
|
||||||
QMPEventFuncEmit emit;
|
QMPEventFuncEmit emit;
|
||||||
''',
|
''',
|
||||||
proto=build_event_send_proto(name, arg_type, boxed))
|
proto=build_event_send_proto(name, arg_type, boxed))
|
||||||
@ -103,45 +102,35 @@ def gen_event_send(name, arg_type, boxed, event_enum_name):
|
|||||||
''')
|
''')
|
||||||
if not arg_type.is_implicit():
|
if not arg_type.is_implicit():
|
||||||
ret += mcgen('''
|
ret += mcgen('''
|
||||||
visit_type_%(c_name)s(v, "%(name)s", &arg, &err);
|
visit_type_%(c_name)s(v, "%(name)s", &arg, &error_abort);
|
||||||
''',
|
''',
|
||||||
name=name, c_name=arg_type.c_name())
|
name=name, c_name=arg_type.c_name())
|
||||||
else:
|
else:
|
||||||
ret += mcgen('''
|
ret += mcgen('''
|
||||||
|
|
||||||
visit_start_struct(v, "%(name)s", NULL, 0, &err);
|
visit_start_struct(v, "%(name)s", NULL, 0, &error_abort);
|
||||||
if (err) {
|
visit_type_%(c_name)s_members(v, ¶m, &error_abort);
|
||||||
goto out;
|
visit_check_struct(v, &error_abort);
|
||||||
}
|
|
||||||
visit_type_%(c_name)s_members(v, ¶m, &err);
|
|
||||||
if (!err) {
|
|
||||||
visit_check_struct(v, &err);
|
|
||||||
}
|
|
||||||
visit_end_struct(v, NULL);
|
visit_end_struct(v, NULL);
|
||||||
''',
|
''',
|
||||||
name=name, c_name=arg_type.c_name())
|
name=name, c_name=arg_type.c_name())
|
||||||
ret += mcgen('''
|
ret += mcgen('''
|
||||||
if (err) {
|
|
||||||
goto out;
|
|
||||||
}
|
|
||||||
|
|
||||||
visit_complete(v, &obj);
|
visit_complete(v, &obj);
|
||||||
qdict_put_obj(qmp, "data", obj);
|
qdict_put_obj(qmp, "data", obj);
|
||||||
''')
|
''')
|
||||||
|
|
||||||
ret += mcgen('''
|
ret += mcgen('''
|
||||||
emit(%(c_enum)s, qmp, &err);
|
emit(%(c_enum)s, qmp);
|
||||||
|
|
||||||
''',
|
''',
|
||||||
c_enum=c_enum_const(event_enum_name, name))
|
c_enum=c_enum_const(event_enum_name, name))
|
||||||
|
|
||||||
if arg_type and not arg_type.is_empty():
|
if arg_type and not arg_type.is_empty():
|
||||||
ret += mcgen('''
|
ret += mcgen('''
|
||||||
out:
|
|
||||||
visit_free(v);
|
visit_free(v);
|
||||||
''')
|
''')
|
||||||
ret += mcgen('''
|
ret += mcgen('''
|
||||||
error_propagate(errp, err);
|
|
||||||
qobject_unref(qmp);
|
qobject_unref(qmp);
|
||||||
}
|
}
|
||||||
''')
|
''')
|
||||||
|
@ -19,12 +19,17 @@ def to_qlit(obj, level=0, suppress_first_indent=False):
|
|||||||
return level * 4 * ' '
|
return level * 4 * ' '
|
||||||
|
|
||||||
if isinstance(obj, tuple):
|
if isinstance(obj, tuple):
|
||||||
ifobj, ifcond = obj
|
ifobj, extra = obj
|
||||||
ret = gen_if(ifcond)
|
ifcond = extra.get('if')
|
||||||
|
comment = extra.get('comment')
|
||||||
|
ret = ''
|
||||||
|
if comment:
|
||||||
|
ret += indent(level) + '/* %s */\n' % comment
|
||||||
|
if ifcond:
|
||||||
|
ret += gen_if(ifcond)
|
||||||
ret += to_qlit(ifobj, level)
|
ret += to_qlit(ifobj, level)
|
||||||
endif = gen_endif(ifcond)
|
if ifcond:
|
||||||
if endif:
|
ret += '\n' + gen_endif(ifcond)
|
||||||
ret += '\n' + endif
|
|
||||||
return ret
|
return ret
|
||||||
|
|
||||||
ret = ''
|
ret = ''
|
||||||
@ -89,7 +94,6 @@ class QAPISchemaGenIntrospectVisitor(QAPISchemaMonolithicCVisitor):
|
|||||||
for typ in self._used_types:
|
for typ in self._used_types:
|
||||||
typ.visit(self)
|
typ.visit(self)
|
||||||
# generate C
|
# generate C
|
||||||
# TODO can generate awfully long lines
|
|
||||||
name = c_name(self._prefix, protect=False) + 'qmp_schema_qlit'
|
name = c_name(self._prefix, protect=False) + 'qmp_schema_qlit'
|
||||||
self._genh.add(mcgen('''
|
self._genh.add(mcgen('''
|
||||||
#include "qapi/qmp/qlit.h"
|
#include "qapi/qmp/qlit.h"
|
||||||
@ -129,8 +133,8 @@ const QLitObject %(c_name)s = %(c_string)s;
|
|||||||
if typ not in self._used_types:
|
if typ not in self._used_types:
|
||||||
self._used_types.append(typ)
|
self._used_types.append(typ)
|
||||||
# Clients should examine commands and events, not types. Hide
|
# Clients should examine commands and events, not types. Hide
|
||||||
# type names to reduce the temptation. Also saves a few
|
# type names as integers to reduce the temptation. Also, it
|
||||||
# characters.
|
# saves a few characters on the wire.
|
||||||
if isinstance(typ, QAPISchemaBuiltinType):
|
if isinstance(typ, QAPISchemaBuiltinType):
|
||||||
return typ.name
|
return typ.name
|
||||||
if isinstance(typ, QAPISchemaArrayType):
|
if isinstance(typ, QAPISchemaArrayType):
|
||||||
@ -138,11 +142,21 @@ const QLitObject %(c_name)s = %(c_string)s;
|
|||||||
return self._name(typ.name)
|
return self._name(typ.name)
|
||||||
|
|
||||||
def _gen_qlit(self, name, mtype, obj, ifcond):
|
def _gen_qlit(self, name, mtype, obj, ifcond):
|
||||||
|
extra = {}
|
||||||
if mtype not in ('command', 'event', 'builtin', 'array'):
|
if mtype not in ('command', 'event', 'builtin', 'array'):
|
||||||
|
if not self._unmask:
|
||||||
|
# Output a comment to make it easy to map masked names
|
||||||
|
# back to the source when reading the generated output.
|
||||||
|
extra['comment'] = '"%s" = %s' % (self._name(name), name)
|
||||||
name = self._name(name)
|
name = self._name(name)
|
||||||
obj['name'] = name
|
obj['name'] = name
|
||||||
obj['meta-type'] = mtype
|
obj['meta-type'] = mtype
|
||||||
self._qlits.append((obj, ifcond))
|
if ifcond:
|
||||||
|
extra['if'] = ifcond
|
||||||
|
if extra:
|
||||||
|
self._qlits.append((obj, extra))
|
||||||
|
else:
|
||||||
|
self._qlits.append(obj)
|
||||||
|
|
||||||
def _gen_member(self, member):
|
def _gen_member(self, member):
|
||||||
ret = {'name': member.name, 'type': self._use_type(member.type)}
|
ret = {'name': member.name, 'type': self._use_type(member.type)}
|
||||||
@ -185,7 +199,7 @@ const QLitObject %(c_name)s = %(c_string)s;
|
|||||||
arg_type = arg_type or self._schema.the_empty_object_type
|
arg_type = arg_type or self._schema.the_empty_object_type
|
||||||
ret_type = ret_type or self._schema.the_empty_object_type
|
ret_type = ret_type or self._schema.the_empty_object_type
|
||||||
obj = {'arg-type': self._use_type(arg_type),
|
obj = {'arg-type': self._use_type(arg_type),
|
||||||
'ret-type': self._use_type(ret_type) }
|
'ret-type': self._use_type(ret_type)}
|
||||||
if allow_oob:
|
if allow_oob:
|
||||||
obj['allow-oob'] = allow_oob
|
obj['allow-oob'] = allow_oob
|
||||||
self._gen_qlit(name, 'command', obj, ifcond)
|
self._gen_qlit(name, 'command', obj, ifcond)
|
||||||
|
@ -44,8 +44,7 @@ static void pr_manager_send_status_changed_event(PRManagerHelper *pr_mgr)
|
|||||||
char *id = object_get_canonical_path_component(OBJECT(pr_mgr));
|
char *id = object_get_canonical_path_component(OBJECT(pr_mgr));
|
||||||
|
|
||||||
if (id) {
|
if (id) {
|
||||||
qapi_event_send_pr_manager_status_changed(id, !!pr_mgr->ioc,
|
qapi_event_send_pr_manager_status_changed(id, !!pr_mgr->ioc);
|
||||||
&error_abort);
|
|
||||||
g_free(id);
|
g_free(id);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -95,7 +95,7 @@ static bool qdict_cmp_simple(QDict *a, QDict *b)
|
|||||||
|
|
||||||
/* This function is hooked as final emit function, which can verify the
|
/* This function is hooked as final emit function, which can verify the
|
||||||
correctness. */
|
correctness. */
|
||||||
static void event_test_emit(test_QAPIEvent event, QDict *d, Error **errp)
|
static void event_test_emit(test_QAPIEvent event, QDict *d)
|
||||||
{
|
{
|
||||||
QDict *t;
|
QDict *t;
|
||||||
int64_t s, ms;
|
int64_t s, ms;
|
||||||
@ -156,7 +156,7 @@ static void test_event_a(TestEventData *data,
|
|||||||
QDict *d;
|
QDict *d;
|
||||||
d = data->expect;
|
d = data->expect;
|
||||||
qdict_put_str(d, "event", "EVENT_A");
|
qdict_put_str(d, "event", "EVENT_A");
|
||||||
qapi_event_send_event_a(&error_abort);
|
qapi_event_send_event_a();
|
||||||
}
|
}
|
||||||
|
|
||||||
static void test_event_b(TestEventData *data,
|
static void test_event_b(TestEventData *data,
|
||||||
@ -165,7 +165,7 @@ static void test_event_b(TestEventData *data,
|
|||||||
QDict *d;
|
QDict *d;
|
||||||
d = data->expect;
|
d = data->expect;
|
||||||
qdict_put_str(d, "event", "EVENT_B");
|
qdict_put_str(d, "event", "EVENT_B");
|
||||||
qapi_event_send_event_b(&error_abort);
|
qapi_event_send_event_b();
|
||||||
}
|
}
|
||||||
|
|
||||||
static void test_event_c(TestEventData *data,
|
static void test_event_c(TestEventData *data,
|
||||||
@ -191,7 +191,7 @@ static void test_event_c(TestEventData *data,
|
|||||||
qdict_put_str(d, "event", "EVENT_C");
|
qdict_put_str(d, "event", "EVENT_C");
|
||||||
qdict_put(d, "data", d_data);
|
qdict_put(d, "data", d_data);
|
||||||
|
|
||||||
qapi_event_send_event_c(true, 1, true, &b, "test2", &error_abort);
|
qapi_event_send_event_c(true, 1, true, &b, "test2");
|
||||||
|
|
||||||
g_free(b.string);
|
g_free(b.string);
|
||||||
}
|
}
|
||||||
@ -233,8 +233,7 @@ static void test_event_d(TestEventData *data,
|
|||||||
qdict_put_str(d, "event", "EVENT_D");
|
qdict_put_str(d, "event", "EVENT_D");
|
||||||
qdict_put(d, "data", d_data);
|
qdict_put(d, "data", d_data);
|
||||||
|
|
||||||
qapi_event_send_event_d(&a, "test3", false, NULL, true, ENUM_ONE_VALUE3,
|
qapi_event_send_event_d(&a, "test3", false, NULL, true, ENUM_ONE_VALUE3);
|
||||||
&error_abort);
|
|
||||||
|
|
||||||
g_free(struct1.string);
|
g_free(struct1.string);
|
||||||
g_free(a.string);
|
g_free(a.string);
|
||||||
|
@ -218,8 +218,7 @@ static void channel_event(int event, SpiceChannelEventInfo *info)
|
|||||||
switch (event) {
|
switch (event) {
|
||||||
case SPICE_CHANNEL_EVENT_CONNECTED:
|
case SPICE_CHANNEL_EVENT_CONNECTED:
|
||||||
qapi_event_send_spice_connected(qapi_SpiceServerInfo_base(server),
|
qapi_event_send_spice_connected(qapi_SpiceServerInfo_base(server),
|
||||||
qapi_SpiceChannel_base(client),
|
qapi_SpiceChannel_base(client));
|
||||||
&error_abort);
|
|
||||||
break;
|
break;
|
||||||
case SPICE_CHANNEL_EVENT_INITIALIZED:
|
case SPICE_CHANNEL_EVENT_INITIALIZED:
|
||||||
if (auth) {
|
if (auth) {
|
||||||
@ -228,13 +227,12 @@ static void channel_event(int event, SpiceChannelEventInfo *info)
|
|||||||
}
|
}
|
||||||
add_channel_info(client, info);
|
add_channel_info(client, info);
|
||||||
channel_list_add(info);
|
channel_list_add(info);
|
||||||
qapi_event_send_spice_initialized(server, client, &error_abort);
|
qapi_event_send_spice_initialized(server, client);
|
||||||
break;
|
break;
|
||||||
case SPICE_CHANNEL_EVENT_DISCONNECTED:
|
case SPICE_CHANNEL_EVENT_DISCONNECTED:
|
||||||
channel_list_del(info);
|
channel_list_del(info);
|
||||||
qapi_event_send_spice_disconnected(qapi_SpiceServerInfo_base(server),
|
qapi_event_send_spice_disconnected(qapi_SpiceServerInfo_base(server),
|
||||||
qapi_SpiceChannel_base(client),
|
qapi_SpiceChannel_base(client));
|
||||||
&error_abort);
|
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
@ -287,7 +285,7 @@ static void migrate_connect_complete_cb(SpiceMigrateInstance *sin)
|
|||||||
|
|
||||||
static void migrate_end_complete_cb(SpiceMigrateInstance *sin)
|
static void migrate_end_complete_cb(SpiceMigrateInstance *sin)
|
||||||
{
|
{
|
||||||
qapi_event_send_spice_migrate_completed(&error_abort);
|
qapi_event_send_spice_migrate_completed();
|
||||||
spice_migration_completed = true;
|
spice_migration_completed = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
7
ui/vnc.c
7
ui/vnc.c
@ -296,14 +296,13 @@ static void vnc_qmp_event(VncState *vs, QAPIEvent event)
|
|||||||
|
|
||||||
switch (event) {
|
switch (event) {
|
||||||
case QAPI_EVENT_VNC_CONNECTED:
|
case QAPI_EVENT_VNC_CONNECTED:
|
||||||
qapi_event_send_vnc_connected(si, qapi_VncClientInfo_base(vs->info),
|
qapi_event_send_vnc_connected(si, qapi_VncClientInfo_base(vs->info));
|
||||||
&error_abort);
|
|
||||||
break;
|
break;
|
||||||
case QAPI_EVENT_VNC_INITIALIZED:
|
case QAPI_EVENT_VNC_INITIALIZED:
|
||||||
qapi_event_send_vnc_initialized(si, vs->info, &error_abort);
|
qapi_event_send_vnc_initialized(si, vs->info);
|
||||||
break;
|
break;
|
||||||
case QAPI_EVENT_VNC_DISCONNECTED:
|
case QAPI_EVENT_VNC_DISCONNECTED:
|
||||||
qapi_event_send_vnc_disconnected(si, vs->info, &error_abort);
|
qapi_event_send_vnc_disconnected(si, vs->info);
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
|
16
vl.c
16
vl.c
@ -1647,8 +1647,7 @@ void qemu_system_reset(ShutdownCause reason)
|
|||||||
qemu_devices_reset();
|
qemu_devices_reset();
|
||||||
}
|
}
|
||||||
if (reason != SHUTDOWN_CAUSE_SUBSYSTEM_RESET) {
|
if (reason != SHUTDOWN_CAUSE_SUBSYSTEM_RESET) {
|
||||||
qapi_event_send_reset(shutdown_caused_by_guest(reason),
|
qapi_event_send_reset(shutdown_caused_by_guest(reason));
|
||||||
&error_abort);
|
|
||||||
}
|
}
|
||||||
cpu_synchronize_all_post_reset();
|
cpu_synchronize_all_post_reset();
|
||||||
}
|
}
|
||||||
@ -1661,11 +1660,11 @@ void qemu_system_guest_panicked(GuestPanicInformation *info)
|
|||||||
current_cpu->crash_occurred = true;
|
current_cpu->crash_occurred = true;
|
||||||
}
|
}
|
||||||
qapi_event_send_guest_panicked(GUEST_PANIC_ACTION_PAUSE,
|
qapi_event_send_guest_panicked(GUEST_PANIC_ACTION_PAUSE,
|
||||||
!!info, info, &error_abort);
|
!!info, info);
|
||||||
vm_stop(RUN_STATE_GUEST_PANICKED);
|
vm_stop(RUN_STATE_GUEST_PANICKED);
|
||||||
if (!no_shutdown) {
|
if (!no_shutdown) {
|
||||||
qapi_event_send_guest_panicked(GUEST_PANIC_ACTION_POWEROFF,
|
qapi_event_send_guest_panicked(GUEST_PANIC_ACTION_POWEROFF,
|
||||||
!!info, info, &error_abort);
|
!!info, info);
|
||||||
qemu_system_shutdown_request(SHUTDOWN_CAUSE_GUEST_PANIC);
|
qemu_system_shutdown_request(SHUTDOWN_CAUSE_GUEST_PANIC);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1706,7 +1705,7 @@ static void qemu_system_suspend(void)
|
|||||||
pause_all_vcpus();
|
pause_all_vcpus();
|
||||||
notifier_list_notify(&suspend_notifiers, NULL);
|
notifier_list_notify(&suspend_notifiers, NULL);
|
||||||
runstate_set(RUN_STATE_SUSPENDED);
|
runstate_set(RUN_STATE_SUSPENDED);
|
||||||
qapi_event_send_suspend(&error_abort);
|
qapi_event_send_suspend();
|
||||||
}
|
}
|
||||||
|
|
||||||
void qemu_system_suspend_request(void)
|
void qemu_system_suspend_request(void)
|
||||||
@ -1776,7 +1775,7 @@ void qemu_system_shutdown_request(ShutdownCause reason)
|
|||||||
|
|
||||||
static void qemu_system_powerdown(void)
|
static void qemu_system_powerdown(void)
|
||||||
{
|
{
|
||||||
qapi_event_send_powerdown(&error_abort);
|
qapi_event_send_powerdown();
|
||||||
notifier_list_notify(&powerdown_notifiers, NULL);
|
notifier_list_notify(&powerdown_notifiers, NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1819,8 +1818,7 @@ static bool main_loop_should_exit(void)
|
|||||||
request = qemu_shutdown_requested();
|
request = qemu_shutdown_requested();
|
||||||
if (request) {
|
if (request) {
|
||||||
qemu_kill_report();
|
qemu_kill_report();
|
||||||
qapi_event_send_shutdown(shutdown_caused_by_guest(request),
|
qapi_event_send_shutdown(shutdown_caused_by_guest(request));
|
||||||
&error_abort);
|
|
||||||
if (no_shutdown) {
|
if (no_shutdown) {
|
||||||
vm_stop(RUN_STATE_SHUTDOWN);
|
vm_stop(RUN_STATE_SHUTDOWN);
|
||||||
} else {
|
} else {
|
||||||
@ -1843,7 +1841,7 @@ static bool main_loop_should_exit(void)
|
|||||||
notifier_list_notify(&wakeup_notifiers, &wakeup_reason);
|
notifier_list_notify(&wakeup_notifiers, &wakeup_reason);
|
||||||
wakeup_reason = QEMU_WAKEUP_REASON_NONE;
|
wakeup_reason = QEMU_WAKEUP_REASON_NONE;
|
||||||
resume_all_vcpus();
|
resume_all_vcpus();
|
||||||
qapi_event_send_wakeup(&error_abort);
|
qapi_event_send_wakeup();
|
||||||
}
|
}
|
||||||
if (qemu_powerdown_requested()) {
|
if (qemu_powerdown_requested()) {
|
||||||
qemu_system_powerdown();
|
qemu_system_powerdown();
|
||||||
|
Loading…
x
Reference in New Issue
Block a user