Blame SOURCES/kvm-iothread-provide-helpers-for-internal-use.patch

9bac43
From a709d66bc6e7b3559fbd8502c6f94b76b6a899d1 Mon Sep 17 00:00:00 2001
9bac43
From: Stefan Hajnoczi <stefanha@redhat.com>
9bac43
Date: Fri, 22 Dec 2017 11:08:45 +0100
9bac43
Subject: [PATCH 27/42] iothread: provide helpers for internal use
9bac43
9bac43
RH-Author: Stefan Hajnoczi <stefanha@redhat.com>
9bac43
Message-id: <20171222110900.24813-6-stefanha@redhat.com>
9bac43
Patchwork-id: 78487
9bac43
O-Subject: [RHV7.5 qemu-kvm-rhev PATCH 05/20] iothread: provide helpers for internal use
9bac43
Bugzilla: 1519721
9bac43
RH-Acked-by: Paolo Bonzini <pbonzini@redhat.com>
9bac43
RH-Acked-by: Jeffrey Cody <jcody@redhat.com>
9bac43
RH-Acked-by: Miroslav Rezanina <mrezanin@redhat.com>
9bac43
9bac43
From: Peter Xu <peterx@redhat.com>
9bac43
9bac43
IOThread is a general framework that contains IO loop environment and a
9bac43
real thread behind.  It's also good to be used internally inside qemu.
9bac43
Provide some helpers for it to create iothreads to be used internally.
9bac43
9bac43
Put all the internal used iothreads into the internal object container.
9bac43
9bac43
Reviewed-by: Fam Zheng <famz@redhat.com>
9bac43
Reviewed-by: Stefan Hajnoczi <stefanha@redhat.com>
9bac43
Signed-off-by: Peter Xu <peterx@redhat.com>
9bac43
Message-id: 20170928025958.1420-3-peterx@redhat.com
9bac43
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
9bac43
(cherry picked from commit 0173e21b617d3de1fcfa917e329bb9194ab332a4)
9bac43
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
9bac43
Signed-off-by: Miroslav Rezanina <mrezanin@redhat.com>
9bac43
---
9bac43
 include/sysemu/iothread.h |  8 ++++++++
9bac43
 iothread.c                | 16 ++++++++++++++++
9bac43
 2 files changed, 24 insertions(+)
9bac43
9bac43
diff --git a/include/sysemu/iothread.h b/include/sysemu/iothread.h
9bac43
index d2985b3..b07663f 100644
9bac43
--- a/include/sysemu/iothread.h
9bac43
+++ b/include/sysemu/iothread.h
9bac43
@@ -46,4 +46,12 @@ AioContext *iothread_get_aio_context(IOThread *iothread);
9bac43
 void iothread_stop_all(void);
9bac43
 GMainContext *iothread_get_g_main_context(IOThread *iothread);
9bac43
 
9bac43
+/*
9bac43
+ * Helpers used to allocate iothreads for internal use.  These
9bac43
+ * iothreads will not be seen by monitor clients when query using
9bac43
+ * "query-iothreads".
9bac43
+ */
9bac43
+IOThread *iothread_create(const char *id, Error **errp);
9bac43
+void iothread_destroy(IOThread *iothread);
9bac43
+
9bac43
 #endif /* IOTHREAD_H */
9bac43
diff --git a/iothread.c b/iothread.c
9bac43
index 59d0850..0672a91 100644
9bac43
--- a/iothread.c
9bac43
+++ b/iothread.c
9bac43
@@ -354,3 +354,19 @@ GMainContext *iothread_get_g_main_context(IOThread *iothread)
9bac43
 
9bac43
     return iothread->worker_context;
9bac43
 }
9bac43
+
9bac43
+IOThread *iothread_create(const char *id, Error **errp)
9bac43
+{
9bac43
+    Object *obj;
9bac43
+
9bac43
+    obj = object_new_with_props(TYPE_IOTHREAD,
9bac43
+                                object_get_internal_root(),
9bac43
+                                id, errp, NULL);
9bac43
+
9bac43
+    return IOTHREAD(obj);
9bac43
+}
9bac43
+
9bac43
+void iothread_destroy(IOThread *iothread)
9bac43
+{
9bac43
+    object_unparent(OBJECT(iothread));
9bac43
+}
9bac43
-- 
9bac43
1.8.3.1
9bac43