maint: fix comma style issues: conf

Most of our code base uses space after comma but not before;
fix the remaining uses before adding a syntax check.

* src/conf/capabilities.c: Consistently use commas.
* src/conf/domain_conf.c: Likewise.
* src/conf/network_conf.c: Likewise.
* src/conf/storage_conf.c: Likewise.

Signed-off-by: Eric Blake <eblake@redhat.com>
(cherry picked from commit 6f4901e13b)
This commit is contained in:
Eric Blake 2013-11-19 15:21:40 -07:00 committed by Cole Robinson
parent b7288926e0
commit 5fdc3e6e2c
4 changed files with 55 additions and 54 deletions

View File

@ -761,7 +761,7 @@ virCapabilitiesFormatXML(virCapsPtr caps)
virBufferAddLit(&xml, " <host>\n"); virBufferAddLit(&xml, " <host>\n");
if (virUUIDIsValid(caps->host.host_uuid)) { if (virUUIDIsValid(caps->host.host_uuid)) {
virUUIDFormat(caps->host.host_uuid, host_uuid); virUUIDFormat(caps->host.host_uuid, host_uuid);
virBufferAsprintf(&xml," <uuid>%s</uuid>\n", host_uuid); virBufferAsprintf(&xml, " <uuid>%s</uuid>\n", host_uuid);
} }
virBufferAddLit(&xml, " <cpu>\n"); virBufferAddLit(&xml, " <cpu>\n");
if (caps->host.arch) if (caps->host.arch)

View File

@ -14243,7 +14243,7 @@ virDomainDiskBlockIoDefFormat(virBufferPtr buf,
{ {
if (def->blockio.logical_block_size > 0 || if (def->blockio.logical_block_size > 0 ||
def->blockio.physical_block_size > 0) { def->blockio.physical_block_size > 0) {
virBufferAddLit(buf," <blockio"); virBufferAddLit(buf, " <blockio");
if (def->blockio.logical_block_size > 0) { if (def->blockio.logical_block_size > 0) {
virBufferAsprintf(buf, virBufferAsprintf(buf,
" logical_block_size='%u'", " logical_block_size='%u'",
@ -14270,7 +14270,7 @@ virDomainDiskSourceDefFormat(virBufferPtr buf,
def->startupPolicy) { def->startupPolicy) {
switch (def->type) { switch (def->type) {
case VIR_DOMAIN_DISK_TYPE_FILE: case VIR_DOMAIN_DISK_TYPE_FILE:
virBufferAddLit(buf," <source"); virBufferAddLit(buf, " <source");
if (def->src) if (def->src)
virBufferEscapeString(buf, " file='%s'", def->src); virBufferEscapeString(buf, " file='%s'", def->src);
if (def->startupPolicy) if (def->startupPolicy)

View File

@ -2393,7 +2393,7 @@ virNetworkIpDefFormat(virBufferPtr buf,
VIR_FREE(addr); VIR_FREE(addr);
} }
if (def->prefix > 0) { if (def->prefix > 0) {
virBufferAsprintf(buf," prefix='%u'", def->prefix); virBufferAsprintf(buf, " prefix='%u'", def->prefix);
} }
virBufferAddLit(buf, ">\n"); virBufferAddLit(buf, ">\n");
virBufferAdjustIndent(buf, 2); virBufferAdjustIndent(buf, 2);
@ -2492,7 +2492,7 @@ virNetworkRouteDefFormat(virBufferPtr buf,
VIR_FREE(addr); VIR_FREE(addr);
} }
if (def->has_prefix) { if (def->has_prefix) {
virBufferAsprintf(buf," prefix='%u'", def->prefix); virBufferAsprintf(buf, " prefix='%u'", def->prefix);
} }
if (VIR_SOCKET_ADDR_VALID(&def->gateway)) { if (VIR_SOCKET_ADDR_VALID(&def->gateway)) {
char *addr = virSocketAddrFormat(&def->gateway); char *addr = virSocketAddrFormat(&def->gateway);
@ -2502,7 +2502,7 @@ virNetworkRouteDefFormat(virBufferPtr buf,
VIR_FREE(addr); VIR_FREE(addr);
} }
if (def->has_metric && def->metric > 0) { if (def->has_metric && def->metric > 0) {
virBufferAsprintf(buf," metric='%u'", def->metric); virBufferAsprintf(buf, " metric='%u'", def->metric);
} }
virBufferAddLit(buf, "/>\n"); virBufferAddLit(buf, "/>\n");

View File

@ -1053,7 +1053,7 @@ virStoragePoolSourceFormat(virBufferPtr buf,
size_t i, j; size_t i, j;
char uuid[VIR_UUID_STRING_BUFLEN]; char uuid[VIR_UUID_STRING_BUFLEN];
virBufferAddLit(buf," <source>\n"); virBufferAddLit(buf, " <source>\n");
if ((options->flags & VIR_STORAGE_POOL_SOURCE_HOST) && src->nhost) { if ((options->flags & VIR_STORAGE_POOL_SOURCE_HOST) && src->nhost) {
for (i = 0; i < src->nhost; i++) { for (i = 0; i < src->nhost; i++) {
virBufferAsprintf(buf, " <host name='%s'", src->hosts[i].name); virBufferAsprintf(buf, " <host name='%s'", src->hosts[i].name);
@ -1067,14 +1067,14 @@ virStoragePoolSourceFormat(virBufferPtr buf,
src->ndevice) { src->ndevice) {
for (i = 0; i < src->ndevice; i++) { for (i = 0; i < src->ndevice; i++) {
if (src->devices[i].nfreeExtent) { if (src->devices[i].nfreeExtent) {
virBufferAsprintf(buf," <device path='%s'>\n", virBufferAsprintf(buf, " <device path='%s'>\n",
src->devices[i].path); src->devices[i].path);
for (j = 0; j < src->devices[i].nfreeExtent; j++) { for (j = 0; j < src->devices[i].nfreeExtent; j++) {
virBufferAsprintf(buf, " <freeExtent start='%llu' end='%llu'/>\n", virBufferAsprintf(buf, " <freeExtent start='%llu' end='%llu'/>\n",
src->devices[i].freeExtents[j].start, src->devices[i].freeExtents[j].start,
src->devices[i].freeExtents[j].end); src->devices[i].freeExtents[j].end);
} }
virBufferAddLit(buf," </device>\n"); virBufferAddLit(buf, " </device>\n");
} else { } else {
virBufferAsprintf(buf, " <device path='%s'/>\n", virBufferAsprintf(buf, " <device path='%s'/>\n",
src->devices[i].path); src->devices[i].path);
@ -1084,7 +1084,7 @@ virStoragePoolSourceFormat(virBufferPtr buf,
if ((options->flags & VIR_STORAGE_POOL_SOURCE_DIR) && if ((options->flags & VIR_STORAGE_POOL_SOURCE_DIR) &&
src->dir) src->dir)
virBufferAsprintf(buf," <dir path='%s'/>\n", src->dir); virBufferAsprintf(buf, " <dir path='%s'/>\n", src->dir);
if ((options->flags & VIR_STORAGE_POOL_SOURCE_ADAPTER)) { if ((options->flags & VIR_STORAGE_POOL_SOURCE_ADAPTER)) {
if (src->adapter.type == VIR_STORAGE_POOL_SOURCE_ADAPTER_TYPE_FC_HOST || if (src->adapter.type == VIR_STORAGE_POOL_SOURCE_ADAPTER_TYPE_FC_HOST ||
@ -1095,24 +1095,25 @@ virStoragePoolSourceFormat(virBufferPtr buf,
if (src->adapter.type == VIR_STORAGE_POOL_SOURCE_ADAPTER_TYPE_FC_HOST) { if (src->adapter.type == VIR_STORAGE_POOL_SOURCE_ADAPTER_TYPE_FC_HOST) {
virBufferEscapeString(buf, " parent='%s'", virBufferEscapeString(buf, " parent='%s'",
src->adapter.data.fchost.parent); src->adapter.data.fchost.parent);
virBufferAsprintf(buf," wwnn='%s' wwpn='%s'/>\n", virBufferAsprintf(buf, " wwnn='%s' wwpn='%s'/>\n",
src->adapter.data.fchost.wwnn, src->adapter.data.fchost.wwnn,
src->adapter.data.fchost.wwpn); src->adapter.data.fchost.wwpn);
} else if (src->adapter.type == } else if (src->adapter.type ==
VIR_STORAGE_POOL_SOURCE_ADAPTER_TYPE_SCSI_HOST) { VIR_STORAGE_POOL_SOURCE_ADAPTER_TYPE_SCSI_HOST) {
virBufferAsprintf(buf," name='%s'/>\n", src->adapter.data.name); virBufferAsprintf(buf, " name='%s'/>\n", src->adapter.data.name);
} }
} }
if ((options->flags & VIR_STORAGE_POOL_SOURCE_NAME) && if ((options->flags & VIR_STORAGE_POOL_SOURCE_NAME) &&
src->name) src->name)
virBufferAsprintf(buf," <name>%s</name>\n", src->name); virBufferAsprintf(buf, " <name>%s</name>\n", src->name);
if ((options->flags & VIR_STORAGE_POOL_SOURCE_INITIATOR_IQN) && if ((options->flags & VIR_STORAGE_POOL_SOURCE_INITIATOR_IQN) &&
src->initiator.iqn) { src->initiator.iqn) {
virBufferAddLit(buf," <initiator>\n"); virBufferAddLit(buf, " <initiator>\n");
virBufferEscapeString(buf," <iqn name='%s'/>\n", src->initiator.iqn); virBufferEscapeString(buf, " <iqn name='%s'/>\n",
virBufferAddLit(buf," </initiator>\n"); src->initiator.iqn);
virBufferAddLit(buf, " </initiator>\n");
} }
if (options->formatToString) { if (options->formatToString) {
@ -1123,40 +1124,40 @@ virStoragePoolSourceFormat(virBufferPtr buf,
src->format); src->format);
return -1; return -1;
} }
virBufferAsprintf(buf," <format type='%s'/>\n", format); virBufferAsprintf(buf, " <format type='%s'/>\n", format);
} }
if (src->authType == VIR_STORAGE_POOL_AUTH_CHAP || if (src->authType == VIR_STORAGE_POOL_AUTH_CHAP ||
src->authType == VIR_STORAGE_POOL_AUTH_CEPHX) { src->authType == VIR_STORAGE_POOL_AUTH_CEPHX) {
virBufferAsprintf(buf," <auth type='%s' username='%s'>\n", virBufferAsprintf(buf, " <auth type='%s' username='%s'>\n",
virStoragePoolAuthTypeTypeToString(src->authType), virStoragePoolAuthTypeTypeToString(src->authType),
(src->authType == VIR_STORAGE_POOL_AUTH_CHAP ? (src->authType == VIR_STORAGE_POOL_AUTH_CHAP ?
src->auth.chap.username : src->auth.chap.username :
src->auth.cephx.username)); src->auth.cephx.username));
virBufferAddLit(buf," <secret"); virBufferAddLit(buf, " <secret");
if (src->auth.cephx.secret.uuidUsable) { if (src->auth.cephx.secret.uuidUsable) {
virUUIDFormat(src->auth.cephx.secret.uuid, uuid); virUUIDFormat(src->auth.cephx.secret.uuid, uuid);
virBufferAsprintf(buf," uuid='%s'", uuid); virBufferAsprintf(buf, " uuid='%s'", uuid);
} }
if (src->auth.cephx.secret.usage != NULL) { if (src->auth.cephx.secret.usage != NULL) {
virBufferAsprintf(buf," usage='%s'", src->auth.cephx.secret.usage); virBufferAsprintf(buf, " usage='%s'", src->auth.cephx.secret.usage);
} }
virBufferAddLit(buf,"/>\n"); virBufferAddLit(buf, "/>\n");
virBufferAddLit(buf," </auth>\n"); virBufferAddLit(buf, " </auth>\n");
} }
if (src->vendor != NULL) { if (src->vendor != NULL) {
virBufferEscapeString(buf," <vendor name='%s'/>\n", src->vendor); virBufferEscapeString(buf, " <vendor name='%s'/>\n", src->vendor);
} }
if (src->product != NULL) { if (src->product != NULL) {
virBufferEscapeString(buf," <product name='%s'/>\n", src->product); virBufferEscapeString(buf, " <product name='%s'/>\n", src->product);
} }
virBufferAddLit(buf," </source>\n"); virBufferAddLit(buf, " </source>\n");
return 0; return 0;
} }
@ -1181,16 +1182,16 @@ virStoragePoolDefFormat(virStoragePoolDefPtr def)
goto cleanup; goto cleanup;
} }
virBufferAsprintf(&buf, "<pool type='%s'>\n", type); virBufferAsprintf(&buf, "<pool type='%s'>\n", type);
virBufferAsprintf(&buf," <name>%s</name>\n", def->name); virBufferAsprintf(&buf, " <name>%s</name>\n", def->name);
virUUIDFormat(def->uuid, uuid); virUUIDFormat(def->uuid, uuid);
virBufferAsprintf(&buf," <uuid>%s</uuid>\n", uuid); virBufferAsprintf(&buf, " <uuid>%s</uuid>\n", uuid);
virBufferAsprintf(&buf," <capacity unit='bytes'>%llu</capacity>\n", virBufferAsprintf(&buf, " <capacity unit='bytes'>%llu</capacity>\n",
def->capacity); def->capacity);
virBufferAsprintf(&buf," <allocation unit='bytes'>%llu</allocation>\n", virBufferAsprintf(&buf, " <allocation unit='bytes'>%llu</allocation>\n",
def->allocation); def->allocation);
virBufferAsprintf(&buf," <available unit='bytes'>%llu</available>\n", virBufferAsprintf(&buf, " <available unit='bytes'>%llu</available>\n",
def->available); def->available);
if (virStoragePoolSourceFormat(&buf, options, &def->source) < 0) if (virStoragePoolSourceFormat(&buf, options, &def->source) < 0)
@ -1200,27 +1201,27 @@ virStoragePoolDefFormat(virStoragePoolDefPtr def)
* doesn't have a target */ * doesn't have a target */
if (def->type != VIR_STORAGE_POOL_RBD && if (def->type != VIR_STORAGE_POOL_RBD &&
def->type != VIR_STORAGE_POOL_SHEEPDOG) { def->type != VIR_STORAGE_POOL_SHEEPDOG) {
virBufferAddLit(&buf," <target>\n"); virBufferAddLit(&buf, " <target>\n");
if (def->target.path) if (def->target.path)
virBufferAsprintf(&buf," <path>%s</path>\n", def->target.path); virBufferAsprintf(&buf, " <path>%s</path>\n", def->target.path);
virBufferAddLit(&buf," <permissions>\n"); virBufferAddLit(&buf, " <permissions>\n");
virBufferAsprintf(&buf," <mode>0%o</mode>\n", virBufferAsprintf(&buf, " <mode>0%o</mode>\n",
def->target.perms.mode); def->target.perms.mode);
virBufferAsprintf(&buf," <owner>%d</owner>\n", virBufferAsprintf(&buf, " <owner>%d</owner>\n",
(int) def->target.perms.uid); (int) def->target.perms.uid);
virBufferAsprintf(&buf," <group>%d</group>\n", virBufferAsprintf(&buf, " <group>%d</group>\n",
(int) def->target.perms.gid); (int) def->target.perms.gid);
if (def->target.perms.label) if (def->target.perms.label)
virBufferAsprintf(&buf," <label>%s</label>\n", virBufferAsprintf(&buf, " <label>%s</label>\n",
def->target.perms.label); def->target.perms.label);
virBufferAddLit(&buf," </permissions>\n"); virBufferAddLit(&buf, " </permissions>\n");
virBufferAddLit(&buf," </target>\n"); virBufferAddLit(&buf, " </target>\n");
} }
virBufferAddLit(&buf,"</pool>\n"); virBufferAddLit(&buf, "</pool>\n");
if (virBufferError(&buf)) if (virBufferError(&buf))
goto no_memory; goto no_memory;
@ -1488,7 +1489,7 @@ virStorageVolTargetDefFormat(virStorageVolOptionsPtr options,
virBufferAsprintf(buf, " <%s>\n", type); virBufferAsprintf(buf, " <%s>\n", type);
if (def->path) if (def->path)
virBufferAsprintf(buf," <path>%s</path>\n", def->path); virBufferAsprintf(buf, " <path>%s</path>\n", def->path);
if (options->formatToString) { if (options->formatToString) {
const char *format = (options->formatToString)(def->format); const char *format = (options->formatToString)(def->format);
@ -1498,23 +1499,23 @@ virStorageVolTargetDefFormat(virStorageVolOptionsPtr options,
def->format); def->format);
return -1; return -1;
} }
virBufferAsprintf(buf," <format type='%s'/>\n", format); virBufferAsprintf(buf, " <format type='%s'/>\n", format);
} }
virBufferAddLit(buf," <permissions>\n"); virBufferAddLit(buf, " <permissions>\n");
virBufferAsprintf(buf," <mode>0%o</mode>\n", virBufferAsprintf(buf, " <mode>0%o</mode>\n",
def->perms.mode); def->perms.mode);
virBufferAsprintf(buf," <owner>%u</owner>\n", virBufferAsprintf(buf, " <owner>%u</owner>\n",
(unsigned int) def->perms.uid); (unsigned int) def->perms.uid);
virBufferAsprintf(buf," <group>%u</group>\n", virBufferAsprintf(buf, " <group>%u</group>\n",
(unsigned int) def->perms.gid); (unsigned int) def->perms.gid);
if (def->perms.label) if (def->perms.label)
virBufferAsprintf(buf," <label>%s</label>\n", virBufferAsprintf(buf, " <label>%s</label>\n",
def->perms.label); def->perms.label);
virBufferAddLit(buf," </permissions>\n"); virBufferAddLit(buf, " </permissions>\n");
if (def->timestamps) { if (def->timestamps) {
virBufferAddLit(buf, " <timestamps>\n"); virBufferAddLit(buf, " <timestamps>\n");
@ -1571,8 +1572,8 @@ virStorageVolDefFormat(virStoragePoolDefPtr pool,
return NULL; return NULL;
virBufferAddLit(&buf, "<volume>\n"); virBufferAddLit(&buf, "<volume>\n");
virBufferAsprintf(&buf," <name>%s</name>\n", def->name); virBufferAsprintf(&buf, " <name>%s</name>\n", def->name);
virBufferAsprintf(&buf," <key>%s</key>\n", NULLSTR(def->key)); virBufferAsprintf(&buf, " <key>%s</key>\n", NULLSTR(def->key));
virBufferAddLit(&buf, " <source>\n"); virBufferAddLit(&buf, " <source>\n");
if (def->source.nextent) { if (def->source.nextent) {
@ -1599,9 +1600,9 @@ virStorageVolDefFormat(virStoragePoolDefPtr pool,
} }
virBufferAddLit(&buf, " </source>\n"); virBufferAddLit(&buf, " </source>\n");
virBufferAsprintf(&buf," <capacity unit='bytes'>%llu</capacity>\n", virBufferAsprintf(&buf, " <capacity unit='bytes'>%llu</capacity>\n",
def->capacity); def->capacity);
virBufferAsprintf(&buf," <allocation unit='bytes'>%llu</allocation>\n", virBufferAsprintf(&buf, " <allocation unit='bytes'>%llu</allocation>\n",
def->allocation); def->allocation);
if (virStorageVolTargetDefFormat(options, &buf, if (virStorageVolTargetDefFormat(options, &buf,
@ -1613,7 +1614,7 @@ virStorageVolDefFormat(virStoragePoolDefPtr pool,
&def->backingStore, "backingStore") < 0) &def->backingStore, "backingStore") < 0)
goto cleanup; goto cleanup;
virBufferAddLit(&buf,"</volume>\n"); virBufferAddLit(&buf, "</volume>\n");
if (virBufferError(&buf)) if (virBufferError(&buf))
goto no_memory; goto no_memory;