On 2013年12月05日 18:11, Ján Tomko wrote:
On 12/05/2013 09:17 AM, Li Zhang wrote:
From: Li Zhang <zhlcindy@xxxxxxxxxxxxxxxxxx>
There is no keyboard for PPC64 platform when grapchic is enabled.
s/grapchic is/graphics are/
It's preferred to add one USB keyboard.
This patch is to add keyboard input device type.
It also splits out 'virDomainDefMaybeAddInput', which would be nicer in a
separate commit IMO.
Thanks for your reviewing.
OK, I will do it in my next version.
Signed-off-by: Li Zhang <zhlcindy@xxxxxxxxxxxxxxxxxx>
---
src/conf/domain_conf.c | 62 +++++++++++++++++++++++++++++++++++-------------
src/conf/domain_conf.h | 5 ++++
src/libvirt_private.syms | 1 +
3 files changed, 51 insertions(+), 17 deletions(-)
@@ -10821,6 +10822,41 @@ virDomainDefMaybeAddController(virDomainDefPtr def,
return 0;
}
+int
+virDomainDefMaybeAddInput(virDomainDefPtr def,
+ int type,
+ int bus)
+{
+ size_t i;
+ virDomainInputDefPtr input;
+
+ for (i = 0; i < def->ninputs; i++) {
+ if (def->inputs[i]->type == type &&
+ def->inputs[i]->bus == bus)
+ return 0;
+ }
+
+ if (VIR_ALLOC(input) < 0) {
+ goto error;
+ }
+ input->type = type;
+ input->bus = bus;
+
+ if (VIR_REALLOC_N(def->inputs, def->ninputs + 1) < 0) {
+ virDomainInputDefFree(input);
+ goto error;
+ }
+
+ def->inputs[def->ninputs] = input;
+ def->ninputs ++;
VIR_APPEND_ELEMENT(def->inputs, def->ninputs, input) will do all this
and set input to NULL if it was successfully added - you can call InputDefFree
unconditionally.
Got it, thanks.
+ return 0;
+
+error:
+ virReportOOMError();
*ALLOC and *ELEMENT already set the OOM error.
ok, I see.
+ return -1;
+}
+
+
/* Parse a memory element located at XPATH within CTXT, and store the
* result into MEM. If REQUIRED, then the value must exist;
Jan
--
libvir-list mailing list
libvir-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/libvir-list