[libvirt PATCH v2 13/13] storage_source: use virStorageSource prefix for all functions

Pavel Hrdina phrdina at redhat.com
Thu Jan 21 19:34:27 UTC 2021


Signed-off-by: Pavel Hrdina <phrdina at redhat.com>
---
 src/libvirt_private.syms              |  42 ++---
 src/qemu/qemu_backup.c                |   8 +-
 src/qemu/qemu_block.c                 |   6 +-
 src/qemu/qemu_domain.c                |  16 +-
 src/qemu/qemu_driver.c                |  66 +++----
 src/qemu/qemu_hotplug.c               |   4 +-
 src/qemu/qemu_process.c               |   4 +-
 src/qemu/qemu_snapshot.c              |  20 +--
 src/security/virt-aa-helper.c         |   2 +-
 src/storage/storage_backend_gluster.c |   4 +-
 src/storage/storage_util.c            |   6 +-
 src/storage_file/storage_source.c     | 250 +++++++++++++-------------
 src/storage_file/storage_source.h     |  90 +++++-----
 tests/virstoragetest.c                |  18 +-
 14 files changed, 268 insertions(+), 268 deletions(-)

diff --git a/src/libvirt_private.syms b/src/libvirt_private.syms
index 088474d54b..41fa8ae5ba 100644
--- a/src/libvirt_private.syms
+++ b/src/libvirt_private.syms
@@ -1686,30 +1686,30 @@ virStorageFileProbeGetMetadata;
 
 
 # storage_file/storage_source.h
-virStorageFileAccess;
-virStorageFileChainLookup;
-virStorageFileChown;
-virStorageFileCreate;
-virStorageFileDeinit;
-virStorageFileGetBackingStoreStr;
-virStorageFileGetMetadata;
-virStorageFileGetMetadataFromBuf;
-virStorageFileGetMetadataFromFD;
-virStorageFileGetRelativeBackingPath;
-virStorageFileGetUniqueIdentifier;
-virStorageFileInit;
-virStorageFileInitAs;
-virStorageFileRead;
-virStorageFileReportBrokenChain;
-virStorageFileStat;
-virStorageFileSupportsAccess;
-virStorageFileSupportsBackingChainTraversal;
-virStorageFileSupportsCreate;
-virStorageFileSupportsSecurityDriver;
-virStorageFileUnlink;
+virStorageSourceAccess;
+virStorageSourceChainLookup;
+virStorageSourceChown;
+virStorageSourceCreate;
+virStorageSourceDeinit;
+virStorageSourceGetBackingStoreStr;
+virStorageSourceGetMetadata;
+virStorageSourceGetMetadataFromBuf;
+virStorageSourceGetMetadataFromFD;
+virStorageSourceGetRelativeBackingPath;
+virStorageSourceGetUniqueIdentifier;
+virStorageSourceInit;
+virStorageSourceInitAs;
 virStorageSourceNewFromBacking;
 virStorageSourceNewFromBackingAbsolute;
 virStorageSourceParseRBDColonString;
+virStorageSourceRead;
+virStorageSourceReportBrokenChain;
+virStorageSourceStat;
+virStorageSourceSupportsAccess;
+virStorageSourceSupportsBackingChainTraversal;
+virStorageSourceSupportsCreate;
+virStorageSourceSupportsSecurityDriver;
+virStorageSourceUnlink;
 virStorageSourceUpdateBackingSizes;
 virStorageSourceUpdateCapacity;
 virStorageSourceUpdatePhysicalSize;
diff --git a/src/qemu/qemu_backup.c b/src/qemu/qemu_backup.c
index 4a07f6a5f4..423de9c719 100644
--- a/src/qemu/qemu_backup.c
+++ b/src/qemu/qemu_backup.c
@@ -135,7 +135,7 @@ qemuBackupDiskDataCleanupOne(virDomainObjPtr vm,
         }
 
         if (dd->created) {
-            if (virStorageFileUnlink(dd->store) < 0)
+            if (virStorageSourceUnlink(dd->store) < 0)
                 VIR_WARN("Unable to remove just-created %s", NULLSTR(dd->store->path));
         }
 
@@ -144,7 +144,7 @@ qemuBackupDiskDataCleanupOne(virDomainObjPtr vm,
     }
 
     if (dd->initialized)
-        virStorageFileDeinit(dd->store);
+        virStorageSourceDeinit(dd->store);
 
     if (dd->blockjob)
         qemuBlockJobStartupFinalize(vm, dd->blockjob);
@@ -429,7 +429,7 @@ qemuBackupDiskPrepareOneStorage(virDomainObjPtr vm,
 
     if (!reuse_external &&
         dd->store->type == VIR_STORAGE_TYPE_FILE &&
-        virStorageFileSupportsCreate(dd->store)) {
+        virStorageSourceSupportsCreate(dd->store)) {
 
         if (virFileExists(dd->store->path)) {
             virReportError(VIR_ERR_INVALID_ARG,
@@ -443,7 +443,7 @@ qemuBackupDiskPrepareOneStorage(virDomainObjPtr vm,
 
         dd->initialized = true;
 
-        if (virStorageFileCreate(dd->store) < 0) {
+        if (virStorageSourceCreate(dd->store) < 0) {
             virReportSystemError(errno,
                                  _("failed to create image file '%s'"),
                                  NULLSTR(dd->store->path));
diff --git a/src/qemu/qemu_block.c b/src/qemu/qemu_block.c
index fafa35071c..15019657e4 100644
--- a/src/qemu/qemu_block.c
+++ b/src/qemu/qemu_block.c
@@ -3426,15 +3426,15 @@ qemuBlockUpdateRelativeBacking(virDomainObjPtr vm,
         if (n->backingStore->relPath)
             break;
 
-        if (!virStorageFileSupportsBackingChainTraversal(n))
+        if (!virStorageSourceSupportsBackingChainTraversal(n))
             continue;
 
         if (qemuDomainStorageFileInit(driver, vm, n, topsrc) < 0)
             return -1;
 
-        rc = virStorageFileGetBackingStoreStr(n, &backingStoreStr);
+        rc = virStorageSourceGetBackingStoreStr(n, &backingStoreStr);
 
-        virStorageFileDeinit(n);
+        virStorageSourceDeinit(n);
 
         if (rc < 0)
             return rc;
diff --git a/src/qemu/qemu_domain.c b/src/qemu/qemu_domain.c
index 165321858e..0c078a9388 100644
--- a/src/qemu/qemu_domain.c
+++ b/src/qemu/qemu_domain.c
@@ -7160,7 +7160,7 @@ qemuDomainStorageFileInit(virQEMUDriverPtr driver,
 
     qemuDomainGetImageIds(cfg, vm, src, parent, &uid, &gid);
 
-    if (virStorageFileInitAs(src, uid, gid) < 0)
+    if (virStorageSourceInitAs(src, uid, gid) < 0)
         return -1;
 
     return 0;
@@ -7298,7 +7298,7 @@ qemuDomainDetermineDiskChain(virQEMUDriverPtr driver,
 
         if (!virFileExists(disksrc->path)) {
             if (report_broken)
-                virStorageFileReportBrokenChain(errno, disksrc, disksrc);
+                virStorageSourceReportBrokenChain(errno, disksrc, disksrc);
 
             return -1;
         }
@@ -7322,7 +7322,7 @@ qemuDomainDetermineDiskChain(virQEMUDriverPtr driver,
     /* skip to the end of the chain if there is any */
     while (virStorageSourceHasBacking(src)) {
         if (report_broken) {
-            int rv = virStorageFileSupportsAccess(src);
+            int rv = virStorageSourceSupportsAccess(src);
 
             if (rv < 0)
                 return -1;
@@ -7331,13 +7331,13 @@ qemuDomainDetermineDiskChain(virQEMUDriverPtr driver,
                 if (qemuDomainStorageFileInit(driver, vm, src, disksrc) < 0)
                     return -1;
 
-                if (virStorageFileAccess(src, F_OK) < 0) {
-                    virStorageFileReportBrokenChain(errno, src, disksrc);
-                    virStorageFileDeinit(src);
+                if (virStorageSourceAccess(src, F_OK) < 0) {
+                    virStorageSourceReportBrokenChain(errno, src, disksrc);
+                    virStorageSourceDeinit(src);
                     return -1;
                 }
 
-                virStorageFileDeinit(src);
+                virStorageSourceDeinit(src);
             }
         }
         src = src->backingStore;
@@ -7354,7 +7354,7 @@ qemuDomainDetermineDiskChain(virQEMUDriverPtr driver,
 
     qemuDomainGetImageIds(cfg, vm, src, disksrc, &uid, &gid);
 
-    if (virStorageFileGetMetadata(src, uid, gid, report_broken) < 0)
+    if (virStorageSourceGetMetadata(src, uid, gid, report_broken) < 0)
         return -1;
 
     for (n = src->backingStore; virStorageSourceIsBacking(n); n = n->backingStore) {
diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c
index 8048c86632..ed966cf7e3 100644
--- a/src/qemu/qemu_driver.c
+++ b/src/qemu/qemu_driver.c
@@ -253,20 +253,20 @@ qemuSecurityChownCallback(const virStorageSource *src,
         return 0;
     }
 
-    if ((rv = virStorageFileSupportsSecurityDriver(src)) <= 0)
+    if ((rv = virStorageSourceSupportsSecurityDriver(src)) <= 0)
         return rv;
 
     if (!(cpy = virStorageSourceCopy(src, false)))
         return -1;
 
     /* src file init reports errors, return -2 on failure */
-    if (virStorageFileInit(cpy) < 0)
+    if (virStorageSourceInit(cpy) < 0)
         return -2;
 
-    ret = virStorageFileChown(cpy, uid, gid);
+    ret = virStorageSourceChown(cpy, uid, gid);
 
     save_errno = errno;
-    virStorageFileDeinit(cpy);
+    virStorageSourceDeinit(cpy);
     errno = save_errno;
 
     return ret;
@@ -10620,7 +10620,7 @@ qemuDomainBlockPeek(virDomainPtr dom,
     if (qemuDomainStorageFileInit(driver, vm, disk->src, NULL) < 0)
         goto cleanup;
 
-    if ((nread = virStorageFileRead(disk->src, offset, size, &tmpbuf)) < 0) {
+    if ((nread = virStorageSourceRead(disk->src, offset, size, &tmpbuf)) < 0) {
         if (nread == -2) {
             virReportError(VIR_ERR_INTERNAL_ERROR,
                            _("storage file reading is not supported for "
@@ -10644,7 +10644,7 @@ qemuDomainBlockPeek(virDomainPtr dom,
 
  cleanup:
     if (disk)
-        virStorageFileDeinit(disk->src);
+        virStorageSourceDeinit(disk->src);
     virDomainObjEndAPI(&vm);
     return ret;
 }
@@ -10776,14 +10776,14 @@ qemuDomainStorageOpenStat(virQEMUDriverPtr driver,
             return -1;
         }
     } else {
-        if (skipInaccessible && virStorageFileSupportsBackingChainTraversal(src) <= 0)
+        if (skipInaccessible && virStorageSourceSupportsBackingChainTraversal(src) <= 0)
             return 0;
 
-        if (virStorageFileInitAs(src, cfg->user, cfg->group) < 0)
+        if (virStorageSourceInitAs(src, cfg->user, cfg->group) < 0)
             return -1;
 
-        if (virStorageFileStat(src, ret_sb) < 0) {
-            virStorageFileDeinit(src);
+        if (virStorageSourceStat(src, ret_sb) < 0) {
+            virStorageSourceDeinit(src);
             virReportSystemError(errno, _("failed to stat remote file '%s'"),
                                  NULLSTR(src->path));
             return -1;
@@ -10808,7 +10808,7 @@ qemuDomainStorageCloseStat(virStorageSourcePtr src,
     if (virStorageSourceIsLocalStorage(src))
         VIR_FORCE_CLOSE(*fd);
     else
-        virStorageFileDeinit(src);
+        virStorageSourceDeinit(src);
 }
 
 
@@ -10908,7 +10908,7 @@ qemuStorageLimitsRefresh(virQEMUDriverPtr driver,
             goto cleanup;
         }
     } else {
-        if ((len = virStorageFileRead(src, 0, VIR_STORAGE_MAX_HEADER, &buf)) < 0)
+        if ((len = virStorageSourceRead(src, 0, VIR_STORAGE_MAX_HEADER, &buf)) < 0)
             goto cleanup;
     }
 
@@ -14449,8 +14449,8 @@ qemuDomainBlockPullCommon(virDomainObjPtr vm,
 
     if (base &&
         (virStorageFileParseChainIndex(disk->dst, base, &baseIndex) < 0 ||
-         !(baseSource = virStorageFileChainLookup(disk->src, disk->src,
-                                                  base, baseIndex, NULL))))
+         !(baseSource = virStorageSourceChainLookup(disk->src, disk->src,
+                                                    base, baseIndex, NULL))))
         goto endjob;
 
     if (baseSource) {
@@ -14466,9 +14466,9 @@ qemuDomainBlockPullCommon(virDomainObjPtr vm,
                 qemuBlockUpdateRelativeBacking(vm, disk->src, disk->src) < 0)
                 goto endjob;
 
-            if (virStorageFileGetRelativeBackingPath(disk->src->backingStore,
-                                                     baseSource,
-                                                     &backingPath) < 0)
+            if (virStorageSourceGetRelativeBackingPath(disk->src->backingStore,
+                                                       baseSource,
+                                                       &backingPath) < 0)
                 goto endjob;
 
             if (!backingPath) {
@@ -14839,7 +14839,7 @@ qemuDomainBlockCopyValidateMirror(virStorageSourcePtr mirror,
     if (!virStorageSourceIsLocalStorage(mirror))
         return 0;
 
-    if (virStorageFileAccess(mirror, F_OK) < 0) {
+    if (virStorageSourceAccess(mirror, F_OK) < 0) {
         if (errno != ENOENT) {
             virReportSystemError(errno, "%s",
                                  _("unable to verify existence of "
@@ -14854,7 +14854,7 @@ qemuDomainBlockCopyValidateMirror(virStorageSourcePtr mirror,
             return -1;
         }
     } else {
-        if (virStorageFileStat(mirror, &st) < 0) {
+        if (virStorageSourceStat(mirror, &st) < 0) {
             virReportSystemError(errno,
                                  _("unable to stat block copy target '%s'"),
                                  mirror->path);
@@ -15058,9 +15058,9 @@ qemuDomainBlockCopyCommon(virDomainObjPtr vm,
         goto endjob;
     }
 
-    supports_access = virStorageFileSupportsAccess(mirror) == 1;
-    supports_create = virStorageFileSupportsCreate(mirror) == 1;
-    supports_detect = virStorageFileSupportsBackingChainTraversal(mirror) == 1;
+    supports_access = virStorageSourceSupportsAccess(mirror) == 1;
+    supports_create = virStorageSourceSupportsCreate(mirror) == 1;
+    supports_detect = virStorageSourceSupportsBackingChainTraversal(mirror) == 1;
 
     if (supports_access || supports_create || supports_detect) {
         if (qemuDomainStorageFileInit(driver, vm, mirror, NULL) < 0)
@@ -15104,7 +15104,7 @@ qemuDomainBlockCopyCommon(virDomainObjPtr vm,
      * required so that libvirt can properly label the image for access by qemu */
     if (!existing) {
         if (supports_create) {
-            if (virStorageFileCreate(mirror) < 0) {
+            if (virStorageSourceCreate(mirror) < 0) {
                 virReportSystemError(errno, "%s", _("failed to create copy target"));
                 goto endjob;
             }
@@ -15247,7 +15247,7 @@ qemuDomainBlockCopyCommon(virDomainObjPtr vm,
 
     /* Update vm in place to match changes.  */
     need_unlink = false;
-    virStorageFileDeinit(mirror);
+    virStorageSourceDeinit(mirror);
     disk->mirror = g_steal_pointer(&mirror);
     disk->mirrorJob = VIR_DOMAIN_BLOCK_JOB_TYPE_COPY;
     qemuBlockJobStarted(job, vm);
@@ -15266,9 +15266,9 @@ qemuDomainBlockCopyCommon(virDomainObjPtr vm,
         if (need_revoke)
             qemuDomainStorageSourceChainAccessRevoke(driver, vm, mirror);
     }
-    if (need_unlink && virStorageFileUnlink(mirror) < 0)
+    if (need_unlink && virStorageSourceUnlink(mirror) < 0)
         VIR_WARN("%s", _("unable to remove just-created copy target"));
-    virStorageFileDeinit(mirror);
+    virStorageSourceDeinit(mirror);
     qemuDomainObjEndJob(driver, vm);
     qemuBlockJobStartupFinalize(vm, job);
 
@@ -15541,9 +15541,9 @@ qemuDomainBlockCommit(virDomainPtr dom,
     if (!top || STREQ(top, disk->dst))
         topSource = disk->src;
     else if (virStorageFileParseChainIndex(disk->dst, top, &topIndex) < 0 ||
-             !(topSource = virStorageFileChainLookup(disk->src, NULL,
-                                                     top, topIndex,
-                                                     &top_parent)))
+             !(topSource = virStorageSourceChainLookup(disk->src, NULL,
+                                                       top, topIndex,
+                                                       &top_parent)))
         goto endjob;
 
     if (topSource == disk->src) {
@@ -15576,8 +15576,8 @@ qemuDomainBlockCommit(virDomainPtr dom,
     if (!base && (flags & VIR_DOMAIN_BLOCK_COMMIT_SHALLOW))
         baseSource = topSource->backingStore;
     else if (virStorageFileParseChainIndex(disk->dst, base, &baseIndex) < 0 ||
-             !(baseSource = virStorageFileChainLookup(disk->src, topSource,
-                                                      base, baseIndex, NULL)))
+             !(baseSource = virStorageSourceChainLookup(disk->src, topSource,
+                                                        base, baseIndex, NULL)))
         goto endjob;
 
     if ((flags & VIR_DOMAIN_BLOCK_COMMIT_SHALLOW) &&
@@ -15611,8 +15611,8 @@ qemuDomainBlockCommit(virDomainPtr dom,
             qemuBlockUpdateRelativeBacking(vm, top_parent, disk->src) < 0)
             goto endjob;
 
-        if (virStorageFileGetRelativeBackingPath(topSource, baseSource,
-                                                 &backingPath) < 0)
+        if (virStorageSourceGetRelativeBackingPath(topSource, baseSource,
+                                                   &backingPath) < 0)
             goto endjob;
 
         if (!backingPath) {
diff --git a/src/qemu/qemu_hotplug.c b/src/qemu/qemu_hotplug.c
index 99950a1360..882e5d2384 100644
--- a/src/qemu/qemu_hotplug.c
+++ b/src/qemu/qemu_hotplug.c
@@ -4375,8 +4375,8 @@ qemuDomainRemoveDiskDevice(virQEMUDriverPtr driver,
         VIR_DEBUG("Removing transient overlay '%s' of disk '%s'",
                   disk->src->path, disk->dst);
         if (qemuDomainStorageFileInit(driver, vm, disk->src, NULL) >= 0) {
-            virStorageFileUnlink(disk->src);
-            virStorageFileDeinit(disk->src);
+            virStorageSourceUnlink(disk->src);
+            virStorageSourceDeinit(disk->src);
         }
     }
 
diff --git a/src/qemu/qemu_process.c b/src/qemu/qemu_process.c
index 14e1f5d962..f87a3c0f60 100644
--- a/src/qemu/qemu_process.c
+++ b/src/qemu/qemu_process.c
@@ -7887,8 +7887,8 @@ void qemuProcessStop(virQEMUDriverPtr driver,
                 VIR_DEBUG("Removing transient overlay '%s' of disk '%s'",
                           disk->src->path, disk->dst);
                 if (qemuDomainStorageFileInit(driver, vm, disk->src, NULL) >= 0) {
-                    virStorageFileUnlink(disk->src);
-                    virStorageFileDeinit(disk->src);
+                    virStorageSourceUnlink(disk->src);
+                    virStorageSourceDeinit(disk->src);
                 }
             }
         }
diff --git a/src/qemu/qemu_snapshot.c b/src/qemu/qemu_snapshot.c
index 699090ae40..1c8b1a70f8 100644
--- a/src/qemu/qemu_snapshot.c
+++ b/src/qemu/qemu_snapshot.c
@@ -567,13 +567,13 @@ qemuSnapshotPrepareDiskExternal(virDomainObjPtr vm,
     }
 
     if (virStorageSourceIsLocalStorage(snapdisk->src)) {
-        if (virStorageFileInit(snapdisk->src) < 0)
+        if (virStorageSourceInit(snapdisk->src) < 0)
             return -1;
 
-        rc = virStorageFileStat(snapdisk->src, &st);
+        rc = virStorageSourceStat(snapdisk->src, &st);
         err = errno;
 
-        virStorageFileDeinit(snapdisk->src);
+        virStorageSourceDeinit(snapdisk->src);
 
         if (rc < 0) {
             if (err != ENOENT) {
@@ -867,13 +867,13 @@ qemuSnapshotDiskCleanup(qemuSnapshotDiskDataPtr data,
             }
 
             if (data[i].created &&
-                virStorageFileUnlink(data[i].src) < 0) {
+                virStorageSourceUnlink(data[i].src) < 0) {
                 VIR_WARN("Unable to remove just-created %s",
                          NULLSTR(data[i].src->path));
             }
 
             if (data[i].initialized)
-                virStorageFileDeinit(data[i].src);
+                virStorageSourceDeinit(data[i].src);
 
             if (data[i].prepared)
                 qemuDomainStorageSourceAccessRevoke(driver, vm, data[i].src);
@@ -1072,13 +1072,13 @@ qemuSnapshotDiskPrepareOne(virDomainObjPtr vm,
             return -1;
     }
 
-    supportsCreate = virStorageFileSupportsCreate(dd->src);
+    supportsCreate = virStorageSourceSupportsCreate(dd->src);
 
     /* relative backing store paths need to be updated so that relative
      * block commit still works. With blockdev we must update it when doing
      * commit anyways so it's skipped here */
     if (!blockdev &&
-        virStorageFileSupportsBackingChainTraversal(dd->src))
+        virStorageSourceSupportsBackingChainTraversal(dd->src))
         updateRelativeBacking = true;
 
     if (supportsCreate || updateRelativeBacking) {
@@ -1091,7 +1091,7 @@ qemuSnapshotDiskPrepareOne(virDomainObjPtr vm,
             if (updateRelativeBacking) {
                 g_autofree char *backingStoreStr = NULL;
 
-                if (virStorageFileGetBackingStoreStr(dd->src, &backingStoreStr) < 0)
+                if (virStorageSourceGetBackingStoreStr(dd->src, &backingStoreStr) < 0)
                     return -1;
                 if (backingStoreStr != NULL) {
                     if (virStorageFileIsRelative(backingStoreStr))
@@ -1101,7 +1101,7 @@ qemuSnapshotDiskPrepareOne(virDomainObjPtr vm,
         } else {
             /* pre-create the image file so that we can label it before handing it to qemu */
             if (supportsCreate && dd->src->type != VIR_STORAGE_TYPE_BLOCK) {
-                if (virStorageFileCreate(dd->src) < 0) {
+                if (virStorageSourceCreate(dd->src) < 0) {
                     virReportSystemError(errno, _("failed to create image file '%s'"),
                                          NULLSTR(dd->src->path));
                     return -1;
@@ -1251,7 +1251,7 @@ qemuSnapshotDiskUpdateSource(virDomainObjPtr vm,
 
     /* storage driver access won'd be needed */
     if (dd->initialized)
-        virStorageFileDeinit(dd->src);
+        virStorageSourceDeinit(dd->src);
 
     if (qemuSecurityMoveImageMetadata(driver, vm, dd->disk->src, dd->src) < 0)
         VIR_WARN("Unable to move disk metadata on vm %s", vm->def->name);
diff --git a/src/security/virt-aa-helper.c b/src/security/virt-aa-helper.c
index 6525baf193..f71fe6f23b 100644
--- a/src/security/virt-aa-helper.c
+++ b/src/security/virt-aa-helper.c
@@ -939,7 +939,7 @@ get_files(vahControl * ctl)
          *        so that the open could be re-tried as that user:group.
          */
         if (!virStorageSourceHasBacking(disk->src))
-            virStorageFileGetMetadata(disk->src, -1, -1, false);
+            virStorageSourceGetMetadata(disk->src, -1, -1, false);
 
          /* XXX should handle open errors more careful than just ignoring them.
          */
diff --git a/src/storage/storage_backend_gluster.c b/src/storage/storage_backend_gluster.c
index 554c76ddb4..8de0cb8a6b 100644
--- a/src/storage/storage_backend_gluster.c
+++ b/src/storage/storage_backend_gluster.c
@@ -272,8 +272,8 @@ virStorageBackendGlusterRefreshVol(virStorageBackendGlusterStatePtr state,
                                             &header)) < 0)
         goto cleanup;
 
-    if (!(meta = virStorageFileGetMetadataFromBuf(name, header, len,
-                                                  VIR_STORAGE_FILE_AUTO)))
+    if (!(meta = virStorageSourceGetMetadataFromBuf(name, header, len,
+                                                    VIR_STORAGE_FILE_AUTO)))
         goto cleanup;
 
     if (meta->backingStoreRaw) {
diff --git a/src/storage/storage_util.c b/src/storage/storage_util.c
index 10c04e1257..3d8de16341 100644
--- a/src/storage/storage_util.c
+++ b/src/storage/storage_util.c
@@ -3427,9 +3427,9 @@ storageBackendProbeTarget(virStorageSourcePtr target,
         }
     }
 
-    if (!(meta = virStorageFileGetMetadataFromFD(target->path,
-                                                 fd,
-                                                 VIR_STORAGE_FILE_AUTO)))
+    if (!(meta = virStorageSourceGetMetadataFromFD(target->path,
+                                                   fd,
+                                                   VIR_STORAGE_FILE_AUTO)))
         return -1;
 
     if (meta->backingStoreRaw) {
diff --git a/src/storage_file/storage_source.c b/src/storage_file/storage_source.c
index ffc7fe8ea5..71bff1e55e 100644
--- a/src/storage_file/storage_source.c
+++ b/src/storage_file/storage_source.c
@@ -46,8 +46,8 @@ VIR_LOG_INIT("storage_source");
 
 
 static virStorageSourcePtr
-virStorageFileMetadataNew(const char *path,
-                          int format)
+virStorageSourceMetadataNew(const char *path,
+                            int format)
 {
     g_autoptr(virStorageSource) def = virStorageSourceNew();
 
@@ -61,7 +61,7 @@ virStorageFileMetadataNew(const char *path,
 
 
 /**
- * virStorageFileGetMetadataFromBuf:
+ * virStorageSourceGetMetadataFromBuf:
  * @path: name of file, for error messages
  * @buf: header bytes from @path
  * @len: length of @buf
@@ -83,14 +83,14 @@ virStorageFileMetadataNew(const char *path,
  * Caller MUST free the result after use via virObjectUnref.
  */
 virStorageSourcePtr
-virStorageFileGetMetadataFromBuf(const char *path,
-                                 char *buf,
-                                 size_t len,
-                                 int format)
+virStorageSourceGetMetadataFromBuf(const char *path,
+                                   char *buf,
+                                   size_t len,
+                                   int format)
 {
     virStorageSourcePtr ret = NULL;
 
-    if (!(ret = virStorageFileMetadataNew(path, format)))
+    if (!(ret = virStorageSourceMetadataNew(path, format)))
         return NULL;
 
     if (virStorageFileProbeGetMetadata(ret, buf, len) < 0) {
@@ -103,7 +103,7 @@ virStorageFileGetMetadataFromBuf(const char *path,
 
 
 /**
- * virStorageFileGetMetadataFromFD:
+ * virStorageSourceGetMetadataFromFD:
  *
  * Extract metadata about the storage volume with the specified
  * image format. If image format is VIR_STORAGE_FILE_AUTO, it
@@ -116,9 +116,9 @@ virStorageFileGetMetadataFromBuf(const char *path,
  * Caller MUST free the result after use via virObjectUnref.
  */
 virStorageSourcePtr
-virStorageFileGetMetadataFromFD(const char *path,
-                                int fd,
-                                int format)
+virStorageSourceGetMetadataFromFD(const char *path,
+                                  int fd,
+                                  int format)
 
 {
     ssize_t len = VIR_STORAGE_MAX_HEADER;
@@ -132,7 +132,7 @@ virStorageFileGetMetadataFromFD(const char *path,
         return NULL;
     }
 
-    if (!(meta = virStorageFileMetadataNew(path, format)))
+    if (!(meta = virStorageSourceMetadataNew(path, format)))
         return NULL;
 
     if (S_ISDIR(sb.st_mode)) {
@@ -177,11 +177,11 @@ virStorageFileGetMetadataFromFD(const char *path,
  * found.
  */
 virStorageSourcePtr
-virStorageFileChainLookup(virStorageSourcePtr chain,
-                          virStorageSourcePtr startFrom,
-                          const char *name,
-                          unsigned int idx,
-                          virStorageSourcePtr *parent)
+virStorageSourceChainLookup(virStorageSourcePtr chain,
+                            virStorageSourcePtr startFrom,
+                            const char *name,
+                            unsigned int idx,
+                            virStorageSourcePtr *parent)
 {
     virStorageSourcePtr prev;
     const char *start = chain->path;
@@ -1794,8 +1794,8 @@ virStorageSourceUpdateCapacity(virStorageSourcePtr src,
 
     if (format == VIR_STORAGE_FILE_RAW && !src->encryption) {
         src->capacity = src->physical;
-    } else if ((meta = virStorageFileGetMetadataFromBuf(src->path, buf,
-                                                        len, format))) {
+    } else if ((meta = virStorageSourceGetMetadataFromBuf(src->path, buf,
+                                                          len, format))) {
         src->capacity = meta->capacity ? meta->capacity : src->physical;
         if (src->encryption && meta->encryption)
             src->encryption->payload_offset = meta->encryption->payload_offset;
@@ -1811,7 +1811,7 @@ virStorageSourceUpdateCapacity(virStorageSourcePtr src,
 
 
 /**
- * virStorageFileRemoveLastPathComponent:
+ * virStorageSourceRemoveLastPathComponent:
  *
  * @path: Path string to remove the last component from
  *
@@ -1820,7 +1820,7 @@ virStorageSourceUpdateCapacity(virStorageSourcePtr src,
  * responsible to free the returned string.
  */
 static char *
-virStorageFileRemoveLastPathComponent(const char *path)
+virStorageSourceRemoveLastPathComponent(const char *path)
 {
     char *ret;
 
@@ -1833,7 +1833,7 @@ virStorageFileRemoveLastPathComponent(const char *path)
 
 
 /*
- * virStorageFileGetRelativeBackingPath:
+ * virStorageSourceGetRelativeBackingPath:
  *
  * Resolve relative path to be written to the overlay of @top image when
  * collapsing the backing chain between @top and @base.
@@ -1841,9 +1841,9 @@ virStorageFileRemoveLastPathComponent(const char *path)
  * Returns 0 on success; 1 if backing chain isn't relative and -1 on error.
  */
 int
-virStorageFileGetRelativeBackingPath(virStorageSourcePtr top,
-                                     virStorageSourcePtr base,
-                                     char **relpath)
+virStorageSourceGetRelativeBackingPath(virStorageSourcePtr top,
+                                       virStorageSourcePtr base,
+                                       char **relpath)
 {
     virStorageSourcePtr next;
     g_autofree char *tmp = NULL;
@@ -1855,7 +1855,7 @@ virStorageFileGetRelativeBackingPath(virStorageSourcePtr top,
         if (!next->relPath)
             return 1;
 
-        if (!(tmp = virStorageFileRemoveLastPathComponent(path)))
+        if (!(tmp = virStorageSourceRemoveLastPathComponent(path)))
             return -1;
 
         VIR_FREE(path);
@@ -1881,14 +1881,14 @@ virStorageFileGetRelativeBackingPath(virStorageSourcePtr top,
 
 
 static bool
-virStorageFileIsInitialized(const virStorageSource *src)
+virStorageSourceIsInitialized(const virStorageSource *src)
 {
     return src && src->drv;
 }
 
 
 /**
- * virStorageFileGetBackendForSupportCheck:
+ * virStorageSourceGetBackendForSupportCheck:
  * @src: storage source to check support for
  * @backend: pointer to the storage backend for @src if it's supported
  *
@@ -1896,8 +1896,8 @@ virStorageFileIsInitialized(const virStorageSource *src)
  * 1 if it is supported and -1 on error with an error reported.
  */
 static int
-virStorageFileGetBackendForSupportCheck(const virStorageSource *src,
-                                        virStorageFileBackendPtr *backend)
+virStorageSourceGetBackendForSupportCheck(const virStorageSource *src,
+                                          virStorageFileBackendPtr *backend)
 {
     int actualType;
 
@@ -1926,12 +1926,12 @@ virStorageFileGetBackendForSupportCheck(const virStorageSource *src,
 
 
 int
-virStorageFileSupportsBackingChainTraversal(const virStorageSource *src)
+virStorageSourceSupportsBackingChainTraversal(const virStorageSource *src)
 {
     virStorageFileBackendPtr backend;
     int rv;
 
-    if ((rv = virStorageFileGetBackendForSupportCheck(src, &backend)) < 1)
+    if ((rv = virStorageSourceGetBackendForSupportCheck(src, &backend)) < 1)
         return rv;
 
     return backend->storageFileGetUniqueIdentifier &&
@@ -1941,7 +1941,7 @@ virStorageFileSupportsBackingChainTraversal(const virStorageSource *src)
 
 
 /**
- * virStorageFileSupportsSecurityDriver:
+ * virStorageSourceSupportsSecurityDriver:
  *
  * @src: a storage file structure
  *
@@ -1949,12 +1949,12 @@ virStorageFileSupportsBackingChainTraversal(const virStorageSource *src)
  * driver to perform labelling
  */
 int
-virStorageFileSupportsSecurityDriver(const virStorageSource *src)
+virStorageSourceSupportsSecurityDriver(const virStorageSource *src)
 {
     virStorageFileBackendPtr backend;
     int rv;
 
-    if ((rv = virStorageFileGetBackendForSupportCheck(src, &backend)) < 1)
+    if ((rv = virStorageSourceGetBackendForSupportCheck(src, &backend)) < 1)
         return rv;
 
     return backend->storageFileChown ? 1 : 0;
@@ -1962,7 +1962,7 @@ virStorageFileSupportsSecurityDriver(const virStorageSource *src)
 
 
 /**
- * virStorageFileSupportsAccess:
+ * virStorageSourceSupportsAccess:
  *
  * @src: a storage file structure
  *
@@ -1970,12 +1970,12 @@ virStorageFileSupportsSecurityDriver(const virStorageSource *src)
  * for the given vm.
  */
 int
-virStorageFileSupportsAccess(const virStorageSource *src)
+virStorageSourceSupportsAccess(const virStorageSource *src)
 {
     virStorageFileBackendPtr backend;
     int rv;
 
-    if ((rv = virStorageFileGetBackendForSupportCheck(src, &backend)) < 1)
+    if ((rv = virStorageSourceGetBackendForSupportCheck(src, &backend)) < 1)
         return rv;
 
     return backend->storageFileAccess ? 1 : 0;
@@ -1983,19 +1983,19 @@ virStorageFileSupportsAccess(const virStorageSource *src)
 
 
 /**
- * virStorageFileSupportsCreate:
+ * virStorageSourceSupportsCreate:
  * @src: a storage file structure
  *
  * Check if the storage driver supports creating storage described by @src
- * via virStorageFileCreate.
+ * via virStorageSourceCreate.
  */
 int
-virStorageFileSupportsCreate(const virStorageSource *src)
+virStorageSourceSupportsCreate(const virStorageSource *src)
 {
     virStorageFileBackendPtr backend;
     int rv;
 
-    if ((rv = virStorageFileGetBackendForSupportCheck(src, &backend)) < 1)
+    if ((rv = virStorageSourceGetBackendForSupportCheck(src, &backend)) < 1)
         return rv;
 
     return backend->storageFileCreate ? 1 : 0;
@@ -2003,11 +2003,11 @@ virStorageFileSupportsCreate(const virStorageSource *src)
 
 
 void
-virStorageFileDeinit(virStorageSourcePtr src)
+virStorageSourceDeinit(virStorageSourcePtr src)
 {
     virStorageDriverDataPtr drv = NULL;
 
-    if (!virStorageFileIsInitialized(src))
+    if (!virStorageSourceIsInitialized(src))
         return;
 
     drv = src->drv;
@@ -2021,7 +2021,7 @@ virStorageFileDeinit(virStorageSourcePtr src)
 
 
 /**
- * virStorageFileInitAs:
+ * virStorageSourceInitAs:
  *
  * @src: storage source definition
  * @uid: uid used to access the file, or -1 for current uid
@@ -2034,8 +2034,8 @@ virStorageFileDeinit(virStorageSourcePtr src)
  * initialization failed. Libvirt error is reported.
  */
 int
-virStorageFileInitAs(virStorageSourcePtr src,
-                     uid_t uid, gid_t gid)
+virStorageSourceInitAs(virStorageSourcePtr src,
+                       uid_t uid, gid_t gid)
 {
     int actualType = virStorageSourceGetActualType(src);
     virStorageDriverDataPtr drv = g_new0(virStorageDriverData, 1);
@@ -2071,20 +2071,20 @@ virStorageFileInitAs(virStorageSourcePtr src,
 
 
 /**
- * virStorageFileInit:
+ * virStorageSourceInit:
  *
- * See virStorageFileInitAs. The file is initialized to be accessed by the
+ * See virStorageSourceInitAs. The file is initialized to be accessed by the
  * current user.
  */
 int
-virStorageFileInit(virStorageSourcePtr src)
+virStorageSourceInit(virStorageSourcePtr src)
 {
-    return virStorageFileInitAs(src, -1, -1);
+    return virStorageSourceInitAs(src, -1, -1);
 }
 
 
 /**
- * virStorageFileCreate: Creates an empty storage file via storage driver
+ * virStorageSourceCreate: Creates an empty storage file via storage driver
  *
  * @src: file structure pointing to the file
  *
@@ -2092,12 +2092,12 @@ virStorageFileInit(virStorageSourcePtr src)
  * -1 on other failure. Errno is set in case of failure.
  */
 int
-virStorageFileCreate(virStorageSourcePtr src)
+virStorageSourceCreate(virStorageSourcePtr src)
 {
     virStorageDriverDataPtr drv = NULL;
     int ret;
 
-    if (!virStorageFileIsInitialized(src)) {
+    if (!virStorageSourceIsInitialized(src)) {
         errno = ENOSYS;
         return -2;
     }
@@ -2119,7 +2119,7 @@ virStorageFileCreate(virStorageSourcePtr src)
 
 
 /**
- * virStorageFileUnlink: Unlink storage file via storage driver
+ * virStorageSourceUnlink: Unlink storage file via storage driver
  *
  * @src: file structure pointing to the file
  *
@@ -2129,12 +2129,12 @@ virStorageFileCreate(virStorageSourcePtr src)
  * -1 on other failure. Errno is set in case of failure.
  */
 int
-virStorageFileUnlink(virStorageSourcePtr src)
+virStorageSourceUnlink(virStorageSourcePtr src)
 {
     virStorageDriverDataPtr drv = NULL;
     int ret;
 
-    if (!virStorageFileIsInitialized(src)) {
+    if (!virStorageSourceIsInitialized(src)) {
         errno = ENOSYS;
         return -2;
     }
@@ -2156,7 +2156,7 @@ virStorageFileUnlink(virStorageSourcePtr src)
 
 
 /**
- * virStorageFileStat: returns stat struct of a file via storage driver
+ * virStorageSourceStat: returns stat struct of a file via storage driver
  *
  * @src: file structure pointing to the file
  * @stat: stat structure to return data
@@ -2165,13 +2165,13 @@ virStorageFileUnlink(virStorageSourcePtr src)
  * -1 on other failure. Errno is set in case of failure.
 */
 int
-virStorageFileStat(virStorageSourcePtr src,
-                   struct stat *st)
+virStorageSourceStat(virStorageSourcePtr src,
+                     struct stat *st)
 {
     virStorageDriverDataPtr drv = NULL;
     int ret;
 
-    if (!virStorageFileIsInitialized(src)) {
+    if (!virStorageSourceIsInitialized(src)) {
         errno = ENOSYS;
         return -2;
     }
@@ -2193,7 +2193,7 @@ virStorageFileStat(virStorageSourcePtr src,
 
 
 /**
- * virStorageFileRead: read bytes from a file into a buffer
+ * virStorageSourceRead: read bytes from a file into a buffer
  *
  * @src: file structure pointing to the file
  * @offset: number of bytes to skip in the storage file
@@ -2205,15 +2205,15 @@ virStorageFileStat(virStorageSourcePtr src,
  * Libvirt error is reported on failure.
  */
 ssize_t
-virStorageFileRead(virStorageSourcePtr src,
-                   size_t offset,
-                   size_t len,
-                   char **buf)
+virStorageSourceRead(virStorageSourcePtr src,
+                     size_t offset,
+                     size_t len,
+                     char **buf)
 {
     virStorageDriverDataPtr drv = NULL;
     ssize_t ret;
 
-    if (!virStorageFileIsInitialized(src)) {
+    if (!virStorageSourceIsInitialized(src)) {
         virReportError(VIR_ERR_INTERNAL_ERROR, "%s",
                        _("storage file backend not initialized"));
         return -1;
@@ -2234,7 +2234,7 @@ virStorageFileRead(virStorageSourcePtr src,
 
 
 /*
- * virStorageFileGetUniqueIdentifier: Get a unique string describing the volume
+ * virStorageSourceGetUniqueIdentifier: Get a unique string describing the volume
  *
  * @src: file structure pointing to the file
  *
@@ -2242,11 +2242,11 @@ virStorageFileRead(virStorageSourcePtr src,
  * The string shall not be freed and is valid until the storage file is
  * deinitialized. Returns NULL on error and sets a libvirt error code */
 const char *
-virStorageFileGetUniqueIdentifier(virStorageSourcePtr src)
+virStorageSourceGetUniqueIdentifier(virStorageSourcePtr src)
 {
     virStorageDriverDataPtr drv = NULL;
 
-    if (!virStorageFileIsInitialized(src)) {
+    if (!virStorageSourceIsInitialized(src)) {
         virReportError(VIR_ERR_INTERNAL_ERROR, "%s",
                        _("storage file backend not initialized"));
         return NULL;
@@ -2268,7 +2268,7 @@ virStorageFileGetUniqueIdentifier(virStorageSourcePtr src)
 
 
 /**
- * virStorageFileAccess: Check accessibility of a storage file
+ * virStorageSourceAccess: Check accessibility of a storage file
  *
  * @src: storage file to check access permissions
  * @mode: accessibility check options (see man 2 access)
@@ -2278,12 +2278,12 @@ virStorageFileGetUniqueIdentifier(virStorageSourcePtr src)
  * by libvirt storage backend.
  */
 int
-virStorageFileAccess(virStorageSourcePtr src,
-                     int mode)
+virStorageSourceAccess(virStorageSourcePtr src,
+                       int mode)
 {
     virStorageDriverDataPtr drv = NULL;
 
-    if (!virStorageFileIsInitialized(src)) {
+    if (!virStorageSourceIsInitialized(src)) {
         errno = ENOSYS;
         return -2;
     }
@@ -2300,7 +2300,7 @@ virStorageFileAccess(virStorageSourcePtr src,
 
 
 /**
- * virStorageFileChown: Change owner of a storage file
+ * virStorageSourceChown: Change owner of a storage file
  *
  * @src: storage file to change owner of
  * @uid: new owner id
@@ -2311,13 +2311,13 @@ virStorageFileAccess(virStorageSourcePtr src,
  * by libvirt storage backend.
  */
 int
-virStorageFileChown(const virStorageSource *src,
-                    uid_t uid,
-                    gid_t gid)
+virStorageSourceChown(const virStorageSource *src,
+                      uid_t uid,
+                      gid_t gid)
 {
     virStorageDriverDataPtr drv = NULL;
 
-    if (!virStorageFileIsInitialized(src)) {
+    if (!virStorageSourceIsInitialized(src)) {
         errno = ENOSYS;
         return -2;
     }
@@ -2337,7 +2337,7 @@ virStorageFileChown(const virStorageSource *src,
 
 
 /**
- * virStorageFileReportBrokenChain:
+ * virStorageSourceReportBrokenChain:
  *
  * @errcode: errno when accessing @src
  * @src: inaccessible file in the backing chain of @parent
@@ -2347,9 +2347,9 @@ virStorageFileChown(const virStorageSource *src,
  * for @parent.
  */
 void
-virStorageFileReportBrokenChain(int errcode,
-                                virStorageSourcePtr src,
-                                virStorageSourcePtr parent)
+virStorageSourceReportBrokenChain(int errcode,
+                                  virStorageSourcePtr src,
+                                  virStorageSourcePtr parent)
 {
     if (src->drv) {
         virStorageDriverDataPtr drv = src->drv;
@@ -2383,27 +2383,27 @@ virStorageFileReportBrokenChain(int errcode,
 
 
 static int
-virStorageFileGetMetadataRecurseReadHeader(virStorageSourcePtr src,
-                                           virStorageSourcePtr parent,
-                                           uid_t uid,
-                                           gid_t gid,
-                                           char **buf,
-                                           size_t *headerLen,
-                                           GHashTable *cycle)
+virStorageSourceGetMetadataRecurseReadHeader(virStorageSourcePtr src,
+                                             virStorageSourcePtr parent,
+                                             uid_t uid,
+                                             gid_t gid,
+                                             char **buf,
+                                             size_t *headerLen,
+                                             GHashTable *cycle)
 {
     int ret = -1;
     const char *uniqueName;
     ssize_t len;
 
-    if (virStorageFileInitAs(src, uid, gid) < 0)
+    if (virStorageSourceInitAs(src, uid, gid) < 0)
         return -1;
 
-    if (virStorageFileAccess(src, F_OK) < 0) {
-        virStorageFileReportBrokenChain(errno, src, parent);
+    if (virStorageSourceAccess(src, F_OK) < 0) {
+        virStorageSourceReportBrokenChain(errno, src, parent);
         goto cleanup;
     }
 
-    if (!(uniqueName = virStorageFileGetUniqueIdentifier(src)))
+    if (!(uniqueName = virStorageSourceGetUniqueIdentifier(src)))
         goto cleanup;
 
     if (virHashHasEntry(cycle, uniqueName)) {
@@ -2416,26 +2416,26 @@ virStorageFileGetMetadataRecurseReadHeader(virStorageSourcePtr src,
     if (virHashAddEntry(cycle, uniqueName, NULL) < 0)
         goto cleanup;
 
-    if ((len = virStorageFileRead(src, 0, VIR_STORAGE_MAX_HEADER, buf)) < 0)
+    if ((len = virStorageSourceRead(src, 0, VIR_STORAGE_MAX_HEADER, buf)) < 0)
         goto cleanup;
 
     *headerLen = len;
     ret = 0;
 
  cleanup:
-    virStorageFileDeinit(src);
+    virStorageSourceDeinit(src);
     return ret;
 }
 
 
-/* Recursive workhorse for virStorageFileGetMetadata.  */
+/* Recursive workhorse for virStorageSourceGetMetadata.  */
 static int
-virStorageFileGetMetadataRecurse(virStorageSourcePtr src,
-                                 virStorageSourcePtr parent,
-                                 uid_t uid, gid_t gid,
-                                 bool report_broken,
-                                 GHashTable *cycle,
-                                 unsigned int depth)
+virStorageSourceGetMetadataRecurse(virStorageSourcePtr src,
+                                   virStorageSourcePtr parent,
+                                   uid_t uid, gid_t gid,
+                                   bool report_broken,
+                                   GHashTable *cycle,
+                                   unsigned int depth)
 {
     virStorageFileFormat orig_format = src->format;
     size_t headerLen;
@@ -2451,7 +2451,7 @@ virStorageFileGetMetadataRecurse(virStorageSourcePtr src,
         src->format = VIR_STORAGE_FILE_AUTO;
 
     /* exit if we can't load information about the current image */
-    rv = virStorageFileSupportsBackingChainTraversal(src);
+    rv = virStorageSourceSupportsBackingChainTraversal(src);
     if (rv <= 0) {
         if (orig_format == VIR_STORAGE_FILE_AUTO)
             return -2;
@@ -2459,8 +2459,8 @@ virStorageFileGetMetadataRecurse(virStorageSourcePtr src,
         return rv;
     }
 
-    if (virStorageFileGetMetadataRecurseReadHeader(src, parent, uid, gid,
-                                                   &buf, &headerLen, cycle) < 0)
+    if (virStorageSourceGetMetadataRecurseReadHeader(src, parent, uid, gid,
+                                                     &buf, &headerLen, cycle) < 0)
         return -1;
 
     if (virStorageFileProbeGetMetadata(src, buf, headerLen) < 0)
@@ -2484,10 +2484,10 @@ virStorageFileGetMetadataRecurse(virStorageSourcePtr src,
         if (rv == 1)
             return 0;
 
-        if ((rv = virStorageFileGetMetadataRecurse(backingStore, parent,
-                                                   uid, gid,
-                                                   report_broken,
-                                                   cycle, depth + 1)) < 0) {
+        if ((rv = virStorageSourceGetMetadataRecurse(backingStore, parent,
+                                                     uid, gid,
+                                                     report_broken,
+                                                     cycle, depth + 1)) < 0) {
             if (!report_broken)
                 return 0;
 
@@ -2513,7 +2513,7 @@ virStorageFileGetMetadataRecurse(virStorageSourcePtr src,
 
 
 /**
- * virStorageFileGetMetadata:
+ * virStorageSourceGetMetadata:
  *
  * Extract metadata about the storage volume with the specified
  * image format. If image format is VIR_STORAGE_FILE_AUTO, it
@@ -2534,9 +2534,9 @@ virStorageFileGetMetadataRecurse(virStorageSourcePtr src,
  * Caller MUST free result after use via virObjectUnref.
  */
 int
-virStorageFileGetMetadata(virStorageSourcePtr src,
-                          uid_t uid, gid_t gid,
-                          bool report_broken)
+virStorageSourceGetMetadata(virStorageSourcePtr src,
+                            uid_t uid, gid_t gid,
+                            bool report_broken)
 {
     GHashTable *cycle = NULL;
     virStorageType actualType = virStorageSourceGetActualType(src);
@@ -2556,8 +2556,8 @@ virStorageFileGetMetadata(virStorageSourcePtr src,
             src->format = VIR_STORAGE_FILE_RAW;
     }
 
-    ret = virStorageFileGetMetadataRecurse(src, src, uid, gid,
-                                           report_broken, cycle, 1);
+    ret = virStorageSourceGetMetadataRecurse(src, src, uid, gid,
+                                             report_broken, cycle, 1);
 
     virHashFree(cycle);
     return ret;
@@ -2565,7 +2565,7 @@ virStorageFileGetMetadata(virStorageSourcePtr src,
 
 
 /**
- * virStorageFileGetBackingStoreStr:
+ * virStorageSourceGetBackingStoreStr:
  * @src: storage object
  *
  * Extracts the backing store string as stored in the storage volume described
@@ -2574,8 +2574,8 @@ virStorageFileGetMetadata(virStorageSourcePtr src,
  * returned.
  */
 int
-virStorageFileGetBackingStoreStr(virStorageSourcePtr src,
-                                 char **backing)
+virStorageSourceGetBackingStoreStr(virStorageSourcePtr src,
+                                   char **backing)
 {
     ssize_t headerLen;
     int rv;
@@ -2585,19 +2585,19 @@ virStorageFileGetBackingStoreStr(virStorageSourcePtr src,
     *backing = NULL;
 
     /* exit if we can't load information about the current image */
-    if (!virStorageFileSupportsBackingChainTraversal(src))
+    if (!virStorageSourceSupportsBackingChainTraversal(src))
         return 0;
 
-    rv = virStorageFileAccess(src, F_OK);
+    rv = virStorageSourceAccess(src, F_OK);
     if (rv == -2)
         return 0;
     if (rv < 0) {
-        virStorageFileReportBrokenChain(errno, src, src);
+        virStorageSourceReportBrokenChain(errno, src, src);
         return -1;
     }
 
-    if ((headerLen = virStorageFileRead(src, 0, VIR_STORAGE_MAX_HEADER,
-                                        &buf)) < 0) {
+    if ((headerLen = virStorageSourceRead(src, 0, VIR_STORAGE_MAX_HEADER,
+                                          &buf)) < 0) {
         if (headerLen == -2)
             return 0;
         return -1;
diff --git a/src/storage_file/storage_source.h b/src/storage_file/storage_source.h
index 5d6ad4606d..480333d37a 100644
--- a/src/storage_file/storage_source.h
+++ b/src/storage_file/storage_source.h
@@ -28,23 +28,23 @@
 #endif
 
 virStorageSourcePtr
-virStorageFileGetMetadataFromFD(const char *path,
-                                int fd,
-                                int format);
+virStorageSourceGetMetadataFromFD(const char *path,
+                                  int fd,
+                                  int format);
 
 virStorageSourcePtr
-virStorageFileGetMetadataFromBuf(const char *path,
-                                 char *buf,
-                                 size_t len,
-                                 int format)
+virStorageSourceGetMetadataFromBuf(const char *path,
+                                   char *buf,
+                                   size_t len,
+                                   int format)
     ATTRIBUTE_NONNULL(1) ATTRIBUTE_NONNULL(2);
 
 virStorageSourcePtr
-virStorageFileChainLookup(virStorageSourcePtr chain,
-                          virStorageSourcePtr startFrom,
-                          const char *name,
-                          unsigned int idx,
-                          virStorageSourcePtr *parent)
+virStorageSourceChainLookup(virStorageSourcePtr chain,
+                            virStorageSourcePtr startFrom,
+                            const char *name,
+                            unsigned int idx,
+                            virStorageSourcePtr *parent)
     ATTRIBUTE_NONNULL(1);
 
 int
@@ -72,9 +72,9 @@ virStorageSourceParseRBDColonString(const char *rbdstr,
     ATTRIBUTE_NONNULL(1) ATTRIBUTE_NONNULL(2);
 
 int
-virStorageFileGetRelativeBackingPath(virStorageSourcePtr top,
-                                     virStorageSourcePtr base,
-                                     char **relpath)
+virStorageSourceGetRelativeBackingPath(virStorageSourcePtr top,
+                                       virStorageSourcePtr base,
+                                       char **relpath)
     ATTRIBUTE_NONNULL(1) ATTRIBUTE_NONNULL(2) ATTRIBUTE_NONNULL(3);
 
 int
@@ -82,67 +82,67 @@ virStorageSourceNewFromBackingAbsolute(const char *path,
                                        virStorageSourcePtr *src);
 
 int
-virStorageFileInit(virStorageSourcePtr src);
+virStorageSourceInit(virStorageSourcePtr src);
 
 int
-virStorageFileInitAs(virStorageSourcePtr src,
-                     uid_t uid, gid_t gid);
+virStorageSourceInitAs(virStorageSourcePtr src,
+                       uid_t uid, gid_t gid);
 
 void
-virStorageFileDeinit(virStorageSourcePtr src);
+virStorageSourceDeinit(virStorageSourcePtr src);
 
 int
-virStorageFileCreate(virStorageSourcePtr src);
+virStorageSourceCreate(virStorageSourcePtr src);
 
 int
-virStorageFileUnlink(virStorageSourcePtr src);
+virStorageSourceUnlink(virStorageSourcePtr src);
 
 int
-virStorageFileStat(virStorageSourcePtr src,
-                   struct stat *st);
+virStorageSourceStat(virStorageSourcePtr src,
+                     struct stat *st);
 
 ssize_t
-virStorageFileRead(virStorageSourcePtr src,
-                   size_t offset,
-                   size_t len,
-                   char **buf);
+virStorageSourceRead(virStorageSourcePtr src,
+                     size_t offset,
+                     size_t len,
+                     char **buf);
 
 const char *
-virStorageFileGetUniqueIdentifier(virStorageSourcePtr src);
+virStorageSourceGetUniqueIdentifier(virStorageSourcePtr src);
 
 int
-virStorageFileAccess(virStorageSourcePtr src,
-                     int mode);
+virStorageSourceAccess(virStorageSourcePtr src,
+                       int mode);
 
 int
-virStorageFileChown(const virStorageSource *src,
-                    uid_t uid,
-                    gid_t gid);
+virStorageSourceChown(const virStorageSource *src,
+                      uid_t uid,
+                      gid_t gid);
 
 int
-virStorageFileSupportsSecurityDriver(const virStorageSource *src);
+virStorageSourceSupportsSecurityDriver(const virStorageSource *src);
 
 int
-virStorageFileSupportsAccess(const virStorageSource *src);
+virStorageSourceSupportsAccess(const virStorageSource *src);
 
 int
-virStorageFileSupportsCreate(const virStorageSource *src);
+virStorageSourceSupportsCreate(const virStorageSource *src);
 
 int
-virStorageFileSupportsBackingChainTraversal(const virStorageSource *src);
+virStorageSourceSupportsBackingChainTraversal(const virStorageSource *src);
 
 int
-virStorageFileGetMetadata(virStorageSourcePtr src,
-                          uid_t uid, gid_t gid,
-                          bool report_broken)
+virStorageSourceGetMetadata(virStorageSourcePtr src,
+                            uid_t uid, gid_t gid,
+                            bool report_broken)
     ATTRIBUTE_NONNULL(1);
 
 int
-virStorageFileGetBackingStoreStr(virStorageSourcePtr src,
-                                 char **backing)
+virStorageSourceGetBackingStoreStr(virStorageSourcePtr src,
+                                   char **backing)
     ATTRIBUTE_NONNULL(1) ATTRIBUTE_NONNULL(2);
 
 void
-virStorageFileReportBrokenChain(int errcode,
-                                virStorageSourcePtr src,
-                                virStorageSourcePtr parent);
+virStorageSourceReportBrokenChain(int errcode,
+                                  virStorageSourcePtr src,
+                                  virStorageSourcePtr parent);
diff --git a/tests/virstoragetest.c b/tests/virstoragetest.c
index 5c2f211557..0e168ce730 100644
--- a/tests/virstoragetest.c
+++ b/tests/virstoragetest.c
@@ -101,7 +101,7 @@ testStorageFileGetMetadata(const char *path,
 
     def->path = g_strdup(path);
 
-    if (virStorageFileGetMetadata(def, uid, gid, true) < 0)
+    if (virStorageSourceGetMetadata(def, uid, gid, true) < 0)
         return NULL;
 
     return g_steal_pointer(&def);
@@ -366,9 +366,9 @@ testStorageLookup(const void *args)
     }
 
      /* Test twice to ensure optional parameter doesn't cause NULL deref. */
-    result = virStorageFileChainLookup(data->chain, data->from,
-                                       idx ? NULL : data->name,
-                                       idx, NULL);
+    result = virStorageSourceChainLookup(data->chain, data->from,
+                                         idx ? NULL : data->name,
+                                         idx, NULL);
 
     if (!data->expResult) {
         if (virGetLastErrorCode() == VIR_ERR_OK) {
@@ -395,8 +395,8 @@ testStorageLookup(const void *args)
         ret = -1;
     }
 
-    result = virStorageFileChainLookup(data->chain, data->from,
-                                       data->name, idx, &actualParent);
+    result = virStorageSourceChainLookup(data->chain, data->from,
+                                         data->name, idx, &actualParent);
     if (!data->expResult)
         virResetLastError();
 
@@ -552,9 +552,9 @@ testPathRelative(const void *args)
     const struct testPathRelativeBacking *data = args;
     g_autofree char *actual = NULL;
 
-    if (virStorageFileGetRelativeBackingPath(data->top,
-                                             data->base,
-                                             &actual) < 0) {
+    if (virStorageSourceGetRelativeBackingPath(data->top,
+                                               data->base,
+                                               &actual) < 0) {
         fprintf(stderr, "relative backing path resolution failed\n");
         return -1;
     }
-- 
2.29.2




More information about the libvir-list mailing list