[PATCHv3 25/36] util: storage: Remove now redundant backingRelative from virStorageSource

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

 



Now that we store only relative names in virStorageSource's member
relPath the backingRelative member is obsolete. Remove it and adapt the
code to the removal.
---
 src/util/virstoragefile.c |  4 +---
 src/util/virstoragefile.h |  2 --
 tests/virstoragetest.c    | 23 +++++++++++------------
 3 files changed, 12 insertions(+), 17 deletions(-)

diff --git a/src/util/virstoragefile.c b/src/util/virstoragefile.c
index b33bc1a..6482689 100644
--- a/src/util/virstoragefile.c
+++ b/src/util/virstoragefile.c
@@ -1590,8 +1590,6 @@ virStorageSourceNewFromBackingRelative(virStorageSourcePtr parent,
     if (VIR_ALLOC(ret) < 0)
         return NULL;

-    ret->backingRelative = true;
-
     /* store relative name */
     if (VIR_STRDUP(ret->relPath, parent->backingStoreRaw) < 0)
         goto error;
@@ -2112,7 +2110,7 @@ virStorageFileGetRelativeBackingPath(virStorageSourcePtr from,
     *relpath = NULL;

     for (next = from; next; next = next->backingStore) {
-        if (!next->backingRelative || !next->relPath) {
+        if (!next->relPath) {
             ret = 1;
             goto cleanup;
         }
diff --git a/src/util/virstoragefile.h b/src/util/virstoragefile.h
index 1f2ae53..37f4e66 100644
--- a/src/util/virstoragefile.h
+++ b/src/util/virstoragefile.h
@@ -256,8 +256,6 @@ struct _virStorageSource {
     /* Name of the child backing store recorded in metadata of the
      * current file.  */
     char *backingStoreRaw;
-    /* is backing store identified as relative */
-    bool backingRelative;
 };


diff --git a/tests/virstoragetest.c b/tests/virstoragetest.c
index af565c9..a787cc9 100644
--- a/tests/virstoragetest.c
+++ b/tests/virstoragetest.c
@@ -570,34 +570,33 @@ testPathRelativePrepare(void)

     for (i = 0; i < ARRAY_CARDINALITY(backingchain) - 1; i++) {
         backingchain[i].backingStore = &backingchain[i+1];
+        backingchain[i].relPath = NULL;
     }

-    backingchain[0].relPath = (char *) "/path/to/some/img";
-    backingchain[0].backingRelative = false;
+    backingchain[0].path = (char *) "/path/to/disk";

+    backingchain[1].path = (char *) "/path/to/asdf";
     backingchain[1].relPath = (char *) "asdf";
-    backingchain[1].backingRelative = true;

+    backingchain[2].path = (char *) "/path/to/test";
     backingchain[2].relPath = (char *) "test";
-    backingchain[2].backingRelative = true;

+    backingchain[3].path = (char *) "/path/to/blah";
     backingchain[3].relPath = (char *) "blah";
-    backingchain[3].backingRelative = true;

-    backingchain[4].relPath = (char *) "/path/to/some/other/img";
-    backingchain[4].backingRelative = false;
+    backingchain[4].path = (char *) "/path/to/some/other/img";

+    backingchain[5].path = (char *) "/path/to/some/other/relative/in/other/path";
     backingchain[5].relPath = (char *) "../relative/in/other/path";
-    backingchain[5].backingRelative = true;

+    backingchain[6].path = (char *) "/path/to/some/other/relative/in/other/test";
     backingchain[6].relPath = (char *) "test";
-    backingchain[6].backingRelative = true;

+    backingchain[7].path = (char *) "/path/to/below";
     backingchain[7].relPath = (char *) "../../../../../below";
-    backingchain[7].backingRelative = true;

+    backingchain[8].path = (char *) "/path/to/a/little/more/upwards";
     backingchain[8].relPath = (char *) "a/little/more/upwards";
-    backingchain[8].backingRelative = true;
 }


@@ -626,7 +625,7 @@ testPathRelative(const void *args)
     if (STRNEQ_NULLABLE(data->expect, actual)) {
         fprintf(stderr, "relative path resolution from '%s' to '%s': "
                 "expected '%s', got '%s'\n",
-                data->from->relPath, data->to->relPath,
+                data->from->path, data->to->path,
                 NULLSTR(data->expect), NULLSTR(actual));
         goto cleanup;
     }
-- 
1.9.3

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