aboutsummaryrefslogtreecommitdiff
path: root/iothread.c
diff options
context:
space:
mode:
authorStefan Hajnoczi <stefanha@redhat.com>2017-12-06 14:45:48 +0000
committerStefan Hajnoczi <stefanha@redhat.com>2017-12-19 10:25:09 +0000
commitfbcc6923b00c2b468a7470fec7863f0403a65736 (patch)
tree665c5283371b8fc24fd9ad5d4d9b413b901f77e8 /iothread.c
parent5016f21b705152d138395f90219b665ddce89c1b (diff)
iothread: add iothread_by_id() API
Encapsulate IOThread QOM object lookup so that callers don't need to know how and where IOThread objects live. Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com> Reviewed-by: Kevin Wolf <kwolf@redhat.com> Reviewed-by: Eric Blake <eblake@redhat.com> Message-id: 20171206144550.22295-8-stefanha@redhat.com Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
Diffstat (limited to 'iothread.c')
-rw-r--r--iothread.c7
1 files changed, 7 insertions, 0 deletions
diff --git a/iothread.c b/iothread.c
index 27a4288578..e7b93e02a3 100644
--- a/iothread.c
+++ b/iothread.c
@@ -380,3 +380,10 @@ void iothread_destroy(IOThread *iothread)
{
object_unparent(OBJECT(iothread));
}
+
+/* Lookup IOThread by its id. Only finds user-created objects, not internal
+ * iothread_create() objects. */
+IOThread *iothread_by_id(const char *id)
+{
+ return IOTHREAD(object_resolve_path_type(id, TYPE_IOTHREAD, NULL));
+}