VirtualBox

Changeset 27623 in vbox for trunk/src/VBox/Devices


Ignore:
Timestamp:
Mar 23, 2010 12:06:34 PM (15 years ago)
Author:
vboxsync
Message:

VMDK: Fix OVF export and import

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Devices/Storage/VmdkHDDCore.cpp

    r27533 r27623  
    477477{
    478478    /* File where the data is stored. */
    479     RTFILE File;
     479    PVMDKFILE File;
    480480    /* Total size of the data to read. */
    481481    size_t cbSize;
     
    490490{
    491491    /* File where the data is to be stored. */
    492     RTFILE File;
     492    PVMDKFILE File;
    493493    /* Offset in the file to write at. */
    494494    uint64_t uFileOffset;
     
    812812    }
    813813    cbBuf = RT_MIN(cbBuf, pInflateState->cbSize);
    814     int rc = RTFileReadAt(pInflateState->File, pInflateState->uFileOffset, pvBuf, cbBuf, NULL);
     814    int rc = vmdkFileReadAt(pInflateState->File, pInflateState->uFileOffset, pvBuf, cbBuf, NULL);
    815815    if (RT_FAILURE(rc))
    816816        return rc;
     
    849849        if (uMarker == VMDK_MARKER_IGNORE)
    850850            cbMarker -= sizeof(Marker.uType);
    851         rc = RTFileReadAt(pVmdkFile->File, uOffset, &Marker, cbMarker, NULL);
     851        rc = vmdkFileReadAt(pVmdkFile, uOffset, &Marker, cbMarker, NULL);
    852852        if (RT_FAILURE(rc))
    853853            return rc;
     
    891891            }
    892892        }
    893         InflateState.File = pVmdkFile->File;
     893        InflateState.File = pVmdkFile;
    894894        InflateState.cbSize = cbComp;
    895895        InflateState.uFileOffset = uCompOffset;
     
    926926    if (!cbBuf)
    927927        return VINF_SUCCESS;
    928     int rc = RTFileWriteAt(pDeflateState->File, pDeflateState->uFileOffset, pvBuf, cbBuf, NULL);
     928    int rc = vmdkFileWriteAt(pDeflateState->File, pDeflateState->uFileOffset, pvBuf, cbBuf, NULL);
    929929    if (RT_FAILURE(rc))
    930930        return rc;
     
    969969            return VERR_NOT_IMPLEMENTED;
    970970        }
    971         DeflateState.File = pVmdkFile->File;
     971        DeflateState.File = pVmdkFile;
    972972        DeflateState.uFileOffset = uCompOffset;
    973973        DeflateState.iOffset = -1;
     
    988988             * guarantees that data gets only appended. */
    989989            Assert(DeflateState.uFileOffset > uCompOffset);
    990             rc = RTFileSetSize(pVmdkFile->File, DeflateState.uFileOffset);
     990            rc = vmdkFileSetSize(pVmdkFile, DeflateState.uFileOffset);
    991991
    992992            if (uMarker == VMDK_MARKER_IGNORE)
     
    994994                /* Compressed grain marker. */
    995995                Marker.cbSize = RT_H2LE_U32(DeflateState.iOffset);
    996                 rc = RTFileWriteAt(pVmdkFile->File, uOffset, &Marker, 12, NULL);
     996                rc = vmdkFileWriteAt(pVmdkFile, uOffset, &Marker, 12, NULL);
    997997                if (RT_FAILURE(rc))
    998998                    return rc;
     
    10291029                                                               pVmdkFile->pStorage);
    10301030        else
    1031             rc2 = RTFileClose(pVmdkFile->File);
    1032 
    1033         if (RT_SUCCESS(rc) && pVmdkFile->fDelete)
    1034             rc2 = RTFileDelete(pVmdkFile->pszFilename);
    1035         RTStrFree((char *)(void *)pVmdkFile->pszFilename);
    1036         RTMemFree(pVmdkFile);
     1031            rc2 = vmdkFileClose(pImage, &pVmdkFile, pVmdkFile->fDelete);
     1032
    10371033        if (RT_SUCCESS(rc))
    10381034            rc = rc2;
Note: See TracChangeset for help on using the changeset viewer.

© 2024 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette