]> xenbits.xensource.com Git - people/liuw/libxenctrl-split/libvirt.git/commitdiff
Remove unnecessary curly brackets in src/storage/
authorMartin Kletzander <mkletzan@redhat.com>
Thu, 13 Nov 2014 14:25:27 +0000 (15:25 +0100)
committerMartin Kletzander <mkletzan@redhat.com>
Fri, 14 Nov 2014 16:13:01 +0000 (17:13 +0100)
Signed-off-by: Martin Kletzander <mkletzan@redhat.com>
src/storage/parthelper.c
src/storage/storage_backend.c
src/storage/storage_backend_disk.c
src/storage/storage_backend_fs.c
src/storage/storage_backend_mpath.c
src/storage/storage_backend_rbd.c
src/storage/storage_backend_scsi.c
src/storage/storage_driver.c

index 84e7ba01c3576d1e5de913b2aa10b74313995b6d..8de32fd5c7b2cc975923674fe5f90b4dc4add230 100644 (file)
@@ -91,9 +91,8 @@ int main(int argc, char **argv)
         if (VIR_STRDUP_QUIET(canonical_path, path) < 0)
             return 2;
     } else {
-        if (virFileResolveLink(path, &canonical_path) != 0) {
+        if (virFileResolveLink(path, &canonical_path) != 0)
             return 2;
-        }
 
         partsep = *canonical_path &&
             c_isdigit(canonical_path[strlen(canonical_path)-1]) ? "p" : "";
index 00cfe74c8824912811ff153b5d34082b06d578c7..98720f630c4906a4be2df15d003c3a20a544a69f 100644 (file)
@@ -182,9 +182,8 @@ virStorageBackendCopyToFD(virStorageVolDefPtr vol,
     }
 
 #ifdef __linux__
-    if (ioctl(fd, BLKBSZGET, &wbytes) < 0) {
+    if (ioctl(fd, BLKBSZGET, &wbytes) < 0)
         wbytes = 0;
-    }
 #endif
     if ((wbytes == 0) && fstat(fd, &st) == 0)
         wbytes = st.st_blksize;
@@ -395,9 +394,8 @@ createRawFile(int fd, virStorageVolDefPtr vol,
             (vol->target.allocation < inputvol->target.capacity);
 
         ret = virStorageBackendCopyToFD(vol, inputvol, fd, &remain, want_sparse);
-        if (ret < 0) {
+        if (ret < 0)
             goto cleanup;
-        }
     }
 
     if (remain && need_alloc) {
@@ -631,9 +629,8 @@ virStorageBackendCreateExecCommand(virStoragePoolObjPtr pool,
     virCommandSetGID(cmd, -1);
 
     if (!filecreated) {
-        if (virCommandRun(cmd, NULL) < 0) {
+        if (virCommandRun(cmd, NULL) < 0)
             return -1;
-        }
         if (stat(vol->target.path, &st) < 0) {
             virReportSystemError(errno,
                                  _("failed to create %s"), vol->target.path);
index abab1e19d6f0215a69f21ab35f17f363394e5443..4b05e8c3b50225e0b593be411ce3f462e7aef057 100644 (file)
@@ -171,9 +171,8 @@ virStorageBackendDiskMakeFreeExtent(virStoragePoolObjPtr pool,
         return -1; /* Don't bother to re-alloc freeExtents - it'll be free'd shortly */
 
     /* first block reported as free, even if it is not */
-    if (dev->freeExtents[dev->nfreeExtent].start == 0) {
+    if (dev->freeExtents[dev->nfreeExtent].start == 0)
         dev->freeExtents[dev->nfreeExtent].start = SECTOR_SIZE;
-    }
 
     pool->def->available +=
         (dev->freeExtents[dev->nfreeExtent].end -
@@ -349,9 +348,8 @@ virStorageBackendDiskRefreshPool(virConnectPtr conn ATTRIBUTE_UNUSED,
         return -1;
     }
 
-    if (virStorageBackendDiskReadGeometry(pool) != 0) {
+    if (virStorageBackendDiskReadGeometry(pool) != 0)
         return -1;
-    }
 
     return virStorageBackendDiskReadPartitions(pool, NULL);
 }
@@ -467,9 +465,8 @@ virStorageBackendDiskPartTypeToCreate(virStoragePoolObjPtr pool)
                 partType == VIR_STORAGE_VOL_DISK_TYPE_EXTENDED)
                 count++;
         }
-        if (count >= 4) {
+        if (count >= 4)
             return VIR_STORAGE_VOL_DISK_TYPE_LOGICAL;
-        }
     }
 
     /* for all other cases, all partitions are primary */
@@ -587,9 +584,8 @@ virStorageBackendDiskPartBoundaries(virStoragePoolObjPtr pool,
              }
              /* if we are creating a logical partition, we need one extra
                 block between partitions (or actually move start one block) */
-             if (partType == VIR_STORAGE_VOL_DISK_TYPE_LOGICAL) {
+             if (partType == VIR_STORAGE_VOL_DISK_TYPE_LOGICAL)
                  size -= SECTOR_SIZE;
-             }
          }
          if (size > neededSize &&
              (smallestSize == 0 ||
@@ -659,9 +655,8 @@ virStorageBackendDiskCreateVol(virConnectPtr conn ATTRIBUTE_UNUSED,
         goto cleanup;
     }
 
-    if (virStorageBackendDiskPartFormat(pool, vol, &partFormat) != 0) {
+    if (virStorageBackendDiskPartFormat(pool, vol, &partFormat) != 0)
         goto cleanup;
-    }
     virCommandAddArg(cmd, partFormat);
 
     if (virStorageBackendDiskPartBoundaries(pool, &startOffset,
index 0f8ceee5498c61f7f472023f41131eec5886df12..f4bf5d6e03c8e58f5d5ffeaf8461198fcf9c6964 100644 (file)
@@ -639,9 +639,8 @@ virStorageBackendFileSystemProbe(const char *device,
  error:
     VIR_FREE(libblkid_format);
 
-    if (probe != NULL) {
+    if (probe != NULL)
         blkid_free_probe(probe);
-    }
 
     return ret;
 }
@@ -737,9 +736,8 @@ virStorageBackendMakeFileSystem(virStoragePoolObjPtr pool,
         ok_to_mkfs = true;
     }
 
-    if (ok_to_mkfs) {
+    if (ok_to_mkfs)
         ret = virStorageBackendExecuteMKFS(device, format);
-    }
 
  error:
     return ret;
index f21ae4cafed424c180193a80417e0c42384d2a13..b67dc2a6b5b8958c0003058b9b3a46a79cde66f9 100644 (file)
@@ -119,14 +119,12 @@ virStorageBackendIsMultipath(const char *dev_name)
         goto out;
     }
 
-    if (STREQ(target_type, "multipath")) {
+    if (STREQ(target_type, "multipath"))
         ret = 1;
-    }
 
  out:
-    if (dmt != NULL) {
+    if (dmt != NULL)
         dm_task_destroy(dmt);
-    }
     return ret;
 }
 
@@ -138,21 +136,17 @@ virStorageBackendGetMinorNumber(const char *dev_name, uint32_t *minor)
     struct dm_task *dmt;
     struct dm_info info;
 
-    if (!(dmt = dm_task_create(DM_DEVICE_INFO))) {
+    if (!(dmt = dm_task_create(DM_DEVICE_INFO)))
         goto out;
-    }
 
-    if (!dm_task_set_name(dmt, dev_name)) {
+    if (!dm_task_set_name(dmt, dev_name))
         goto out;
-    }
 
-    if (!dm_task_run(dmt)) {
+    if (!dm_task_run(dmt))
         goto out;
-    }
 
-    if (!dm_task_get_info(dmt, &info)) {
+    if (!dm_task_get_info(dmt, &info))
         goto out;
-    }
 
     *minor = info.minor;
     ret = 0;
@@ -177,9 +171,8 @@ virStorageBackendCreateVols(virStoragePoolObjPtr pool,
     do {
         is_mpath = virStorageBackendIsMultipath(names->name);
 
-        if (is_mpath < 0) {
+        if (is_mpath < 0)
             goto out;
-        }
 
         if (is_mpath == 1) {
 
@@ -193,9 +186,8 @@ virStorageBackendCreateVols(virStoragePoolObjPtr pool,
                 goto out;
             }
 
-            if (virStorageBackendMpathNewVol(pool, minor, map_device) < 0) {
+            if (virStorageBackendMpathNewVol(pool, minor, map_device) < 0)
                 goto out;
-            }
 
             VIR_FREE(map_device);
         }
@@ -247,9 +239,8 @@ virStorageBackendGetMaps(virStoragePoolObjPtr pool)
     virStorageBackendCreateVols(pool, names);
 
  out:
-    if (dmt != NULL) {
+    if (dmt != NULL)
         dm_task_destroy(dmt);
-    }
     return retval;
 }
 
index bddbc1d4c5c57015fa6d66f8feeb808ec78288cd..5a16effd61d91e86c4d437204c523c73e0b99021 100644 (file)
@@ -330,13 +330,11 @@ static int virStorageBackendRBDRefreshPool(virConnectPtr conn,
     ptr.cluster = NULL;
     ptr.ioctx = NULL;
 
-    if (virStorageBackendRBDOpenRADOSConn(&ptr, conn, &pool->def->source) < 0) {
+    if (virStorageBackendRBDOpenRADOSConn(&ptr, conn, &pool->def->source) < 0)
         goto cleanup;
-    }
 
-    if (virStorageBackendRBDOpenIoCTX(&ptr, pool) < 0) {
+    if (virStorageBackendRBDOpenIoCTX(&ptr, pool) < 0)
         goto cleanup;
-    }
 
     struct rados_cluster_stat_t clusterstat;
     r = rados_cluster_stat(ptr.cluster, &clusterstat);
@@ -428,17 +426,14 @@ static int virStorageBackendRBDDeleteVol(virConnectPtr conn,
 
     VIR_DEBUG("Removing RBD image %s/%s", pool->def->source.name, vol->name);
 
-    if (flags & VIR_STORAGE_VOL_DELETE_ZEROED) {
+    if (flags & VIR_STORAGE_VOL_DELETE_ZEROED)
         VIR_WARN("%s", _("This storage backend does not supported zeroed removal of volumes"));
-    }
 
-    if (virStorageBackendRBDOpenRADOSConn(&ptr, conn, &pool->def->source) < 0) {
+    if (virStorageBackendRBDOpenRADOSConn(&ptr, conn, &pool->def->source) < 0)
         goto cleanup;
-    }
 
-    if (virStorageBackendRBDOpenIoCTX(&ptr, pool) < 0) {
+    if (virStorageBackendRBDOpenIoCTX(&ptr, pool) < 0)
         goto cleanup;
-    }
 
     r = rbd_remove(ptr.ioctx, vol->name);
     if (r < 0) {
@@ -555,17 +550,14 @@ static int virStorageBackendRBDRefreshVol(virConnectPtr conn,
     ptr.ioctx = NULL;
     int ret = -1;
 
-    if (virStorageBackendRBDOpenRADOSConn(&ptr, conn, &pool->def->source) < 0) {
+    if (virStorageBackendRBDOpenRADOSConn(&ptr, conn, &pool->def->source) < 0)
         goto cleanup;
-    }
 
-    if (virStorageBackendRBDOpenIoCTX(&ptr, pool) < 0) {
+    if (virStorageBackendRBDOpenIoCTX(&ptr, pool) < 0)
         goto cleanup;
-    }
 
-    if (volStorageBackendRBDRefreshVolInfo(vol, pool, &ptr) < 0) {
+    if (volStorageBackendRBDRefreshVolInfo(vol, pool, &ptr) < 0)
         goto cleanup;
-    }
 
     ret = 0;
 
@@ -589,13 +581,11 @@ static int virStorageBackendRBDResizeVol(virConnectPtr conn ATTRIBUTE_UNUSED,
 
     virCheckFlags(0, -1);
 
-    if (virStorageBackendRBDOpenRADOSConn(&ptr, conn, &pool->def->source) < 0) {
+    if (virStorageBackendRBDOpenRADOSConn(&ptr, conn, &pool->def->source) < 0)
         goto cleanup;
-    }
 
-    if (virStorageBackendRBDOpenIoCTX(&ptr, pool) < 0) {
+    if (virStorageBackendRBDOpenIoCTX(&ptr, pool) < 0)
         goto cleanup;
-    }
 
     r = rbd_open(ptr.ioctx, vol->name, &image, NULL);
     if (r < 0) {
index 3f61610c3430ab0039992e2b0ef8f35cebf32459..c952b713888474917a28e6b3094028fa2650f159 100644 (file)
@@ -256,9 +256,8 @@ getNewStyleBlockDevice(const char *lun_path,
 
     while ((direrr = virDirRead(block_dir, &block_dirent, block_path)) > 0) {
 
-        if (STREQLEN(block_dirent->d_name, ".", 1)) {
+        if (STREQLEN(block_dirent->d_name, ".", 1))
             continue;
-        }
 
         if (VIR_STRDUP(*block_device, block_dirent->d_name) < 0) {
             closedir(block_dir);
@@ -397,9 +396,8 @@ processLU(virStoragePoolObjPtr pool,
     VIR_DEBUG("%u:%u:%u:%u is a Direct-Access LUN",
               host, bus, target, lun);
 
-    if (getBlockDevice(host, bus, target, lun, &block_device) < 0) {
+    if (getBlockDevice(host, bus, target, lun, &block_device) < 0)
         goto out;
-    }
 
     if (virStorageBackendSCSINewLun(pool,
                                     host, bus, target, lun,
index fe6059a5464cbca8b62c0349a0e66b5047c7f709..9b89a676a51531762d0c1ef6e18f72bb98ade678 100644 (file)
@@ -484,9 +484,8 @@ storageConnectListDefinedStoragePools(virConnectPtr conn,
 
  cleanup:
     storageDriverUnlock();
-    for (i = 0; i < got; i++) {
+    for (i = 0; i < got; i++)
         VIR_FREE(names[i]);
-    }
     memset(names, 0, nnames * sizeof(*names));
     return -1;
 }
@@ -1650,9 +1649,8 @@ storageVolCreateXML(virStoragePoolPtr obj,
     /* Wipe any key the user may have suggested, as volume creation
      * will generate the canonical key.  */
     VIR_FREE(voldef->key);
-    if (backend->createVol(obj->conn, pool, voldef) < 0) {
+    if (backend->createVol(obj->conn, pool, voldef) < 0)
         goto cleanup;
-    }
 
     pool->volumes.objs[pool->volumes.count++] = voldef;
     volobj = virGetStorageVol(obj->conn, pool->def->name, voldef->name,
@@ -1830,9 +1828,8 @@ storageVolCreateXMLFrom(virStoragePoolPtr obj,
      * Wipe any key the user may have suggested, as volume creation
      * will generate the canonical key.  */
     VIR_FREE(newvol->key);
-    if (backend->createVol(obj->conn, pool, newvol) < 0) {
+    if (backend->createVol(obj->conn, pool, newvol) < 0)
         goto cleanup;
-    }
 
     pool->volumes.objs[pool->volumes.count++] = newvol;
     volobj = virGetStorageVol(obj->conn, pool->def->name, newvol->name,