Index: /trunk/src/VBox/Runtime/testcase/tstRTDvm.cpp
===================================================================
--- /trunk/src/VBox/Runtime/testcase/tstRTDvm.cpp	(revision 76904)
+++ /trunk/src/VBox/Runtime/testcase/tstRTDvm.cpp	(revision 76905)
@@ -35,4 +35,5 @@
 #include <iprt/file.h>
 #include <iprt/string.h>
+#include <iprt/vfs.h>
 
 
@@ -40,42 +41,7 @@
 *   Structures and Typedefs                                                                                                      *
 *********************************************************************************************************************************/
-/**
- * Disk structure.
- */
-typedef struct TSTRTDVMDISK
-{
-    /** Flag whether this disk uses the image file or a volume. */
-    bool            fUseImage;
-    /** Data dependent on the flag. */
-    union
-    {
-        /** File handle of the image. */
-        RTVFSFILE   hImage;
-        /** Handle of the volume. */
-        RTDVMVOLUME hVol;
-    };
-} TSTRTDVMDISK, *PTSTRTDVMDISK;
 
 
-#if 0
-static DECLCALLBACK(int) dvmDiskRead(void *pvUser, uint64_t off, void *pvBuf, size_t cbRead)
-{
-    PTSTRTDVMDISK pDisk = (PTSTRTDVMDISK)pvUser;
-
-    if (pDisk->fUseImage)
-        return RTFileReadAt(pDisk->hImage, off, pvBuf, cbRead, NULL);
-    return RTDvmVolumeRead(pDisk->hVol, off, pvBuf, cbRead);
-}
-
-static DECLCALLBACK(int) dvmDiskWrite(void *pvUser, uint64_t off, const void *pvBuf, size_t cbWrite)
-{
-    PTSTRTDVMDISK pDisk = (PTSTRTDVMDISK)pvUser;
-
-    if (pDisk->fUseImage)
-        return RTFileWriteAt(pDisk->hImage, off, pvBuf, cbWrite, NULL);
-    return RTDvmVolumeWrite(pDisk->hVol, off, pvBuf, cbWrite);
-}
-
-static int tstRTDvmVolume(RTTEST hTest, PTSTRTDVMDISK pDisk, uint64_t cb, unsigned cNesting)
+static int tstRTDvmVolume(RTTEST hTest, RTVFSFILE hVfsDisk, unsigned cNesting)
 {
     char szPrefix[100];
@@ -92,5 +58,5 @@
     RTTestSubF(hTest, "Create DVM");
     RTDVM hVolMgr;
-    rc = RTDvmCreate(&hVolMgr, dvmDiskRead, dvmDiskWrite, cb, 512, 0, pDisk);
+    rc = RTDvmCreate(&hVolMgr, hVfsDisk, 512, 0 /*fFlags*/);
     if (RT_FAILURE(rc))
     {
@@ -110,5 +76,5 @@
         return VINF_SUCCESS;
 
-    RTTestIPrintf(RTTESTLVL_ALWAYS, "%s Successfully opened map with format: %s.\n", szPrefix, RTDvmMapGetFormat(hVolMgr));
+    RTTestIPrintf(RTTESTLVL_ALWAYS, "%s Successfully opened map with format: %s.\n", szPrefix, RTDvmMapGetFormatName(hVolMgr));
 
     /* Dump all volumes. */
@@ -147,8 +113,13 @@
          * (think of MBR partitions with a bsdlabel inside)
          */
-        TSTRTDVMDISK Disk;
-        Disk.fUseImage = false;
-        Disk.hVol      = hVol;
-        rc = tstRTDvmVolume(hTest, &Disk, RTDvmVolumeGetSize(hVol), cNesting + 1);
+        RTVFSFILE hVfsVol;
+        rc = RTDvmVolumeCreateVfsFile(hVol, RTFILE_O_OPEN | RTFILE_O_DENY_NONE | RTFILE_O_READWRITE, &hVfsVol);
+        if (RT_SUCCESS(rc))
+        {
+            rc = tstRTDvmVolume(hTest, hVfsVol, cNesting + 1);
+            RTVfsFileRelease(hVfsVol);
+        }
+        else
+            RTTestIFailed("RTDvmVolumeCreateVfsFile -> %Rrc", rc);
 
         RTDVMVOLUME hVolNext;
@@ -171,5 +142,5 @@
     return rc;
 }
-#endif
+
 
 int main(int argc, char **argv)
@@ -193,30 +164,22 @@
     }
 
-#if 1
-    RTTestFailed(hTest, "Needs updating to RTDvm API changes!");
-#else
-    /* Open image. */
-    RTFILE hFile;
-    uint64_t cb = 0;
-    rc = RTFileOpen(&hFile, argv[1], RTFILE_O_OPEN | RTFILE_O_DENY_NONE | RTFILE_O_READWRITE);
+    RTVFSFILE hVfsDisk;
+    rc = RTVfsFileOpenNormal(argv[1], RTFILE_O_OPEN | RTFILE_O_DENY_NONE | RTFILE_O_READWRITE, &hVfsDisk);
     if (RT_FAILURE(rc))
     {
-        RTTestIFailed("RTFileOpen -> %Rrc", rc);
+        RTTestIFailed("RTVfsFileOpenNormal -> %Rrc", rc);
         return RTTestSummaryAndDestroy(hTest);
     }
 
-    rc = RTFileGetSize(hFile, &cb);
+    uint64_t cb = 0;
+    rc = RTVfsFileGetSize(hVfsDisk, &cb);
     if (   RT_FAILURE(rc)
         || cb % 512 != 0) /* Assume 512 byte sector size. */
     {
-        RTTestIFailed("RTFileGetSize -> %Rrc", rc);
+        RTTestIFailed("RTVfsFileGetSize -> %Rrc", rc);
         return RTTestSummaryAndDestroy(hTest);
     }
 
-    TSTRTDVMDISK Disk;
-
-    Disk.fUseImage = true;
-    Disk.hImage    = hFile;
-    rc = tstRTDvmVolume(hTest, &Disk, cb, 0);
+    rc = tstRTDvmVolume(hTest, hVfsDisk, 0);
 
     RTTESTI_CHECK(rc == VINF_SUCCESS);
@@ -225,5 +188,4 @@
      * Summary
      */
-#endif
     return RTTestSummaryAndDestroy(hTest);
 }
