---
 src/conf/domain_conf.c   | 29 +++++++++++++++++++++++++++++
 src/conf/domain_conf.h   |  3 +++
 src/libvirt_private.syms |  1 +
 3 files changed, 33 insertions(+)

diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c
index 0c28c03..556cd71 100644
--- a/src/conf/domain_conf.c
+++ b/src/conf/domain_conf.c
@@ -18292,6 +18292,35 @@ virDomainIOThreadIDAdd(virDomainDefPtr def,
     return NULL;
 }

+
+/*
+ * virDomainIOThreadIDMap:
+ * @def: domain definition
+ *
+ * Returns a map of active iothreads for @def.
+ */
+virBitmapPtr
+virDomainIOThreadIDMap(virDomainDefPtr def)
+{
+    unsigned int max = 0;
+    size_t i;
+    virBitmapPtr ret = NULL;
+
+    for (i = 0; i < def->niothreadids; i++) {
+        if (def->iothreadids[i]->iothread_id > max)
+            max = def->iothreadids[i]->iothread_id;
+    }
+
+    if (!(ret = virBitmapNew(max)))
+        return NULL;
+
+    for (i = 0; i < def->niothreadids; i++)
+        ignore_value(virBitmapSetBit(ret, def->iothreadids[i]->iothread_id));
+
+    return ret;
+}
+
+
 void
 virDomainIOThreadIDDel(virDomainDefPtr def,
                        unsigned int iothread_id)
diff --git a/src/conf/domain_conf.h b/src/conf/domain_conf.h
index 6a5f615..fe8334c 100644
--- a/src/conf/domain_conf.h
+++ b/src/conf/domain_conf.h
@@ -2700,6 +2700,9 @@ virDomainIOThreadIDDefPtr 
virDomainIOThreadIDFind(virDomainDefPtr def,
                                                   unsigned int iothread_id);
 virDomainIOThreadIDDefPtr virDomainIOThreadIDAdd(virDomainDefPtr def,
                                                  unsigned int iothread_id);
+
+virBitmapPtr virDomainIOThreadIDMap(virDomainDefPtr def)
+    ATTRIBUTE_NONNULL(1) ATTRIBUTE_RETURN_CHECK;
 void virDomainIOThreadIDDel(virDomainDefPtr def, unsigned int iothread_id);
 void virDomainIOThreadSchedDelId(virDomainDefPtr def, unsigned int 
iothread_id);

diff --git a/src/libvirt_private.syms b/src/libvirt_private.syms
index 7e9102a..af36a37 100644
--- a/src/libvirt_private.syms
+++ b/src/libvirt_private.syms
@@ -344,6 +344,7 @@ virDomainIOThreadIDAdd;
 virDomainIOThreadIDDefFree;
 virDomainIOThreadIDDel;
 virDomainIOThreadIDFind;
+virDomainIOThreadIDMap;
 virDomainIOThreadSchedDelId;
 virDomainKeyWrapCipherNameTypeFromString;
 virDomainKeyWrapCipherNameTypeToString;
-- 
2.6.2

--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list

Reply via email to