[libvirt PATCH v2 2/9] virstoragefile: remove unused virStorageFileChainCheckBroken

Pavel Hrdina phrdina at redhat.com
Wed Jan 6 12:25:53 UTC 2021


The last usage outside of tests was removed by commit
<780f8c94ca8b3dee7eb59c1bfbc32f672f965df8>.

Signed-off-by: Pavel Hrdina <phrdina at redhat.com>
Reviewed-by: Peter Krempa <pkrempa at redhat.com>
---
 src/libvirt_private.syms  |  1 -
 src/util/virstoragefile.c | 33 ---------------------------------
 src/util/virstoragefile.h |  3 ---
 tests/virstoragetest.c    |  6 ------
 4 files changed, 43 deletions(-)

diff --git a/src/libvirt_private.syms b/src/libvirt_private.syms
index d7714361d3..f8da4a7648 100644
--- a/src/libvirt_private.syms
+++ b/src/libvirt_private.syms
@@ -3127,7 +3127,6 @@ virStorageAuthDefFree;
 virStorageAuthDefParse;
 virStorageFileAccess;
 virStorageFileCanonicalizePath;
-virStorageFileChainGetBroken;
 virStorageFileChainLookup;
 virStorageFileChown;
 virStorageFileCreate;
diff --git a/src/util/virstoragefile.c b/src/util/virstoragefile.c
index fac93118fd..119342d296 100644
--- a/src/util/virstoragefile.c
+++ b/src/util/virstoragefile.c
@@ -1193,39 +1193,6 @@ virStorageFileGetMetadataFromFD(const char *path,
 }
 
 
-/**
- * virStorageFileChainCheckBroken
- *
- * If CHAIN is broken, set *brokenFile to the broken file name,
- * otherwise set it to NULL. Caller MUST free *brokenFile after use.
- * Return 0 on success (including when brokenFile is set), negative on
- * error (allocation failure).
- */
-int
-virStorageFileChainGetBroken(virStorageSourcePtr chain,
-                             char **brokenFile)
-{
-    virStorageSourcePtr tmp;
-
-    *brokenFile = NULL;
-
-    if (!chain)
-        return 0;
-
-    for (tmp = chain; virStorageSourceIsBacking(tmp); tmp = tmp->backingStore) {
-        /* Break when we hit end of chain; report error if we detected
-         * a missing backing file, infinite loop, or other error */
-        if (!tmp->backingStore && tmp->backingStoreRaw) {
-            *brokenFile = g_strdup(tmp->backingStoreRaw);
-
-           return 0;
-        }
-    }
-
-    return 0;
-}
-
-
 /**
  * virStorageFileResize:
  *
diff --git a/src/util/virstoragefile.h b/src/util/virstoragefile.h
index 87763cf389..cc9bd4875f 100644
--- a/src/util/virstoragefile.h
+++ b/src/util/virstoragefile.h
@@ -403,9 +403,6 @@ virStorageSourcePtr virStorageFileGetMetadataFromBuf(const char *path,
                                                      size_t len,
                                                      int format)
     ATTRIBUTE_NONNULL(1) ATTRIBUTE_NONNULL(2);
-int virStorageFileChainGetBroken(virStorageSourcePtr chain,
-                                 char **broken_file);
-
 int virStorageFileParseChainIndex(const char *diskTarget,
                                   const char *name,
                                   unsigned int *chainIndex)
diff --git a/tests/virstoragetest.c b/tests/virstoragetest.c
index 2e466ecb99..a376154def 100644
--- a/tests/virstoragetest.c
+++ b/tests/virstoragetest.c
@@ -270,7 +270,6 @@ testStorageChain(const void *args)
     virStorageSourcePtr elt;
     size_t i = 0;
     g_autoptr(virStorageSource) meta = NULL;
-    g_autofree char *broken = NULL;
 
     meta = testStorageFileGetMetadata(data->start, data->format, -1, -1);
     if (!meta) {
@@ -289,11 +288,6 @@ testStorageChain(const void *args)
         return -1;
     }
 
-    if (virStorageFileChainGetBroken(meta, &broken) || broken) {
-        fprintf(stderr, "chain should not be identified as broken\n");
-        return -1;
-    }
-
     elt = meta;
     while (virStorageSourceIsBacking(elt)) {
         g_autofree char *expect = NULL;
-- 
2.29.2




More information about the libvir-list mailing list