[libvirt PATCH 17/17] storage_file: use virStorageFile prefix for all functions

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

 



Now that storage file code is separated from storage source definition
it makes sense to rename the functions to make it clear.

Signed-off-by: Pavel Hrdina <phrdina@xxxxxxxxxx>
---
 src/libvirt_private.syms        | 18 +++++-----
 src/libxl/xen_xl.c              |  2 +-
 src/qemu/qemu_domain.c          | 16 ++++-----
 src/qemu/qemu_driver.c          |  6 ++--
 src/storage/storage_util.c      |  6 ++--
 src/storage_file/storage_file.c | 60 ++++++++++++++++-----------------
 src/storage_file/storage_file.h | 42 +++++++++++------------
 tests/qemublocktest.c           |  6 ++--
 tests/virstoragetest.c          |  2 +-
 9 files changed, 79 insertions(+), 79 deletions(-)

diff --git a/src/libvirt_private.syms b/src/libvirt_private.syms
index 91f795adfc..c1a5aab7d6 100644
--- a/src/libvirt_private.syms
+++ b/src/libvirt_private.syms
@@ -1681,6 +1681,7 @@ virStorageFileChainLookup;
 virStorageFileChown;
 virStorageFileCreate;
 virStorageFileDeinit;
+virStorageFileFindByNodeName;
 virStorageFileGetBackingStoreStr;
 virStorageFileGetMetadata;
 virStorageFileGetMetadataFromBuf;
@@ -1689,8 +1690,13 @@ virStorageFileGetRelativeBackingPath;
 virStorageFileGetUniqueIdentifier;
 virStorageFileInit;
 virStorageFileInitAs;
+virStorageFileNewFromBacking;
+virStorageFileNewFromBackingAbsolute;
 virStorageFileParseBackingStoreStr;
 virStorageFileParseChainIndex;
+virStorageFileParseRBDColonString;
+virStorageFilePrivateDataFormatRelPath;
+virStorageFilePrivateDataParseRelPath;
 virStorageFileProbeFormat;
 virStorageFileRead;
 virStorageFileReportBrokenChain;
@@ -1700,15 +1706,9 @@ virStorageFileSupportsBackingChainTraversal;
 virStorageFileSupportsCreate;
 virStorageFileSupportsSecurityDriver;
 virStorageFileUnlink;
-virStorageSourceFindByNodeName;
-virStorageSourceNewFromBacking;
-virStorageSourceNewFromBackingAbsolute;
-virStorageSourceParseRBDColonString;
-virStorageSourcePrivateDataFormatRelPath;
-virStorageSourcePrivateDataParseRelPath;
-virStorageSourceUpdateBackingSizes;
-virStorageSourceUpdateCapacity;
-virStorageSourceUpdatePhysicalSize;
+virStorageFileUpdateBackingSizes;
+virStorageFileUpdateCapacity;
+virStorageFileUpdatePhysicalSize;
 
 
 # storage_file/storage_file_backend.h
diff --git a/src/libxl/xen_xl.c b/src/libxl/xen_xl.c
index 1f97e6bdd4..f26f9bb5b7 100644
--- a/src/libxl/xen_xl.c
+++ b/src/libxl/xen_xl.c
@@ -640,7 +640,7 @@ xenParseXLDiskSrc(virDomainDiskDefPtr disk, char *srcstr)
 
         virDomainDiskSetType(disk, VIR_STORAGE_TYPE_NETWORK);
         disk->src->protocol = VIR_STORAGE_NET_PROTOCOL_RBD;
-        ret = virStorageSourceParseRBDColonString(tmpstr, disk->src);
+        ret = virStorageFileParseRBDColonString(tmpstr, disk->src);
     } else {
         virDomainDiskSetSource(disk, srcstr);
 
diff --git a/src/qemu/qemu_domain.c b/src/qemu/qemu_domain.c
index 8ddb7b70d2..f193c5e417 100644
--- a/src/qemu/qemu_domain.c
+++ b/src/qemu/qemu_domain.c
@@ -1894,7 +1894,7 @@ qemuStorageSourcePrivateDataParse(xmlXPathContextPtr ctxt,
             return -1;
     }
 
-    if (virStorageSourcePrivateDataParseRelPath(ctxt, src) < 0)
+    if (virStorageFilePrivateDataParseRelPath(ctxt, src) < 0)
         return -1;
 
     return 0;
@@ -1936,7 +1936,7 @@ qemuStorageSourcePrivateDataFormat(virStorageSourcePtr src,
     if (src->pr)
         virBufferAsprintf(buf, "<reservations mgralias='%s'/>\n", src->pr->mgralias);
 
-    if (virStorageSourcePrivateDataFormatRelPath(src, buf) < 0)
+    if (virStorageFilePrivateDataFormatRelPath(src, buf) < 0)
         return -1;
 
     if (srcPriv) {
@@ -2597,15 +2597,15 @@ qemuDomainObjPrivateXMLParseBlockjobNodename(qemuBlockJobDataPtr job,
         return;
 
     if (job->disk &&
-        (*src = virStorageSourceFindByNodeName(job->disk->src, nodename)))
+        (*src = virStorageFileFindByNodeName(job->disk->src, nodename)))
         return;
 
     if (job->chain &&
-        (*src = virStorageSourceFindByNodeName(job->chain, nodename)))
+        (*src = virStorageFileFindByNodeName(job->chain, nodename)))
         return;
 
     if (job->mirrorChain &&
-        (*src = virStorageSourceFindByNodeName(job->mirrorChain, nodename)))
+        (*src = virStorageFileFindByNodeName(job->mirrorChain, nodename)))
         return;
 
     /* the node was in the XML but was not found in the job definitions */
@@ -9920,11 +9920,11 @@ qemuDomainDiskLookupByNodename(virDomainDefPtr def,
     for (i = 0; i < def->ndisks; i++) {
         virDomainDiskDefPtr domdisk = def->disks[i];
 
-        if ((*src = virStorageSourceFindByNodeName(domdisk->src, nodename)))
+        if ((*src = virStorageFileFindByNodeName(domdisk->src, nodename)))
             return domdisk;
 
         if (domdisk->mirror &&
-            (*src = virStorageSourceFindByNodeName(domdisk->mirror, nodename)))
+            (*src = virStorageFileFindByNodeName(domdisk->mirror, nodename)))
             return domdisk;
     }
 
@@ -9933,7 +9933,7 @@ qemuDomainDiskLookupByNodename(virDomainDefPtr def,
             virDomainBackupDiskDefPtr backupdisk = backupdef->disks + i;
 
             if (backupdisk->store &&
-                (*src = virStorageSourceFindByNodeName(backupdisk->store, nodename)))
+                (*src = virStorageFileFindByNodeName(backupdisk->store, nodename)))
                 return virDomainDiskByTarget(def, backupdisk->name);
         }
     }
diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c
index f6554e1506..0818bb9f89 100644
--- a/src/qemu/qemu_driver.c
+++ b/src/qemu/qemu_driver.c
@@ -10838,7 +10838,7 @@ qemuDomainStorageUpdatePhysical(virQEMUDriverPtr driver,
         return -1;
     }
 
-    ret = virStorageSourceUpdatePhysicalSize(src, fd, &sb);
+    ret = virStorageFileUpdatePhysicalSize(src, fd, &sb);
 
     qemuDomainStorageCloseStat(src, &fd);
 
@@ -10906,10 +10906,10 @@ qemuStorageLimitsRefresh(virQEMUDriverPtr driver,
             goto cleanup;
     }
 
-    if (virStorageSourceUpdateBackingSizes(src, fd, &sb) < 0)
+    if (virStorageFileUpdateBackingSizes(src, fd, &sb) < 0)
         goto cleanup;
 
-    if (virStorageSourceUpdateCapacity(src, buf, len) < 0)
+    if (virStorageFileUpdateCapacity(src, buf, len) < 0)
         goto cleanup;
 
     /* If guest is not using raw disk format and is on a host block
diff --git a/src/storage/storage_util.c b/src/storage/storage_util.c
index 7616ec63a0..9274e91c47 100644
--- a/src/storage/storage_util.c
+++ b/src/storage/storage_util.c
@@ -1842,7 +1842,7 @@ storageBackendUpdateVolTargetInfo(virStorageVolType voltype,
             }
         }
 
-        if (virStorageSourceUpdateCapacity(target, buf, len) < 0)
+        if (virStorageFileUpdateCapacity(target, buf, len) < 0)
             return -1;
     }
 
@@ -1906,7 +1906,7 @@ virStorageBackendUpdateVolTargetInfoFD(virStorageSourcePtr target,
     char *filecon = NULL;
 #endif
 
-    if (virStorageSourceUpdateBackingSizes(target, fd, sb) < 0)
+    if (virStorageFileUpdateBackingSizes(target, fd, sb) < 0)
         return -1;
 
     if (!target->perms)
@@ -3449,7 +3449,7 @@ storageBackendProbeTarget(virStorageSourcePtr target,
         return -1;
 
     if (meta->backingStoreRaw) {
-        virStorageSourceNewFromBacking(meta, &target->backingStore);
+        virStorageFileNewFromBacking(meta, &target->backingStore);
 
         /* XXX: Remote storage doesn't play nicely with volumes backed by
          * remote storage. To avoid trouble, just fake the backing store is RAW
diff --git a/src/storage_file/storage_file.c b/src/storage_file/storage_file.c
index e5b2f68420..7de3daec33 100644
--- a/src/storage_file/storage_file.c
+++ b/src/storage_file/storage_file.c
@@ -1292,8 +1292,8 @@ virStorageFileChainLookup(virStorageSourcePtr chain,
 
 
 static virStorageSourcePtr
-virStorageSourceNewFromBackingRelative(virStorageSourcePtr parent,
-                                       const char *rel)
+virStorageFileNewFromBackingRelative(virStorageSourcePtr parent,
+                                     const char *rel)
 {
     g_autofree char *dirname = NULL;
     g_autoptr(virStorageSource) def = virStorageSourceNew();
@@ -1480,8 +1480,8 @@ virStorageSourceRBDAddHost(virStorageSourcePtr src,
 
 
 int
-virStorageSourceParseRBDColonString(const char *rbdstr,
-                                    virStorageSourcePtr src)
+virStorageFileParseRBDColonString(const char *rbdstr,
+                                  virStorageSourcePtr src)
 {
     char *p, *e, *next;
     g_autofree char *options = NULL;
@@ -1691,7 +1691,7 @@ virStorageSourceParseBackingColon(virStorageSourcePtr src,
         break;
 
     case VIR_STORAGE_NET_PROTOCOL_RBD:
-        if (virStorageSourceParseRBDColonString(path, src) < 0)
+        if (virStorageFileParseRBDColonString(path, src) < 0)
             return -1;
         break;
 
@@ -2253,7 +2253,7 @@ virStorageSourceParseBackingJSONRBD(virStorageSourcePtr src,
 
     /* legacy syntax passed via 'filename' option */
     if ((filename = virJSONValueObjectGetString(json, "filename")))
-        return virStorageSourceParseRBDColonString(filename, src);
+        return virStorageFileParseRBDColonString(filename, src);
 
     if (!pool || !image) {
         virReportError(VIR_ERR_INVALID_ARG, "%s",
@@ -2487,7 +2487,7 @@ virStorageSourceParseBackingJSON(virStorageSourcePtr src,
 
 
 /**
- * virStorageSourceNewFromBackingAbsolute
+ * virStorageFileNewFromBackingAbsolute
  * @path: string representing absolute location of a storage source
  * @src: filled with virStorageSource object representing @path
  *
@@ -2497,8 +2497,8 @@ virStorageSourceParseBackingJSON(virStorageSourcePtr src,
  * error is reported.
  */
 int
-virStorageSourceNewFromBackingAbsolute(const char *path,
-                                       virStorageSourcePtr *src)
+virStorageFileNewFromBackingAbsolute(const char *path,
+                                     virStorageSourcePtr *src)
 {
     const char *json;
     const char *dirpath;
@@ -2580,10 +2580,10 @@ virStorageSourceNewFromChild(virStorageSourcePtr parent,
     *child = NULL;
 
     if (virFileIsRelative(parentRaw)) {
-        if (!(def = virStorageSourceNewFromBackingRelative(parent, parentRaw)))
+        if (!(def = virStorageFileNewFromBackingRelative(parent, parentRaw)))
             return -1;
     } else {
-        if ((rc = virStorageSourceNewFromBackingAbsolute(parentRaw, &def)) < 0)
+        if ((rc = virStorageFileNewFromBackingAbsolute(parentRaw, &def)) < 0)
             return -1;
     }
 
@@ -2611,8 +2611,8 @@ virStorageSourceNewFromChild(virStorageSourcePtr parent,
 
 
 int
-virStorageSourceNewFromBacking(virStorageSourcePtr parent,
-                               virStorageSourcePtr *backing)
+virStorageFileNewFromBacking(virStorageSourcePtr parent,
+                             virStorageSourcePtr *backing)
 {
     int rc;
 
@@ -2639,9 +2639,9 @@ virStorageSourceNewFromBacking(virStorageSourcePtr parent,
  * Returns 0 on success, -1 on error. No libvirt errors are reported.
  */
 int
-virStorageSourceUpdatePhysicalSize(virStorageSourcePtr src,
-                                   int fd,
-                                   struct stat const *sb)
+virStorageFileUpdatePhysicalSize(virStorageSourcePtr src,
+                                 int fd,
+                                 struct stat const *sb)
 {
     off_t end;
     virStorageType actual_type = virStorageSourceGetActualType(src);
@@ -2687,9 +2687,9 @@ virStorageSourceUpdatePhysicalSize(virStorageSourcePtr src,
  * Returns 0 on success, -1 on error.
  */
 int
-virStorageSourceUpdateBackingSizes(virStorageSourcePtr src,
-                                   int fd,
-                                   struct stat const *sb)
+virStorageFileUpdateBackingSizes(virStorageSourcePtr src,
+                                 int fd,
+                                 struct stat const *sb)
 {
     /* Get info for normal formats */
     if (S_ISREG(sb->st_mode) || fd == -1) {
@@ -2750,9 +2750,9 @@ virStorageSourceUpdateBackingSizes(virStorageSourcePtr src,
  * Returns 0 on success, -1 on error.
  */
 int
-virStorageSourceUpdateCapacity(virStorageSourcePtr src,
-                               char *buf,
-                               ssize_t len)
+virStorageFileUpdateCapacity(virStorageSourcePtr src,
+                             char *buf,
+                             ssize_t len)
 {
     int format = src->format;
     g_autoptr(virStorageSource) meta = NULL;
@@ -3066,7 +3066,7 @@ virStorageFileGetRelativeBackingPath(virStorageSourcePtr top,
 
 
 /**
- * virStorageSourceFindByNodeName:
+ * virStorageFileFindByNodeName:
  * @top: backing chain top
  * @nodeName: node name to find in backing chain
  *
@@ -3075,8 +3075,8 @@ virStorageFileGetRelativeBackingPath(virStorageSourcePtr top,
  * On failure NULL is returned and no error is reported.
  */
 virStorageSourcePtr
-virStorageSourceFindByNodeName(virStorageSourcePtr top,
-                               const char *nodeName)
+virStorageFileFindByNodeName(virStorageSourcePtr top,
+                             const char *nodeName)
 {
     virStorageSourcePtr tmp;
 
@@ -3091,8 +3091,8 @@ virStorageSourceFindByNodeName(virStorageSourcePtr top,
 
 
 int
-virStorageSourcePrivateDataParseRelPath(xmlXPathContextPtr ctxt,
-                                        virStorageSourcePtr src)
+virStorageFilePrivateDataParseRelPath(xmlXPathContextPtr ctxt,
+                                      virStorageSourcePtr src)
 {
     src->relPath = virXPathString("string(./relPath)", ctxt);
     return 0;
@@ -3100,8 +3100,8 @@ virStorageSourcePrivateDataParseRelPath(xmlXPathContextPtr ctxt,
 
 
 int
-virStorageSourcePrivateDataFormatRelPath(virStorageSourcePtr src,
-                                         virBufferPtr buf)
+virStorageFilePrivateDataFormatRelPath(virStorageSourcePtr src,
+                                       virBufferPtr buf)
 {
     if (src->relPath)
         virBufferEscapeString(buf, "<relPath>%s</relPath>\n", src->relPath);
@@ -3708,7 +3708,7 @@ virStorageFileGetMetadataRecurse(virStorageSourcePtr src,
     }
 
     if (src->backingStoreRaw) {
-        if ((rv = virStorageSourceNewFromBacking(src, &backingStore)) < 0)
+        if ((rv = virStorageFileNewFromBacking(src, &backingStore)) < 0)
             return -1;
 
         /* the backing file would not be usable for VM usage */
diff --git a/src/storage_file/storage_file.h b/src/storage_file/storage_file.h
index 181efded87..67eb20a866 100644
--- a/src/storage_file/storage_file.h
+++ b/src/storage_file/storage_file.h
@@ -74,26 +74,26 @@ virStorageFileChainLookup(virStorageSourcePtr chain,
     ATTRIBUTE_NONNULL(1);
 
 int
-virStorageSourceUpdatePhysicalSize(virStorageSourcePtr src,
-                                   int fd,
-                                   struct stat const *sb);
+virStorageFileUpdatePhysicalSize(virStorageSourcePtr src,
+                                 int fd,
+                                 struct stat const *sb);
 int
-virStorageSourceUpdateBackingSizes(virStorageSourcePtr src,
-                                   int fd,
-                                   struct stat const *sb);
+virStorageFileUpdateBackingSizes(virStorageSourcePtr src,
+                                 int fd,
+                                 struct stat const *sb);
 
 int
-virStorageSourceUpdateCapacity(virStorageSourcePtr src,
-                               char *buf,
-                               ssize_t len);
+virStorageFileUpdateCapacity(virStorageSourcePtr src,
+                             char *buf,
+                             ssize_t len);
 
 int
-virStorageSourceNewFromBacking(virStorageSourcePtr parent,
-                               virStorageSourcePtr *backing);
+virStorageFileNewFromBacking(virStorageSourcePtr parent,
+                             virStorageSourcePtr *backing);
 
 int
-virStorageSourceParseRBDColonString(const char *rbdstr,
-                                    virStorageSourcePtr src)
+virStorageFileParseRBDColonString(const char *rbdstr,
+                                  virStorageSourcePtr src)
     ATTRIBUTE_NONNULL(1) ATTRIBUTE_NONNULL(2);
 
 typedef int
@@ -113,21 +113,21 @@ virStorageFileGetRelativeBackingPath(virStorageSourcePtr from,
     ATTRIBUTE_NONNULL(1) ATTRIBUTE_NONNULL(2) ATTRIBUTE_NONNULL(3);
 
 int
-virStorageSourceNewFromBackingAbsolute(const char *path,
-                                       virStorageSourcePtr *src);
+virStorageFileNewFromBackingAbsolute(const char *path,
+                                     virStorageSourcePtr *src);
 
 virStorageSourcePtr
-virStorageSourceFindByNodeName(virStorageSourcePtr top,
-                               const char *nodeName)
+virStorageFileFindByNodeName(virStorageSourcePtr top,
+                             const char *nodeName)
     ATTRIBUTE_NONNULL(1) ATTRIBUTE_NONNULL(2);
 
 int
-virStorageSourcePrivateDataParseRelPath(xmlXPathContextPtr ctxt,
-                                        virStorageSourcePtr src);
+virStorageFilePrivateDataParseRelPath(xmlXPathContextPtr ctxt,
+                                      virStorageSourcePtr src);
 
 int
-virStorageSourcePrivateDataFormatRelPath(virStorageSourcePtr src,
-                                         virBufferPtr buf);
+virStorageFilePrivateDataFormatRelPath(virStorageSourcePtr src,
+                                       virBufferPtr buf);
 
 int
 virStorageFileInit(virStorageSourcePtr src);
diff --git a/tests/qemublocktest.c b/tests/qemublocktest.c
index ee57449868..b31746fa17 100644
--- a/tests/qemublocktest.c
+++ b/tests/qemublocktest.c
@@ -106,8 +106,8 @@ testBackingXMLjsonXML(const void *args)
 
     protocolwrapper = g_strdup_printf("json:%s", propsstr);
 
-    if (virStorageSourceNewFromBackingAbsolute(protocolwrapper,
-                                               &jsonsrc) < 0) {
+    if (virStorageFileNewFromBackingAbsolute(protocolwrapper,
+                                             &jsonsrc) < 0) {
         fprintf(stderr, "failed to parse disk json\n");
         return -1;
     }
@@ -155,7 +155,7 @@ testJSONtoJSON(const void *args)
     if (virTestLoadFile(infile, &in) < 0)
         return -1;
 
-    if (virStorageSourceNewFromBackingAbsolute(in, &src) < 0) {
+    if (virStorageFileNewFromBackingAbsolute(in, &src) < 0) {
         fprintf(stderr, "failed to parse disk json\n");
         return -1;
     }
diff --git a/tests/virstoragetest.c b/tests/virstoragetest.c
index 59c03255d4..0882c6c86d 100644
--- a/tests/virstoragetest.c
+++ b/tests/virstoragetest.c
@@ -592,7 +592,7 @@ testBackingParse(const void *args)
     if (!data->expect)
         erc = -1;
 
-    if ((rc = virStorageSourceNewFromBackingAbsolute(data->backing, &src)) != erc) {
+    if ((rc = virStorageFileNewFromBackingAbsolute(data->backing, &src)) != erc) {
         fprintf(stderr, "expected return value '%d' actual '%d'\n", erc, rc);
         return -1;
     }
-- 
2.28.0




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

  Powered by Linux