提交 583022e5 编写于 作者: J Ján Tomko

conf: eliminate monster condition in virDomainControllerDefFormat

Move most of the subelement formatting out of the giant if.
上级 1a4b21f1
...@@ -21479,11 +21479,7 @@ virDomainControllerDefFormat(virBufferPtr buf, ...@@ -21479,11 +21479,7 @@ virDomainControllerDefFormat(virBufferPtr buf,
break; break;
} }
if (pciModel || pciTarget || if (pciModel || pciTarget) {
def->queues || def->cmd_per_lun || def->max_sectors || def->ioeventfd ||
def->iothread ||
virDomainDeviceInfoNeedsFormat(&def->info, flags) || pcihole64) {
if (pciModel) { if (pciModel) {
modelName = virDomainControllerPCIModelNameTypeToString(def->opts.pciopts.modelName); modelName = virDomainControllerPCIModelNameTypeToString(def->opts.pciopts.modelName);
if (!modelName) { if (!modelName) {
...@@ -21520,17 +21516,17 @@ virDomainControllerDefFormat(virBufferPtr buf, ...@@ -21520,17 +21516,17 @@ virDomainControllerDefFormat(virBufferPtr buf,
virBufferAddLit(&childBuf, "</target>\n"); virBufferAddLit(&childBuf, "</target>\n");
} }
} }
}
virDomainControllerDriverFormat(&childBuf, def); virDomainControllerDriverFormat(&childBuf, def);
if (virDomainDeviceInfoNeedsFormat(&def->info, flags) && if (virDomainDeviceInfoNeedsFormat(&def->info, flags) &&
virDomainDeviceInfoFormat(&childBuf, &def->info, flags) < 0) virDomainDeviceInfoFormat(&childBuf, &def->info, flags) < 0)
return -1; return -1;
if (pcihole64) { if (pcihole64) {
virBufferAsprintf(&childBuf, "<pcihole64 unit='KiB'>%lu</" virBufferAsprintf(&childBuf, "<pcihole64 unit='KiB'>%lu</"
"pcihole64>\n", def->opts.pciopts.pcihole64size); "pcihole64>\n", def->opts.pciopts.pcihole64size);
}
} }
if (virBufferUse(&childBuf)) { if (virBufferUse(&childBuf)) {
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册