[libvirt] [PATCH 5/9] Remove conn parameter from storage file functions

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

 



It was used for error reporting only.
---
 src/qemu/qemu_security_dac.c     |    4 ++--
 src/security/security_selinux.c  |    4 ++--
 src/storage/storage_backend_fs.c |   13 +++++--------
 src/util/storage_file.c          |   31 +++++++++++--------------------
 src/util/storage_file.h          |    6 ++----
 5 files changed, 22 insertions(+), 36 deletions(-)

diff --git a/src/qemu/qemu_security_dac.c b/src/qemu/qemu_security_dac.c
index e6ada9a..c532368 100644
--- a/src/qemu/qemu_security_dac.c
+++ b/src/qemu/qemu_security_dac.c
@@ -105,7 +105,7 @@ err:
 
 
 static int
-qemuSecurityDACSetSecurityImageLabel(virConnectPtr conn,
+qemuSecurityDACSetSecurityImageLabel(virConnectPtr conn ATTRIBUTE_UNUSED,
                                      virDomainObjPtr vm ATTRIBUTE_UNUSED,
                                      virDomainDiskDefPtr disk)
 
@@ -125,7 +125,7 @@ qemuSecurityDACSetSecurityImageLabel(virConnectPtr conn,
 
         memset(&meta, 0, sizeof(meta));
 
-        ret = virStorageFileGetMetadata(conn, path, &meta);
+        ret = virStorageFileGetMetadata(path, &meta);
 
         if (path != disk->src)
             VIR_FREE(path);
diff --git a/src/security/security_selinux.c b/src/security/security_selinux.c
index 1b7f995..3c9ab62 100644
--- a/src/security/security_selinux.c
+++ b/src/security/security_selinux.c
@@ -407,7 +407,7 @@ SELinuxRestoreSecurityImageLabel(virConnectPtr conn ATTRIBUTE_UNUSED,
 }
 
 static int
-SELinuxSetSecurityImageLabel(virConnectPtr conn,
+SELinuxSetSecurityImageLabel(virConnectPtr conn ATTRIBUTE_UNUSED,
                              virDomainObjPtr vm,
                              virDomainDiskDefPtr disk)
 
@@ -428,7 +428,7 @@ SELinuxSetSecurityImageLabel(virConnectPtr conn,
 
         memset(&meta, 0, sizeof(meta));
 
-        ret = virStorageFileGetMetadata(conn, path, &meta);
+        ret = virStorageFileGetMetadata(path, &meta);
 
         if (path != disk->src)
             VIR_FREE(path);
diff --git a/src/storage/storage_backend_fs.c b/src/storage/storage_backend_fs.c
index dcc5bf9..a431ac1 100644
--- a/src/storage/storage_backend_fs.c
+++ b/src/storage/storage_backend_fs.c
@@ -49,8 +49,7 @@
 #define VIR_FROM_THIS VIR_FROM_STORAGE
 
 static int
-virStorageBackendProbeTarget(virConnectPtr conn,
-                             virStorageVolTargetPtr target,
+virStorageBackendProbeTarget(virStorageVolTargetPtr target,
                              char **backingStore,
                              unsigned long long *allocation,
                              unsigned long long *capacity,
@@ -78,7 +77,7 @@ virStorageBackendProbeTarget(virConnectPtr conn,
 
     memset(&meta, 0, sizeof(meta));
 
-    if (virStorageFileGetMetadataFromFD(conn, target->path, fd, &meta) < 0) {
+    if (virStorageFileGetMetadataFromFD(target->path, fd, &meta) < 0) {
         close(fd);
         return -1;
     }
@@ -556,7 +555,7 @@ error:
  * within it. This is non-recursive.
  */
 static int
-virStorageBackendFileSystemRefresh(virConnectPtr conn,
+virStorageBackendFileSystemRefresh(virConnectPtr conn ATTRIBUTE_UNUSED,
                                    virStoragePoolObjPtr pool)
 {
     DIR *dir;
@@ -591,8 +590,7 @@ virStorageBackendFileSystemRefresh(virConnectPtr conn,
         if ((vol->key = strdup(vol->target.path)) == NULL)
             goto no_memory;
 
-        if ((ret = virStorageBackendProbeTarget(conn,
-                                                &vol->target,
+        if ((ret = virStorageBackendProbeTarget(&vol->target,
                                                 &backingStore,
                                                 &vol->allocation,
                                                 &vol->capacity,
@@ -633,8 +631,7 @@ virStorageBackendFileSystemRefresh(virConnectPtr conn,
             } else {
                 vol->backingStore.path = backingStore;
 
-                if ((ret = virStorageBackendProbeTarget(conn,
-                                                        &vol->backingStore,
+                if ((ret = virStorageBackendProbeTarget(&vol->backingStore,
                                                         NULL, NULL, NULL,
                                                         NULL)) < 0) {
                     if (ret == -1)
diff --git a/src/util/storage_file.c b/src/util/storage_file.c
index d78e236..0414085 100644
--- a/src/util/storage_file.c
+++ b/src/util/storage_file.c
@@ -70,16 +70,12 @@ struct FileTypeInfo {
     int qcowCryptOffset;  /* Byte offset from start of file
                            * where to find encryption mode,
                            * -1 if encryption is not used */
-    int (*getBackingStore)(virConnectPtr conn, char **res,
-                           const unsigned char *buf, size_t buf_size);
+    int (*getBackingStore)(char **res, const unsigned char *buf, size_t buf_size);
 };
 
-static int cowGetBackingStore(virConnectPtr, char **,
-                              const unsigned char *, size_t);
-static int qcowXGetBackingStore(virConnectPtr, char **,
-                                const unsigned char *, size_t);
-static int vmdk4GetBackingStore(virConnectPtr, char **,
-                                const unsigned char *, size_t);
+static int cowGetBackingStore(char **, const unsigned char *, size_t);
+static int qcowXGetBackingStore(char **, const unsigned char *, size_t);
+static int vmdk4GetBackingStore(char **, const unsigned char *, size_t);
 
 
 static struct FileTypeInfo const fileTypeInfo[] = {
@@ -139,8 +135,7 @@ static struct FileTypeInfo const fileTypeInfo[] = {
 };
 
 static int
-cowGetBackingStore(virConnectPtr conn ATTRIBUTE_UNUSED /*TEMPORARY*/,
-                   char **res,
+cowGetBackingStore(char **res,
                    const unsigned char *buf,
                    size_t buf_size)
 {
@@ -160,8 +155,7 @@ cowGetBackingStore(virConnectPtr conn ATTRIBUTE_UNUSED /*TEMPORARY*/,
 }
 
 static int
-qcowXGetBackingStore(virConnectPtr conn ATTRIBUTE_UNUSED /*TEMPORARY*/,
-                     char **res,
+qcowXGetBackingStore(char **res,
                      const unsigned char *buf,
                      size_t buf_size)
 {
@@ -202,8 +196,7 @@ qcowXGetBackingStore(virConnectPtr conn ATTRIBUTE_UNUSED /*TEMPORARY*/,
 
 
 static int
-vmdk4GetBackingStore(virConnectPtr conn ATTRIBUTE_UNUSED /*TEMPORARY*/,
-                     char **res,
+vmdk4GetBackingStore(char **res,
                      const unsigned char *buf,
                      size_t buf_size)
 {
@@ -274,8 +267,7 @@ absolutePathFromBaseFile(const char *base_file, const char *path)
  * it is, and info about its capacity if available.
  */
 int
-virStorageFileGetMetadataFromFD(virConnectPtr conn,
-                                const char *path,
+virStorageFileGetMetadataFromFD(const char *path,
                                 int fd,
                                 virStorageFileMetadata *meta)
 {
@@ -367,7 +359,7 @@ virStorageFileGetMetadataFromFD(virConnectPtr conn,
         if (fileTypeInfo[i].getBackingStore != NULL) {
             char *base;
 
-            switch (fileTypeInfo[i].getBackingStore(conn, &base, head, len)) {
+            switch (fileTypeInfo[i].getBackingStore(&base, head, len)) {
             case BACKING_STORE_OK:
                 break;
 
@@ -405,8 +397,7 @@ virStorageFileGetMetadataFromFD(virConnectPtr conn,
 }
 
 int
-virStorageFileGetMetadata(virConnectPtr conn,
-                          const char *path,
+virStorageFileGetMetadata(const char *path,
                           virStorageFileMetadata *meta)
 {
     int fd, ret;
@@ -416,7 +407,7 @@ virStorageFileGetMetadata(virConnectPtr conn,
         return -1;
     }
 
-    ret = virStorageFileGetMetadataFromFD(conn, path, fd, meta);
+    ret = virStorageFileGetMetadataFromFD(path, fd, meta);
 
     close(fd);
 
diff --git a/src/util/storage_file.h b/src/util/storage_file.h
index b0abcaf..ca69a1b 100644
--- a/src/util/storage_file.h
+++ b/src/util/storage_file.h
@@ -51,11 +51,9 @@ typedef struct _virStorageFileMetadata {
     bool encrypted;
 } virStorageFileMetadata;
 
-int virStorageFileGetMetadata(virConnectPtr conn,
-                              const char *path,
+int virStorageFileGetMetadata(const char *path,
                               virStorageFileMetadata *meta);
-int virStorageFileGetMetadataFromFD(virConnectPtr conn,
-                                    const char *path,
+int virStorageFileGetMetadataFromFD(const char *path,
                                     int fd,
                                     virStorageFileMetadata *meta);
 
-- 
1.6.3.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]