Signed-off-by: Pavel Hrdina <phrdina(a)redhat.com>
---
src/libvirt_private.syms | 2 +-
src/qemu/qemu_block.c | 2 +-
src/qemu/qemu_snapshot.c | 2 +-
src/util/virfile.c | 13 +++++++++++++
src/util/virfile.h | 2 ++
src/util/virstoragefile.c | 15 +--------------
src/util/virstoragefile.h | 2 --
7 files changed, 19 insertions(+), 19 deletions(-)
diff --git a/src/libvirt_private.syms b/src/libvirt_private.syms
index 0b560dfe45..1bbf567847 100644
--- a/src/libvirt_private.syms
+++ b/src/libvirt_private.syms
@@ -2094,6 +2094,7 @@ virFileIsFile;
virFileIsLink;
virFileIsMountPoint;
virFileIsRegular;
+virFileIsRelative;
virFileIsSharedFS;
virFileIsSharedFSType;
virFileLength;
@@ -3157,7 +3158,6 @@ virStorageFileSupportsBackingChainTraversal;
virStorageFileSupportsCreate;
virStorageFileSupportsSecurityDriver;
virStorageFileUnlink;
-virStorageIsRelative;
virStorageNetHostDefClear;
virStorageNetHostDefCopy;
virStorageNetHostDefFree;
diff --git a/src/qemu/qemu_block.c b/src/qemu/qemu_block.c
index 4640e339c0..0743db4d2c 100644
--- a/src/qemu/qemu_block.c
+++ b/src/qemu/qemu_block.c
@@ -3357,7 +3357,7 @@ qemuBlockUpdateRelativeBacking(virDomainObjPtr vm,
if (rc < 0)
return rc;
- if (backingStoreStr && virStorageIsRelative(backingStoreStr))
+ if (backingStoreStr && virFileIsRelative(backingStoreStr))
n->backingStore->relPath = g_steal_pointer(&backingStoreStr);
}
diff --git a/src/qemu/qemu_snapshot.c b/src/qemu/qemu_snapshot.c
index 15494c3415..6f64111ca8 100644
--- a/src/qemu/qemu_snapshot.c
+++ b/src/qemu/qemu_snapshot.c
@@ -1075,7 +1075,7 @@ qemuSnapshotDiskPrepareOne(virDomainObjPtr vm,
if (virStorageFileGetBackingStoreStr(dd->src, &backingStoreStr)
< 0)
return -1;
if (backingStoreStr != NULL) {
- if (virStorageIsRelative(backingStoreStr))
+ if (virFileIsRelative(backingStoreStr))
dd->relPath = g_steal_pointer(&backingStoreStr);
}
}
diff --git a/src/util/virfile.c b/src/util/virfile.c
index 7a7468b202..c3f0e7cabc 100644
--- a/src/util/virfile.c
+++ b/src/util/virfile.c
@@ -2016,6 +2016,19 @@ virFileIsFile(const char *backing)
}
+bool
+virFileIsRelative(const char *path)
+{
+ if (path[0] == '/')
+ return false;
+
+ if (!virFileIsFile(path))
+ return false;
+
+ return true;
+}
+
+
#if defined WITH_MNTENT_H && defined WITH_GETMNTENT_R
static int
virFileGetMountSubtreeImpl(const char *mtabpath,
diff --git a/src/util/virfile.h b/src/util/virfile.h
index dfd3188ff2..06d9cffd88 100644
--- a/src/util/virfile.h
+++ b/src/util/virfile.h
@@ -228,6 +228,8 @@ int virFileIsMountPoint(const char *file) ATTRIBUTE_NONNULL(1);
int virFileIsCDROM(const char *path)
ATTRIBUTE_NONNULL(1) G_GNUC_WARN_UNUSED_RESULT;
bool virFileIsFile(const char *path);
+bool virFileIsRelative(const char *path);
+
int virFileGetMountSubtree(const char *mtabpath,
const char *prefix,
diff --git a/src/util/virstoragefile.c b/src/util/virstoragefile.c
index f37802260b..6ced28762a 100644
--- a/src/util/virstoragefile.c
+++ b/src/util/virstoragefile.c
@@ -757,19 +757,6 @@ virStorageFileMatchesVersion(int versionOffset,
}
-bool
-virStorageIsRelative(const char *backing)
-{
- if (backing[0] == '/')
- return false;
-
- if (!virFileIsFile(backing))
- return false;
-
- return true;
-}
-
-
static int
virStorageFileProbeFormatFromBuf(const char *path,
char *buf,
@@ -3846,7 +3833,7 @@ virStorageSourceNewFromChild(virStorageSourcePtr parent,
*child = NULL;
- if (virStorageIsRelative(parentRaw)) {
+ if (virFileIsRelative(parentRaw)) {
if (!(def = virStorageSourceNewFromBackingRelative(parent, parentRaw)))
return -1;
} else {
diff --git a/src/util/virstoragefile.h b/src/util/virstoragefile.h
index 2a44a535a1..d39486ad59 100644
--- a/src/util/virstoragefile.h
+++ b/src/util/virstoragefile.h
@@ -420,8 +420,6 @@ virStorageSourcePtr virStorageFileChainLookup(virStorageSourcePtr
chain,
virStorageSourcePtr *parent)
ATTRIBUTE_NONNULL(1);
-bool virStorageIsRelative(const char *backing);
-
int virStorageFileGetSCSIKey(const char *path,
char **key,
bool ignoreError);
--
2.28.0