On 08/25/2014 12:22 PM, Ján Tomko wrote:
Define the public API implementation and declare internal
driver prototype.
---
include/libvirt/libvirt.h.in | 5 ++++
src/driver.h | 7 ++++++
src/libvirt.c | 58 ++++++++++++++++++++++++++++++++++++++++++++
src/libvirt_public.syms | 5 ++++
4 files changed, 75 insertions(+)
diff --git a/include/libvirt/libvirt.h.in b/include/libvirt/libvirt.h.in
index 47ea695..153b386 100644
--- a/include/libvirt/libvirt.h.in
+++ b/include/libvirt/libvirt.h.in
@@ -5321,6 +5321,11 @@ int virDomainOpenGraphics(virDomainPtr dom,
int fd,
unsigned int flags);
+int virDomainOpenGraphicsFD(virDomainPtr dom,
+ unsigned int idx,
+ int *fd,
+ unsigned int flags);
Wait. Why are we returning 0/-1 and making the user pass in a pointer
to get the fd?
+ * @fd: returned file descriptor
+ * @flags: bitwise-OR of virDomainOpenGraphicsFlags
+ *
+ * This will create a socket pair connected to the graphics backend of @dom.
+ * One pair will be returned as @fd.
+ * If @dom has multiple graphics backends configured, then @idx will determine
+ * which one is opened, starting from @idx 0.
+ *
+ * To disable any authentication, pass the VIR_DOMAIN_OPEN_GRAPHICS_SKIPAUTH
+ * constant for @flags.
+ *
+ * This method can only be used when connected to a local
+ * libvirt hypervisor, over a UNIX domain socket. Attempts
+ * to use this method over a TCP connection will always fail
+ *
+ * Returns 0 on success, -1 on failure
+ */
+int
+virDomainOpenGraphicsFD(virDomainPtr dom,
+ unsigned int idx,
+ int *fd,
+ unsigned int flags)
I'd much rather us return -1 on failure, and the actual fd on success,
with a signature:
int virDomainOpenGraphicsFD(virDomainPtr dom, unsigned int idx, unsigned
int flags)
Let's change that now, before we bake the mistake into the release candidate
--
Eric Blake eblake redhat com +1-919-301-3266
Libvirt virtualization library
http://libvirt.org