[libvirt] [PATCH 1/3] Introduce virDomainOpenGraphicsFD API
Eric Blake
eblake at redhat.com
Tue Aug 26 21:20:21 UTC 2014
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
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 539 bytes
Desc: OpenPGP digital signature
URL: <http://listman.redhat.com/archives/libvir-list/attachments/20140826/68def129/attachment-0001.sig>
More information about the libvir-list
mailing list