VirtualBox

Changeset 67221 in vbox for trunk


Ignore:
Timestamp:
Jun 1, 2017 9:44:24 PM (7 years ago)
Author:
vboxsync
Message:

IPRT: Adding RTVfsIoStrmGetOpenFlags, RTVfsFileGetOpenFlags, RTVfsCreateProcessForIoStream and RTVfsCreateProcessForFile.

Location:
trunk
Files:
1 added
4 edited

Legend:

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

    r67186 r67221  
    23522352# define RTVfsIoStrmFromRTPipe                          RT_MANGLER(RTVfsIoStrmFromRTPipe)
    23532353# define RTVfsIoStrmFromStdHandle                       RT_MANGLER(RTVfsIoStrmFromStdHandle)
     2354# define RTVfsIoStrmGetOpenFlags                        RT_MANGLER(RTVfsIoStrmGetOpenFlags)
    23542355# define RTVfsIoStrmIsAtEnd                             RT_MANGLER(RTVfsIoStrmIsAtEnd)
    23552356# define RTVfsIoStrmOpenNormal                          RT_MANGLER(RTVfsIoStrmOpenNormal)
     
    24252426# define RTVfsUtilDummyPollOne                          RT_MANGLER(RTVfsUtilDummyPollOne)
    24262427# define RTVfsUtilPumpIoStreams                         RT_MANGLER(RTVfsUtilPumpIoStreams)
     2428# define RTVfsCreateProcessForFile                      RT_MANGLER(RTVfsCreateProcessForFile)
     2429# define RTVfsCreateProcessForIoStream                  RT_MANGLER(RTVfsCreateProcessForIoStream)
    24272430# define RTVfsCreateReadAheadForFile                    RT_MANGLER(RTVfsCreateReadAheadForFile)
    24282431# define RTVfsCreateReadAheadForIoStream                RT_MANGLER(RTVfsCreateReadAheadForIoStream)
  • trunk/include/iprt/vfs.h

    r67186 r67221  
    946946
    947947/**
     948 * Get the RTFILE_O_XXX flags for the I/O stream.
     949 *
     950 * @returns RTFILE_O_XXX, 0 on failure.
     951 * @param   hVfsIos         The VFS I/O stream handle.
     952 */
     953RTDECL(uint64_t)    RTVfsIoStrmGetOpenFlags(RTVFSIOSTREAM hVfsIos);
     954
     955/**
    948956 * Process the rest of the stream, checking if it's all valid UTF-8 encoding.
    949957 *
     
    11911199RTDECL(RTFOFF)      RTVfsFileGetMaxSize(RTVFSFILE hVfsFile);
    11921200RTDECL(int)         RTVfsFileGetMaxSizeEx(RTVFSFILE hVfsFile, PRTFOFF pcbMax);
     1201
     1202/**
     1203 * Get the RTFILE_O_XXX flags for the I/O stream.
     1204 *
     1205 * @returns RTFILE_O_XXX, 0 on failure.
     1206 * @param   hVfsIos         The VFS I/O stream handle.
     1207 */
     1208RTDECL(uint64_t)    RTVfsFileGetOpenFlags(RTVFSFILE hVfsFile);
    11931209
    11941210/** @} */
     
    12891305RTDECL(int) RTVfsUtilPumpIoStreams(RTVFSIOSTREAM hVfsIosSrc, RTVFSIOSTREAM hVfsIosDst, size_t cbBufHint);
    12901306
     1307
     1308/**
     1309 * Creates a progress wrapper for an I/O stream.
     1310 *
     1311 * @returns IRPT status code.
     1312 * @param   hVfsIos             The I/O stream to wrap.
     1313 * @param   pfnProgress         The progress callback.  The return code is
     1314 *                              ignored!
     1315 * @param   pvUser              The user argument to @a pfnProgress.
     1316 * @param   fFlags              RTVFSPROGRESS_F_XXX
     1317 * @param   cbExpectedRead      The expected number of bytes read.
     1318 * @param   cbExpectedWritten   The execpted number of bytes written.
     1319 * @param   phVfsIos            Where to return the I/O stream handle.
     1320 *
     1321 * @remarks Again, the return code from @a pfnProgress is ignored.  Cancellation
     1322 *          is not supported.
     1323 */
     1324RTDECL(int) RTVfsCreateProcessForIoStream(RTVFSIOSTREAM hVfsIos, PFNRTPROGRESS pfnProgress, void *pvUser, uint32_t fFlags,
     1325                                          uint64_t cbExpectedRead, uint64_t cbExpectedWritten, PRTVFSIOSTREAM phVfsIos);
     1326
     1327/**
     1328 * Creates a progress wrapper for a file stream.
     1329 *
     1330 * @returns IRPT status code.
     1331 * @param   hVfsFile            The file to wrap.
     1332 * @param   pfnProgress         The progress callback.  The return code is
     1333 *                              ignored!
     1334 * @param   pvUser              The user argument to @a pfnProgress.
     1335 * @param   fFlags              RTVFSPROGRESS_F_XXX
     1336 * @param   cbExpectedRead      The expected number of bytes read.
     1337 * @param   cbExpectedWritten   The execpted number of bytes written.
     1338 * @param   phVfsFile           Where to return the file handle.
     1339 *
     1340 * @remarks Again, the return code from @a pfnProgress is ignored.  Cancellation
     1341 *          is not supported.
     1342 */
     1343RTDECL(int) RTVfsCreateProcessForFile(RTVFSFILE hVfsFile, PFNRTPROGRESS pfnProgress, void *pvUser, uint32_t fFlags,
     1344                                      uint64_t cbExpectedRead, uint64_t cbExpectedWritten, PRTVFSFILE phVfsFile);
     1345
     1346/** @name RTVFSPROGRESS_F_XXX - Flags for RTVfsCreateProcessForIoStream and
     1347 *        RTVfsCreateProcessForFile.
     1348 * @{ */
     1349/** Account forward seeks as reads. */
     1350#define RTVFSPROGRESS_F_FORWARD_SEEK_AS_READ    RT_BIT_32(0)
     1351/** Account fprward seeks as writes. */
     1352#define RTVFSPROGRESS_F_FORWARD_SEEK_AS_WRITE   RT_BIT_32(1)
     1353/** Valid bits.   */
     1354#define RTVFSPROGRESS_F_VALID_MASK              UINT32_C(0x00000003)
     1355/** @} */
     1356
     1357
    12911358/**
    12921359 * Create an I/O stream instance performing simple sequential read-ahead.
  • trunk/src/VBox/Runtime/Makefile.kmk

    r67186 r67221  
    613613        common/vfs/vfsmisc.cpp \
    614614        common/vfs/vfsmsg.cpp \
     615        common/vfs/vfsprogress.cpp \
    615616        common/vfs/vfsreadahead.cpp \
    616617        common/vfs/vfsstdfile.cpp \
  • trunk/src/VBox/Runtime/common/vfs/vfsbase.cpp

    r67189 r67221  
    30843084
    30853085
     3086RTDECL(uint64_t) RTVfsIoStrmGetOpenFlags(RTVFSIOSTREAM hVfsIos)
     3087{
     3088    RTVFSIOSTREAMINTERNAL *pThis = hVfsIos;
     3089    AssertPtrReturn(pThis, 0);
     3090    AssertReturn(pThis->uMagic == RTVFSIOSTREAM_MAGIC, 0);
     3091    return pThis->fFlags;
     3092}
    30863093
    30873094
     
    34053412    return rc;
    34063413}
     3414
     3415
     3416RTDECL(uint64_t) RTVfsFileGetOpenFlags(RTVFSFILE hVfsFile)
     3417{
     3418    RTVFSFILEINTERNAL *pThis = hVfsFile;
     3419    AssertPtrReturn(pThis, 0);
     3420    AssertReturn(pThis->uMagic == RTVFSFILE_MAGIC, 0);
     3421    return pThis->Stream.fFlags;
     3422}
     3423
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