[libvirt] [PATCH 04/10] maint: whitespace cleanups

Eric Blake eblake at redhat.com
Wed Aug 18 23:45:07 UTC 2010


* src/storage/storage_backend_disk.c
(virStorageBackendDiskPartFormat): Fix spacing.
---

Should be cosmetic only.

 src/storage/storage_backend_disk.c |   66 +++++++++++++++++++-----------------
 1 files changed, 35 insertions(+), 31 deletions(-)

diff --git a/src/storage/storage_backend_disk.c b/src/storage/storage_backend_disk.c
index 7188386..4038093 100644
--- a/src/storage/storage_backend_disk.c
+++ b/src/storage/storage_backend_disk.c
@@ -385,20 +385,22 @@ virStorageBackendDiskPartFormat(virStoragePoolObjPtr pool,
 {
     int i;
     if (pool->def->source.format == VIR_STORAGE_POOL_DISK_DOS) {
-        const char *partedFormat = virStoragePartedFsTypeTypeToString(vol->target.format);
+        const char *partedFormat;
+        partedFormat = virStoragePartedFsTypeTypeToString(vol->target.format);
         if(partedFormat == NULL) {
-           virStorageReportError(VIR_ERR_INTERNAL_ERROR,
-                                 "%s", _("Invalid partition type"));
-           return -1;
+            virStorageReportError(VIR_ERR_INTERNAL_ERROR,
+                                  "%s", _("Invalid partition type"));
+            return -1;
         }
         if (vol->target.format == VIR_STORAGE_VOL_DISK_EXTENDED) {
             /* make sure we don't have a extended partition already */
             for (i = 0; i < pool->volumes.count; i++) {
-                 if (pool->volumes.objs[i]->target.format == VIR_STORAGE_VOL_DISK_EXTENDED) {
-                     virStorageReportError(VIR_ERR_INTERNAL_ERROR,
-                                           "%s", _("extended partition already exists"));
-                     return -1;
-                 }
+                if (pool->volumes.objs[i]->target.format ==
+                    VIR_STORAGE_VOL_DISK_EXTENDED) {
+                    virStorageReportError(VIR_ERR_INTERNAL_ERROR, "%s",
+                                          _("extended partition already exists"));
+                    return -1;
+                }
             }
             sprintf(partFormat, "%s", partedFormat);
         } else {
@@ -407,25 +409,26 @@ virStorageBackendDiskPartFormat(virStoragePoolObjPtr pool,
                to create logical partitions. */
             /* XXX Only support one extended partition */
             switch (virStorageBackendDiskPartTypeToCreate(pool)) {
-                    case VIR_STORAGE_VOL_DISK_TYPE_PRIMARY:
-                         sprintf(partFormat, "primary %s", partedFormat);
-                         break;
-                    case VIR_STORAGE_VOL_DISK_TYPE_LOGICAL:
-                         /* make sure we have a extended partition */
-                         for (i = 0; i < pool->volumes.count; i++) {
-                              if (pool->volumes.objs[i]->target.format == VIR_STORAGE_VOL_DISK_EXTENDED) {
-                                  sprintf(partFormat, "logical %s", partedFormat);
-                                  break;
-                              }
-                         }
-                         if (i == pool->volumes.count) {
-                             virStorageReportError(VIR_ERR_INTERNAL_ERROR,
-                                                   "%s", _("no extended partition found and no primary partition available"));
-                             return -1;
-                         }
-                         break;
-                    default:
-                         break;
+            case VIR_STORAGE_VOL_DISK_TYPE_PRIMARY:
+                sprintf(partFormat, "primary %s", partedFormat);
+                break;
+            case VIR_STORAGE_VOL_DISK_TYPE_LOGICAL:
+                /* make sure we have a extended partition */
+                for (i = 0; i < pool->volumes.count; i++) {
+                    if (pool->volumes.objs[i]->target.format ==
+                        VIR_STORAGE_VOL_DISK_EXTENDED) {
+                        sprintf(partFormat, "logical %s", partedFormat);
+                        break;
+                    }
+                }
+                if (i == pool->volumes.count) {
+                    virStorageReportError(VIR_ERR_INTERNAL_ERROR,
+                                          "%s", _("no extended partition found and no primary partition available"));
+                    return -1;
+                }
+                break;
+            default:
+                break;
             }
         }
     } else {
@@ -436,7 +439,7 @@ virStorageBackendDiskPartFormat(virStoragePoolObjPtr pool,

 /**
  * Aligns a new partition to nearest cylinder boundry
- * when haveing a msdos partition table type
+ * when having a msdos partition table type
  * to avoid any problem with all ready existing
  * partitions
  */
@@ -455,7 +458,8 @@ virStorageBackendDiskPartBoundries(virStoragePoolObjPtr pool,
     unsigned long long cylinderSize = dev->geometry.heads *
                                       dev->geometry.sectors * SECTOR_SIZE;

-    DEBUG("find free area: allocation %llu, cyl size %llu", allocation, cylinderSize);
+    DEBUG("find free area: allocation %llu, cyl size %llu", allocation,
+          cylinderSize);
     int partType = virStorageBackendDiskPartTypeToCreate(pool);

     /* how many extra bytes we have since we allocate
@@ -561,7 +565,7 @@ virStorageBackendDiskCreateVol(virConnectPtr conn ATTRIBUTE_UNUSED,
     if (virStorageBackendDiskPartBoundries(pool, &startOffset,
                                            &endOffset,
                                            vol->capacity) != 0) {
-       return -1;
+        return -1;
     }

     snprintf(start, sizeof(start)-1, "%lluB", startOffset);
-- 
1.7.2.1




More information about the libvir-list mailing list