diff options
author | Osier Yang <jyang@redhat.com> | 2012-03-23 21:44:50 +0800 |
---|---|---|
committer | Osier Yang <jyang@redhat.com> | 2012-03-23 23:10:26 +0800 |
commit | a26a1969c37c865b18294c5717544c1dc90beb3c (patch) | |
tree | ef2b2fc5785ae3e052c128fbc1b630f8c9dda9c2 /include | |
parent | Implement sysinfo on PowerPC. (diff) | |
download | libvirt-a26a1969c37c865b18294c5717544c1dc90beb3c.tar.gz libvirt-a26a1969c37c865b18294c5717544c1dc90beb3c.tar.bz2 libvirt-a26a1969c37c865b18294c5717544c1dc90beb3c.zip |
Add support for event tray moved of removable disks
This patch introduces a new event type for the QMP event
DEVICE_TRAY_MOVED, which occurs when the tray of a removable
disk is moved (i.e opened or closed):
VIR_DOMAIN_EVENT_ID_TRAY_CHANGE
The event's data includes the device alias and the reason
for tray status' changing, which indicates why the tray
status was changed. Thus the callback definition for the event
is:
enum {
VIR_DOMAIN_EVENT_TRAY_CHANGE_OPEN = 0,
VIR_DOMAIN_EVENT_TRAY_CHANGE_CLOSE,
\#ifdef VIR_ENUM_SENTINELS
VIR_DOMAIN_EVENT_TRAY_CHANGE_LAST
\#endif
} virDomainEventTrayChangeReason;
typedef void
(*virConnectDomainEventTrayChangeCallback)(virConnectPtr conn,
virDomainPtr dom,
const char *devAlias,
int reason,
void *opaque);
Diffstat (limited to 'include')
-rw-r--r-- | include/libvirt/libvirt.h.in | 35 |
1 files changed, 35 insertions, 0 deletions
diff --git a/include/libvirt/libvirt.h.in b/include/libvirt/libvirt.h.in index 7d41642e2..7bf1004cf 100644 --- a/include/libvirt/libvirt.h.in +++ b/include/libvirt/libvirt.h.in @@ -3668,6 +3668,40 @@ typedef void (*virConnectDomainEventDiskChangeCallback)(virConnectPtr conn, void *opaque); /** + * virConnectDomainEventTrayChangeReason: + * + * The reason describing why the callback was called + */ +enum { + VIR_DOMAIN_EVENT_TRAY_CHANGE_OPEN = 0, + VIR_DOMAIN_EVENT_TRAY_CHANGE_CLOSE, + +#ifdef VIR_ENUM_SENTINELS + VIR_DOMAIN_EVENT_TRAY_CHANGE_LAST +#endif +} virDomainEventTrayChangeReason; + +/** + * virConnectDomainEventTrayChangeCallback: + * @conn: connection object + * @dom: domain on which the event occurred + * @devAlias: device alias + * @reason: why the tray status was changed? + * @opaque: application specified data + * + * This callback occurs when the tray of a removable device is moved. + * + * The callback signature to use when registering for an event of type + * VIR_DOMAIN_EVENT_ID_TRAY_CHANGE with virConnectDomainEventRegisterAny() + */ +typedef void (*virConnectDomainEventTrayChangeCallback)(virConnectPtr conn, + virDomainPtr dom, + const char *devAlias, + int reason, + void *opaque); + + +/** * VIR_DOMAIN_EVENT_CALLBACK: * * Used to cast the event specific callback into the generic one @@ -3687,6 +3721,7 @@ typedef enum { VIR_DOMAIN_EVENT_ID_CONTROL_ERROR = 7, /* virConnectDomainEventGenericCallback */ VIR_DOMAIN_EVENT_ID_BLOCK_JOB = 8, /* virConnectDomainEventBlockJobCallback */ VIR_DOMAIN_EVENT_ID_DISK_CHANGE = 9, /* virConnectDomainEventDiskChangeCallback */ + VIR_DOMAIN_EVENT_ID_TRAY_CHANGE = 10, /* virConnectDomainEventTrayChangeCallback */ #ifdef VIR_ENUM_SENTINELS /* |