[PATCH 2/2] Search for schemas and cpu_map.xml in source tree

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

 



Both RNG schemas and cpu_map.xml are distributed in source tarball.

Signed-off-by: Jiri Denemark <jdenemar@xxxxxxxxxx>
---
 src/conf/domain_conf.c   |  6 +++---
 src/cpu/cpu_map.c        |  6 +++---
 src/libvirt_private.syms |  1 +
 src/util/virfile.c       | 10 ++++++++++
 src/util/virfile.h       |  4 ++++
 5 files changed, 21 insertions(+), 6 deletions(-)

diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c
index b13cae8..b3d63f8 100644
--- a/src/conf/domain_conf.c
+++ b/src/conf/domain_conf.c
@@ -12886,9 +12886,9 @@ virDomainDefParseXML(xmlDocPtr xml,
     bool primaryVideo = false;
 
     if (flags & VIR_DOMAIN_DEF_PARSE_VALIDATE) {
-        char *schema = virFileFindResource("domain.rng",
-                                           "docs/schemas",
-                                           PKGDATADIR "/schemas");
+        char *schema = virFileFindResourceSrc("domain.rng",
+                                              "docs/schemas",
+                                              PKGDATADIR "/schemas");
         if (!schema)
             return NULL;
         if (virXMLValidateAgainstSchema(schema, xml) < 0) {
diff --git a/src/cpu/cpu_map.c b/src/cpu/cpu_map.c
index b77f688..8c005d4 100644
--- a/src/cpu/cpu_map.c
+++ b/src/cpu/cpu_map.c
@@ -86,9 +86,9 @@ int cpuMapLoad(const char *arch,
     int element;
     char *mapfile;
 
-    if (!(mapfile = virFileFindResource("cpu_map.xml",
-                                        "src/cpu",
-                                        PKGDATADIR)))
+    if (!(mapfile = virFileFindResourceSrc("cpu_map.xml",
+                                           "src/cpu",
+                                           PKGDATADIR)))
         return -1;
 
     VIR_DEBUG("Loading CPU map from %s", mapfile);
diff --git a/src/libvirt_private.syms b/src/libvirt_private.syms
index c07a561..488cde6 100644
--- a/src/libvirt_private.syms
+++ b/src/libvirt_private.syms
@@ -1346,6 +1346,7 @@ virFileFindHugeTLBFS;
 virFileFindMountPoint;
 virFileFindResource;
 virFileFindResourceFull;
+virFileFindResourceSrc;
 virFileGetHugepageSize;
 virFileGetMountReverseSubtree;
 virFileGetMountSubtree;
diff --git a/src/util/virfile.c b/src/util/virfile.c
index e60896f..fc3d0a2 100644
--- a/src/util/virfile.c
+++ b/src/util/virfile.c
@@ -1695,6 +1695,16 @@ virFileFindResource(const char *filename,
                                    installdir, NULL);
 }
 
+char *
+virFileFindResourceSrc(const char *filename,
+                       const char *srcdir,
+                       const char *installdir)
+{
+    return virFileFindResourceFull(filename, NULL, NULL,
+                                   srcdir, VIR_FILE_FIND_RESOURCE_VPATH_SOURCE,
+                                   installdir, NULL);
+}
+
 
 /**
  * virFileActivateDirOverride:
diff --git a/src/util/virfile.h b/src/util/virfile.h
index 0e481c2..ddce797 100644
--- a/src/util/virfile.h
+++ b/src/util/virfile.h
@@ -172,6 +172,10 @@ char *virFileFindResource(const char *filename,
                           const char *builddir,
                           const char *installdir)
     ATTRIBUTE_NONNULL(1) ATTRIBUTE_NONNULL(2) ATTRIBUTE_NONNULL(3);
+char *virFileFindResourceSrc(const char *filename,
+                             const char *srcdir,
+                             const char *installdir)
+    ATTRIBUTE_NONNULL(1) ATTRIBUTE_NONNULL(2) ATTRIBUTE_NONNULL(3);
 char *virFileFindResourceFull(const char *filename,
                               const char *prefix,
                               const char *suffix,
-- 
2.3.0

--
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]