]> xenbits.xensource.com Git - libvirt.git/commitdiff
vbox: Make IMediumAttachment work with vbox2.2 and 3.0
authorTaowei Luo <uaedante@gmail.com>
Fri, 24 Oct 2014 01:46:47 +0000 (09:46 +0800)
committerMichal Privoznik <mprivozn@redhat.com>
Wed, 29 Oct 2014 00:21:40 +0000 (01:21 +0100)
The GetMedium will always return a IHardDisk object them.
In 2.2 and 3.0, it is what GetHardDisk exactly do. In 3.1 and later,
The IMedium is same as IHardDisk.

src/vbox/vbox_tmpl.c
src/vbox/vbox_uniformed_api.h

index 7c14c0d46d6d6320b33fa6c98bc9bbd560da222b..8aed0d6a604a815a5708a0ff551b811a70c8a714 100644 (file)
@@ -4680,14 +4680,13 @@ _mediumCreateDiffStorage(IMedium *medium ATTRIBUTE_UNUSED,
 }
 
 static nsresult
-_mediumAttachmentGetMedium(IMediumAttachment *mediumAttachment ATTRIBUTE_UNUSED,
-                           IMedium **medium ATTRIBUTE_UNUSED)
+_mediumAttachmentGetMedium(IMediumAttachment *mediumAttachment,
+                           IHardDisk **hardDisk)
 {
 #if VBOX_API_VERSION < 3001000
-    vboxUnsupported();
-    return 0;
+    return mediumAttachment->vtbl->GetHardDisk(mediumAttachment, hardDisk);
 #else /* VBOX_API_VERSION >= 3001000 */
-    return mediumAttachment->vtbl->GetMedium(mediumAttachment, medium);
+    return mediumAttachment->vtbl->GetMedium(mediumAttachment, hardDisk);
 #endif /* VBOX_API_VERSION >= 3001000 */
 }
 
index d0403ad6d6be3e3109cf9acda890ac5af288a53e..337ae9c1642ad5913b3ee7e4320e33397ebdade0 100644 (file)
@@ -426,7 +426,7 @@ typedef struct {
 
 /* Functions for IMediumAttachment */
 typedef struct {
-    nsresult (*GetMedium)(IMediumAttachment *mediumAttachment, IMedium **medium);
+    nsresult (*GetMedium)(IMediumAttachment *mediumAttachment, IHardDisk **hardDisk);
     nsresult (*GetController)(IMediumAttachment *mediumAttachment, PRUnichar **controller);
     nsresult (*GetType)(IMediumAttachment *mediumAttachment, PRUint32 *type);
     nsresult (*GetPort)(IMediumAttachment *mediumAttachment, PRInt32 *port);