The handler allows a qtest client to send commands to the server by directly calling a function, rather than using a file/CharBackend
Signed-off-by: Alexander Oleinik <alx...@bu.edu> --- include/sysemu/qtest.h | 1 + qtest.c | 7 +++++++ 2 files changed, 8 insertions(+) diff --git a/include/sysemu/qtest.h b/include/sysemu/qtest.h index fda7000d2c..3f365522d5 100644 --- a/include/sysemu/qtest.h +++ b/include/sysemu/qtest.h @@ -28,5 +28,6 @@ void qtest_server_init(const char *qtest_chrdev, const char *qtest_log, Error ** void qtest_server_set_tx_handler(void (*send)(void *, const char *, size_t), void *opaque); +void qtest_server_inproc_recv(void *opaque, const char *buf, size_t size); #endif diff --git a/qtest.c b/qtest.c index ae7e6d779d..44a916485f 100644 --- a/qtest.c +++ b/qtest.c @@ -802,3 +802,10 @@ bool qtest_driver(void) { return qtest_chr.chr != NULL; } + +void qtest_server_inproc_recv(void *opaque, const char *buf, size_t size) +{ + GString *gstr = g_string_new_len(buf, size); + qtest_process_inbuf(NULL, gstr); + g_string_free(gstr, true); +} -- 2.23.0