]> git.ipfire.org Git - thirdparty/libvirt.git/commitdiff
conf: Move -virDomainDiskDefForeachPath to virt-aa-helper
authorCole Robinson <crobinso@redhat.com>
Tue, 8 Oct 2019 15:40:30 +0000 (11:40 -0400)
committerCole Robinson <crobinso@redhat.com>
Wed, 9 Oct 2019 18:16:53 +0000 (14:16 -0400)
It is the only user. Rename it to match the local style

Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
Signed-off-by: Cole Robinson <crobinso@redhat.com>
src/conf/domain_conf.c
src/conf/domain_conf.h
src/libvirt_private.syms
src/security/virt-aa-helper.c

index a53cd6a72592c97db25c09994f53cccb8da8a524..5fe03ea866d9c707193e223de329efc4d341d898 100644 (file)
@@ -29486,48 +29486,6 @@ virDomainUSBDeviceDefForeach(virDomainDefPtr def,
 }
 
 
-/* Call iter(disk, name, depth, opaque) for each element of disk and
- * its backing chain in the pre-populated disk->src.backingStore.
- * ignoreOpenFailure determines whether to warn about a chain that
- * mentions a backing file without also having metadata on that
- * file.  */
-int
-virDomainDiskDefForeachPath(virDomainDiskDefPtr disk,
-                            bool ignoreOpenFailure,
-                            virDomainDiskDefPathIterator iter,
-                            void *opaque)
-{
-    size_t depth = 0;
-    virStorageSourcePtr tmp;
-    VIR_AUTOFREE(char *) brokenRaw = NULL;
-
-    if (!ignoreOpenFailure) {
-        if (virStorageFileChainGetBroken(disk->src, &brokenRaw) < 0)
-            return -1;
-
-        if (brokenRaw) {
-            virReportError(VIR_ERR_INTERNAL_ERROR,
-                           _("unable to visit backing chain file %s"),
-                           brokenRaw);
-            return -1;
-        }
-    }
-
-    for (tmp = disk->src; virStorageSourceIsBacking(tmp); tmp = tmp->backingStore) {
-        /* execute the callback only for local storage */
-        if (virStorageSourceIsLocalStorage(tmp) &&
-            tmp->path) {
-            if (iter(disk, tmp->path, depth, opaque) < 0)
-                return -1;
-        }
-
-        depth++;
-    }
-
-    return 0;
-}
-
-
 /* Copy src into a new definition; with the quality of the copy
  * depending on the migratable flag (false for transitions between
  * persistent and active, true for transitions across save files or
index 2884af49d8c31be3bb6d0f39be943953e28679f7..653dcaf2bcfb1d3c21637ab5b1b7a9481d805713 100644 (file)
@@ -3327,11 +3327,6 @@ int virDomainChrDefForeach(virDomainDefPtr def,
                            virDomainChrDefIterator iter,
                            void *opaque);
 
-typedef int (*virDomainDiskDefPathIterator)(virDomainDiskDefPtr disk,
-                                            const char *path,
-                                            size_t depth,
-                                            void *opaque);
-
 typedef int (*virDomainUSBDeviceDefIterator)(virDomainDeviceInfoPtr info,
                                              void *opaque);
 int virDomainUSBDeviceDefForeach(virDomainDefPtr def,
@@ -3339,11 +3334,6 @@ int virDomainUSBDeviceDefForeach(virDomainDefPtr def,
                                  void *opaque,
                                  bool skipHubs);
 
-int virDomainDiskDefForeachPath(virDomainDiskDefPtr disk,
-                                bool ignoreOpenFailure,
-                                virDomainDiskDefPathIterator iter,
-                                void *opaque);
-
 void
 virDomainObjSetState(virDomainObjPtr obj, virDomainState state, int reason)
         ATTRIBUTE_NONNULL(1);
index c818bc807ad81cce601928c3b382431b1eb9e58d..5949cba08d6b2e55ddef7fac63c6953a18c55e7f 100644 (file)
@@ -334,7 +334,6 @@ virDomainDiskCacheTypeFromString;
 virDomainDiskCacheTypeToString;
 virDomainDiskDefAssignAddress;
 virDomainDiskDefCheckDuplicateInfo;
-virDomainDiskDefForeachPath;
 virDomainDiskDefFree;
 virDomainDiskDefNew;
 virDomainDiskDefParse;
index 5853ad985fe17c91af3f1dc39d179f22a1dca5b7..087774daa2e019577f19d4e09abcc79d55b47105 100644 (file)
@@ -934,6 +934,54 @@ add_file_path(virDomainDiskDefPtr disk,
     return ret;
 }
 
+
+typedef int (*disk_foreach_iterator)(virDomainDiskDefPtr disk,
+                                     const char *path,
+                                     size_t depth,
+                                     void *opaque);
+
+
+/* Call iter(disk, name, depth, opaque) for each element of disk and
+ * its backing chain in the pre-populated disk->src.backingStore.
+ * ignoreOpenFailure determines whether to warn about a chain that
+ * mentions a backing file without also having metadata on that
+ * file.  */
+static int
+disk_foreach_path(virDomainDiskDefPtr disk,
+                  bool ignoreOpenFailure,
+                  disk_foreach_iterator iter,
+                  void *opaque)
+{
+    size_t depth = 0;
+    virStorageSourcePtr tmp;
+    VIR_AUTOFREE(char *) brokenRaw = NULL;
+
+    if (!ignoreOpenFailure) {
+        if (virStorageFileChainGetBroken(disk->src, &brokenRaw) < 0)
+            return -1;
+
+        if (brokenRaw) {
+            virReportError(VIR_ERR_INTERNAL_ERROR,
+                           _("unable to visit backing chain file %s"),
+                           brokenRaw);
+            return -1;
+        }
+    }
+
+    for (tmp = disk->src; virStorageSourceIsBacking(tmp); tmp = tmp->backingStore) {
+        /* execute the callback only for local storage */
+        if (virStorageSourceIsLocalStorage(tmp) &&
+            tmp->path) {
+            if (iter(disk, tmp->path, depth, opaque) < 0)
+                return -1;
+        }
+
+        depth++;
+    }
+
+    return 0;
+}
+
 static int
 get_files(vahControl * ctl)
 {
@@ -973,11 +1021,11 @@ get_files(vahControl * ctl)
             virStorageFileGetMetadata(disk->src, -1, -1, false);
 
         /* XXX passing ignoreOpenFailure = true to get back to the behavior
-         * from before using virDomainDiskDefForeachPath. actually we should
+         * from before using disk_foreach_path. actually we should
          * be passing ignoreOpenFailure = false and handle open errors more
          * careful than just ignoring them.
          */
-        if (virDomainDiskDefForeachPath(disk, true, add_file_path, &buf) < 0)
+        if (disk_foreach_path(disk, true, add_file_path, &buf) < 0)
             goto cleanup;
     }