mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2025-01-10 23:07:44 +00:00
Introduce virDomainInputDefGetPath
Use it to denadify qemuDomainSetupInput.
This commit is contained in:
parent
74fc32a955
commit
cbf4242db7
@ -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,
|
|||||||
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;
|
|||||||
virDomainInputBusTypeToString;
|
virDomainInputBusTypeToString;
|
||||||
virDomainInputDefFind;
|
virDomainInputDefFind;
|
||||||
virDomainInputDefFree;
|
virDomainInputDefFree;
|
||||||
|
virDomainInputDefGetPath;
|
||||||
virDomainIOMMUModelTypeFromString;
|
virDomainIOMMUModelTypeFromString;
|
||||||
virDomainIOMMUModelTypeToString;
|
virDomainIOMMUModelTypeToString;
|
||||||
virDomainIOThreadIDAdd;
|
virDomainIOThreadIDAdd;
|
||||||
|
@ -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) {
|
if (path && qemuDomainCreateDevice(path, data, false) < 0)
|
||||||
case VIR_DOMAIN_INPUT_TYPE_PASSTHROUGH:
|
return -1;
|
||||||
if (qemuDomainCreateDevice(input->source.evdev, data, false) < 0)
|
|
||||||
goto cleanup;
|
|
||||||
break;
|
|
||||||
|
|
||||||
case VIR_DOMAIN_INPUT_TYPE_MOUSE:
|
return 0;
|
||||||
case VIR_DOMAIN_INPUT_TYPE_TABLET:
|
|
||||||
case VIR_DOMAIN_INPUT_TYPE_KBD:
|
|
||||||
case VIR_DOMAIN_INPUT_TYPE_LAST:
|
|
||||||
/* nada */
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
ret = 0;
|
|
||||||
cleanup:
|
|
||||||
return ret;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user