[PATCH 27/34] conf: Add helper to return a bitmap of active iothread ids

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



---
 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 b18ce8d..14b6c80 100644
--- a/src/conf/domain_conf.c
+++ b/src/conf/domain_conf.c
@@ -18335,6 +18335,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 b12eeca..a2c8eac 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 8213ff3..0c84672 100644
--- a/src/libvirt_private.syms
+++ b/src/libvirt_private.syms
@@ -342,6 +342,7 @@ virDomainIOThreadIDAdd;
 virDomainIOThreadIDDefFree;
 virDomainIOThreadIDDel;
 virDomainIOThreadIDFind;
+virDomainIOThreadIDMap;
 virDomainIOThreadSchedDelId;
 virDomainKeyWrapCipherNameTypeFromString;
 virDomainKeyWrapCipherNameTypeToString;
-- 
2.6.2

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



[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]