As a temporary step to allow killing of the "backingStore" field of
struct virStorageFileMetadata the recursive metadata retrieval function
will be converted not to use the field in the lookup process.
---
src/util/virstoragefile.c | 11 ++++++++---
1 file changed, 8 insertions(+), 3 deletions(-)
diff --git a/src/util/virstoragefile.c b/src/util/virstoragefile.c
index d4d8427..2077839 100644
--- a/src/util/virstoragefile.c
+++ b/src/util/virstoragefile.c
@@ -1116,6 +1116,7 @@ virStorageFileGetMetadataRecurse(const char *path, const char
*canonPath,
int fd;
int ret = -1;
int backingFormat;
+ char *backingPath = NULL;
char *backingDirectory = NULL;
VIR_DEBUG("path=%s canonPath=%s dir=%s format=%d uid=%d gid=%d probe=%d",
@@ -1167,7 +1168,7 @@ virStorageFileGetMetadataRecurse(const char *path, const char
*canonPath,
if (virFindBackingFile(directory,
meta->backingStoreRaw,
&backingDirectory,
- &meta->backingStore) < 0) {
+ &backingPath) < 0) {
/* the backing file is (currently) unavailable, treat this
* file as standalone:
* backingStoreRaw is kept to mark broken image chains */
@@ -1177,10 +1178,12 @@ virStorageFileGetMetadataRecurse(const char *path, const char
*canonPath,
return 0;
}
} else {
- if (VIR_STRDUP(meta->backingStore, meta->backingStoreRaw) < 0)
+ if (VIR_STRDUP(backingPath, meta->backingStoreRaw) < 0)
return -1;
}
+ if (VIR_STRDUP(meta->backingStore, backingPath) < 0)
+ return -1;
virStorageFileMetadataPtr backing;
@@ -1190,7 +1193,7 @@ virStorageFileGetMetadataRecurse(const char *path, const char
*canonPath,
backingFormat = VIR_STORAGE_FILE_AUTO;
if (VIR_ALLOC(backing) < 0 ||
virStorageFileGetMetadataRecurse(meta->backingStoreRaw,
- meta->backingStore,
+ backingPath,
backingDirectory, backingFormat,
uid, gid, allow_probe,
cycle, backing) < 0) {
@@ -1201,7 +1204,9 @@ virStorageFileGetMetadataRecurse(const char *path, const char
*canonPath,
meta->backingMeta = backing;
}
}
+
VIR_FREE(backingDirectory);
+ VIR_FREE(backingPath);
return ret;
}
--
1.9.1