Re: [PATCH] parallels: simplify event types discrimination

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



04.06.2015 12:50, Nikolay Shirokovskiy пишет:
Use issue type instead of event type to group
vm related events. This saves us from
explicit enumeration of all vm even types in
prlsdkHandleVmEvent.
s/issue/issuer
---
  src/parallels/parallels_sdk.c |   15 +++++----------
  1 files changed, 5 insertions(+), 10 deletions(-)

diff --git a/src/parallels/parallels_sdk.c b/src/parallels/parallels_sdk.c
index 88ad59b..d5a9790 100644
--- a/src/parallels/parallels_sdk.c
+++ b/src/parallels/parallels_sdk.c
@@ -1681,7 +1681,7 @@ prlsdkEventsHandler(PRL_HANDLE prlEvent, PRL_VOID_PTR opaque)
      parallelsConnPtr privconn = opaque;
      PRL_RESULT pret = PRL_ERR_UNINITIALIZED;
      PRL_HANDLE_TYPE handleType;
-    PRL_EVENT_TYPE prlEventType;
+    PRL_EVENT_ISSUER_TYPE prlIssuerType = PIE_UNKNOWN;
pret = PrlHandle_GetType(prlEvent, &handleType);
      prlsdkCheckRetGoto(pret, cleanup);
@@ -1697,20 +1697,15 @@ prlsdkEventsHandler(PRL_HANDLE prlEvent, PRL_VOID_PTR opaque)
          goto cleanup;
      }
- PrlEvent_GetType(prlEvent, &prlEventType);
+    PrlEvent_GetIssuerType(prlEvent, &prlIssuerType);
      prlsdkCheckRetGoto(pret, cleanup);
- switch (prlEventType) {
-        case PET_DSP_EVT_VM_STATE_CHANGED:
-        case PET_DSP_EVT_VM_CONFIG_CHANGED:
-        case PET_DSP_EVT_VM_CREATED:
-        case PET_DSP_EVT_VM_ADDED:
-        case PET_DSP_EVT_VM_DELETED:
-        case PET_DSP_EVT_VM_UNREGISTERED:
+    switch (prlIssuerType) {
+        case PIE_VIRTUAL_MACHINE:
              pret = prlsdkHandleVmEvent(privconn, prlEvent);
              break;
          default:
-            VIR_DEBUG("Skipping event of type %d", prlEventType);
+            VIR_DEBUG("Skipping event of issuer type %d", prlIssuerType);
      }
pret = PRL_ERR_SUCCESS;

--
libvir-list mailing list
libvir-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/libvir-list





[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]