[libvirt] [PATCH v9 1/7] conf: Add one interface to add default input devices
Ján Tomko
jtomko at redhat.com
Tue Feb 18 12:52:20 UTC 2014
On 02/17/2014 11:17 AM, Li Zhang wrote:
> From: Li Zhang <zhlcindy at linux.vnet.ibm.com>
>
> This patch is to add one new interface to add input devices.
>
> Signed-off-by: Li Zhang <zhlcindy at linux.vnet.ibm.com>
> ---
> src/conf/domain_conf.c | 29 +++++++++++++++++++++++++++++
> src/conf/domain_conf.h | 4 ++++
> src/libvirt_private.syms | 1 +
> 3 files changed, 34 insertions(+)
ACK with the following whitespace changes and with the hunk using this
function moved from 2/7 here:
Jan
diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c
index 794153d..939b423 100644
--- a/src/conf/domain_conf.c
+++ b/src/conf/domain_conf.c
@@ -11051,11 +11051,10 @@ virDomainDefMaybeAddController(virDomainDefPtr def,
}
-
int
virDomainDefMaybeAddInput(virDomainDefPtr def,
- int type,
- int bus)
+ int type,
+ int bus)
{
size_t i;
virDomainInputDefPtr input;
@@ -11080,6 +11079,7 @@ virDomainDefMaybeAddInput(virDomainDefPtr def,
return 0;
}
+
/* Parse a memory element located at XPATH within CTXT, and store the
* result into MEM. If REQUIRED, then the value must exist;
* otherwise, the value is optional. The value is in blocks of 1024.
@@ -12493,25 +12493,15 @@ virDomainDefParseXML(xmlDocPtr xml,
/* If graphics are enabled, there's an implicit PS2 mouse */
if (def->ngraphics > 0) {
- virDomainInputDefPtr input;
+ int input_bus = VIR_DOMAIN_INPUT_BUS_XEN;
- if (VIR_ALLOC(input) < 0) {
- goto error;
- }
- if (STREQ(def->os.type, "hvm")) {
- input->type = VIR_DOMAIN_INPUT_TYPE_MOUSE;
- input->bus = VIR_DOMAIN_INPUT_BUS_PS2;
- } else {
- input->type = VIR_DOMAIN_INPUT_TYPE_MOUSE;
- input->bus = VIR_DOMAIN_INPUT_BUS_XEN;
- }
+ if (STREQ(def->os.type, "hvm"))
+ input_bus = VIR_DOMAIN_INPUT_BUS_PS2;
- if (VIR_REALLOC_N(def->inputs, def->ninputs + 1) < 0) {
- virDomainInputDefFree(input);
+ if (virDomainDefMaybeAddInput(def,
+ VIR_DOMAIN_INPUT_TYPE_MOUSE,
+ input_bus) < 0)
goto error;
- }
- def->inputs[def->ninputs] = input;
- def->ninputs++;
}
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 836 bytes
Desc: OpenPGP digital signature
URL: <http://listman.redhat.com/archives/libvir-list/attachments/20140218/6b48c808/attachment-0001.sig>
More information about the libvir-list
mailing list