VirtualBox

Changeset 33822 in vbox for trunk/include


Ignore:
Timestamp:
Nov 7, 2010 8:25:30 PM (15 years ago)
Author:
vboxsync
svn:sync-xref-src-repo-rev:
67467
Message:

iprt/vfs: I/O stream code.

Location:
trunk/include/iprt
Files:
2 edited

Legend:

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

    r33820 r33822  
    4040/** @defgroup grp_rt_fs    RTVfs - Virtual Filesystem
    4141 * @ingroup grp_rt
     42 *
     43 * The virtual filesystem APIs are intended to make it possible to work on
     44 * container files, file system sub-trees, file system overlays and other custom
     45 * filesystem configurations.  It also makes it possible to create filters, like
     46 * automatically gunzipping a tar.gz file before feeding it to the RTTar API for
     47 * unpacking - or wise versa.
     48 *
     49 * The virtual filesystem APIs are intended to mirror the RTDir, RTFile, RTPath
     50 * and RTFs APIs pretty closely so that rewriting a piece of code to work with
     51 * it should be easy.  However there are some differences to the way the APIs
     52 * works and the user should heed the documentation.  The differences are
     53 * usually motivated by simplification and in some case to make the VFS more
     54 * flexible.
     55 *
    4256 * @{
    4357 */
     
    115129 * @{
    116130 */
     131
     132/**
     133 * Retains a reference to the VFS I/O stream handle.
     134 *
     135 * @returns New reference count on success, UINT32_MAX on failure.
     136 * @param   hVfsIos         The VFS I/O stream handle.
     137 */
    117138RTDECL(uint32_t)    RTVfsIoStrmRetain(RTVFSIOSTREAM hVfsIos);
     139
     140/**
     141 * Releases a reference to the VFS I/O stream handle.
     142 *
     143 * @returns New reference count on success (0 if closed), UINT32_MAX on failure.
     144 * @param   hVfsIos         The VFS I/O stream handle.
     145 */
    118146RTDECL(uint32_t)    RTVfsIoStrmRelease(RTVFSIOSTREAM hVfsIos);
     147
     148/**
     149 * Convert the VFS I/O stream handle to a VFS file handle.
     150 *
     151 * @returns The VFS file handle on success, this must be released.
     152 *          NIL_RTVFSFILE if the I/O stream handle is invalid.
     153 * @param   hVfsIos         The VFS I/O stream handle.
     154 * @sa      RTVfsFileToIoStream
     155 */
    119156RTDECL(RTVFSFILE)   RTVfsIoStrmToFile(RTVFSIOSTREAM hVfsIos);
     157
     158/**
     159 * Query information about the I/O stream.
     160 *
     161 * @returns IPRT status code.
     162 * @param   hVfsIos         The VFS I/O stream handle.
     163 * @param   pObjInfo        Where to return the info.
     164 * @param   enmAddAttr      Which additional attributes should be retrieved.
     165 * @sa      RTFileQueryInfo
     166 */
    120167RTDECL(int)         RTVfsIoStrmQueryInfo(RTVFSIOSTREAM hVfsIos, PRTFSOBJINFO pObjInfo, RTFSOBJATTRADD enmAddAttr);
     168
     169/**
     170 * Read bytes from the I/O stream.
     171 *
     172 * @returns IPRT status code.
     173 * @param   hVfsIos         The VFS I/O stream handle.
     174 * @param   pvBuf           Where to store the read bytes.
     175 * @param   cbToRead        The number of bytes to read.
     176 * @param   pcbRead         Where to store the number of bytes actually read.
     177 *                          If this is NULL, the call will block until @a
     178 *                          cbToRead bytes are available.  If this is non-NULL,
     179 *                          the call will not block and return what is currently
     180 *                          avaiable.
     181 * @sa      RTFileRead, RTPipeRead, RTPipeReadBlocking, RTSocketRead
     182 */
    121183RTDECL(int)         RTVfsIoStrmRead(RTVFSIOSTREAM hVfsIos, void *pvBuf, size_t cbToRead, size_t *pcbRead);
     184
     185/**
     186 * Write bytes to the I/O stream.
     187 *
     188 * @returns IPRT status code.
     189 * @param   hVfsIos         The VFS I/O stream handle.
     190 * @param   pvBuf           The bytes to write.
     191 * @param   cbToWrite       The number of bytes to write.
     192 * @param   pcbWritten      Where to store the number of bytes actually written.
     193 *                          If this is NULL, the call will block until @a
     194 *                          cbToWrite bytes are available.  If this is non-NULL,
     195 *                          the call will not block and return after writing
     196 *                          what is possible.
     197 * @sa      RTFileWrite, RTPipeWrite, RTPipeWriteBlocking, RTSocketWrite
     198 */
    122199RTDECL(int)         RTVfsIoStrmWrite(RTVFSIOSTREAM hVfsIos, const void *pvBuf, size_t cbToWrite, size_t *pcbWritten);
    123 RTDECL(int)         RTVfsIoStrmSgRead(RTVFSIOSTREAM hVfsIos, PCRTSGBUF pSgBuf, size_t *pcbRead);
    124 RTDECL(int)         RTVfsIoStrmSgWrite(RTVFSIOSTREAM hVfsIos, PCRTSGBUF pSgBuf, size_t *pcbWritten);
     200
     201/**
     202 * Reads bytes from the I/O stream into a scatter buffer.
     203 *
     204 * @returns IPRT status code.
     205 * @param   hVfsIos         The VFS I/O stream handle.
     206 * @param   pSgBuf          Pointer to a scatter buffer descriptor.  The number
     207 *                          of bytes described by the segments is what will be
     208 *                          attemted read.
     209 * @param   fBlocking       Whether the call is blocking (@c true) or not.  If
     210 *                          not, the @a pcbRead parameter must not be NULL.
     211 * @param   pcbRead         Where to store the number of bytes actually read.
     212 *                          This can be NULL if @a fBlocking is true.
     213 * @sa      RTFileSgRead, RTSocketSgRead
     214 */
     215RTDECL(int)         RTVfsIoStrmSgRead(RTVFSIOSTREAM hVfsIos, PCRTSGBUF pSgBuf, bool fBlocking, size_t *pcbRead);
     216
     217/**
     218 * Write bytes to the I/O stream from a gather buffer.
     219 *
     220 * @returns IPRT status code.
     221 * @param   hVfsIos         The VFS I/O stream handle.
     222 * @param   pSgBuf          Pointer to a gather buffer descriptor.  The number
     223 *                          of bytes described by the segments is what will be
     224 *                          attemted written.
     225 * @param   fBlocking       Whether the call is blocking (@c true) or not.  If
     226 *                          not, the @a pcbWritten parameter must not be NULL.
     227 * @param   pcbRead         Where to store the number of bytes actually written.
     228 *                          This can be NULL if @a fBlocking is true.
     229 * @sa      RTFileSgWrite, RTSocketSgWrite
     230 */
     231RTDECL(int)         RTVfsIoStrmSgWrite(RTVFSIOSTREAM hVfsIos, PCRTSGBUF pSgBuf, bool fBlocking, size_t *pcbWritten);
     232
     233/**
     234 * Flush any buffered data to the I/O stream.
     235 *
     236 * @returns IPRT status code.
     237 * @param   hVfsIos         The VFS I/O stream handle.
     238 * @sa      RTFileFlush, RTPipeFlush
     239 */
    125240RTDECL(int)         RTVfsIoStrmFlush(RTVFSIOSTREAM hVfsIos);
     241
     242/**
     243 * Poll for events.
     244 *
     245 * @returns IPRT status code.
     246 * @param   hVfsIos         The VFS I/O stream handle.
     247 * @param   fEvents         The events to poll for (RTPOLL_EVT_XXX).
     248 * @param   cMillies        How long to wait for event to eventuate.
     249 * @param   fIntr           Whether the wait is interruptible and can return
     250 *                          VERR_INTERRUPTED (@c true) or if this condition
     251 *                          should be hidden from the caller (@c false).
     252 * @param   pfRetEvents     Where to return the event mask.
     253 * @sa      RTPollSetAdd, RTPoll, RTPollNoResume.
     254 */
    126255RTDECL(RTFOFF)      RTVfsIoStrmPoll(RTVFSIOSTREAM hVfsIos, uint32_t fEvents, RTMSINTERVAL cMillies, bool fIntr,
    127256                                    uint32_t *pfRetEvents);
     257/**
     258 * Tells the current I/O stream position.
     259 *
     260 * @returns Zero or higher - where to return the I/O stream offset.  Values
     261 *          below zero are IPRT status codes (VERR_XXX).
     262 * @param   hVfsIos         The VFS I/O stream handle.
     263 * @sa      RTFileTell
     264 */
    128265RTDECL(RTFOFF)      RTVfsIoStrmTell(RTVFSIOSTREAM hVfsIos);
    129266/** @} */
     
    155292 *          NIL_RTVFSIOSTREAM if the file handle is invalid.
    156293 * @param   hVfsFile        The VFS file handle.
     294 * @sa      RTVfsIoStrmToFile
    157295 */
    158296RTDECL(RTVFSIOSTREAM) RTVfsFileToIoStream(RTVFSFILE hVfsFile);
  • trunk/include/iprt/vfslowlevel.h

    r33820 r33822  
    428428     * @param   pvThis      The implementation specific file data.
    429429     * @param   poffActual  Where to return the actual offset.
    430      * @sa      RTFileSeek
     430     * @sa      RTFileTell
    431431     */
    432432    DECLCALLBACKMEMBER(int, pfnTell)(void *pvThis, PRTFOFF poffActual);
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