[libvirt] [PATCH 13/22] storage: Fix misaligned arguments and misaligned conditions

Shi Lei shi_lei at massclouds.com
Fri Oct 5 08:11:36 UTC 2018


This patch fixes misaligned arguments and misaligned conditions.

Signed-off-by: Shi Lei <shi_lei at massclouds.com>
---
 src/storage/storage_backend_disk.c         |  7 +++----
 src/storage/storage_backend_gluster.c      |  2 +-
 src/storage/storage_backend_iscsi_direct.c |  2 +-
 src/storage/storage_backend_rbd.c          | 14 +++++++-------
 src/storage/storage_driver.c               |  6 +++---
 src/storage/storage_util.c                 | 16 +++++++---------
 6 files changed, 22 insertions(+), 25 deletions(-)

diff --git a/src/storage/storage_backend_disk.c b/src/storage/storage_backend_disk.c
index 10df071..9176511 100644
--- a/src/storage/storage_backend_disk.c
+++ b/src/storage/storage_backend_disk.c
@@ -681,7 +681,7 @@ virStorageBackendDiskPartBoundaries(virStoragePoolObjPtr pool,
                                       dev->geometry.sectors * SECTOR_SIZE;
 
     VIR_DEBUG("find free area: allocation %llu, cyl size %llu", allocation,
-          cylinderSize);
+              cylinderSize);
     int partType = virStorageBackendDiskPartTypeToCreate(pool);
 
     /* how many extra bytes we have since we allocate
@@ -708,8 +708,7 @@ virStorageBackendDiskPartBoundaries(virStoragePoolObjPtr pool,
                  size -= SECTOR_SIZE;
          }
          if (size > neededSize &&
-             (smallestSize == 0 ||
-             size < smallestSize)) {
+             (smallestSize == 0 || size < smallestSize)) {
              /* for logical partition, the free extent
                 must be within a logical free area */
              if (partType == VIR_STORAGE_VOL_DISK_TYPE_LOGICAL &&
@@ -798,7 +797,7 @@ virStorageBackendDiskDeleteVol(virStoragePoolObjPtr pool,
     if (!vol->target.path) {
         virReportError(VIR_ERR_INVALID_ARG,
                        _("volume target path empty for source path '%s'"),
-                      src_path);
+                       src_path);
         return -1;
     }
 
diff --git a/src/storage/storage_backend_gluster.c b/src/storage/storage_backend_gluster.c
index e09bc54..4a3c848 100644
--- a/src/storage/storage_backend_gluster.c
+++ b/src/storage/storage_backend_gluster.c
@@ -350,7 +350,7 @@ virStorageBackendGlusterRefreshPool(virStoragePoolObjPtr pool)
         struct dirent ent;
         /* See comment below about readdir_r needing padding */
         char padding[MAX(1, 256 - (int)(sizeof(struct dirent)
-                                         - offsetof(struct dirent, d_name)))];
+                                        - offsetof(struct dirent, d_name)))];
     } de;
     struct dirent *ent;
     glfs_fd_t *dir = NULL;
diff --git a/src/storage/storage_backend_iscsi_direct.c b/src/storage/storage_backend_iscsi_direct.c
index 5c1b251..1142050 100644
--- a/src/storage/storage_backend_iscsi_direct.c
+++ b/src/storage/storage_backend_iscsi_direct.c
@@ -669,7 +669,7 @@ virStorageBackendISCSIDirectVolWipeZero(virStorageVolDefPtr vol,
             lba += BLOCK_PER_PACKET;
         } else {
             if (!(task = iscsi_write10_sync(iscsi, lun, lba, data, block_size,
-                                        block_size, 0, 0, 0, 0, 0)))
+                                            block_size, 0, 0, 0, 0, 0)))
                 goto cleanup;
             scsi_free_scsi_task(task);
             lba++;
diff --git a/src/storage/storage_backend_rbd.c b/src/storage/storage_backend_rbd.c
index 2cba678..f91a6bf 100644
--- a/src/storage/storage_backend_rbd.c
+++ b/src/storage/storage_backend_rbd.c
@@ -136,7 +136,7 @@ virStorageBackendRBDOpenRADOSConn(virStorageBackendRBDStatePtr ptr,
             virBufferAsprintf(&mon_host, "%s,",
                               source->hosts[i].name);
         } else if (source->hosts[i].name != NULL &&
-            source->hosts[i].port) {
+                   source->hosts[i].port) {
             virBufferAsprintf(&mon_host, "%s:%d,",
                               source->hosts[i].name,
                               source->hosts[i].port);
@@ -281,7 +281,7 @@ volStorageBackendRBDGetFeatures(rbd_image_t image,
 
     if ((r = rbd_get_features(image, features)) < 0) {
         virReportSystemError(-r, _("failed to get the features of RBD image "
-                                 "%s"), volname);
+                                   "%s"), volname);
         goto cleanup;
     }
     ret = 0;
@@ -397,7 +397,7 @@ volStorageBackendRBDRefreshVolInfo(virStorageVolDefPtr vol,
     }
 
     VIR_DEBUG("Refreshed RBD image %s/%s (capacity: %llu allocation: %llu "
-                      "obj_size: %"PRIu64" num_objs: %"PRIu64")",
+              "obj_size: %"PRIu64" num_objs: %"PRIu64")",
               def->source.name, vol->name, vol->target.capacity,
               vol->target.allocation, info.obj_size, info.num_objs);
 
@@ -895,7 +895,7 @@ virStorageBackendRBDSnapshotCreate(rbd_image_t image,
 
     if ((r = rbd_snap_create(image, snapname)) < 0) {
         virReportSystemError(-r, _("failed to create RBD snapshot %s@%s"),
-                                   imgname, snapname);
+                             imgname, snapname);
         goto cleanup;
     }
 
@@ -928,7 +928,7 @@ virStorageBackendRBDSnapshotProtect(rbd_image_t image,
 
         if ((r = rbd_snap_protect(image, snapname)) < 0) {
             virReportSystemError(-r, _("failed to protect RBD snapshot %s@%s"),
-                                       imgname, snapname);
+                                 imgname, snapname);
             goto cleanup;
         }
     } else {
@@ -1140,7 +1140,7 @@ virStorageBackendRBDVolWipeZero(rbd_image_t image,
         if ((r = rbd_write(image, offset, length, writebuf)) < 0) {
             virReportSystemError(-r, _("writing %llu bytes failed on "
                                        "RBD image %s at offset %llu"),
-                                       length, imgname, offset);
+                                 length, imgname, offset);
             goto cleanup;
         }
 
@@ -1177,7 +1177,7 @@ virStorageBackendRBDVolWipeDiscard(rbd_image_t image,
         if ((r = rbd_discard(image, offset, length)) < 0) {
             virReportSystemError(-r, _("discarding %llu bytes failed on "
                                        "RBD image %s at offset %llu"),
-                                     length, imgname, offset);
+                                 length, imgname, offset);
             goto cleanup;
         }
 
diff --git a/src/storage/storage_driver.c b/src/storage/storage_driver.c
index 7c22c43..d9d6be7 100644
--- a/src/storage/storage_driver.c
+++ b/src/storage/storage_driver.c
@@ -273,9 +273,9 @@ storageStateInitialize(bool privileged,
             goto error;
 
         if ((virAsprintf(&driver->configDir,
-                        "%s/storage", configdir) < 0) ||
+                         "%s/storage", configdir) < 0) ||
             (virAsprintf(&driver->autostartDir,
-                        "%s/storage/autostart", configdir) < 0) ||
+                         "%s/storage/autostart", configdir) < 0) ||
             (virAsprintf(&driver->stateDir,
                          "%s/storage/run", rundir) < 0))
             goto error;
@@ -586,7 +586,7 @@ storageConnectNumOfDefinedStoragePools(virConnectPtr conn)
         return -1;
 
     return virStoragePoolObjNumOfStoragePools(driver->pools, conn, false,
-                                               virConnectNumOfDefinedStoragePoolsCheckACL);
+                                              virConnectNumOfDefinedStoragePoolsCheckACL);
 }
 
 
diff --git a/src/storage/storage_util.c b/src/storage/storage_util.c
index 318a556..5532221 100644
--- a/src/storage/storage_util.c
+++ b/src/storage/storage_util.c
@@ -1537,7 +1537,7 @@ virStorageBackendDetectBlockVolFormatFD(virStorageSourcePtr target,
         if (disk_types[i].offset + disk_types[i].length > bytes)
             continue;
         if (memcmp(buffer+disk_types[i].offset, &disk_types[i].magic,
-            disk_types[i].length) == 0) {
+                   disk_types[i].length) == 0) {
             target->format = disk_types[i].part_table_type;
             break;
         }
@@ -3760,13 +3760,11 @@ virStorageBackendSCSISerial(const char *dev)
 {
     char *serial = NULL;
 #ifdef WITH_UDEV
-    virCommandPtr cmd = virCommandNewArgList(
-        "/lib/udev/scsi_id",
-        "--replace-whitespace",
-        "--whitelisted",
-        "--device", dev,
-        NULL
-        );
+    virCommandPtr cmd = virCommandNewArgList("/lib/udev/scsi_id",
+                                             "--replace-whitespace",
+                                             "--whitelisted",
+                                             "--device", dev,
+                                             NULL);
 
     /* Run the program and capture its output */
     virCommandSetOutputBuffer(cmd, &serial);
@@ -4156,7 +4154,7 @@ processLU(virStoragePoolObjPtr pool,
 
 int
 virStorageBackendSCSIFindLUs(virStoragePoolObjPtr pool,
-                              uint32_t scanhost)
+                             uint32_t scanhost)
 {
     virStoragePoolDefPtr def = virStoragePoolObjGetDef(pool);
     int retval = 0;
-- 
2.17.1





More information about the libvir-list mailing list