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

Introduce virDomainInputDefGetPath

Use it to denadify qemuDomainSetupInput.
上级 74fc32a9
...@@ -1404,6 +1404,22 @@ void virDomainGraphicsDefFree(virDomainGraphicsDefPtr def) ...@@ -1404,6 +1404,22 @@ void virDomainGraphicsDefFree(virDomainGraphicsDefPtr def)
VIR_FREE(def); VIR_FREE(def);
} }
const char *virDomainInputDefGetPath(virDomainInputDefPtr input)
{
switch ((virDomainInputType) input->type) {
case VIR_DOMAIN_INPUT_TYPE_MOUSE:
case VIR_DOMAIN_INPUT_TYPE_TABLET:
case VIR_DOMAIN_INPUT_TYPE_KBD:
case VIR_DOMAIN_INPUT_TYPE_LAST:
return NULL;
break;
case VIR_DOMAIN_INPUT_TYPE_PASSTHROUGH:
return input->source.evdev;
}
return NULL;
}
void virDomainInputDefFree(virDomainInputDefPtr def) void virDomainInputDefFree(virDomainInputDefPtr def)
{ {
if (!def) if (!def)
......
...@@ -2706,6 +2706,7 @@ int virDomainObjWaitUntil(virDomainObjPtr vm, ...@@ -2706,6 +2706,7 @@ int virDomainObjWaitUntil(virDomainObjPtr vm,
void virDomainPanicDefFree(virDomainPanicDefPtr panic); void virDomainPanicDefFree(virDomainPanicDefPtr panic);
void virDomainResourceDefFree(virDomainResourceDefPtr resource); void virDomainResourceDefFree(virDomainResourceDefPtr resource);
void virDomainGraphicsDefFree(virDomainGraphicsDefPtr def); void virDomainGraphicsDefFree(virDomainGraphicsDefPtr def);
const char *virDomainInputDefGetPath(virDomainInputDefPtr input);
void virDomainInputDefFree(virDomainInputDefPtr def); void virDomainInputDefFree(virDomainInputDefPtr def);
virDomainDiskDefPtr virDomainDiskDefNew(virDomainXMLOptionPtr xmlopt); virDomainDiskDefPtr virDomainDiskDefNew(virDomainXMLOptionPtr xmlopt);
void virDomainDiskDefFree(virDomainDiskDefPtr def); void virDomainDiskDefFree(virDomainDiskDefPtr def);
......
...@@ -395,6 +395,7 @@ virDomainHypervTypeToString; ...@@ -395,6 +395,7 @@ virDomainHypervTypeToString;
virDomainInputBusTypeToString; virDomainInputBusTypeToString;
virDomainInputDefFind; virDomainInputDefFind;
virDomainInputDefFree; virDomainInputDefFree;
virDomainInputDefGetPath;
virDomainIOMMUModelTypeFromString; virDomainIOMMUModelTypeFromString;
virDomainIOMMUModelTypeToString; virDomainIOMMUModelTypeToString;
virDomainIOThreadIDAdd; virDomainIOThreadIDAdd;
......
...@@ -9041,25 +9041,12 @@ qemuDomainSetupInput(virQEMUDriverConfigPtr cfg ATTRIBUTE_UNUSED, ...@@ -9041,25 +9041,12 @@ qemuDomainSetupInput(virQEMUDriverConfigPtr cfg ATTRIBUTE_UNUSED,
virDomainInputDefPtr input, virDomainInputDefPtr input,
const struct qemuDomainCreateDeviceData *data) const struct qemuDomainCreateDeviceData *data)
{ {
int ret = -1; const char *path = virDomainInputDefGetPath(input);
switch ((virDomainInputType) input->type) {
case VIR_DOMAIN_INPUT_TYPE_PASSTHROUGH:
if (qemuDomainCreateDevice(input->source.evdev, data, false) < 0)
goto cleanup;
break;
case VIR_DOMAIN_INPUT_TYPE_MOUSE: if (path && qemuDomainCreateDevice(path, data, false) < 0)
case VIR_DOMAIN_INPUT_TYPE_TABLET: return -1;
case VIR_DOMAIN_INPUT_TYPE_KBD:
case VIR_DOMAIN_INPUT_TYPE_LAST:
/* nada */
break;
}
ret = 0; return 0;
cleanup:
return ret;
} }
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册
新手
引导
客服 返回
顶部