[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PULL 13/23] iothread: add iothread_by_id() API
From: |
Stefan Hajnoczi |
Subject: |
[Qemu-devel] [PULL 13/23] iothread: add iothread_by_id() API |
Date: |
Mon, 18 Dec 2017 14:35:20 +0000 |
Encapsulate IOThread QOM object lookup so that callers don't need to
know how and where IOThread objects live.
Signed-off-by: Stefan Hajnoczi <address@hidden>
Reviewed-by: Kevin Wolf <address@hidden>
Reviewed-by: Eric Blake <address@hidden>
Message-id: address@hidden
Signed-off-by: Stefan Hajnoczi <address@hidden>
---
include/sysemu/iothread.h | 1 +
iothread.c | 7 +++++++
2 files changed, 8 insertions(+)
diff --git a/include/sysemu/iothread.h b/include/sysemu/iothread.h
index 110329b2b4..55de1715c7 100644
--- a/include/sysemu/iothread.h
+++ b/include/sysemu/iothread.h
@@ -42,6 +42,7 @@ typedef struct {
OBJECT_CHECK(IOThread, obj, TYPE_IOTHREAD)
char *iothread_get_id(IOThread *iothread);
+IOThread *iothread_by_id(const char *id);
AioContext *iothread_get_aio_context(IOThread *iothread);
void iothread_stop_all(void);
GMainContext *iothread_get_g_main_context(IOThread *iothread);
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));
+}
--
2.14.3
- [Qemu-devel] [PULL 02/23] hw/block/nvme: Convert to realize, (continued)
- [Qemu-devel] [PULL 02/23] hw/block/nvme: Convert to realize, Stefan Hajnoczi, 2017/12/18
- [Qemu-devel] [PULL 04/23] hw/block: Use errp directly rather than local_err, Stefan Hajnoczi, 2017/12/18
- [Qemu-devel] [PULL 05/23] dev-storage: Fix the unusual function name, Stefan Hajnoczi, 2017/12/18
- [Qemu-devel] [PULL 07/23] blockdev: hold AioContext for bdrv_unref() in external_snapshot_clean(), Stefan Hajnoczi, 2017/12/18
- [Qemu-devel] [PULL 06/23] qdev: drop unused #include "sysemu/iothread.h", Stefan Hajnoczi, 2017/12/18
- [Qemu-devel] [PULL 09/23] block: don't keep AioContext acquired after drive_backup_prepare(), Stefan Hajnoczi, 2017/12/18
- [Qemu-devel] [PULL 08/23] block: don't keep AioContext acquired after external_snapshot_prepare(), Stefan Hajnoczi, 2017/12/18
- [Qemu-devel] [PULL 10/23] block: don't keep AioContext acquired after blockdev_backup_prepare(), Stefan Hajnoczi, 2017/12/18
- [Qemu-devel] [PULL 11/23] block: don't keep AioContext acquired after internal_snapshot_prepare(), Stefan Hajnoczi, 2017/12/18
- [Qemu-devel] [PULL 12/23] block: drop unused BlockDirtyBitmapState->aio_context field, Stefan Hajnoczi, 2017/12/18
- [Qemu-devel] [PULL 13/23] iothread: add iothread_by_id() API,
Stefan Hajnoczi <=
- [Qemu-devel] [PULL 14/23] blockdev: add x-blockdev-set-iothread testing command, Stefan Hajnoczi, 2017/12/18
- [Qemu-devel] [PULL 15/23] qemu-iotests: add 202 external snapshots IOThread test, Stefan Hajnoczi, 2017/12/18
- [Qemu-devel] [PULL 16/23] virtio-blk: make queue size configurable, Stefan Hajnoczi, 2017/12/18
- [Qemu-devel] [PULL 17/23] virtio-blk: reject configs with logical block size > physical block size, Stefan Hajnoczi, 2017/12/18
- [Qemu-devel] [PULL 18/23] block: avoid recursive AioContext acquire in bdrv_inactivate_all(), Stefan Hajnoczi, 2017/12/18
- [Qemu-devel] [PULL 19/23] docs: mark nested AioContext locking as a legacy API, Stefan Hajnoczi, 2017/12/18
- [Qemu-devel] [PULL 20/23] blockdev: add x-blockdev-set-iothread force boolean, Stefan Hajnoczi, 2017/12/18
- [Qemu-devel] [PULL 21/23] iotests: add VM.add_object(), Stefan Hajnoczi, 2017/12/18
- [Qemu-devel] [PULL 22/23] iothread: fix iothread_stop() race condition, Stefan Hajnoczi, 2017/12/18
- [Qemu-devel] [PULL 23/23] qemu-iotests: add 203 savevm with IOThreads test, Stefan Hajnoczi, 2017/12/18