From 0dde544c95408e7aaa91757836d5cd3bedaa2b49 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Guido=20G=C3=BCnther?= Date: Tue, 29 May 2012 20:46:38 +0200 Subject: [PATCH] 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 221e1d0a25..8d80f3b017 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 8d5b35a2b2..d627ad82e8 100644 --- a/src/conf/domain_conf.h +++ b/src/conf/domain_conf.h @@ -2085,6 +2085,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 ef8047d75d..ea0e59b659 100644 --- a/src/libvirt_private.syms +++ b/src/libvirt_private.syms @@ -320,6 +320,7 @@ virDomainDiskSnapshotTypeToString; virDomainDiskTypeFromString; virDomainDiskTypeToString; virDomainFSDefFree; +virDomainFSIndexByName; virDomainFSTypeFromString; virDomainFSTypeToString; virDomainFSWrpolicyTypeFromString; -- GitLab