return ret;
}
+static int
+qemuBuildTPMCommandLine(virDomainDefPtr def,
+ virCommandPtr cmd,
+ virQEMUCapsPtr qemuCaps,
+ const char *emulator)
+{
+ char *optstr;
+
+ if (!(optstr = qemuBuildTPMBackendStr(def, qemuCaps, emulator)))
+ return -1;
+
+ virCommandAddArgList(cmd, "-tpmdev", optstr, NULL);
+ VIR_FREE(optstr);
+
+ if (!(optstr = qemuBuildTPMDevStr(def, qemuCaps, emulator)))
+ return -1;
+
+ virCommandAddArgList(cmd, "-device", optstr, NULL);
+ VIR_FREE(optstr);
+
+ return 0;
+}
+
+
qemuBuildCommandLineCallbacks buildCommandLineCallbacks = {
.qemuGetSCSIDeviceSgName = virSCSIDeviceGetSgName,
};
}
if (def->tpm) {
- char *optstr;
-
- if (!(optstr = qemuBuildTPMBackendStr(def, qemuCaps, emulator)))
+ if (qemuBuildTPMCommandLine(def, cmd, qemuCaps, emulator) < 0)
goto error;
-
- virCommandAddArgList(cmd, "-tpmdev", optstr, NULL);
- VIR_FREE(optstr);
-
- if (!(optstr = qemuBuildTPMDevStr(def, qemuCaps, emulator)))
- goto error;
-
- virCommandAddArgList(cmd, "-device", optstr, NULL);
- VIR_FREE(optstr);
}
for (i = 0; i < def->ninputs; i++) {