mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2025-01-21 20:15:17 +00:00
Introduce virDomainOpenGraphicsFD API
Define the public API implementation and declare internal driver prototype.
This commit is contained in:
parent
2f0944dec1
commit
3ddc85440e
@ -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);
|
||||
|
||||
int virDomainInjectNMI(virDomainPtr domain, unsigned int flags);
|
||||
|
||||
int virDomainFSTrim(virDomainPtr dom,
|
||||
|
@ -887,6 +887,12 @@ typedef int
|
||||
int fd,
|
||||
unsigned int flags);
|
||||
|
||||
typedef int
|
||||
(*virDrvDomainOpenGraphicsFD)(virDomainPtr dom,
|
||||
unsigned int idx,
|
||||
int *fd,
|
||||
unsigned int flags);
|
||||
|
||||
typedef int
|
||||
(*virDrvDomainInjectNMI)(virDomainPtr dom,
|
||||
unsigned int flags);
|
||||
@ -1369,6 +1375,7 @@ struct _virDriver {
|
||||
virDrvDomainOpenConsole domainOpenConsole;
|
||||
virDrvDomainOpenChannel domainOpenChannel;
|
||||
virDrvDomainOpenGraphics domainOpenGraphics;
|
||||
virDrvDomainOpenGraphicsFD domainOpenGraphicsFD;
|
||||
virDrvDomainInjectNMI domainInjectNMI;
|
||||
virDrvDomainMigrateBegin3 domainMigrateBegin3;
|
||||
virDrvDomainMigratePrepare3 domainMigratePrepare3;
|
||||
|
@ -20181,6 +20181,64 @@ virDomainOpenGraphics(virDomainPtr dom,
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* virDomainOpenGraphicsFD:
|
||||
* @dom: pointer to domain object
|
||||
* @idx: index of graphics config to open
|
||||
* @fd: returned file descriptor
|
||||
* @flags: bitwise-OR of virDomainOpenGraphicsFlags
|
||||
*
|
||||
* This will create a socket pair connected to the graphics backend of @dom.
|
||||
* One socket 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)
|
||||
{
|
||||
VIR_DOMAIN_DEBUG(dom, "idx=%u, fd=%p, flags=%x",
|
||||
idx, fd, flags);
|
||||
|
||||
virResetLastError();
|
||||
|
||||
virCheckDomainReturn(dom, -1);
|
||||
virCheckNonNullArgGoto(fd, error);
|
||||
|
||||
virCheckReadOnlyGoto(dom->conn->flags, error);
|
||||
|
||||
if (!VIR_DRV_SUPPORTS_FEATURE(dom->conn->driver, dom->conn,
|
||||
VIR_DRV_FEATURE_FD_PASSING)) {
|
||||
virReportError(VIR_ERR_ARGUMENT_UNSUPPORTED, "%s",
|
||||
_("fd passing is not supported by this connection"));
|
||||
goto error;
|
||||
}
|
||||
|
||||
if (dom->conn->driver->domainOpenGraphicsFD) {
|
||||
int ret;
|
||||
ret = dom->conn->driver->domainOpenGraphicsFD(dom, idx, fd, flags);
|
||||
if (ret < 0)
|
||||
goto error;
|
||||
return ret;
|
||||
}
|
||||
|
||||
virReportUnsupportedError();
|
||||
|
||||
error:
|
||||
virDispatchError(dom->conn);
|
||||
return -1;
|
||||
}
|
||||
/**
|
||||
* virConnectSetKeepAlive:
|
||||
* @conn: pointer to a hypervisor connection
|
||||
|
@ -670,4 +670,9 @@ LIBVIRT_1.2.7 {
|
||||
virConnectGetDomainCapabilities;
|
||||
} LIBVIRT_1.2.6;
|
||||
|
||||
LIBVIRT_1.2.8 {
|
||||
global:
|
||||
virDomainOpenGraphicsFD;
|
||||
} LIBVIRT_1.2.7;
|
||||
|
||||
# .... define new API here using predicted next version number ....
|
||||
|
Loading…
x
Reference in New Issue
Block a user