提交 57ae4c04 编写于 作者: E Eric Blake

maint: whitespace cleanups

* src/storage/storage_backend_disk.c
(virStorageBackendDiskPartFormat): Fix spacing.
上级 4b930023
...@@ -128,11 +128,11 @@ virStorageBackendDiskMakeDataVol(virStoragePoolObjPtr pool, ...@@ -128,11 +128,11 @@ virStorageBackendDiskMakeDataVol(virStoragePoolObjPtr pool,
return -1; return -1;
/* set partition type */ /* set partition type */
if(STREQ(groups[1], "normal")) if (STREQ(groups[1], "normal"))
vol->target.type = VIR_STORAGE_VOL_DISK_TYPE_PRIMARY; vol->target.type = VIR_STORAGE_VOL_DISK_TYPE_PRIMARY;
else if(STREQ(groups[1], "logical")) else if (STREQ(groups[1], "logical"))
vol->target.type = VIR_STORAGE_VOL_DISK_TYPE_LOGICAL; vol->target.type = VIR_STORAGE_VOL_DISK_TYPE_LOGICAL;
else if(STREQ(groups[1], "extended")) else if (STREQ(groups[1], "extended"))
vol->target.type = VIR_STORAGE_VOL_DISK_TYPE_EXTENDED; vol->target.type = VIR_STORAGE_VOL_DISK_TYPE_EXTENDED;
else else
vol->target.type = VIR_STORAGE_VOL_DISK_TYPE_NONE; vol->target.type = VIR_STORAGE_VOL_DISK_TYPE_NONE;
...@@ -167,7 +167,7 @@ virStorageBackendDiskMakeFreeExtent(virStoragePoolObjPtr pool, ...@@ -167,7 +167,7 @@ virStorageBackendDiskMakeFreeExtent(virStoragePoolObjPtr pool,
sizeof(dev->freeExtents[0])); sizeof(dev->freeExtents[0]));
/* set type of free area */ /* set type of free area */
if(STREQ(groups[1], "logical")) { if (STREQ(groups[1], "logical")) {
dev->freeExtents[dev->nfreeExtent].type = VIR_STORAGE_FREE_LOGICAL; dev->freeExtents[dev->nfreeExtent].type = VIR_STORAGE_FREE_LOGICAL;
} else { } else {
dev->freeExtents[dev->nfreeExtent].type = VIR_STORAGE_FREE_NORMAL; dev->freeExtents[dev->nfreeExtent].type = VIR_STORAGE_FREE_NORMAL;
...@@ -385,20 +385,22 @@ virStorageBackendDiskPartFormat(virStoragePoolObjPtr pool, ...@@ -385,20 +385,22 @@ virStorageBackendDiskPartFormat(virStoragePoolObjPtr pool,
{ {
int i; int i;
if (pool->def->source.format == VIR_STORAGE_POOL_DISK_DOS) { if (pool->def->source.format == VIR_STORAGE_POOL_DISK_DOS) {
const char *partedFormat = virStoragePartedFsTypeTypeToString(vol->target.format); const char *partedFormat;
if(partedFormat == NULL) { partedFormat = virStoragePartedFsTypeTypeToString(vol->target.format);
virStorageReportError(VIR_ERR_INTERNAL_ERROR, if (partedFormat == NULL) {
"%s", _("Invalid partition type")); virStorageReportError(VIR_ERR_INTERNAL_ERROR,
return -1; "%s", _("Invalid partition type"));
return -1;
} }
if (vol->target.format == VIR_STORAGE_VOL_DISK_EXTENDED) { if (vol->target.format == VIR_STORAGE_VOL_DISK_EXTENDED) {
/* make sure we don't have a extended partition already */ /* make sure we don't have a extended partition already */
for (i = 0; i < pool->volumes.count; i++) { for (i = 0; i < pool->volumes.count; i++) {
if (pool->volumes.objs[i]->target.format == VIR_STORAGE_VOL_DISK_EXTENDED) { if (pool->volumes.objs[i]->target.format ==
virStorageReportError(VIR_ERR_INTERNAL_ERROR, VIR_STORAGE_VOL_DISK_EXTENDED) {
"%s", _("extended partition already exists")); virStorageReportError(VIR_ERR_INTERNAL_ERROR, "%s",
return -1; _("extended partition already exists"));
} return -1;
}
} }
sprintf(partFormat, "%s", partedFormat); sprintf(partFormat, "%s", partedFormat);
} else { } else {
...@@ -407,25 +409,26 @@ virStorageBackendDiskPartFormat(virStoragePoolObjPtr pool, ...@@ -407,25 +409,26 @@ virStorageBackendDiskPartFormat(virStoragePoolObjPtr pool,
to create logical partitions. */ to create logical partitions. */
/* XXX Only support one extended partition */ /* XXX Only support one extended partition */
switch (virStorageBackendDiskPartTypeToCreate(pool)) { switch (virStorageBackendDiskPartTypeToCreate(pool)) {
case VIR_STORAGE_VOL_DISK_TYPE_PRIMARY: case VIR_STORAGE_VOL_DISK_TYPE_PRIMARY:
sprintf(partFormat, "primary %s", partedFormat); sprintf(partFormat, "primary %s", partedFormat);
break; break;
case VIR_STORAGE_VOL_DISK_TYPE_LOGICAL: case VIR_STORAGE_VOL_DISK_TYPE_LOGICAL:
/* make sure we have a extended partition */ /* make sure we have a extended partition */
for (i = 0; i < pool->volumes.count; i++) { for (i = 0; i < pool->volumes.count; i++) {
if (pool->volumes.objs[i]->target.format == VIR_STORAGE_VOL_DISK_EXTENDED) { if (pool->volumes.objs[i]->target.format ==
sprintf(partFormat, "logical %s", partedFormat); VIR_STORAGE_VOL_DISK_EXTENDED) {
break; sprintf(partFormat, "logical %s", partedFormat);
} break;
} }
if (i == pool->volumes.count) { }
virStorageReportError(VIR_ERR_INTERNAL_ERROR, if (i == pool->volumes.count) {
"%s", _("no extended partition found and no primary partition available")); virStorageReportError(VIR_ERR_INTERNAL_ERROR,
return -1; "%s", _("no extended partition found and no primary partition available"));
} return -1;
break; }
default: break;
break; default:
break;
} }
} }
} else { } else {
...@@ -436,7 +439,7 @@ virStorageBackendDiskPartFormat(virStoragePoolObjPtr pool, ...@@ -436,7 +439,7 @@ virStorageBackendDiskPartFormat(virStoragePoolObjPtr pool,
/** /**
* Aligns a new partition to nearest cylinder boundry * 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 * to avoid any problem with all ready existing
* partitions * partitions
*/ */
...@@ -455,7 +458,8 @@ virStorageBackendDiskPartBoundries(virStoragePoolObjPtr pool, ...@@ -455,7 +458,8 @@ virStorageBackendDiskPartBoundries(virStoragePoolObjPtr pool,
unsigned long long cylinderSize = dev->geometry.heads * unsigned long long cylinderSize = dev->geometry.heads *
dev->geometry.sectors * SECTOR_SIZE; 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); int partType = virStorageBackendDiskPartTypeToCreate(pool);
/* how many extra bytes we have since we allocate /* how many extra bytes we have since we allocate
...@@ -492,9 +496,9 @@ virStorageBackendDiskPartBoundries(virStoragePoolObjPtr pool, ...@@ -492,9 +496,9 @@ virStorageBackendDiskPartBoundries(virStoragePoolObjPtr pool,
continue; continue;
/* for primary partition, the free extent /* for primary partition, the free extent
must not be within a logical free area */ must not be within a logical free area */
} else if(partType == VIR_STORAGE_VOL_DISK_TYPE_PRIMARY && } else if (partType == VIR_STORAGE_VOL_DISK_TYPE_PRIMARY &&
dev->freeExtents[i].type != VIR_STORAGE_FREE_NORMAL) { dev->freeExtents[i].type != VIR_STORAGE_FREE_NORMAL) {
continue; continue;
} }
smallestSize = size; smallestSize = size;
smallestExtent = i; smallestExtent = i;
...@@ -561,7 +565,7 @@ virStorageBackendDiskCreateVol(virConnectPtr conn ATTRIBUTE_UNUSED, ...@@ -561,7 +565,7 @@ virStorageBackendDiskCreateVol(virConnectPtr conn ATTRIBUTE_UNUSED,
if (virStorageBackendDiskPartBoundries(pool, &startOffset, if (virStorageBackendDiskPartBoundries(pool, &startOffset,
&endOffset, &endOffset,
vol->capacity) != 0) { vol->capacity) != 0) {
return -1; return -1;
} }
snprintf(start, sizeof(start)-1, "%lluB", startOffset); snprintf(start, sizeof(start)-1, "%lluB", startOffset);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册