Remove unnecessary curly brackets in src/conf/

Signed-off-by: Martin Kletzander <mkletzan@redhat.com>
This commit is contained in:
Martin Kletzander 2014-11-13 15:23:27 +01:00
parent 3d45429ef1
commit 7b9710f818
8 changed files with 85 additions and 170 deletions

View File

@ -219,9 +219,8 @@ virCapabilitiesDispose(void *object)
VIR_FREE(caps->host.migrateTrans[i]); VIR_FREE(caps->host.migrateTrans[i]);
VIR_FREE(caps->host.migrateTrans); VIR_FREE(caps->host.migrateTrans);
for (i = 0; i < caps->host.nsecModels; i++) { for (i = 0; i < caps->host.nsecModels; i++)
virCapabilitiesClearSecModel(&caps->host.secModels[i]); virCapabilitiesClearSecModel(&caps->host.secModels[i]);
}
VIR_FREE(caps->host.secModels); VIR_FREE(caps->host.secModels);
VIR_FREE(caps->host.pagesSize); VIR_FREE(caps->host.pagesSize);

View File

@ -2008,9 +2008,8 @@ virDomainVcpuPinDefArrayFree(virDomainVcpuPinDefPtr *def,
if (!def) if (!def)
return; return;
for (i = 0; i < nvcpupin; i++) { for (i = 0; i < nvcpupin; i++)
virDomainVcpuPinDefFree(def[i]); virDomainVcpuPinDefFree(def[i]);
}
VIR_FREE(def); VIR_FREE(def);
} }
@ -2689,9 +2688,8 @@ virDomainDeviceInfoCopy(virDomainDeviceInfoPtr dst,
void virDomainDeviceInfoClear(virDomainDeviceInfoPtr info) void virDomainDeviceInfoClear(virDomainDeviceInfoPtr info)
{ {
VIR_FREE(info->alias); VIR_FREE(info->alias);
if (info->type == VIR_DOMAIN_DEVICE_ADDRESS_TYPE_USB) { if (info->type == VIR_DOMAIN_DEVICE_ADDRESS_TYPE_USB)
VIR_FREE(info->addr.usb.port); VIR_FREE(info->addr.usb.port);
}
memset(&info->addr, 0, sizeof(info->addr)); memset(&info->addr, 0, sizeof(info->addr));
info->type = VIR_DOMAIN_DEVICE_ADDRESS_TYPE_NONE; info->type = VIR_DOMAIN_DEVICE_ADDRESS_TYPE_NONE;
VIR_FREE(info->romfile); VIR_FREE(info->romfile);
@ -4804,9 +4802,8 @@ virDomainDiskDefAssignAddress(virDomainXMLOptionPtr xmlopt,
def->info.addr.drive.unit = idx % 15; def->info.addr.drive.unit = idx % 15;
/* Skip the SCSI controller at unit 7 */ /* Skip the SCSI controller at unit 7 */
if (def->info.addr.drive.unit >= 7) { if (def->info.addr.drive.unit >= 7)
++def->info.addr.drive.unit; ++def->info.addr.drive.unit;
}
} else { } else {
/* For a narrow SCSI bus we define the default mapping to be /* For a narrow SCSI bus we define the default mapping to be
* 7 units per bus, 1 bus per controller, many controllers */ * 7 units per bus, 1 bus per controller, many controllers */
@ -5081,9 +5078,8 @@ virSecurityLabelDefsParseXML(virDomainDefPtr def,
error: error:
ctxt->node = saved_node; ctxt->node = saved_node;
for (; i > 0; i--) { for (; i > 0; i--)
virSecurityLabelDefFree(def->seclabels[i - 1]); virSecurityLabelDefFree(def->seclabels[i - 1]);
}
VIR_FREE(def->seclabels); VIR_FREE(def->seclabels);
def->nseclabels = 0; def->nseclabels = 0;
VIR_FREE(list); VIR_FREE(list);
@ -5187,9 +5183,8 @@ virSecurityDeviceLabelDefParseXML(virSecurityDeviceLabelDefPtr **seclabels_rtn,
return 0; return 0;
error: error:
for (i = 0; i < nseclabels; i++) { for (i = 0; i < nseclabels; i++)
virSecurityDeviceLabelDefFree(seclabels[i]); virSecurityDeviceLabelDefFree(seclabels[i]);
}
VIR_FREE(seclabels); VIR_FREE(seclabels);
VIR_FREE(list); VIR_FREE(list);
return -1; return -1;
@ -6143,9 +6138,8 @@ virDomainDiskDefParseXML(virDomainXMLOptionPtr xmlopt,
goto error; goto error;
} }
} else { } else {
if (def->bus == VIR_DOMAIN_DISK_BUS_USB) { if (def->bus == VIR_DOMAIN_DISK_BUS_USB)
def->removable = VIR_TRISTATE_SWITCH_ABSENT; def->removable = VIR_TRISTATE_SWITCH_ABSENT;
}
} }
if (def->device == VIR_DOMAIN_DISK_DEVICE_FLOPPY && if (def->device == VIR_DOMAIN_DISK_DEVICE_FLOPPY &&
@ -8329,9 +8323,8 @@ virDomainChrDefParseXML(xmlXPathContextPtr ctxt,
if (cur->type == XML_ELEMENT_NODE) { if (cur->type == XML_ELEMENT_NODE) {
if (xmlStrEqual(cur->name, BAD_CAST "target")) { if (xmlStrEqual(cur->name, BAD_CAST "target")) {
seenTarget = true; seenTarget = true;
if (virDomainChrDefParseTargetXML(def, cur) < 0) { if (virDomainChrDefParseTargetXML(def, cur) < 0)
goto error; goto error;
}
} }
} }
cur = cur->next; cur = cur->next;
@ -9105,9 +9098,8 @@ virDomainGraphicsDefParseXML(xmlNodePtr node,
if (virDomainGraphicsListenGetType(def, i) if (virDomainGraphicsListenGetType(def, i)
== VIR_DOMAIN_GRAPHICS_LISTEN_TYPE_ADDRESS) { == VIR_DOMAIN_GRAPHICS_LISTEN_TYPE_ADDRESS) {
found = virDomainGraphicsListenGetAddress(def, i); found = virDomainGraphicsListenGetAddress(def, i);
if (STREQ_NULLABLE(found, listenAddr)) { if (STREQ_NULLABLE(found, listenAddr))
matched = true; matched = true;
}
break; break;
} }
} }
@ -9243,16 +9235,14 @@ virDomainGraphicsDefParseXML(xmlNodePtr node,
def->data.rdp.port = 0; def->data.rdp.port = 0;
if ((replaceUser = virXMLPropString(node, "replaceUser")) != NULL) { if ((replaceUser = virXMLPropString(node, "replaceUser")) != NULL) {
if (STREQ(replaceUser, "yes")) { if (STREQ(replaceUser, "yes"))
def->data.rdp.replaceUser = true; def->data.rdp.replaceUser = true;
}
VIR_FREE(replaceUser); VIR_FREE(replaceUser);
} }
if ((multiUser = virXMLPropString(node, "multiUser")) != NULL) { if ((multiUser = virXMLPropString(node, "multiUser")) != NULL) {
if (STREQ(multiUser, "yes")) { if (STREQ(multiUser, "yes"))
def->data.rdp.multiUser = true; def->data.rdp.multiUser = true;
}
VIR_FREE(multiUser); VIR_FREE(multiUser);
} }
@ -10452,9 +10442,8 @@ virDomainRedirdevDefParseXML(xmlNodePtr node,
if (remaining < 0) if (remaining < 0)
goto error; goto error;
if (def->source.chr.type == VIR_DOMAIN_CHR_TYPE_SPICEVMC) { if (def->source.chr.type == VIR_DOMAIN_CHR_TYPE_SPICEVMC)
def->source.chr.data.spicevmc = VIR_DOMAIN_CHR_SPICEVMC_USBREDIR; def->source.chr.data.spicevmc = VIR_DOMAIN_CHR_SPICEVMC_USBREDIR;
}
if (virDomainDeviceInfoParseXML(node, bootHash, &def->info, if (virDomainDeviceInfoParseXML(node, bootHash, &def->info,
flags | VIR_DOMAIN_XML_INTERNAL_ALLOW_BOOT) < 0) flags | VIR_DOMAIN_XML_INTERNAL_ALLOW_BOOT) < 0)
@ -10648,9 +10637,8 @@ virDomainRedirFilterDefParseXML(xmlNodePtr node,
goto error; goto error;
ctxt->node = node; ctxt->node = node;
if ((n = virXPathNodeSet("./usbdev", ctxt, &nodes)) < 0) { if ((n = virXPathNodeSet("./usbdev", ctxt, &nodes)) < 0)
goto error; goto error;
}
if (n && VIR_ALLOC_N(def->usbdevs, n) < 0) if (n && VIR_ALLOC_N(def->usbdevs, n) < 0)
goto error; goto error;
@ -11709,9 +11697,8 @@ virDomainDefParseBootXML(xmlXPathContextPtr ctxt,
} }
/* analysis of the boot devices */ /* analysis of the boot devices */
if ((n = virXPathNodeSet("./os/boot", ctxt, &nodes)) < 0) { if ((n = virXPathNodeSet("./os/boot", ctxt, &nodes)) < 0)
goto cleanup; goto cleanup;
}
if (n > 0 && deviceBoot) { if (n > 0 && deviceBoot) {
virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s", virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s",
@ -13250,9 +13237,8 @@ virDomainDefParseXML(xmlDocPtr xml,
def->os.init = virXPathString("string(./os/init[1])", ctxt); def->os.init = virXPathString("string(./os/init[1])", ctxt);
def->os.cmdline = virXPathString("string(./os/cmdline[1])", ctxt); def->os.cmdline = virXPathString("string(./os/cmdline[1])", ctxt);
if ((n = virXPathNodeSet("./os/initarg", ctxt, &nodes)) < 0) { if ((n = virXPathNodeSet("./os/initarg", ctxt, &nodes)) < 0)
goto error; goto error;
}
if (VIR_ALLOC_N(def->os.initargv, n+1) < 0) if (VIR_ALLOC_N(def->os.initargv, n+1) < 0)
goto error; goto error;
@ -13392,9 +13378,8 @@ virDomainDefParseXML(xmlDocPtr xml,
VIR_FREE(nodes); VIR_FREE(nodes);
/* analysis of the filesystems */ /* analysis of the filesystems */
if ((n = virXPathNodeSet("./devices/filesystem", ctxt, &nodes)) < 0) { if ((n = virXPathNodeSet("./devices/filesystem", ctxt, &nodes)) < 0)
goto error; goto error;
}
if (n && VIR_ALLOC_N(def->fss, n) < 0) if (n && VIR_ALLOC_N(def->fss, n) < 0)
goto error; goto error;
for (i = 0; i < n; i++) { for (i = 0; i < n; i++) {
@ -13408,9 +13393,8 @@ virDomainDefParseXML(xmlDocPtr xml,
VIR_FREE(nodes); VIR_FREE(nodes);
/* analysis of the network devices */ /* analysis of the network devices */
if ((n = virXPathNodeSet("./devices/interface", ctxt, &nodes)) < 0) { if ((n = virXPathNodeSet("./devices/interface", ctxt, &nodes)) < 0)
goto error; goto error;
}
if (n && VIR_ALLOC_N(def->nets, n) < 0) if (n && VIR_ALLOC_N(def->nets, n) < 0)
goto error; goto error;
for (i = 0; i < n; i++) { for (i = 0; i < n; i++) {
@ -13437,9 +13421,8 @@ virDomainDefParseXML(xmlDocPtr xml,
/* analysis of the smartcard devices */ /* analysis of the smartcard devices */
if ((n = virXPathNodeSet("./devices/smartcard", ctxt, &nodes)) < 0) { if ((n = virXPathNodeSet("./devices/smartcard", ctxt, &nodes)) < 0)
goto error; goto error;
}
if (n && VIR_ALLOC_N(def->smartcards, n) < 0) if (n && VIR_ALLOC_N(def->smartcards, n) < 0)
goto error; goto error;
@ -13455,9 +13438,8 @@ virDomainDefParseXML(xmlDocPtr xml,
/* analysis of the character devices */ /* analysis of the character devices */
if ((n = virXPathNodeSet("./devices/parallel", ctxt, &nodes)) < 0) { if ((n = virXPathNodeSet("./devices/parallel", ctxt, &nodes)) < 0)
goto error; goto error;
}
if (n && VIR_ALLOC_N(def->parallels, n) < 0) if (n && VIR_ALLOC_N(def->parallels, n) < 0)
goto error; goto error;
@ -13531,9 +13513,8 @@ virDomainDefParseXML(xmlDocPtr xml,
} }
VIR_FREE(nodes); VIR_FREE(nodes);
if ((n = virXPathNodeSet("./devices/channel", ctxt, &nodes)) < 0) { if ((n = virXPathNodeSet("./devices/channel", ctxt, &nodes)) < 0)
goto error; goto error;
}
if (n && VIR_ALLOC_N(def->channels, n) < 0) if (n && VIR_ALLOC_N(def->channels, n) < 0)
goto error; goto error;
@ -13571,9 +13552,8 @@ virDomainDefParseXML(xmlDocPtr xml,
/* analysis of the input devices */ /* analysis of the input devices */
if ((n = virXPathNodeSet("./devices/input", ctxt, &nodes)) < 0) { if ((n = virXPathNodeSet("./devices/input", ctxt, &nodes)) < 0)
goto error; goto error;
}
if (n && VIR_ALLOC_N(def->inputs, n) < 0) if (n && VIR_ALLOC_N(def->inputs, n) < 0)
goto error; goto error;
@ -13613,9 +13593,8 @@ virDomainDefParseXML(xmlDocPtr xml,
VIR_FREE(nodes); VIR_FREE(nodes);
/* analysis of the graphics devices */ /* analysis of the graphics devices */
if ((n = virXPathNodeSet("./devices/graphics", ctxt, &nodes)) < 0) { if ((n = virXPathNodeSet("./devices/graphics", ctxt, &nodes)) < 0)
goto error; goto error;
}
if (n && VIR_ALLOC_N(def->graphics, n) < 0) if (n && VIR_ALLOC_N(def->graphics, n) < 0)
goto error; goto error;
for (i = 0; i < n; i++) { for (i = 0; i < n; i++) {
@ -13649,9 +13628,8 @@ virDomainDefParseXML(xmlDocPtr xml,
} }
/* analysis of the sound devices */ /* analysis of the sound devices */
if ((n = virXPathNodeSet("./devices/sound", ctxt, &nodes)) < 0) { if ((n = virXPathNodeSet("./devices/sound", ctxt, &nodes)) < 0)
goto error; goto error;
}
if (n && VIR_ALLOC_N(def->sounds, n) < 0) if (n && VIR_ALLOC_N(def->sounds, n) < 0)
goto error; goto error;
for (i = 0; i < n; i++) { for (i = 0; i < n; i++) {
@ -13666,9 +13644,8 @@ virDomainDefParseXML(xmlDocPtr xml,
VIR_FREE(nodes); VIR_FREE(nodes);
/* analysis of the video devices */ /* analysis of the video devices */
if ((n = virXPathNodeSet("./devices/video", ctxt, &nodes)) < 0) { if ((n = virXPathNodeSet("./devices/video", ctxt, &nodes)) < 0)
goto error; goto error;
}
if (n && VIR_ALLOC_N(def->videos, n) < 0) if (n && VIR_ALLOC_N(def->videos, n) < 0)
goto error; goto error;
for (i = 0; i < n; i++) { for (i = 0; i < n; i++) {
@ -13723,9 +13700,8 @@ virDomainDefParseXML(xmlDocPtr xml,
} }
/* analysis of the host devices */ /* analysis of the host devices */
if ((n = virXPathNodeSet("./devices/hostdev", ctxt, &nodes)) < 0) { if ((n = virXPathNodeSet("./devices/hostdev", ctxt, &nodes)) < 0)
goto error; goto error;
}
if (n && VIR_REALLOC_N(def->hostdevs, def->nhostdevs + n) < 0) if (n && VIR_REALLOC_N(def->hostdevs, def->nhostdevs + n) < 0)
goto error; goto error;
for (i = 0; i < n; i++) { for (i = 0; i < n; i++) {
@ -13754,9 +13730,8 @@ virDomainDefParseXML(xmlDocPtr xml,
/* analysis of the watchdog devices */ /* analysis of the watchdog devices */
def->watchdog = NULL; def->watchdog = NULL;
if ((n = virXPathNodeSet("./devices/watchdog", ctxt, &nodes)) < 0) { if ((n = virXPathNodeSet("./devices/watchdog", ctxt, &nodes)) < 0)
goto error; goto error;
}
if (n > 1) { if (n > 1) {
virReportError(VIR_ERR_INTERNAL_ERROR, "%s", virReportError(VIR_ERR_INTERNAL_ERROR, "%s",
_("only a single watchdog device is supported")); _("only a single watchdog device is supported"));
@ -13774,9 +13749,8 @@ virDomainDefParseXML(xmlDocPtr xml,
/* analysis of the memballoon devices */ /* analysis of the memballoon devices */
def->memballoon = NULL; def->memballoon = NULL;
if ((n = virXPathNodeSet("./devices/memballoon", ctxt, &nodes)) < 0) { if ((n = virXPathNodeSet("./devices/memballoon", ctxt, &nodes)) < 0)
goto error; goto error;
}
if (n > 1) { if (n > 1) {
virReportError(VIR_ERR_INTERNAL_ERROR, "%s", virReportError(VIR_ERR_INTERNAL_ERROR, "%s",
_("only a single memory balloon device is supported")); _("only a single memory balloon device is supported"));
@ -13824,9 +13798,8 @@ virDomainDefParseXML(xmlDocPtr xml,
} }
VIR_FREE(nodes); VIR_FREE(nodes);
if ((n = virXPathNodeSet("./devices/nvram", ctxt, &nodes)) < 0) { if ((n = virXPathNodeSet("./devices/nvram", ctxt, &nodes)) < 0)
goto error; goto error;
}
if (n > 1) { if (n > 1) {
virReportError(VIR_ERR_INTERNAL_ERROR, "%s", virReportError(VIR_ERR_INTERNAL_ERROR, "%s",
@ -13842,9 +13815,8 @@ virDomainDefParseXML(xmlDocPtr xml,
} }
/* analysis of the hub devices */ /* analysis of the hub devices */
if ((n = virXPathNodeSet("./devices/hub", ctxt, &nodes)) < 0) { if ((n = virXPathNodeSet("./devices/hub", ctxt, &nodes)) < 0)
goto error; goto error;
}
if (n && VIR_ALLOC_N(def->hubs, n) < 0) if (n && VIR_ALLOC_N(def->hubs, n) < 0)
goto error; goto error;
for (i = 0; i < n; i++) { for (i = 0; i < n; i++) {
@ -13865,9 +13837,8 @@ virDomainDefParseXML(xmlDocPtr xml,
VIR_FREE(nodes); VIR_FREE(nodes);
/* analysis of the redirected devices */ /* analysis of the redirected devices */
if ((n = virXPathNodeSet("./devices/redirdev", ctxt, &nodes)) < 0) { if ((n = virXPathNodeSet("./devices/redirdev", ctxt, &nodes)) < 0)
goto error; goto error;
}
if (n && VIR_ALLOC_N(def->redirdevs, n) < 0) if (n && VIR_ALLOC_N(def->redirdevs, n) < 0)
goto error; goto error;
for (i = 0; i < n; i++) { for (i = 0; i < n; i++) {
@ -13890,9 +13861,8 @@ virDomainDefParseXML(xmlDocPtr xml,
VIR_FREE(nodes); VIR_FREE(nodes);
/* analysis of the redirection filter rules */ /* analysis of the redirection filter rules */
if ((n = virXPathNodeSet("./devices/redirfilter", ctxt, &nodes)) < 0) { if ((n = virXPathNodeSet("./devices/redirfilter", ctxt, &nodes)) < 0)
goto error; goto error;
}
if (n > 1) { if (n > 1) {
virReportError(VIR_ERR_INTERNAL_ERROR, "%s", virReportError(VIR_ERR_INTERNAL_ERROR, "%s",
_("only one set of redirection filter rule is supported")); _("only one set of redirection filter rule is supported"));
@ -13911,9 +13881,8 @@ virDomainDefParseXML(xmlDocPtr xml,
/* analysis of the panic devices */ /* analysis of the panic devices */
def->panic = NULL; def->panic = NULL;
if ((n = virXPathNodeSet("./devices/panic", ctxt, &nodes)) < 0) { if ((n = virXPathNodeSet("./devices/panic", ctxt, &nodes)) < 0)
goto error; goto error;
}
if (n > 1) { if (n > 1) {
virReportError(VIR_ERR_XML_ERROR, "%s", virReportError(VIR_ERR_XML_ERROR, "%s",
_("only a single panic device is supported")); _("only a single panic device is supported"));
@ -13930,9 +13899,8 @@ virDomainDefParseXML(xmlDocPtr xml,
} }
/* analysis of the shmem devices */ /* analysis of the shmem devices */
if ((n = virXPathNodeSet("./devices/shmem", ctxt, &nodes)) < 0) { if ((n = virXPathNodeSet("./devices/shmem", ctxt, &nodes)) < 0)
goto error; goto error;
}
if (n && VIR_ALLOC_N(def->shmems, n) < 0) if (n && VIR_ALLOC_N(def->shmems, n) < 0)
goto error; goto error;
@ -14106,9 +14074,8 @@ virDomainObjParseXML(xmlDocPtr xml,
} }
obj->pid = (pid_t)val; obj->pid = (pid_t)val;
if ((n = virXPathNodeSet("./taint", ctxt, &nodes)) < 0) { if ((n = virXPathNodeSet("./taint", ctxt, &nodes)) < 0)
goto error; goto error;
}
for (i = 0; i < n; i++) { for (i = 0; i < n; i++) {
char *str = virXMLPropString(nodes[i], "flag"); char *str = virXMLPropString(nodes[i], "flag");
if (str) { if (str) {
@ -15886,9 +15853,8 @@ virDomainEmulatorPinAdd(virDomainDefPtr def,
int int
virDomainEmulatorPinDel(virDomainDefPtr def) virDomainEmulatorPinDel(virDomainDefPtr def)
{ {
if (!def->cputune.emulatorpin) { if (!def->cputune.emulatorpin)
return 0; return 0;
}
virDomainVcpuPinDefFree(def->cputune.emulatorpin); virDomainVcpuPinDefFree(def->cputune.emulatorpin);
def->cputune.emulatorpin = NULL; def->cputune.emulatorpin = NULL;
@ -16588,9 +16554,8 @@ virDomainControllerDefFormat(virBufferPtr buf,
"<controller type='%s' index='%u'", "<controller type='%s' index='%u'",
type, def->idx); type, def->idx);
if (model) { if (model)
virBufferEscapeString(buf, " model='%s'", model); virBufferEscapeString(buf, " model='%s'", model);
}
switch (def->type) { switch (def->type) {
case VIR_DOMAIN_CONTROLLER_TYPE_VIRTIO_SERIAL: case VIR_DOMAIN_CONTROLLER_TYPE_VIRTIO_SERIAL:
@ -17556,9 +17521,8 @@ virDomainChrDefFormat(virBufferPtr buf,
} }
case VIR_DOMAIN_CHR_CHANNEL_TARGET_TYPE_VIRTIO: { case VIR_DOMAIN_CHR_CHANNEL_TARGET_TYPE_VIRTIO: {
if (def->target.name) { if (def->target.name)
virBufferEscapeString(buf, " name='%s'", def->target.name); virBufferEscapeString(buf, " name='%s'", def->target.name);
}
break; break;
} }
@ -18114,9 +18078,8 @@ virDomainTimerDefFormat(virBufferPtr buf,
} }
if (def->name == VIR_DOMAIN_TIMER_NAME_TSC) { if (def->name == VIR_DOMAIN_TIMER_NAME_TSC) {
if (def->frequency > 0) { if (def->frequency > 0)
virBufferAsprintf(buf, " frequency='%lu'", def->frequency); virBufferAsprintf(buf, " frequency='%lu'", def->frequency);
}
if (def->mode != -1) { if (def->mode != -1) {
const char *mode const char *mode
@ -18138,15 +18101,12 @@ virDomainTimerDefFormat(virBufferPtr buf,
virBufferAddLit(buf, ">\n"); virBufferAddLit(buf, ">\n");
virBufferAdjustIndent(buf, 2); virBufferAdjustIndent(buf, 2);
virBufferAddLit(buf, "<catchup"); virBufferAddLit(buf, "<catchup");
if (def->catchup.threshold > 0) { if (def->catchup.threshold > 0)
virBufferAsprintf(buf, " threshold='%lu'", def->catchup.threshold); virBufferAsprintf(buf, " threshold='%lu'", def->catchup.threshold);
} if (def->catchup.slew > 0)
if (def->catchup.slew > 0) {
virBufferAsprintf(buf, " slew='%lu'", def->catchup.slew); virBufferAsprintf(buf, " slew='%lu'", def->catchup.slew);
} if (def->catchup.limit > 0)
if (def->catchup.limit > 0) {
virBufferAsprintf(buf, " limit='%lu'", def->catchup.limit); virBufferAsprintf(buf, " limit='%lu'", def->catchup.limit);
}
virBufferAddLit(buf, "/>\n"); virBufferAddLit(buf, "/>\n");
virBufferAdjustIndent(buf, -2); virBufferAdjustIndent(buf, -2);
virBufferAddLit(buf, "</timer>\n"); virBufferAddLit(buf, "</timer>\n");
@ -20536,9 +20496,8 @@ virDomainNetGetActualBridgeName(virDomainNetDefPtr iface)
return iface->data.bridge.brname; return iface->data.bridge.brname;
if (iface->type == VIR_DOMAIN_NET_TYPE_NETWORK && if (iface->type == VIR_DOMAIN_NET_TYPE_NETWORK &&
iface->data.network.actual && iface->data.network.actual &&
iface->data.network.actual->type == VIR_DOMAIN_NET_TYPE_BRIDGE) { iface->data.network.actual->type == VIR_DOMAIN_NET_TYPE_BRIDGE)
return iface->data.network.actual->data.bridge.brname; return iface->data.network.actual->data.bridge.brname;
}
return NULL; return NULL;
} }
@ -20549,9 +20508,8 @@ virDomainNetGetActualDirectDev(virDomainNetDefPtr iface)
return iface->data.direct.linkdev; return iface->data.direct.linkdev;
if (iface->type == VIR_DOMAIN_NET_TYPE_NETWORK && if (iface->type == VIR_DOMAIN_NET_TYPE_NETWORK &&
iface->data.network.actual && iface->data.network.actual &&
iface->data.network.actual->type == VIR_DOMAIN_NET_TYPE_DIRECT) { iface->data.network.actual->type == VIR_DOMAIN_NET_TYPE_DIRECT)
return iface->data.network.actual->data.direct.linkdev; return iface->data.network.actual->data.direct.linkdev;
}
return NULL; return NULL;
} }
@ -20562,9 +20520,8 @@ virDomainNetGetActualDirectMode(virDomainNetDefPtr iface)
return iface->data.direct.mode; return iface->data.direct.mode;
if (iface->type == VIR_DOMAIN_NET_TYPE_NETWORK && if (iface->type == VIR_DOMAIN_NET_TYPE_NETWORK &&
iface->data.network.actual && iface->data.network.actual &&
iface->data.network.actual->type == VIR_DOMAIN_NET_TYPE_DIRECT) { iface->data.network.actual->type == VIR_DOMAIN_NET_TYPE_DIRECT)
return iface->data.network.actual->data.direct.mode; return iface->data.network.actual->data.direct.mode;
}
return 0; return 0;
} }
@ -20575,9 +20532,8 @@ virDomainNetGetActualHostdev(virDomainNetDefPtr iface)
return &iface->data.hostdev.def; return &iface->data.hostdev.def;
if (iface->type == VIR_DOMAIN_NET_TYPE_NETWORK && if (iface->type == VIR_DOMAIN_NET_TYPE_NETWORK &&
iface->data.network.actual && iface->data.network.actual &&
iface->data.network.actual->type == VIR_DOMAIN_NET_TYPE_HOSTDEV) { iface->data.network.actual->type == VIR_DOMAIN_NET_TYPE_HOSTDEV)
return &iface->data.network.actual->data.hostdev.def; return &iface->data.network.actual->data.hostdev.def;
}
return NULL; return NULL;
} }
@ -20612,9 +20568,8 @@ virDomainNetGetActualBandwidth(virDomainNetDefPtr iface)
* its bandwidth rather than the NetDef's bandwidth. * its bandwidth rather than the NetDef's bandwidth.
*/ */
if (iface->type == VIR_DOMAIN_NET_TYPE_NETWORK && if (iface->type == VIR_DOMAIN_NET_TYPE_NETWORK &&
iface->data.network.actual) { iface->data.network.actual)
return iface->data.network.actual->bandwidth; return iface->data.network.actual->bandwidth;
}
return iface->bandwidth; return iface->bandwidth;
} }

View File

@ -60,9 +60,8 @@ void virInterfaceProtocolDefFree(virInterfaceProtocolDefPtr def)
if (def == NULL) if (def == NULL)
return; return;
for (i = 0; i < def->nips; i++) { for (i = 0; i < def->nips; i++)
virInterfaceIpDefFree(def->ips[i]); virInterfaceIpDefFree(def->ips[i]);
}
VIR_FREE(def->ips); VIR_FREE(def->ips);
VIR_FREE(def->family); VIR_FREE(def->family);
VIR_FREE(def->gateway); VIR_FREE(def->gateway);
@ -106,9 +105,8 @@ void virInterfaceDefFree(virInterfaceDefPtr def)
} }
/* free all protos */ /* free all protos */
for (pp = 0; pp < def->nprotos; pp++) { for (pp = 0; pp < def->nprotos; pp++)
virInterfaceProtocolDefFree(def->protos[pp]); virInterfaceProtocolDefFree(def->protos[pp]);
}
VIR_FREE(def->protos); VIR_FREE(def->protos);
VIR_FREE(def); VIR_FREE(def);
} }
@ -1081,9 +1079,8 @@ virInterfaceDefDevFormat(virBufferPtr buf, const virInterfaceDef *def,
virInterfaceProtocolDefFormat(buf, def); virInterfaceProtocolDefFormat(buf, def);
} }
if (def->type != VIR_INTERFACE_TYPE_BRIDGE) { if (def->type != VIR_INTERFACE_TYPE_BRIDGE)
virInterfaceLinkFormat(buf, &def->lnk); virInterfaceLinkFormat(buf, &def->lnk);
}
switch (def->type) { switch (def->type) {
case VIR_INTERFACE_TYPE_ETHERNET: case VIR_INTERFACE_TYPE_ETHERNET:
if (def->mac) if (def->mac)

View File

@ -218,14 +218,12 @@ virNetworkForwardDefClear(virNetworkForwardDefPtr def)
{ {
size_t i; size_t i;
for (i = 0; i < def->npfs && def->pfs; i++) { for (i = 0; i < def->npfs && def->pfs; i++)
virNetworkForwardPfDefClear(&def->pfs[i]); virNetworkForwardPfDefClear(&def->pfs[i]);
}
VIR_FREE(def->pfs); VIR_FREE(def->pfs);
for (i = 0; i < def->nifs && def->ifs; i++) { for (i = 0; i < def->nifs && def->ifs; i++)
virNetworkForwardIfDefClear(&def->ifs[i]); virNetworkForwardIfDefClear(&def->ifs[i]);
}
VIR_FREE(def->ifs); VIR_FREE(def->ifs);
def->nifs = def->npfs = 0; def->nifs = def->npfs = 0;
} }
@ -244,19 +242,16 @@ virNetworkDefFree(virNetworkDefPtr def)
virNetworkForwardDefClear(&def->forward); virNetworkForwardDefClear(&def->forward);
for (i = 0; i < def->nips && def->ips; i++) { for (i = 0; i < def->nips && def->ips; i++)
virNetworkIpDefClear(&def->ips[i]); virNetworkIpDefClear(&def->ips[i]);
}
VIR_FREE(def->ips); VIR_FREE(def->ips);
for (i = 0; i < def->nroutes && def->routes; i++) { for (i = 0; i < def->nroutes && def->routes; i++)
virNetworkRouteDefClear(&def->routes[i]); virNetworkRouteDefClear(&def->routes[i]);
}
VIR_FREE(def->routes); VIR_FREE(def->routes);
for (i = 0; i < def->nPortGroups && def->portGroups; i++) { for (i = 0; i < def->nPortGroups && def->portGroups; i++)
virPortGroupDefClear(&def->portGroups[i]); virPortGroupDefClear(&def->portGroups[i]);
}
VIR_FREE(def->portGroups); VIR_FREE(def->portGroups);
virNetworkDNSDefClear(&def->dns); virNetworkDNSDefClear(&def->dns);
@ -596,9 +591,8 @@ virNetworkDefGetIpByIndex(const virNetworkDef *def,
if (!def->ips || n >= def->nips) if (!def->ips || n >= def->nips)
return NULL; return NULL;
if (family == AF_UNSPEC) { if (family == AF_UNSPEC)
return &def->ips[n]; return &def->ips[n];
}
/* find the nth ip of type "family" */ /* find the nth ip of type "family" */
for (i = 0; i < def->nips; i++) { for (i = 0; i < def->nips; i++) {
@ -1363,9 +1357,8 @@ virNetworkIPDefParseXML(const char *networkName,
result = 0; result = 0;
cleanup: cleanup:
if (result < 0) { if (result < 0)
virNetworkIpDefClear(def); virNetworkIpDefClear(def);
}
VIR_FREE(address); VIR_FREE(address);
VIR_FREE(netmask); VIR_FREE(netmask);
@ -1589,9 +1582,8 @@ virNetworkRouteDefParseXML(const char *networkName,
result = 0; result = 0;
cleanup: cleanup:
if (result < 0) { if (result < 0)
virNetworkRouteDefClear(def); virNetworkRouteDefClear(def);
}
VIR_FREE(address); VIR_FREE(address);
VIR_FREE(netmask); VIR_FREE(netmask);
VIR_FREE(gateway); VIR_FREE(gateway);
@ -1663,9 +1655,8 @@ virNetworkPortGroupParseXML(virPortGroupDefPtr def,
result = 0; result = 0;
cleanup: cleanup:
if (result < 0) { if (result < 0)
virPortGroupDefClear(def); virPortGroupDefClear(def);
}
VIR_FREE(isDefault); VIR_FREE(isDefault);
VIR_FREE(trustGuestRxFilters); VIR_FREE(trustGuestRxFilters);
@ -2483,9 +2474,8 @@ virNetworkIpDefFormat(virBufferPtr buf,
virBufferAddLit(buf, "<ip"); virBufferAddLit(buf, "<ip");
if (def->family) { if (def->family)
virBufferAsprintf(buf, " family='%s'", def->family); virBufferAsprintf(buf, " family='%s'", def->family);
}
if (VIR_SOCKET_ADDR_VALID(&def->address)) { if (VIR_SOCKET_ADDR_VALID(&def->address)) {
char *addr = virSocketAddrFormat(&def->address); char *addr = virSocketAddrFormat(&def->address);
if (!addr) if (!addr)
@ -2500,9 +2490,8 @@ virNetworkIpDefFormat(virBufferPtr buf,
virBufferAsprintf(buf, " netmask='%s'", addr); virBufferAsprintf(buf, " netmask='%s'", addr);
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);
@ -2580,9 +2569,8 @@ virNetworkRouteDefFormat(virBufferPtr buf,
virBufferAddLit(buf, "<route"); virBufferAddLit(buf, "<route");
if (def->family) { if (def->family)
virBufferAsprintf(buf, " family='%s'", def->family); virBufferAsprintf(buf, " family='%s'", def->family);
}
if (VIR_SOCKET_ADDR_VALID(&def->address)) { if (VIR_SOCKET_ADDR_VALID(&def->address)) {
char *addr = virSocketAddrFormat(&def->address); char *addr = virSocketAddrFormat(&def->address);
@ -2599,9 +2587,8 @@ virNetworkRouteDefFormat(virBufferPtr buf,
virBufferAsprintf(buf, " netmask='%s'", addr); virBufferAsprintf(buf, " netmask='%s'", addr);
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);
if (!addr) if (!addr)
@ -2609,9 +2596,8 @@ virNetworkRouteDefFormat(virBufferPtr buf,
virBufferAsprintf(buf, " gateway='%s'", addr); virBufferAsprintf(buf, " gateway='%s'", addr);
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");
result = 0; result = 0;
@ -2624,9 +2610,8 @@ virPortGroupDefFormat(virBufferPtr buf,
const virPortGroupDef *def) const virPortGroupDef *def)
{ {
virBufferAsprintf(buf, "<portgroup name='%s'", def->name); virBufferAsprintf(buf, "<portgroup name='%s'", def->name);
if (def->isDefault) { if (def->isDefault)
virBufferAddLit(buf, " default='yes'"); virBufferAddLit(buf, " default='yes'");
}
if (def->trustGuestRxFilters) if (def->trustGuestRxFilters)
virBufferAsprintf(buf, " trustGuestRxFilters='%s'", virBufferAsprintf(buf, " trustGuestRxFilters='%s'",
virTristateBoolTypeToString(def->trustGuestRxFilters)); virTristateBoolTypeToString(def->trustGuestRxFilters));
@ -2703,9 +2688,8 @@ virNetworkDefFormatBuf(virBufferPtr buf,
bool shortforward; bool shortforward;
virBufferAddLit(buf, "<network"); virBufferAddLit(buf, "<network");
if (!(flags & VIR_NETWORK_XML_INACTIVE) && (def->connections > 0)) { if (!(flags & VIR_NETWORK_XML_INACTIVE) && (def->connections > 0))
virBufferAsprintf(buf, " connections='%d'", def->connections); virBufferAsprintf(buf, " connections='%d'", def->connections);
}
if (def->ipv6nogw) if (def->ipv6nogw)
virBufferAddLit(buf, " ipv6='yes'"); virBufferAddLit(buf, " ipv6='yes'");
if (def->trustGuestRxFilters) if (def->trustGuestRxFilters)
@ -3326,9 +3310,8 @@ char *virNetworkAllocateBridge(virNetworkObjListPtr nets,
do { do {
if (virAsprintf(&newname, template, id) < 0) if (virAsprintf(&newname, template, id) < 0)
return NULL; return NULL;
if (!virNetworkBridgeInUse(nets, newname, NULL)) { if (!virNetworkBridgeInUse(nets, newname, NULL))
return newname; return newname;
}
VIR_FREE(newname); VIR_FREE(newname);
id++; id++;

View File

@ -669,9 +669,8 @@ virNodeDevCapStorageParseXML(xmlXPathContextPtr ctxt,
data->storage.vendor = virXPathString("string(./vendor[1])", ctxt); data->storage.vendor = virXPathString("string(./vendor[1])", ctxt);
data->storage.serial = virXPathString("string(./serial[1])", ctxt); data->storage.serial = virXPathString("string(./serial[1])", ctxt);
if ((n = virXPathNodeSet("./capability", ctxt, &nodes)) < 0) { if ((n = virXPathNodeSet("./capability", ctxt, &nodes)) < 0)
goto out; goto out;
}
for (i = 0; i < n; i++) { for (i = 0; i < n; i++) {
char *type = virXMLPropString(nodes[i], "type"); char *type = virXMLPropString(nodes[i], "type");
@ -841,9 +840,8 @@ virNodeDevCapSCSIHostParseXML(xmlXPathContextPtr ctxt,
} }
} }
if ((n = virXPathNodeSet("./capability", ctxt, &nodes)) < 0) { if ((n = virXPathNodeSet("./capability", ctxt, &nodes)) < 0)
goto out; goto out;
}
for (i = 0; i < n; i++) { for (i = 0; i < n; i++) {
type = virXMLPropString(nodes[i], "type"); type = virXMLPropString(nodes[i], "type");
@ -1453,9 +1451,8 @@ virNodeDeviceDefParseXML(xmlXPathContextPtr ctxt,
/* Parse device capabilities */ /* Parse device capabilities */
nodes = NULL; nodes = NULL;
if ((n = virXPathNodeSet("./capability", ctxt, &nodes)) < 0) { if ((n = virXPathNodeSet("./capability", ctxt, &nodes)) < 0)
goto error; goto error;
}
if (n == 0) { if (n == 0) {
virReportError(VIR_ERR_INTERNAL_ERROR, virReportError(VIR_ERR_INTERNAL_ERROR,
@ -1656,13 +1653,11 @@ void virNodeDevCapsDefFree(virNodeDevCapsDefPtr caps)
VIR_FREE(data->pci_dev.product_name); VIR_FREE(data->pci_dev.product_name);
VIR_FREE(data->pci_dev.vendor_name); VIR_FREE(data->pci_dev.vendor_name);
VIR_FREE(data->pci_dev.physical_function); VIR_FREE(data->pci_dev.physical_function);
for (i = 0; i < data->pci_dev.num_virtual_functions; i++) { for (i = 0; i < data->pci_dev.num_virtual_functions; i++)
VIR_FREE(data->pci_dev.virtual_functions[i]); VIR_FREE(data->pci_dev.virtual_functions[i]);
}
VIR_FREE(data->pci_dev.virtual_functions); VIR_FREE(data->pci_dev.virtual_functions);
for (i = 0; i < data->pci_dev.nIommuGroupDevices; i++) { for (i = 0; i < data->pci_dev.nIommuGroupDevices; i++)
VIR_FREE(data->pci_dev.iommuGroupDevices[i]); VIR_FREE(data->pci_dev.iommuGroupDevices[i]);
}
VIR_FREE(data->pci_dev.iommuGroupDevices); VIR_FREE(data->pci_dev.iommuGroupDevices);
virPCIEDeviceInfoFree(data->pci_dev.pci_express); virPCIEDeviceInfoFree(data->pci_dev.pci_express);
break; break;

View File

@ -535,9 +535,8 @@ checkVlanVlanID(enum attrDatatype datatype, union data *value,
int32_t res; int32_t res;
res = value->ui; res = value->ui;
if (res < 0 || res > 4095) { if (res < 0 || res > 4095)
res = -1; res = -1;
}
if (res != -1) { if (res != -1) {
nwf->p.vlanHdrFilter.dataVlanID.u.u16 = res; nwf->p.vlanHdrFilter.dataVlanID.u.u16 = res;
@ -2899,9 +2898,8 @@ static virNWFilterCallbackDriverPtr callbackDrvArray[MAX_CALLBACK_DRIVER];
void void
virNWFilterRegisterCallbackDriver(virNWFilterCallbackDriverPtr cbd) virNWFilterRegisterCallbackDriver(virNWFilterCallbackDriverPtr cbd)
{ {
if (nCallbackDriver < MAX_CALLBACK_DRIVER) { if (nCallbackDriver < MAX_CALLBACK_DRIVER)
callbackDrvArray[nCallbackDriver++] = cbd; callbackDrvArray[nCallbackDriver++] = cbd;
}
} }
void void
@ -3141,9 +3139,8 @@ virNWFilterObjLoad(virNWFilterObjListPtr nwfilters,
virNWFilterDefPtr def; virNWFilterDefPtr def;
virNWFilterObjPtr nwfilter; virNWFilterObjPtr nwfilter;
if (!(def = virNWFilterDefParseFile(path))) { if (!(def = virNWFilterDefParseFile(path)))
return NULL; return NULL;
}
if (!virFileMatchesNameSuffix(file, def->name, ".xml")) { if (!virFileMatchesNameSuffix(file, def->name, ".xml")) {
virReportError(VIR_ERR_XML_ERROR, virReportError(VIR_ERR_XML_ERROR,
@ -3177,9 +3174,8 @@ virNWFilterLoadAllConfigs(virNWFilterObjListPtr nwfilters,
int ret = -1; int ret = -1;
if (!(dir = opendir(configDir))) { if (!(dir = opendir(configDir))) {
if (errno == ENOENT) { if (errno == ENOENT)
return 0; return 0;
}
virReportSystemError(errno, _("Failed to open dir '%s'"), virReportSystemError(errno, _("Failed to open dir '%s'"),
configDir); configDir);
return -1; return -1;

View File

@ -388,9 +388,8 @@ virObjectEventCallbackListAddID(virConnectPtr conn,
callback, opaque, legacy, callbackID, serverFilter); callback, opaque, legacy, callbackID, serverFilter);
/* Check incoming */ /* Check incoming */
if (!cbList) { if (!cbList)
return -1; return -1;
}
/* If there is no additional filtering, then check if we already /* If there is no additional filtering, then check if we already
* have this callback on our list. */ * have this callback on our list. */
@ -460,9 +459,8 @@ virObjectEventQueueClear(virObjectEventQueuePtr queue)
if (!queue) if (!queue)
return; return;
for (i = 0; i < queue->count; i++) { for (i = 0; i < queue->count; i++)
virObjectUnref(queue->events[i]); virObjectUnref(queue->events[i]);
}
VIR_FREE(queue->events); VIR_FREE(queue->events);
queue->count = 0; queue->count = 0;
} }

View File

@ -333,9 +333,8 @@ virStorageVolDefFree(virStorageVolDefPtr def)
VIR_FREE(def->name); VIR_FREE(def->name);
VIR_FREE(def->key); VIR_FREE(def->key);
for (i = 0; i < def->source.nextent; i++) { for (i = 0; i < def->source.nextent; i++)
VIR_FREE(def->source.extents[i].path); VIR_FREE(def->source.extents[i].path);
}
VIR_FREE(def->source.extents); VIR_FREE(def->source.extents);
virStorageSourceClear(&def->target); virStorageSourceClear(&def->target);
@ -370,9 +369,8 @@ virStoragePoolSourceClear(virStoragePoolSourcePtr source)
if (!source) if (!source)
return; return;
for (i = 0; i < source->nhost; i++) { for (i = 0; i < source->nhost; i++)
VIR_FREE(source->hosts[i].name); VIR_FREE(source->hosts[i].name);
}
VIR_FREE(source->hosts); VIR_FREE(source->hosts);
for (i = 0; i < source->ndevice; i++) for (i = 0; i < source->ndevice; i++)
@ -481,9 +479,8 @@ virStoragePoolDefParseSource(xmlXPathContextPtr ctxt,
relnode = ctxt->node; relnode = ctxt->node;
ctxt->node = node; ctxt->node = node;
if ((options = virStoragePoolOptionsForPoolType(pool_type)) == NULL) { if ((options = virStoragePoolOptionsForPoolType(pool_type)) == NULL)
goto cleanup; goto cleanup;
}
source->name = virXPathString("string(./name)", ctxt); source->name = virXPathString("string(./name)", ctxt);
if (pool_type == VIR_STORAGE_POOL_RBD && source->name == NULL) { if (pool_type == VIR_STORAGE_POOL_RBD && source->name == NULL) {
@ -833,9 +830,8 @@ virStoragePoolDefParseXML(xmlXPathContextPtr ctxt)
goto error; goto error;
} }
if ((options = virStoragePoolOptionsForPoolType(ret->type)) == NULL) { if ((options = virStoragePoolOptionsForPoolType(ret->type)) == NULL)
goto error; goto error;
}
source_node = virXPathNode("./source", ctxt); source_node = virXPathNode("./source", ctxt);
if (source_node) { if (source_node) {
@ -945,13 +941,11 @@ virStoragePoolDefParseXML(xmlXPathContextPtr ctxt)
* path and permissions */ * path and permissions */
if (!(options->flags & VIR_STORAGE_POOL_SOURCE_NETWORK)) { if (!(options->flags & VIR_STORAGE_POOL_SOURCE_NETWORK)) {
if (ret->type == VIR_STORAGE_POOL_LOGICAL) { if (ret->type == VIR_STORAGE_POOL_LOGICAL) {
if (virAsprintf(&target_path, "/dev/%s", ret->source.name) < 0) { if (virAsprintf(&target_path, "/dev/%s", ret->source.name) < 0)
goto error; goto error;
}
} else if (ret->type == VIR_STORAGE_POOL_ZFS) { } else if (ret->type == VIR_STORAGE_POOL_ZFS) {
if (virAsprintf(&target_path, "/dev/zvol/%s", ret->source.name) < 0) { if (virAsprintf(&target_path, "/dev/zvol/%s", ret->source.name) < 0)
goto error; goto error;
}
} else { } else {
target_path = virXPathString("string(./target/path)", ctxt); target_path = virXPathString("string(./target/path)", ctxt);
if (!target_path) { if (!target_path) {
@ -1814,9 +1808,8 @@ virStoragePoolObjLoad(virStoragePoolObjListPtr pools,
virStoragePoolDefPtr def; virStoragePoolDefPtr def;
virStoragePoolObjPtr pool; virStoragePoolObjPtr pool;
if (!(def = virStoragePoolDefParseFile(path))) { if (!(def = virStoragePoolDefParseFile(path)))
return NULL; return NULL;
}
if (!virFileMatchesNameSuffix(file, def->name, ".xml")) { if (!virFileMatchesNameSuffix(file, def->name, ".xml")) {
virReportError(VIR_ERR_XML_ERROR, virReportError(VIR_ERR_XML_ERROR,
@ -2006,9 +1999,8 @@ virStoragePoolSourceListFormat(virStoragePoolSourceListPtr def)
virBufferAddLit(&buf, "<sources>\n"); virBufferAddLit(&buf, "<sources>\n");
virBufferAdjustIndent(&buf, 2); virBufferAdjustIndent(&buf, 2);
for (i = 0; i < def->nsources; i++) { for (i = 0; i < def->nsources; i++)
virStoragePoolSourceFormat(&buf, options, &def->sources[i]); virStoragePoolSourceFormat(&buf, options, &def->sources[i]);
}
virBufferAdjustIndent(&buf, -2); virBufferAdjustIndent(&buf, -2);
virBufferAddLit(&buf, "</sources>\n"); virBufferAddLit(&buf, "</sources>\n");