VirtualBox

Changeset 67180 in vbox


Ignore:
Timestamp:
May 31, 2017 7:39:10 PM (8 years ago)
Author:
vboxsync
svn:sync-xref-src-repo-rev:
115857
Message:

IPRT: Added RTVfsMemIoStrmCreate for convenience.

Location:
trunk
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/include/iprt/mangling.h

    r67166 r67180  
    23762376# define RTVfsLockRetainDebug                           RT_MANGLER(RTVfsLockRetainDebug)
    23772377# define RTVfsMemFileCreate                             RT_MANGLER(RTVfsMemFileCreate)
     2378# define RTVfsMemIoStrmCreate                           RT_MANGLER(RTVfsMemIoStrmCreate)
    23782379# define RTVfsMemorizeIoStreamAsFile                    RT_MANGLER(RTVfsMemorizeIoStreamAsFile)
    23792380# define RTVfsNew                                       RT_MANGLER(RTVfsNew)
  • trunk/include/iprt/vfs.h

    r67149 r67180  
    12161216RTDECL(int) RTVfsMemorizeIoStreamAsFile(RTVFSIOSTREAM hVfsIos, uint32_t fFlags, PRTVFSFILE phVfsFile);
    12171217
    1218 
    12191218/**
    12201219 * Creates a VFS file from a memory buffer.
     
    12421241 * @param   phVfsFile       Where to return the handle to the memory file on
    12431242 *                          success.
     1243 * @sa      RTVfsMemIoStrmCreate
    12441244 */
    12451245RTDECL(int) RTVfsMemFileCreate(RTVFSIOSTREAM hVfsIos, size_t cbEstimate, PRTVFSFILE phVfsFile);
     1246
     1247/**
     1248 * Creates a memory backed VFS file object for read and write.
     1249 *
     1250 * @returns IPRT status code.
     1251 *
     1252 * @param   hVfsIos         The VFS I/O stream to memorize.  This will be read
     1253 *                          to the end on success, on failure its position is
     1254 *                          undefined.
     1255 * @param   cbEstimate      The estimated file size.
     1256 * @param   phVfsIos        Where to return the handle to the memory I/O stream
     1257 *                          on success.
     1258 * @sa      RTVfsMemFileCreate
     1259 */
     1260RTDECL(int) RTVfsMemIoStrmCreate(RTVFSIOSTREAM hVfsIos, size_t cbEstimate, PRTVFSIOSTREAM phVfsIos);
    12461261
    12471262/**
  • trunk/src/VBox/Runtime/common/vfs/vfsmemory.cpp

    r62561 r67180  
    817817
    818818
     819RTDECL(int) RTVfsMemIoStrmCreate(RTVFSIOSTREAM hVfsIos, size_t cbEstimate, PRTVFSIOSTREAM phVfsIos)
     820{
     821    RTVFSFILE hVfsFile;
     822    int rc = RTVfsMemFileCreate(hVfsIos, cbEstimate, &hVfsFile);
     823    if (RT_SUCCESS(rc))
     824    {
     825        *phVfsIos = RTVfsFileToIoStream(hVfsFile);
     826        AssertStmt(*phVfsIos != NIL_RTVFSIOSTREAM, rc = VERR_INTERNAL_ERROR_2);
     827        RTVfsFileRelease(hVfsFile);
     828    }
     829    return rc;
     830}
     831
     832
    819833RTDECL(int) RTVfsFileFromBuffer(uint32_t fFlags, void const *pvBuf, size_t cbBuf, PRTVFSFILE phVfsFile)
    820834{
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