VirtualBox

Ignore:
Timestamp:
Feb 10, 2016 12:47:33 AM (9 years ago)
Author:
vboxsync
svn:sync-xref-src-repo-rev:
105459
Message:

IPRT: Added 'off' parameter to RTVfsIoStrmSgWrite and RTVfsIoStrmSgRead so it's easier to write passthru layers. Added RTVfsIoStrmReadAll, RTVfsIoStrmReadAllFree, RTVfsIoStrmFromBuffer, RTManifestPtIosIsInstanceOf, RTCrX509Certificate_ReadFromBuffer and RTCrDigestUpdateFromVfsFile. Updated the manifest passthru read code to handle ReadAt requests which skips parts and jumps back to re-read stuff on streams/files which are seekable.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Runtime/common/vfs/vfsbase.cpp

    r57358 r59620  
    21352135
    21362136
    2137 RTDECL(int) RTVfsIoStrmSgRead(RTVFSIOSTREAM hVfsIos, PCRTSGBUF pSgBuf, bool fBlocking, size_t *pcbRead)
     2137RTDECL(int) RTVfsIoStrmSgRead(RTVFSIOSTREAM hVfsIos, RTFOFF off, PCRTSGBUF pSgBuf, bool fBlocking, size_t *pcbRead)
    21382138{
    21392139    AssertPtrNullReturn(pcbRead, VERR_INVALID_POINTER);
     
    21502150    int rc;
    21512151    if (!(pThis->pOps->fFeatures & RTVFSIOSTREAMOPS_FEAT_NO_SG))
    2152         rc = pThis->pOps->pfnRead(pThis->Base.pvThis, -1 /*off*/, pSgBuf, fBlocking, pcbRead);
     2152        rc = pThis->pOps->pfnRead(pThis->Base.pvThis, off, pSgBuf, fBlocking, pcbRead);
    21532153    else
    21542154    {
     
    21622162
    21632163            size_t cbReadSeg = pcbRead ? 0 : pSgBuf->paSegs[iSeg].cbSeg;
    2164             rc = pThis->pOps->pfnRead(pThis->Base.pvThis, -1 /*off*/, &SgBuf, fBlocking, pcbRead ? &cbReadSeg : NULL);
     2164            rc = pThis->pOps->pfnRead(pThis->Base.pvThis, off, &SgBuf, fBlocking, pcbRead ? &cbReadSeg : NULL);
    21652165            if (RT_FAILURE(rc))
    21662166                break;
     
    21682168            if ((pcbRead && cbReadSeg != SgBuf.paSegs[0].cbSeg) || rc != VINF_SUCCESS)
    21692169                break;
     2170            if (off != -1)
     2171                off += cbReadSeg;
    21702172        }
    21712173
     
    21782180
    21792181
    2180 RTDECL(int) RTVfsIoStrmSgWrite(RTVFSIOSTREAM hVfsIos, PCRTSGBUF pSgBuf, bool fBlocking, size_t *pcbWritten)
     2182RTDECL(int) RTVfsIoStrmSgWrite(RTVFSIOSTREAM hVfsIos, RTFOFF off, PCRTSGBUF pSgBuf, bool fBlocking, size_t *pcbWritten)
    21812183{
    21822184    AssertPtrNullReturn(pcbWritten, VERR_INVALID_POINTER);
     
    21932195    int rc;
    21942196    if (!(pThis->pOps->fFeatures & RTVFSIOSTREAMOPS_FEAT_NO_SG))
    2195         rc = pThis->pOps->pfnWrite(pThis->Base.pvThis, -1 /*off*/, pSgBuf, fBlocking, pcbWritten);
     2197        rc = pThis->pOps->pfnWrite(pThis->Base.pvThis, off, pSgBuf, fBlocking, pcbWritten);
    21962198    else
    21972199    {
     
    22052207
    22062208            size_t cbWrittenSeg = 0;
    2207             rc = pThis->pOps->pfnWrite(pThis->Base.pvThis, -1 /*off*/, &SgBuf, fBlocking, pcbWritten ? &cbWrittenSeg : NULL);
     2209            rc = pThis->pOps->pfnWrite(pThis->Base.pvThis, off, &SgBuf, fBlocking, pcbWritten ? &cbWrittenSeg : NULL);
    22082210            if (RT_FAILURE(rc))
    22092211                break;
     
    22132215                if (cbWrittenSeg != SgBuf.paSegs[0].cbSeg)
    22142216                    break;
     2217                if (off != -1)
     2218                    off += cbWrittenSeg;
    22152219            }
     2220            else if (off != -1)
     2221                off += pSgBuf->paSegs[iSeg].cbSeg;
    22162222        }
    22172223
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