VirtualBox

Changeset 33651 in vbox for trunk/src


Ignore:
Timestamp:
Nov 1, 2010 1:53:01 PM (14 years ago)
Author:
vboxsync
svn:sync-xref-src-repo-rev:
67266
Message:

Main-OVF: rename

Location:
trunk/src/VBox/Main
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Main/ApplianceImplExport.cpp

    r33540 r33651  
    16131613    HRESULT rc = S_OK;
    16141614
    1615     PVDINTERFACEIO pSha1Callbacks = 0;
     1615    PVDINTERFACEIO pRTSha1Callbacks = 0;
    16161616    PVDINTERFACEIO pRTFileCallbacks = 0;
    16171617    do
    16181618    {
    1619         pSha1Callbacks = Sha1CreateInterface();
    1620         if (!pSha1Callbacks)
     1619        pRTSha1Callbacks = RTSha1CreateInterface();
     1620        if (!pRTSha1Callbacks)
    16211621        {
    16221622            rc = E_OUTOFMEMORY;
     
    16301630        }
    16311631
    1632         SHA1STORAGE storage;
     1632        RTSHA1STORAGE storage;
    16331633        RT_ZERO(storage);
    16341634        storage.fCreateDigest = m->fManifest;
     
    16421642            break;
    16431643        }
    1644         rc = writeFSImpl(pTask, writeLock, pSha1Callbacks, &storage);
     1644        rc = writeFSImpl(pTask, writeLock, pRTSha1Callbacks, &storage);
    16451645    }while(0);
    16461646
    16471647    /* Cleanup */
    1648     if (pSha1Callbacks)
    1649         RTMemFree(pSha1Callbacks);
     1648    if (pRTSha1Callbacks)
     1649        RTMemFree(pRTSha1Callbacks);
    16501650    if (pRTFileCallbacks)
    16511651        RTMemFree(pRTFileCallbacks);
     
    16681668    HRESULT rc = S_OK;
    16691669
    1670     PVDINTERFACEIO pSha1Callbacks = 0;
     1670    PVDINTERFACEIO pRTSha1Callbacks = 0;
    16711671    PVDINTERFACEIO pRTTarCallbacks = 0;
    16721672    do
    16731673    {
    1674         pSha1Callbacks = Sha1CreateInterface();
    1675         if (!pSha1Callbacks)
     1674        pRTSha1Callbacks = RTSha1CreateInterface();
     1675        if (!pRTSha1Callbacks)
    16761676        {
    16771677            rc = E_OUTOFMEMORY;
     
    16851685        }
    16861686        VDINTERFACE VDInterfaceIO;
    1687         SHA1STORAGE storage;
     1687        RTSHA1STORAGE storage;
    16881688        RT_ZERO(storage);
    16891689        storage.fCreateDigest = m->fManifest;
     
    16961696            break;
    16971697        }
    1698         rc = writeFSImpl(pTask, writeLock, pSha1Callbacks, &storage);
     1698        rc = writeFSImpl(pTask, writeLock, pRTSha1Callbacks, &storage);
    16991699    }while(0);
    17001700
     
    17021702
    17031703    /* Cleanup */
    1704     if (pSha1Callbacks)
    1705         RTMemFree(pSha1Callbacks);
     1704    if (pRTSha1Callbacks)
     1705        RTMemFree(pRTSha1Callbacks);
    17061706    if (pRTTarCallbacks)
    17071707        RTMemFree(pRTTarCallbacks);
     
    17151715}
    17161716
    1717 HRESULT Appliance::writeFSImpl(TaskOVF *pTask, AutoWriteLockBase& writeLock, PVDINTERFACEIO pCallbacks, PSHA1STORAGE pStorage)
     1717HRESULT Appliance::writeFSImpl(TaskOVF *pTask, AutoWriteLockBase& writeLock, PVDINTERFACEIO pCallbacks, PRTSHA1STORAGE pStorage)
    17181718{
    17191719    LogFlowFuncEnter();
     
    17471747                               strOvfFile.c_str());
    17481748            /* Write the ovf file to disk. */
    1749             vrc = Sha1WriteBuf(strOvfFile.c_str(), pvBuf, cbSize, pCallbacks, pStorage);
     1749            vrc = RTSha1WriteBuf(strOvfFile.c_str(), pvBuf, cbSize, pCallbacks, pStorage);
    17501750            RTMemFree(pvBuf);
    17511751            if (RT_FAILURE(vrc))
     
    18651865            pStorage->fCreateDigest = false;
    18661866            /* Write the manifest file to disk. */
    1867             vrc = Sha1WriteBuf(strMfFilePath.c_str(), pvBuf, cbSize, pCallbacks, pStorage);
     1867            vrc = RTSha1WriteBuf(strMfFilePath.c_str(), pvBuf, cbSize, pCallbacks, pStorage);
    18681868            RTMemFree(pvBuf);
    18691869            if (RT_FAILURE(vrc))
  • trunk/src/VBox/Main/ApplianceImplIO.cpp

    r33643 r33651  
    5353} RTTARSTORAGEINTERNAL, *PRTTARSTORAGEINTERNAL;
    5454
    55 typedef struct SHA1STORAGEINTERNAL
     55typedef struct RTSHA1STORAGEINTERNAL
    5656{
    5757    /** Completion callback. */
     
    6262    uint32_t fOpenMode;
    6363    /** Our own storage handle. */
    64     PSHA1STORAGE pSha1Storage;
     64    PRTSHA1STORAGE pSha1Storage;
    6565    /** Circular buffer used for transferring data from/to the worker thread. */
    6666    PRTCIRCBUF pCircBuf;
     
    7777    /** Event for signaling a finished task of the worker thread. */
    7878    RTSEMEVENT workFinishedEvent;
    79     /** SHA1 calculation context. */
     79    /** rtSha1 calculation context. */
    8080    RTSHA1CONTEXT ctx;
    8181    /** Write mode only: Memory buffer for writing zeros. */
     
    8787//    uint64_t calls;
    8888//    uint64_t waits;
    89 } SHA1STORAGEINTERNAL, *PSHA1STORAGEINTERNAL;
     89} RTSHA1STORAGEINTERNAL, *PRTSHA1STORAGEINTERNAL;
    9090
    9191/******************************************************************************
     
    456456
    457457/******************************************************************************
    458  *   Internal: Sha1 interface
     458 *   Internal: RTSha1 interface
    459459 ******************************************************************************/
    460460
    461 DECLCALLBACK(int) sha1CalcWorkerThread(RTTHREAD /* aThread */, void *pvUser)
    462 {
    463     /* Validate input. */
    464     AssertPtrReturn(pvUser, VERR_INVALID_POINTER);
    465 
    466     PSHA1STORAGEINTERNAL pInt = (PSHA1STORAGEINTERNAL)pvUser;
     461DECLCALLBACK(int) rtSha1CalcWorkerThread(RTTHREAD /* aThread */, void *pvUser)
     462{
     463    /* Validate input. */
     464    AssertPtrReturn(pvUser, VERR_INVALID_POINTER);
     465
     466    PRTSHA1STORAGEINTERNAL pInt = (PRTSHA1STORAGEINTERNAL)pvUser;
    467467
    468468    PVDINTERFACE pIO = VDInterfaceGet(pInt->pSha1Storage->pVDImageIfaces, VDINTERFACETYPE_IO);
     
    624624}
    625625
    626 DECLINLINE(int) sha1SignalManifestThread(PSHA1STORAGEINTERNAL pInt, uint32_t uStatus)
     626DECLINLINE(int) rtSha1SignalManifestThread(PRTSHA1STORAGEINTERNAL pInt, uint32_t uStatus)
    627627{
    628628    ASMAtomicWriteU32(&pInt->u32Status, uStatus);
     
    630630}
    631631
    632 DECLINLINE(int) sha1WaitForManifestThreadFinished(PSHA1STORAGEINTERNAL pInt)
     632DECLINLINE(int) rtSha1WaitForManifestThreadFinished(PRTSHA1STORAGEINTERNAL pInt)
    633633{
    634634//    RTPrintf("start\n");
     
    647647}
    648648
    649 DECLINLINE(int) sha1FlushCurBuf(PSHA1STORAGEINTERNAL pInt)
     649DECLINLINE(int) rtSha1FlushCurBuf(PRTSHA1STORAGEINTERNAL pInt)
    650650{
    651651    int rc = VINF_SUCCESS;
     
    653653    {
    654654        /* Let the write worker thread start immediately. */
    655         rc = sha1SignalManifestThread(pInt, STATUS_WRITE);
     655        rc = rtSha1SignalManifestThread(pInt, STATUS_WRITE);
    656656        if (RT_FAILURE(rc))
    657657            return rc;
    658658
    659659        /* Wait until the write worker thread has finished. */
    660         rc = sha1WaitForManifestThreadFinished(pInt);
     660        rc = rtSha1WaitForManifestThreadFinished(pInt);
    661661    }
    662662
     
    664664}
    665665
    666 static int sha1OpenCallback(void *pvUser, const char *pszLocation, uint32_t fOpen,
    667                             PFNVDCOMPLETED pfnCompleted, void **ppInt)
     666static int rtSha1OpenCallback(void *pvUser, const char *pszLocation, uint32_t fOpen,
     667                              PFNVDCOMPLETED pfnCompleted, void **ppInt)
    668668{
    669669    /* Validate input. */
     
    674674    AssertReturn((fOpen & RTFILE_O_READWRITE) != RTFILE_O_READWRITE, VERR_INVALID_PARAMETER); /* No read/write allowed */
    675675
    676     PSHA1STORAGE pSha1Storage = (PSHA1STORAGE)pvUser;
     676    PRTSHA1STORAGE pSha1Storage = (PRTSHA1STORAGE)pvUser;
    677677    PVDINTERFACE pIO = VDInterfaceGet(pSha1Storage->pVDImageIfaces, VDINTERFACETYPE_IO);
    678678    AssertPtrReturn(pIO, VERR_INVALID_PARAMETER);
     
    682682    DEBUG_PRINT_FLOW();
    683683
    684     PSHA1STORAGEINTERNAL pInt = (PSHA1STORAGEINTERNAL)RTMemAllocZ(sizeof(SHA1STORAGEINTERNAL));
     684    PRTSHA1STORAGEINTERNAL pInt = (PRTSHA1STORAGEINTERNAL)RTMemAllocZ(sizeof(RTSHA1STORAGEINTERNAL));
    685685    if (!pInt)
    686686        return VERR_NO_MEMORY;
     
    724724            break;
    725725        /* Create the worker thread. */
    726         rc = RTThreadCreate(&pInt->pWorkerThread, sha1CalcWorkerThread, pInt, 0, RTTHREADTYPE_MAIN_HEAVY_WORKER, RTTHREADFLAGS_WAITABLE, "SHA1-Worker");
     726        rc = RTThreadCreate(&pInt->pWorkerThread, rtSha1CalcWorkerThread, pInt, 0, RTTHREADTYPE_MAIN_HEAVY_WORKER, RTTHREADFLAGS_WAITABLE, "SHA1-Worker");
    727727        if (RT_FAILURE(rc))
    728728            break;
    729729
    730730        if (pSha1Storage->fCreateDigest)
    731             /* Create a sha1 context the worker thread will work with. */
     731            /* Create a SHA1 context the worker thread will work with. */
    732732            RTSha1Init(&pInt->ctx);
    733733
     
    742742        {
    743743            /* Immediately let the worker thread start the reading. */
    744             rc = sha1SignalManifestThread(pInt, STATUS_READ);
     744            rc = rtSha1SignalManifestThread(pInt, STATUS_READ);
    745745        }
    746746    }
     
    751751        if (pInt->pWorkerThread)
    752752        {
    753             sha1SignalManifestThread(pInt, STATUS_END);
     753            rtSha1SignalManifestThread(pInt, STATUS_END);
    754754            RTThreadWait(pInt->pWorkerThread, RT_INDEFINITE_WAIT, 0);
    755755        }
     
    770770}
    771771
    772 static int sha1CloseCallback(void *pvUser, void *pvStorage)
    773 {
    774     /* Validate input. */
    775     AssertPtrReturn(pvUser, VERR_INVALID_POINTER);
    776     AssertPtrReturn(pvStorage, VERR_INVALID_POINTER);
    777 
    778     PSHA1STORAGE pSha1Storage = (PSHA1STORAGE)pvUser;
     772static int rtSha1CloseCallback(void *pvUser, void *pvStorage)
     773{
     774    /* Validate input. */
     775    AssertPtrReturn(pvUser, VERR_INVALID_POINTER);
     776    AssertPtrReturn(pvStorage, VERR_INVALID_POINTER);
     777
     778    PRTSHA1STORAGE pSha1Storage = (PRTSHA1STORAGE)pvUser;
    779779    PVDINTERFACE pIO = VDInterfaceGet(pSha1Storage->pVDImageIfaces, VDINTERFACETYPE_IO);
    780780    AssertPtrReturn(pIO, VERR_INVALID_PARAMETER);
     
    782782    AssertPtrReturn(pCallbacks, VERR_INVALID_PARAMETER);
    783783
    784     PSHA1STORAGEINTERNAL pInt = (PSHA1STORAGEINTERNAL)pvStorage;
     784    PRTSHA1STORAGEINTERNAL pInt = (PRTSHA1STORAGEINTERNAL)pvStorage;
    785785
    786786    DEBUG_PRINT_FLOW();
     
    789789
    790790    /* Make sure all pending writes are flushed */
    791     rc = sha1FlushCurBuf(pInt);
     791    rc = rtSha1FlushCurBuf(pInt);
    792792
    793793    if (pInt->pWorkerThread)
    794794    {
    795795        /* Signal the worker thread to end himself */
    796         rc = sha1SignalManifestThread(pInt, STATUS_END);
     796        rc = rtSha1SignalManifestThread(pInt, STATUS_END);
    797797        /* Worker thread stopped? */
    798798        rc = RTThreadWait(pInt->pWorkerThread, RT_INDEFINITE_WAIT, 0);
     
    835835}
    836836
    837 static int sha1DeleteCallback(void *pvUser, const char *pcszFilename)
    838 {
    839     /* Validate input. */
    840     AssertPtrReturn(pvUser, VERR_INVALID_POINTER);
    841 
    842     PSHA1STORAGE pSha1Storage = (PSHA1STORAGE)pvUser;
     837static int rtSha1DeleteCallback(void *pvUser, const char *pcszFilename)
     838{
     839    /* Validate input. */
     840    AssertPtrReturn(pvUser, VERR_INVALID_POINTER);
     841
     842    PRTSHA1STORAGE pSha1Storage = (PRTSHA1STORAGE)pvUser;
    843843    PVDINTERFACE pIO = VDInterfaceGet(pSha1Storage->pVDImageIfaces, VDINTERFACETYPE_IO);
    844844    AssertPtrReturn(pIO, VERR_INVALID_PARAMETER);
     
    851851}
    852852
    853 static int sha1MoveCallback(void *pvUser, const char *pcszSrc, const char *pcszDst, unsigned fMove)
    854 {
    855     /* Validate input. */
    856     AssertPtrReturn(pvUser, VERR_INVALID_POINTER);
    857 
    858     PSHA1STORAGE pSha1Storage = (PSHA1STORAGE)pvUser;
     853static int rtSha1MoveCallback(void *pvUser, const char *pcszSrc, const char *pcszDst, unsigned fMove)
     854{
     855    /* Validate input. */
     856    AssertPtrReturn(pvUser, VERR_INVALID_POINTER);
     857
     858    PRTSHA1STORAGE pSha1Storage = (PRTSHA1STORAGE)pvUser;
    859859    PVDINTERFACE pIO = VDInterfaceGet(pSha1Storage->pVDImageIfaces, VDINTERFACETYPE_IO);
    860860    AssertPtrReturn(pIO, VERR_INVALID_PARAMETER);
     
    867867}
    868868
    869 static int sha1GetFreeSpaceCallback(void *pvUser, const char *pcszFilename, int64_t *pcbFreeSpace)
    870 {
    871     /* Validate input. */
    872     AssertPtrReturn(pvUser, VERR_INVALID_POINTER);
    873 
    874     PSHA1STORAGE pSha1Storage = (PSHA1STORAGE)pvUser;
     869static int rtSha1GetFreeSpaceCallback(void *pvUser, const char *pcszFilename, int64_t *pcbFreeSpace)
     870{
     871    /* Validate input. */
     872    AssertPtrReturn(pvUser, VERR_INVALID_POINTER);
     873
     874    PRTSHA1STORAGE pSha1Storage = (PRTSHA1STORAGE)pvUser;
    875875    PVDINTERFACE pIO = VDInterfaceGet(pSha1Storage->pVDImageIfaces, VDINTERFACETYPE_IO);
    876876    AssertPtrReturn(pIO, VERR_INVALID_PARAMETER);
     
    883883}
    884884
    885 static int sha1GetModificationTimeCallback(void *pvUser, const char *pcszFilename, PRTTIMESPEC pModificationTime)
    886 {
    887     /* Validate input. */
    888     AssertPtrReturn(pvUser, VERR_INVALID_POINTER);
    889 
    890     PSHA1STORAGE pSha1Storage = (PSHA1STORAGE)pvUser;
     885static int rtSha1GetModificationTimeCallback(void *pvUser, const char *pcszFilename, PRTTIMESPEC pModificationTime)
     886{
     887    /* Validate input. */
     888    AssertPtrReturn(pvUser, VERR_INVALID_POINTER);
     889
     890    PRTSHA1STORAGE pSha1Storage = (PRTSHA1STORAGE)pvUser;
    891891    PVDINTERFACE pIO = VDInterfaceGet(pSha1Storage->pVDImageIfaces, VDINTERFACETYPE_IO);
    892892    AssertPtrReturn(pIO, VERR_INVALID_PARAMETER);
     
    900900
    901901
    902 static int sha1GetSizeCallback(void *pvUser, void *pvStorage, uint64_t *pcbSize)
    903 {
    904     /* Validate input. */
    905     AssertPtrReturn(pvUser, VERR_INVALID_POINTER);
    906     AssertPtrReturn(pvStorage, VERR_INVALID_POINTER);
    907 
    908     PSHA1STORAGE pSha1Storage = (PSHA1STORAGE)pvUser;
     902static int rtSha1GetSizeCallback(void *pvUser, void *pvStorage, uint64_t *pcbSize)
     903{
     904    /* Validate input. */
     905    AssertPtrReturn(pvUser, VERR_INVALID_POINTER);
     906    AssertPtrReturn(pvStorage, VERR_INVALID_POINTER);
     907
     908    PRTSHA1STORAGE pSha1Storage = (PRTSHA1STORAGE)pvUser;
    909909    PVDINTERFACE pIO = VDInterfaceGet(pSha1Storage->pVDImageIfaces, VDINTERFACETYPE_IO);
    910910    AssertPtrReturn(pIO, VERR_INVALID_PARAMETER);
     
    912912    AssertPtrReturn(pCallbacks, VERR_INVALID_PARAMETER);
    913913
    914     PSHA1STORAGEINTERNAL pInt = (PSHA1STORAGEINTERNAL)pvStorage;
     914    PRTSHA1STORAGEINTERNAL pInt = (PRTSHA1STORAGEINTERNAL)pvStorage;
    915915
    916916    DEBUG_PRINT_FLOW();
     
    926926}
    927927
    928 static int sha1SetSizeCallback(void *pvUser, void *pvStorage, uint64_t cbSize)
    929 {
    930     /* Validate input. */
    931     AssertPtrReturn(pvUser, VERR_INVALID_POINTER);
    932     AssertPtrReturn(pvStorage, VERR_INVALID_POINTER);
    933 
    934     PSHA1STORAGE pSha1Storage = (PSHA1STORAGE)pvUser;
     928static int rtSha1SetSizeCallback(void *pvUser, void *pvStorage, uint64_t cbSize)
     929{
     930    /* Validate input. */
     931    AssertPtrReturn(pvUser, VERR_INVALID_POINTER);
     932    AssertPtrReturn(pvStorage, VERR_INVALID_POINTER);
     933
     934    PRTSHA1STORAGE pSha1Storage = (PRTSHA1STORAGE)pvUser;
    935935    PVDINTERFACE pIO = VDInterfaceGet(pSha1Storage->pVDImageIfaces, VDINTERFACETYPE_IO);
    936936    AssertPtrReturn(pIO, VERR_INVALID_PARAMETER);
     
    938938    AssertPtrReturn(pCallbacks, VERR_INVALID_PARAMETER);
    939939
    940     PSHA1STORAGEINTERNAL pInt = (PSHA1STORAGEINTERNAL)pvStorage;
     940    PRTSHA1STORAGEINTERNAL pInt = (PRTSHA1STORAGEINTERNAL)pvStorage;
    941941
    942942    DEBUG_PRINT_FLOW();
     
    945945}
    946946
    947 static int sha1WriteSyncCallback(void *pvUser, void *pvStorage, uint64_t uOffset,
     947static int rtSha1WriteSyncCallback(void *pvUser, void *pvStorage, uint64_t uOffset,
    948948                                 const void *pvBuf, size_t cbWrite, size_t *pcbWritten)
    949949{
     
    952952    AssertPtrReturn(pvStorage, VERR_INVALID_POINTER);
    953953
    954     PSHA1STORAGE pSha1Storage = (PSHA1STORAGE)pvUser;
     954    PRTSHA1STORAGE pSha1Storage = (PRTSHA1STORAGE)pvUser;
    955955    PVDINTERFACE pIO = VDInterfaceGet(pSha1Storage->pVDImageIfaces, VDINTERFACETYPE_IO);
    956956    AssertPtrReturn(pIO, VERR_INVALID_PARAMETER);
     
    958958    AssertPtrReturn(pCallbacks, VERR_INVALID_PARAMETER);
    959959
    960     PSHA1STORAGEINTERNAL pInt = (PSHA1STORAGEINTERNAL)pvStorage;
     960    PRTSHA1STORAGEINTERNAL pInt = (PRTSHA1STORAGEINTERNAL)pvStorage;
    961961
    962962    DEBUG_PRINT_FLOW();
     
    980980            size_t cbToWrite = RT_MIN(pInt->cbZeroBuf, cbSize - cbAllWritten);
    981981            size_t cbWritten = 0;
    982             rc = sha1WriteSyncCallback(pvUser, pvStorage, pInt->cbCurAll,
    983                                        pInt->pvZeroBuf, cbToWrite, &cbWritten);
     982            rc = rtSha1WriteSyncCallback(pvUser, pvStorage, pInt->cbCurAll,
     983                                         pInt->pvZeroBuf, cbToWrite, &cbWritten);
    984984            if (RT_FAILURE(rc))
    985985                break;
     
    10051005        if ((cbWrite - cbAllWritten) > cbAvail)
    10061006        {
    1007             rc = sha1SignalManifestThread(pInt, STATUS_WRITE);
     1007            rc = rtSha1SignalManifestThread(pInt, STATUS_WRITE);
    10081008            if(RT_FAILURE(rc))
    10091009                break;
     
    10111011            if (cbAvail == 0)
    10121012            {
    1013                 rc = sha1WaitForManifestThreadFinished(pInt);
     1013                rc = rtSha1WaitForManifestThreadFinished(pInt);
    10141014                if (RT_FAILURE(rc))
    10151015                    break;
     
    10371037    if (   RT_SUCCESS(rc)
    10381038           && RTCircBufUsed(pInt->pCircBuf) >= (RTCircBufSize(pInt->pCircBuf) / 2))
    1039         rc = sha1SignalManifestThread(pInt, STATUS_WRITE);
     1039        rc = rtSha1SignalManifestThread(pInt, STATUS_WRITE);
    10401040
    10411041    return rc;
    10421042}
    10431043
    1044 static int sha1ReadSyncCallback(void *pvUser, void *pvStorage, uint64_t uOffset,
    1045                                 void *pvBuf, size_t cbRead, size_t *pcbRead)
    1046 {
    1047     /* Validate input. */
    1048     AssertPtrReturn(pvUser, VERR_INVALID_POINTER);
    1049     AssertPtrReturn(pvStorage, VERR_INVALID_POINTER);
    1050 
    1051     PSHA1STORAGE pSha1Storage = (PSHA1STORAGE)pvUser;
     1044static int rtSha1ReadSyncCallback(void *pvUser, void *pvStorage, uint64_t uOffset,
     1045                                  void *pvBuf, size_t cbRead, size_t *pcbRead)
     1046{
     1047    /* Validate input. */
     1048    AssertPtrReturn(pvUser, VERR_INVALID_POINTER);
     1049    AssertPtrReturn(pvStorage, VERR_INVALID_POINTER);
     1050
     1051    PRTSHA1STORAGE pSha1Storage = (PRTSHA1STORAGE)pvUser;
    10521052    PVDINTERFACE pIO = VDInterfaceGet(pSha1Storage->pVDImageIfaces, VDINTERFACETYPE_IO);
    10531053    AssertPtrReturn(pIO, VERR_INVALID_PARAMETER);
     
    10571057//    DEBUG_PRINT_FLOW();
    10581058
    1059     PSHA1STORAGEINTERNAL pInt = (PSHA1STORAGEINTERNAL)pvStorage;
     1059    PRTSHA1STORAGEINTERNAL pInt = (PRTSHA1STORAGEINTERNAL)pvStorage;
    10601060
    10611061    int rc = VINF_SUCCESS;
     
    10681068    if (pInt->cbCurAll < uOffset)
    10691069    {
    1070         rc = sha1ReadSyncCallback(pvUser, pvStorage, pInt->cbCurAll, 0, uOffset - pInt->cbCurAll, 0);
     1070        rc = rtSha1ReadSyncCallback(pvUser, pvStorage, pInt->cbCurAll, 0, uOffset - pInt->cbCurAll, 0);
    10711071        if (RT_FAILURE(rc))
    10721072            return rc;
     
    10891089        if ((cbRead - cbAllRead) > cbAvail)
    10901090        {
    1091             rc = sha1SignalManifestThread(pInt, STATUS_READ);
     1091            rc = rtSha1SignalManifestThread(pInt, STATUS_READ);
    10921092            if(RT_FAILURE(rc))
    10931093                break;
     
    10951095            if (cbAvail == 0)
    10961096            {
    1097                 rc = sha1WaitForManifestThreadFinished(pInt);
     1097                rc = rtSha1WaitForManifestThreadFinished(pInt);
    10981098                if (RT_FAILURE(rc))
    10991099                    break;
     
    11261126    if (   RT_SUCCESS(rc)
    11271127        && RTCircBufFree(pInt->pCircBuf) >= (RTCircBufSize(pInt->pCircBuf) / 2))
    1128         rc = sha1SignalManifestThread(pInt, STATUS_READ);
     1128        rc = rtSha1SignalManifestThread(pInt, STATUS_READ);
    11291129
    11301130    return rc;
    11311131}
    11321132
    1133 static int sha1FlushSyncCallback(void *pvUser, void *pvStorage)
    1134 {
    1135     /* Validate input. */
    1136     AssertPtrReturn(pvUser, VERR_INVALID_POINTER);
    1137     AssertPtrReturn(pvStorage, VERR_INVALID_POINTER);
    1138 
    1139     PSHA1STORAGE pSha1Storage = (PSHA1STORAGE)pvUser;
     1133static int rtSha1FlushSyncCallback(void *pvUser, void *pvStorage)
     1134{
     1135    /* Validate input. */
     1136    AssertPtrReturn(pvUser, VERR_INVALID_POINTER);
     1137    AssertPtrReturn(pvStorage, VERR_INVALID_POINTER);
     1138
     1139    PRTSHA1STORAGE pSha1Storage = (PRTSHA1STORAGE)pvUser;
    11401140    PVDINTERFACE pIO = VDInterfaceGet(pSha1Storage->pVDImageIfaces, VDINTERFACETYPE_IO);
    11411141    AssertPtrReturn(pIO, VERR_INVALID_PARAMETER);
     
    11451145    DEBUG_PRINT_FLOW();
    11461146
    1147     PSHA1STORAGEINTERNAL pInt = (PSHA1STORAGEINTERNAL)pvStorage;
     1147    PRTSHA1STORAGEINTERNAL pInt = (PRTSHA1STORAGEINTERNAL)pvStorage;
    11481148
    11491149    /* Check if there is still something in the buffer. If yes, flush it. */
    1150     int rc = sha1FlushCurBuf(pInt);
     1150    int rc = rtSha1FlushCurBuf(pInt);
    11511151    if (RT_FAILURE(rc))
    11521152        return rc;
     
    11591159 ******************************************************************************/
    11601160
    1161 PVDINTERFACEIO Sha1CreateInterface()
     1161PVDINTERFACEIO RTSha1CreateInterface()
    11621162{
    11631163    PVDINTERFACEIO pCallbacks = (PVDINTERFACEIO)RTMemAllocZ(sizeof(VDINTERFACEIO));
     
    11671167    pCallbacks->cbSize                 = sizeof(VDINTERFACEIO);
    11681168    pCallbacks->enmInterface           = VDINTERFACETYPE_IO;
    1169     pCallbacks->pfnOpen                = sha1OpenCallback;
    1170     pCallbacks->pfnClose               = sha1CloseCallback;
    1171     pCallbacks->pfnDelete              = sha1DeleteCallback;
    1172     pCallbacks->pfnMove                = sha1MoveCallback;
    1173     pCallbacks->pfnGetFreeSpace        = sha1GetFreeSpaceCallback;
    1174     pCallbacks->pfnGetModificationTime = sha1GetModificationTimeCallback;
    1175     pCallbacks->pfnGetSize             = sha1GetSizeCallback;
    1176     pCallbacks->pfnSetSize             = sha1SetSizeCallback;
    1177     pCallbacks->pfnReadSync            = sha1ReadSyncCallback;
    1178     pCallbacks->pfnWriteSync           = sha1WriteSyncCallback;
    1179     pCallbacks->pfnFlushSync           = sha1FlushSyncCallback;
     1169    pCallbacks->pfnOpen                = rtSha1OpenCallback;
     1170    pCallbacks->pfnClose               = rtSha1CloseCallback;
     1171    pCallbacks->pfnDelete              = rtSha1DeleteCallback;
     1172    pCallbacks->pfnMove                = rtSha1MoveCallback;
     1173    pCallbacks->pfnGetFreeSpace        = rtSha1GetFreeSpaceCallback;
     1174    pCallbacks->pfnGetModificationTime = rtSha1GetModificationTimeCallback;
     1175    pCallbacks->pfnGetSize             = rtSha1GetSizeCallback;
     1176    pCallbacks->pfnSetSize             = rtSha1SetSizeCallback;
     1177    pCallbacks->pfnReadSync            = rtSha1ReadSyncCallback;
     1178    pCallbacks->pfnWriteSync           = rtSha1WriteSyncCallback;
     1179    pCallbacks->pfnFlushSync           = rtSha1FlushSyncCallback;
    11801180
    11811181    return pCallbacks;
     
    12281228}
    12291229
    1230 int Sha1ReadBuf(const char *pcszFilename, void **ppvBuf, size_t *pcbSize, PVDINTERFACEIO pCallbacks, void *pvUser)
     1230int RTSha1ReadBuf(const char *pcszFilename, void **ppvBuf, size_t *pcbSize, PVDINTERFACEIO pCallbacks, void *pvUser)
    12311231{
    12321232    /* Validate input. */
     
    12941294}
    12951295
    1296 int Sha1WriteBuf(const char *pcszFilename, void *pvBuf, size_t cbSize, PVDINTERFACEIO pCallbacks, void *pvUser)
     1296int RTSha1WriteBuf(const char *pcszFilename, void *pvBuf, size_t cbSize, PVDINTERFACEIO pCallbacks, void *pvUser)
    12971297{
    12981298    /* Validate input. */
  • trunk/src/VBox/Main/ApplianceImplImport.cpp

    r33567 r33651  
    707707    HRESULT rc = S_OK;
    708708
    709     PVDINTERFACEIO pSha1Callbacks = 0;
     709    PVDINTERFACEIO pRTSha1Callbacks = 0;
    710710    PVDINTERFACEIO pRTFileCallbacks = 0;
    711711    do
    712712    {
    713         pSha1Callbacks = Sha1CreateInterface();
    714         if (!pSha1Callbacks)
     713        pRTSha1Callbacks = RTSha1CreateInterface();
     714        if (!pRTSha1Callbacks)
    715715        {
    716716            rc = E_OUTOFMEMORY;
     
    724724        }
    725725        VDINTERFACE VDInterfaceIO;
    726         SHA1STORAGE storage;
     726        RTSHA1STORAGE storage;
    727727        RT_ZERO(storage);
    728728        int vrc = VDInterfaceAdd(&VDInterfaceIO, "Appliance::IORTFile",
     
    734734            break;
    735735        }
    736         rc = readFSImpl(pTask, pSha1Callbacks, &storage);
     736        rc = readFSImpl(pTask, pRTSha1Callbacks, &storage);
    737737    }while(0);
    738738
    739739    /* Cleanup */
    740     if (pSha1Callbacks)
    741         RTMemFree(pSha1Callbacks);
     740    if (pRTSha1Callbacks)
     741        RTMemFree(pRTSha1Callbacks);
    742742    if (pRTFileCallbacks)
    743743        RTMemFree(pRTFileCallbacks);
     
    762762    HRESULT rc = S_OK;
    763763
    764     PVDINTERFACEIO pSha1Callbacks = 0;
     764    PVDINTERFACEIO pRTSha1Callbacks = 0;
    765765    PVDINTERFACEIO pRTTarCallbacks = 0;
    766766    do
    767767    {
    768         pSha1Callbacks = Sha1CreateInterface();
    769         if (!pSha1Callbacks)
     768        pRTSha1Callbacks = RTSha1CreateInterface();
     769        if (!pRTSha1Callbacks)
    770770        {
    771771            rc = E_OUTOFMEMORY;
     
    779779        }
    780780        VDINTERFACE VDInterfaceIO;
    781         SHA1STORAGE storage;
     781        RTSHA1STORAGE storage;
    782782        RT_ZERO(storage);
    783783        vrc = VDInterfaceAdd(&VDInterfaceIO, "Appliance::IORTTar",
     
    789789            break;
    790790        }
    791         rc = readFSImpl(pTask, pSha1Callbacks, &storage);
     791        rc = readFSImpl(pTask, pRTSha1Callbacks, &storage);
    792792    }while(0);
    793793
     
    795795
    796796    /* Cleanup */
    797     if (pSha1Callbacks)
    798         RTMemFree(pSha1Callbacks);
     797    if (pRTSha1Callbacks)
     798        RTMemFree(pRTSha1Callbacks);
    799799    if (pRTTarCallbacks)
    800800        RTMemFree(pRTTarCallbacks);
     
    806806}
    807807
    808 HRESULT Appliance::readFSImpl(TaskOVF *pTask, PVDINTERFACEIO pCallbacks, PSHA1STORAGE pStorage)
     808HRESULT Appliance::readFSImpl(TaskOVF *pTask, PVDINTERFACEIO pCallbacks, PRTSHA1STORAGE pStorage)
    809809{
    810810    LogFlowFuncEnter();
     
    820820        /* Read the OVF into a memory buffer */
    821821        size_t cbSize = 0;
    822         int vrc = Sha1ReadBuf(strOvfFile.c_str(), &pvTmpBuf, &cbSize, pCallbacks, pStorage);
     822        int vrc = RTSha1ReadBuf(strOvfFile.c_str(), &pvTmpBuf, &cbSize, pCallbacks, pStorage);
    823823        if (RT_FAILURE(vrc))
    824824            throw setError(VBOX_E_FILE_ERROR,
     
    11121112    HRESULT rc = S_OK;
    11131113
    1114     PVDINTERFACEIO pSha1Callbacks = 0;
     1114    PVDINTERFACEIO pRTSha1Callbacks = 0;
    11151115    PVDINTERFACEIO pRTFileCallbacks = 0;
    11161116    void *pvMfBuf = 0;
     
    11191119    {
    11201120        /* Create the necessary file access interfaces. */
    1121         pSha1Callbacks = Sha1CreateInterface();
    1122         if (!pSha1Callbacks)
     1121        pRTSha1Callbacks = RTSha1CreateInterface();
     1122        if (!pRTSha1Callbacks)
    11231123            throw E_OUTOFMEMORY;
    11241124        pRTFileCallbacks = RTFileCreateInterface();
     
    11271127
    11281128        VDINTERFACE VDInterfaceIO;
    1129         SHA1STORAGE storage;
     1129        RTSHA1STORAGE storage;
    11301130        RT_ZERO(storage);
    11311131        storage.fCreateDigest = true;
     
    11431143        storage.fCreateDigest = RTFileExists(strMfFile.c_str());
    11441144        /* Now import the appliance. */
    1145         importMachines(stack, pSha1Callbacks, &storage);
     1145        importMachines(stack, pRTSha1Callbacks, &storage);
    11461146        /* Read & verify the manifest file, if there is one. */
    11471147        if (storage.fCreateDigest)
     
    11491149            /* Add the ovf file to the digest list. */
    11501150            stack.llSrcDisksDigest.push_front(STRPAIR(pTask->locInfo.strPath, m->strOVFSHA1Digest));
    1151             rc = readManifestFile(strMfFile, &pvMfBuf, &cbMfSize, pSha1Callbacks, &storage);
     1151            rc = readManifestFile(strMfFile, &pvMfBuf, &cbMfSize, pRTSha1Callbacks, &storage);
    11521152            if (FAILED(rc)) throw rc;
    11531153            rc = verifyManifestFile(strMfFile, stack, pvMfBuf, cbMfSize);
     
    11641164    if (pvMfBuf)
    11651165        RTMemFree(pvMfBuf);
    1166     if (pSha1Callbacks)
    1167         RTMemFree(pSha1Callbacks);
     1166    if (pRTSha1Callbacks)
     1167        RTMemFree(pRTSha1Callbacks);
    11681168    if (pRTFileCallbacks)
    11691169        RTMemFree(pRTFileCallbacks);
     
    11881188    HRESULT rc = S_OK;
    11891189
    1190     PVDINTERFACEIO pSha1Callbacks = 0;
     1190    PVDINTERFACEIO pRTSha1Callbacks = 0;
    11911191    PVDINTERFACEIO pRTTarCallbacks = 0;
    11921192    void *pvMfBuf = 0;
     
    11951195    {
    11961196        /* Create the necessary file access interfaces. */
    1197         pSha1Callbacks = Sha1CreateInterface();
    1198         if (!pSha1Callbacks)
     1197        pRTSha1Callbacks = RTSha1CreateInterface();
     1198        if (!pRTSha1Callbacks)
    11991199            throw E_OUTOFMEMORY;
    12001200        pRTTarCallbacks = RTTarCreateInterface();
     
    12031203
    12041204        VDINTERFACE VDInterfaceIO;
    1205         SHA1STORAGE storage;
     1205        RTSHA1STORAGE storage;
    12061206        RT_ZERO(storage);
    12071207        vrc = VDInterfaceAdd(&VDInterfaceIO, "Appliance::IORTTar",
     
    12171217            throw E_FAIL;
    12181218
    1219         PVDINTERFACEIO pCallbacks = pSha1Callbacks;
    1220         PSHA1STORAGE pStorage = &storage;
     1219        PVDINTERFACEIO pCallbacks = pRTSha1Callbacks;
     1220        PRTSHA1STORAGE pStorage = &storage;
    12211221
    12221222        /* We always need to create the digest, cause we didn't know if there
     
    12701270    if (pvMfBuf)
    12711271        RTMemFree(pvMfBuf);
    1272     if (pSha1Callbacks)
    1273         RTMemFree(pSha1Callbacks);
     1272    if (pRTSha1Callbacks)
     1273        RTMemFree(pRTSha1Callbacks);
    12741274    if (pRTTarCallbacks)
    12751275        RTMemFree(pRTTarCallbacks);
     
    14721472}
    14731473
    1474 HRESULT Appliance::readManifestFile(const Utf8Str &strFile, void **ppvBuf, size_t *pcbSize, PVDINTERFACEIO pCallbacks, PSHA1STORAGE pStorage)
     1474HRESULT Appliance::readManifestFile(const Utf8Str &strFile, void **ppvBuf, size_t *pcbSize, PVDINTERFACEIO pCallbacks, PRTSHA1STORAGE pStorage)
    14751475{
    14761476    HRESULT rc = S_OK;
     
    14781478    bool fOldDigest = pStorage->fCreateDigest;
    14791479    pStorage->fCreateDigest = false; /* No digest for the manifest file */
    1480     int vrc = Sha1ReadBuf(strFile.c_str(), ppvBuf, pcbSize, pCallbacks, pStorage);
     1480    int vrc = RTSha1ReadBuf(strFile.c_str(), ppvBuf, pcbSize, pCallbacks, pStorage);
    14811481    if (   RT_FAILURE(vrc)
    14821482        && vrc != VERR_FILE_NOT_FOUND)
     
    14891489}
    14901490
    1491 HRESULT Appliance::readTarManifestFile(RTTAR tar, const Utf8Str &strFile, void **ppvBuf, size_t *pcbSize, PVDINTERFACEIO pCallbacks, PSHA1STORAGE pStorage)
     1491HRESULT Appliance::readTarManifestFile(RTTAR tar, const Utf8Str &strFile, void **ppvBuf, size_t *pcbSize, PVDINTERFACEIO pCallbacks, PRTSHA1STORAGE pStorage)
    14921492{
    14931493    HRESULT rc = S_OK;
     
    16631663                                   ImportStack &stack,
    16641664                                   PVDINTERFACEIO pCallbacks,
    1665                                    PSHA1STORAGE pStorage)
     1665                                   PRTSHA1STORAGE pStorage)
    16661666{
    16671667    ComObjPtr<Progress> pProgress;
     
    18031803                                     ImportStack &stack,
    18041804                                     PVDINTERFACEIO pCallbacks,
    1805                                      PSHA1STORAGE pStorage)
     1805                                     PRTSHA1STORAGE pStorage)
    18061806{
    18071807    HRESULT rc;
     
    23552355                                  ImportStack &stack,
    23562356                                  PVDINTERFACEIO pCallbacks,
    2357                                   PSHA1STORAGE pStorage)
     2357                                  PRTSHA1STORAGE pStorage)
    23582358{
    23592359    Assert(vsdescThis->m->pConfig);
     
    25442544void Appliance::importMachines(ImportStack &stack,
    25452545                               PVDINTERFACEIO pCallbacks,
    2546                                PSHA1STORAGE pStorage)
     2546                               PRTSHA1STORAGE pStorage)
    25472547{
    25482548    HRESULT rc = S_OK;
  • trunk/src/VBox/Main/include/ApplianceImpl.h

    r33417 r33651  
    3535typedef struct VDINTERFACE   *PVDINTERFACE;
    3636typedef struct VDINTERFACEIO *PVDINTERFACEIO;
    37 typedef struct SHA1STORAGE   *PSHA1STORAGE;
     37typedef struct RTSHA1STORAGE *PRTSHA1STORAGE;
    3838
    3939namespace ovf
     
    152152    HRESULT readFSOVF(TaskOVF *pTask);
    153153    HRESULT readFSOVA(TaskOVF *pTask);
    154     HRESULT readFSImpl(TaskOVF *pTask, PVDINTERFACEIO pCallbacks, PSHA1STORAGE pStorage);
     154    HRESULT readFSImpl(TaskOVF *pTask, PVDINTERFACEIO pCallbacks, PRTSHA1STORAGE pStorage);
    155155    HRESULT readS3(TaskOVF *pTask);
    156156
     
    166166    HRESULT importS3(TaskOVF *pTask);
    167167
    168     HRESULT readManifestFile(const Utf8Str &strFile, void **ppvBuf, size_t *pcbSize, PVDINTERFACEIO pCallbacks, PSHA1STORAGE pStorage);
    169     HRESULT readTarManifestFile(RTTAR tar, const Utf8Str &strFile, void **ppvBuf, size_t *pcbSize, PVDINTERFACEIO pCallbacks, PSHA1STORAGE pStorage);
     168    HRESULT readManifestFile(const Utf8Str &strFile, void **ppvBuf, size_t *pcbSize, PVDINTERFACEIO pCallbacks, PRTSHA1STORAGE pStorage);
     169    HRESULT readTarManifestFile(RTTAR tar, const Utf8Str &strFile, void **ppvBuf, size_t *pcbSize, PVDINTERFACEIO pCallbacks, PRTSHA1STORAGE pStorage);
    170170    HRESULT verifyManifestFile(const Utf8Str &strFile, ImportStack &stack, void *pvBuf, size_t cbSize);
    171171
     
    181181                            ImportStack &stack,
    182182                            PVDINTERFACEIO pCallbacks,
    183                             PSHA1STORAGE pStorage);
     183                            PRTSHA1STORAGE pStorage);
    184184    void importMachineGeneric(const ovf::VirtualSystem &vsysThis,
    185185                              ComObjPtr<VirtualSystemDescription> &vsdescThis,
     
    187187                              ImportStack &stack,
    188188                              PVDINTERFACEIO pCallbacks,
    189                               PSHA1STORAGE pStorage);
     189                              PRTSHA1STORAGE pStorage);
    190190    void importVBoxMachine(ComObjPtr<VirtualSystemDescription> &vsdescThis,
    191191                           ComPtr<IMachine> &pNewMachine,
    192192                           ImportStack &stack,
    193193                           PVDINTERFACEIO pCallbacks,
    194                            PSHA1STORAGE pStorage);
     194                           PRTSHA1STORAGE pStorage);
    195195    void importMachines(ImportStack &stack,
    196196                        PVDINTERFACEIO pCallbacks,
    197                         PSHA1STORAGE pStorage);
     197                        PRTSHA1STORAGE pStorage);
    198198
    199199    /*******************************************************************************
     
    206206    HRESULT writeFSOVF(TaskOVF *pTask, AutoWriteLockBase& writeLock);
    207207    HRESULT writeFSOVA(TaskOVF *pTask, AutoWriteLockBase& writeLock);
    208     HRESULT writeFSImpl(TaskOVF *pTask, AutoWriteLockBase& writeLock, PVDINTERFACEIO pCallbacks, PSHA1STORAGE pStorage);
     208    HRESULT writeFSImpl(TaskOVF *pTask, AutoWriteLockBase& writeLock, PVDINTERFACEIO pCallbacks, PRTSHA1STORAGE pStorage);
    209209    HRESULT writeS3(TaskOVF *pTask);
    210210
  • trunk/src/VBox/Main/include/ApplianceImplPrivate.h

    r33417 r33651  
    221221ovf::CIMOSType_T convertVBoxOSType2CIMOSType(const char *pcszVbox);
    222222
    223 typedef struct SHA1STORAGE
     223typedef struct RTSHA1STORAGE
    224224{
    225225    PVDINTERFACE pVDImageIfaces;
    226226    bool         fCreateDigest;
    227227    Utf8Str      strDigest;
    228 } SHA1STORAGE, *PSHA1STORAGE;
    229 
    230 PVDINTERFACEIO Sha1CreateInterface();
     228} RTSHA1STORAGE, *PRTSHA1STORAGE;
     229
     230PVDINTERFACEIO RTSha1CreateInterface();
    231231PVDINTERFACEIO RTFileCreateInterface();
    232232PVDINTERFACEIO RTTarCreateInterface();
    233 int Sha1ReadBuf(const char *pcszFilename, void **ppvBuf, size_t *pcbSize, PVDINTERFACEIO pCallbacks, void *pvUser);
    234 int Sha1WriteBuf(const char *pcszFilename, void *pvBuf, size_t cbSize, PVDINTERFACEIO pCallbacks, void *pvUser);
     233int RTSha1ReadBuf(const char *pcszFilename, void **ppvBuf, size_t *pcbSize, PVDINTERFACEIO pCallbacks, void *pvUser);
     234int RTSha1WriteBuf(const char *pcszFilename, void *pvBuf, size_t cbSize, PVDINTERFACEIO pCallbacks, void *pvUser);
    235235
    236236#endif // ____H_APPLIANCEIMPLPRIVATE
Note: See TracChangeset for help on using the changeset viewer.

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