]> git.ipfire.org Git - thirdparty/libvirt.git/commitdiff
vbox: Remove old unflexible macros
authorDawid Zamirski <dzamirski@datto.com>
Tue, 24 Oct 2017 21:09:15 +0000 (17:09 -0400)
committerJohn Ferlan <jferlan@redhat.com>
Wed, 25 Oct 2017 15:14:21 +0000 (11:14 -0400)
The VBOX_SESSION_OPEN/CLOSE macros are only called in
_vboxDomainSnapshotRestore and they are unflexible because:

* assume the caller will have variable named "data"
* can only create Write lock type

As per above, it's not that hard to simply use the VBOX API directly.

src/vbox/vbox_tmpl.c

index dffeabde029fd279410bbd12bec156e37ea6121e..ce2ee90371d0b4252a17d1f49c92fdbbb0950054 100644 (file)
@@ -144,12 +144,6 @@ if (strUtf16) {\
           (unsigned)(iid)->m3[7]);\
 }\
 
-#define VBOX_SESSION_OPEN(/* unused */ iid_value, /* in */ machine) \
-    machine->vtbl->LockMachine(machine, data->vboxSession, LockType_Write)
-
-#define VBOX_SESSION_CLOSE() \
-    data->vboxSession->vtbl->UnlockMachine(data->vboxSession)
-
 #define VBOX_IID_INITIALIZER { NULL, true }
 
 static void
@@ -323,7 +317,7 @@ _vboxDomainSnapshotRestore(virDomainPtr dom,
         goto cleanup;
     }
 
-    rc = VBOX_SESSION_OPEN(domiid.value, machine);
+    rc = machine->vtbl->LockMachine(machine, data->vboxSession, LockType_Write);
 #if VBOX_API_VERSION < 5000000
     if (NS_SUCCEEDED(rc))
         rc = data->vboxSession->vtbl->GetConsole(data->vboxSession, &console);
@@ -368,7 +362,7 @@ _vboxDomainSnapshotRestore(virDomainPtr dom,
 #if VBOX_API_VERSION < 5000000
     VBOX_RELEASE(console);
 #endif /*VBOX_API_VERSION < 5000000*/
-    VBOX_SESSION_CLOSE();
+    data->vboxSession->vtbl->UnlockMachine(data->vboxSession);
     vboxIIDUnalloc(&domiid);
     return ret;
 }