######################################################################
# qapi
-common-obj-y += qmp.o hmp.o
common-obj-y += qapi/
+common-obj-y += monitor/
endif
#######################################################################
2. Write the QMP command itself, which is a regular C function. Preferably,
the command should be exported by some QEMU subsystem. But it can also be
- added to the qmp.c file
+ added to the monitor/qmp-cmds.c file
3. At this point the command can be tested under the QMP protocol
The next step is to write the "hello-world" implementation. As explained
earlier, it's preferable for commands to live in QEMU subsystems. But
-"hello-world" doesn't pertain to any, so we put its implementation in qmp.c:
+"hello-world" doesn't pertain to any, so we put its implementation in
+monitor/qmp-cmds.c:
void qmp_hello_world(Error **errp)
{
stands for "string". The QAPI also supports integers, booleans, enumerations
and user defined types.
-Now, let's update our C implementation in qmp.c:
+Now, let's update our C implementation in monitor/qmp-cmds.c:
void qmp_hello_world(bool has_message, const char *message, Error **errp)
{
With the introduction of the QAPI, HMP commands make QMP calls. Most of the
time HMP commands are simple wrappers. All HMP commands implementation exist in
-the hmp.c file.
+the monitor/hmp-cmds.c file.
Here's the implementation of the "hello-world" HMP command: