[libvirt] [PATCH 04/18] util: storage: Remove obsolete argument virStorageFileGetMetadataInternal

Peter Krempa pkrempa at redhat.com
Sun Apr 20 22:13:08 UTC 2014


As we already pass the whole structure down the call path there's no
need to return some stuff in a separate argument. Remove the argument
and call tweakers to avoid breaking semantics.

virStorageFileGetMetadataFromBuf will be refactored later along with the
storage driver.
---
 src/util/virstoragefile.c | 13 ++++++-------
 1 file changed, 6 insertions(+), 7 deletions(-)

diff --git a/src/util/virstoragefile.c b/src/util/virstoragefile.c
index c707200..513f15d 100644
--- a/src/util/virstoragefile.c
+++ b/src/util/virstoragefile.c
@@ -803,7 +803,6 @@ virStorageFileGetMetadataInternal(const char *path,
                                   size_t len,
                                   int format,
                                   virStorageFileMetadataPtr meta,
-                                  char **backingStore,
                                   int *backingFormat,
                                   char **backingDirectory)
 {
@@ -891,10 +890,6 @@ virStorageFileGetMetadataInternal(const char *path,
                 if (VIR_STRDUP(meta->backingStore, meta->backingStoreRaw) < 0)
                     goto cleanup;

-                if (backingStore &&
-                    VIR_STRDUP(*backingStore, meta->backingStoreRaw) < 0)
-                    goto cleanup;
-
                 *backingFormat = VIR_STORAGE_FILE_RAW;
             }
         } else {
@@ -1022,12 +1017,17 @@ virStorageFileGetMetadataFromBuf(const char *path,
         goto cleanup;

     if (virStorageFileGetMetadataInternal(path, canonPath, ".", buf, len,
-                                          format, ret, backing,
+                                          format, ret,
                                           backingFormat, NULL) < 0) {
         virStorageFileFreeMetadata(ret);
         ret = NULL;
     }

+    if (VIR_STRDUP(*backing, ret->backingStoreRaw) < 0) {
+        virStorageFileFreeMetadata(ret);
+        ret = NULL;
+    }
+
  cleanup:
     VIR_FREE(canonPath);
     return ret;
@@ -1085,7 +1085,6 @@ virStorageFileGetMetadataFromFDInternal(const char *path,

     ret = virStorageFileGetMetadataInternal(path, canonPath, directory,
                                             buf, len, format, meta,
-                                            NULL,
                                             backingFormat, backingDirectory);

     if (ret == 0) {
-- 
1.9.1




More information about the libvir-list mailing list