On 06/13/2011 04:55 PM, Daniel P. Berrange wrote:
> +++ b/src/libvirt.c
> @@ -26,6 +26,8 @@
> #include <libxml/uri.h>
> #include "getpass.h"
>
> +#include <libvirt/virtkeys.h>
> +
If we move the enum/#define into libvirt.h, this extra
include won't be needed (at least not for this file)
> /**
> + * virDomainSendKey:
> + * @domain: pointer to domain object, or NULL for Domain0
> + * @codeset: the code set of keycodes
> + * @holdtime: the time (in millsecond) how long the keys will be held
s/millsecond/milliseconds/, plus some grammar improvements
> + * @nkeycodes: number of keycodes
> + * @keycodes: array of keycodes
Order doesn't match. Per Matthias' comment on 8/10, document the limit.
ACK, if the whitespace is fixed in the debug message
Here's what I squashed in before pushing:
diff --git i/src/libvirt.c w/src/libvirt.c
index 8389e06..a7b55b6 100644
--- i/src/libvirt.c
+++ w/src/libvirt.c
@@ -26,8 +26,6 @@
#include <libxml/uri.h>
#include "getpass.h"
-#include <libvirt/virtkeys.h>
-
#ifdef HAVE_WINSOCK2_H
# include <winsock2.h>
#endif
@@ -6465,13 +6463,13 @@ error:
/**
* virDomainSendKey:
* @domain: pointer to domain object, or NULL for Domain0
- * @codeset: the code set of keycodes
- * @holdtime: the time (in millsecond) how long the keys will be held
- * @nkeycodes: number of keycodes
+ * @codeset: the code set of keycodes, from virKeycodeSet
+ * @holdtime: the duration (in milliseconds) that the keys will be held
* @keycodes: array of keycodes
+ * @nkeycodes: number of keycodes, up to VIR_DOMAIN_SEND_KEY_MAX_KEYS
* @flags: the flags for controlling behavior, pass 0 for now
*
- * Send key to the guest
+ * Send key(s) to the guest.
*
* Returns 0 in case of success, -1 in case of failure.
*/
@@ -6484,12 +6482,13 @@ int virDomainSendKey(virDomainPtr domain,
unsigned int flags)
{
virConnectPtr conn;
- VIR_DOMAIN_DEBUG(domain,
"codeset=%u,holdtime=%u,nkeycodes=%u,flags=%u",
+ VIR_DOMAIN_DEBUG(domain, "codeset=%u, holdtime=%u, nkeycodes=%u,
flags=%u",
codeset, holdtime, nkeycodes, flags);
virResetLastError();
- if (nkeycodes == 0 || nkeycodes > MAX_SEND_KEY) {
+ if (keycodes == NULL ||
+ nkeycodes == 0 || nkeycodes > VIR_DOMAIN_SEND_KEY_MAX_KEYS) {
virLibDomainError(VIR_ERR_OPERATION_INVALID, __FUNCTION__);
virDispatchError(NULL);
return -1;
--
Eric Blake eblake(a)redhat.com +1-801-349-2682
Libvirt virtualization library
http://libvirt.org