VirtualBox

Changeset 89264 in vbox for trunk/include


Ignore:
Timestamp:
May 25, 2021 11:09:36 AM (4 years ago)
Author:
vboxsync
Message:

Runtime/sg.h: Add copy variants which take a callback instead of a buffer to do the actual copying for single segments, bugref:4841

Location:
trunk/include/iprt
Files:
2 edited

Legend:

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

    r89149 r89264  
    20212021# define RTSgBufCopy                                    RT_MANGLER(RTSgBufCopy)
    20222022# define RTSgBufCopyFromBuf                             RT_MANGLER(RTSgBufCopyFromBuf)
     2023# define RTSgBufCopyFromFn                              RT_MANGLER(RTSgBufCopyFromFn)
    20232024# define RTSgBufCopyToBuf                               RT_MANGLER(RTSgBufCopyToBuf)
     2025# define RTSgBufCopyToFn                                RT_MANGLER(RTSgBufCopyToFn)
    20242026# define RTSgBufInit                                    RT_MANGLER(RTSgBufInit)
    20252027# define RTSgBufIsZero                                  RT_MANGLER(RTSgBufIsZero)
  • trunk/include/iprt/sg.h

    r82968 r89264  
    3838 * @{
    3939 */
     40
     41/** Pointer to a const S/G entry. */
     42typedef const struct RTSGBUF *PCRTSGBUF;
     43
     44/**
     45 * Callback for RTSgBufCopyToFn() called on every segment of the given S/G buffer.
     46 *
     47 * @returns Number of bytes copied for this segment, a value smaller than cbSrc will stop the copy operation.
     48 * @param   pSgBuf          The S/G buffer for reference.
     49 * @param   pvSrc           Where to copy from.
     50 * @param   cbSrc           The number of bytes in the source buffer.
     51 * @param   pvUser          Opaque user data passed in RTSgBufCopyToFn().
     52 */
     53typedef DECLCALLBACKTYPE(size_t, FNRTSGBUFCOPYTO, (PCRTSGBUF pSgBuf, const void *pvSrc, size_t cbSrc, void *pvUser));
     54/** Pointer to a FNRTSGBUFCOPYTO. */
     55typedef FNRTSGBUFCOPYTO *PFNRTSGBUFCOPYTO;
     56
     57/**
     58 * Callback for RTSgBufCopyFromFn() called on every segment of the given S/G buffer.
     59 *
     60 * @returns Number of bytes copied for this segment, a value smaller than cbDst will stop the copy operation.
     61 * @param   pSgBuf          The S/G buffer for reference.
     62 * @param   pvDst           Where to copy to.
     63 * @param   cbDst           The number of bytes in the destination buffer.
     64 * @param   pvUser          Opaque user data passed in RTSgBufCopyFromFn().
     65 */
     66typedef DECLCALLBACKTYPE(size_t, FNRTSGBUFCOPYFROM, (PCRTSGBUF pSgBuf, void *pvDst, size_t cbDst, void *pvUser));
     67/** Pointer to a FNRTSGBUFCOPYFROM. */
     68typedef FNRTSGBUFCOPYFROM *PFNRTSGBUFCOPYFROM;
    4069
    4170/**
     
    82111/** Pointer to a S/G entry. */
    83112typedef RTSGBUF *PRTSGBUF;
    84 /** Pointer to a const S/G entry. */
    85 typedef const RTSGBUF *PCRTSGBUF;
    86113/** Pointer to a S/G entry pointer. */
    87114typedef PRTSGBUF *PPRTSGBUF;
     
    302329 */
    303330RTDECL(size_t) RTSgBufCopyFromBuf(PRTSGBUF pSgBuf, const void *pvBuf, size_t cbCopy);
     331
     332/**
     333 * Copies data from the given S/G buffer to a destination handled by the given callback.
     334 *
     335 * @returns Number of bytes copied.
     336 * @param   pSgBuf       The S/G buffer to copy from.
     337 * @param   cbCopy       How many bytes to copy.
     338 * @param   pfnCopyTo    The callback to call on every S/G buffer segment until the operation finished.
     339 * @param   pvUser       Opaque user data to pass in the given callback.
     340 *
     341 * @note This operation advances the internal buffer pointer of the S/G buffer.
     342 */
     343RTDECL(size_t) RTSgBufCopyToFn(PRTSGBUF pSgBuf, size_t cbCopy, PFNRTSGBUFCOPYTO pfnCopyTo, void *pvUser);
     344
     345/**
     346 * Copies data to the given S/G buffer from a destination handled by the given callback.
     347 *
     348 * @returns Number of bytes copied.
     349 * @param   pSgBuf       The S/G buffer to copy to.
     350 * @param   cbCopy       How many bytes to copy.
     351 * @param   pfnCopyFrom  The callback to call on every S/G buffer segment until the operation finished.
     352 * @param   pvUser       Opaque user data to pass in the given callback.
     353 *
     354 * @note This operation advances the internal buffer pointer of the S/G buffer.
     355 */
     356RTDECL(size_t) RTSgBufCopyFromFn(PRTSGBUF pSgBuf, size_t cbCopy, PFNRTSGBUFCOPYFROM pfnCopyFrom, void *pvUser);
    304357
    305358/**
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