diff mbox series

[3/5] monitor: add qmp tracing API for qmp_commands

Message ID 20210923195451.714796-4-vsementsov@virtuozzo.com (mailing list archive)
State New, archived
Headers show
Series trace: inroduce qmp: trace namespace | expand

Commit Message

Vladimir Sementsov-Ogievskiy Sept. 23, 2021, 7:54 p.m. UTC
Add wrappers to manipulate with .tracing in qmp_commands list.

Signed-off-by: Vladimir Sementsov-Ogievskiy <vsementsov@virtuozzo.com>
---
 include/monitor/monitor.h |  3 +++
 monitor/qmp.c             | 10 ++++++++++
 2 files changed, 13 insertions(+)
diff mbox series

Patch

diff --git a/include/monitor/monitor.h b/include/monitor/monitor.h
index 1a8a369b50..9587998217 100644
--- a/include/monitor/monitor.h
+++ b/include/monitor/monitor.h
@@ -54,4 +54,7 @@  int64_t monitor_fdset_dup_fd_find(int dup_fd);
 void monitor_register_hmp(const char *name, bool info,
                           void (*cmd)(Monitor *mon, const QDict *qdict));
 
+bool monitor_qmp_is_tracing_enabled(const char *pattern);
+void monitor_qmp_set_tracing(const char *pattern, bool enable);
+
 #endif /* MONITOR_H */
diff --git a/monitor/qmp.c b/monitor/qmp.c
index 092c527b6f..def2c7d1da 100644
--- a/monitor/qmp.c
+++ b/monitor/qmp.c
@@ -536,3 +536,13 @@  void monitor_init_qmp(Chardev *chr, bool pretty, Error **errp)
         monitor_list_append(&mon->common);
     }
 }
+
+void monitor_qmp_set_tracing(const char *pattern, bool enable)
+{
+    qmp_commands_set_tracing(&qmp_commands, pattern, enable);
+}
+
+bool monitor_qmp_is_tracing_enabled(const char *pattern)
+{
+    return qmp_commands_is_tracing_enabled(&qmp_commands, pattern);
+}