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

[libvirt] [PATCHv2 1/3] Introduce virDomainFSIndexByName



for containers matching virDomainDiskIndexByName.
---
 src/conf/domain_conf.c   |   16 ++++++++++++++++
 src/conf/domain_conf.h   |    1 +
 src/libvirt_private.syms |    1 +
 3 files changed, 18 insertions(+)

diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c
index bd7b520..c34ce26 100644
--- a/src/conf/domain_conf.c
+++ b/src/conf/domain_conf.c
@@ -11265,6 +11265,22 @@ virDomainControllerDefFormat(virBufferPtr buf,
     return 0;
 }
 
+
+int
+virDomainFSIndexByName(virDomainDefPtr def, const char *name)
+{
+    virDomainFSDefPtr fs;
+    int i;
+
+    for (i = 0; i < def->nfss; i++) {
+        fs = def->fss[i];
+        if (STREQ(fs->dst, name))
+            return i;
+    }
+    return -1;
+}
+
+
 static int
 virDomainFSDefFormat(virBufferPtr buf,
                      virDomainFSDefPtr def,
diff --git a/src/conf/domain_conf.h b/src/conf/domain_conf.h
index 7642720..e2f56fb 100644
--- a/src/conf/domain_conf.h
+++ b/src/conf/domain_conf.h
@@ -2087,6 +2087,7 @@ int virDiskNameToBusDeviceIndex(virDomainDiskDefPtr disk,
                                 int *devIdx);
 
 virDomainFSDefPtr virDomainGetRootFilesystem(virDomainDefPtr def);
+int virDomainFSIndexByName(virDomainDefPtr def, const char *name);
 int virDomainVideoDefaultType(virDomainDefPtr def);
 int virDomainVideoDefaultRAM(virDomainDefPtr def, int type);
 
diff --git a/src/libvirt_private.syms b/src/libvirt_private.syms
index fdf2186..a452e62 100644
--- a/src/libvirt_private.syms
+++ b/src/libvirt_private.syms
@@ -319,6 +319,7 @@ virDomainDiskSnapshotTypeToString;
 virDomainDiskTypeFromString;
 virDomainDiskTypeToString;
 virDomainFSDefFree;
+virDomainFSIndexByName;
 virDomainFSTypeFromString;
 virDomainFSTypeToString;
 virDomainFSWrpolicyTypeFromString;
-- 
1.7.10.4


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