VirtualBox

Changeset 77832 in vbox for trunk/src/VBox/Runtime


Ignore:
Timestamp:
Mar 21, 2019 8:41:23 PM (6 years ago)
Author:
vboxsync
Message:

IPRT: Spealiced RTFileCopyPartEx and associated prep/cleanup functions for linux copy_file_range(). bugref:9172

Location:
trunk/src/VBox/Runtime
Files:
1 added
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Runtime/Makefile.kmk

    r77830 r77832  
    670670        generic/RTFileCopyByHandlesEx-generic.cpp \
    671671        generic/RTFileCopyPart-generic.cpp \
    672         generic/RTFileCopyPartEx-generic.cpp \
    673672        generic/RTFileQuerySize-generic.cpp \
    674673        generic/RTFileReadAll-generic.cpp \
     
    822821        generic/fileio-sg-generic.cpp \
    823822        generic/fileio-sg-at-generic.cpp \
     823        generic/RTFileCopyPartEx-generic.cpp \
    824824        generic/RTFileExists-generic.cpp \
    825825        generic/RTFileSetAllocationSize-generic.cpp \
     
    942942        r3/linux/time-linux.cpp \
    943943        r3/linux/thread-affinity-linux.cpp \
     944        r3/linux/RTFileCopyPartEx-linux.cpp \
    944945        r3/linux/RTFileSetAllocationSize-linux.cpp \
    945946        r3/linux/RTProcIsRunningByName-linux.cpp \
     
    10181019        generic/fileio-sg-generic.cpp \
    10191020        generic/fileio-sg-at-generic.cpp \
     1021        generic/RTFileCopyPartEx-generic.cpp \
    10201022        generic/RTFileMove-generic.cpp \
    10211023        generic/RTFileSetAllocationSize-generic.cpp \
     
    10991101        generic/RTDirQueryInfo-generic.cpp \
    11001102        generic/RTDirSetTimes-generic.cpp \
     1103        generic/RTFileCopyPartEx-generic.cpp \
    11011104        generic/RTFileMove-generic.cpp \
    11021105        generic/RTFileSetAllocationSize-generic.cpp \
     
    11841187        generic/RTDirQueryInfo-generic.cpp \
    11851188        generic/RTDirSetTimes-generic.cpp \
     1189        generic/RTFileCopyPartEx-generic.cpp \
    11861190        generic/RTFileMove-generic.cpp \
    11871191        generic/RTFileSetAllocationSize-generic.cpp \
     
    12671271        generic/RTDirQueryInfo-generic.cpp \
    12681272        generic/RTDirSetTimes-generic.cpp \
     1273        generic/RTFileCopyPartEx-generic.cpp \
    12691274        generic/RTFileMove-generic.cpp \
    12701275        generic/RTLogWriteDebugger-generic.cpp \
     
    13481353        generic/RTDirQueryInfo-generic.cpp \
    13491354        generic/RTDirSetTimes-generic.cpp \
     1355        generic/RTFileCopyPartEx-generic.cpp \
    13501356        generic/RTFileMove-generic.cpp \
    13511357        generic/RTLogWriteDebugger-generic.cpp \
     
    14431449        generic/fileio-sg-generic.cpp \
    14441450        generic/fileio-sg-at-generic.cpp \
     1451        generic/RTFileCopyPartEx-generic.cpp \
    14451452        generic/RTFileMove-generic.cpp \
    14461453        generic/RTFileSetAllocationSize-generic.cpp \
     
    17941801        generic/RTFileCopyEx-generic.cpp \
    17951802        generic/RTFileCopyByHandlesEx-generic.cpp \
    1796         generic/RTFileCopyPartEx-generic.cpp \
    17971803        generic/RTFileQuerySize-generic.cpp \
    17981804        generic/RTFileReadAll-generic.cpp \
     
    18351841RuntimeBldProg_SOURCES.darwin = $(filter-out \
    18361842        generic/cdrom-generic.cpp \
     1843        generic/RTFileCopyPartEx-generic.cpp \
    18371844        generic/RTFileMove-generic.cpp \
    18381845        generic/RTPathGetCurrentOnDrive-generic.cpp \
     
    18741881        generic/RTDirExists-generic.cpp \
    18751882        generic/RTDirSetTimes-generic.cpp \
     1883        generic/RTFileCopyPartEx-generic.cpp \
    18761884        generic/RTFileExists-generic.cpp \
    18771885        generic/RTFileSetAllocationSize-generic.cpp \
     
    19421950        generic/RTDirSetTimes-generic.cpp \
    19431951        generic/fileio-at-generic.cpp \
     1952        generic/RTFileCopyPartEx-generic.cpp \
    19441953        generic/RTFileMove-generic.cpp \
    19451954        generic/RTFileSetAllocationSize-generic.cpp \
  • trunk/src/VBox/Runtime/generic/RTFileCopyPartEx-generic.cpp

    r77830 r77832  
    3838
    3939
     40#ifndef IPRT_FALLBACK_VERSION
    4041RTDECL(int) RTFileCopyPartPrep(PRTFILECOPYPARTBUFSTATE pBufState, uint64_t cbToCopy)
     42#else
     43static int rtFileCopyPartPrepFallback(PRTFILECOPYPARTBUFSTATE pBufState, uint64_t cbToCopy)
     44#endif
    4145{
    4246    /*
     
    7175
    7276
     77#ifndef IPRT_FALLBACK_VERSION
    7378RTDECL(void) RTFileCopyPartCleanup(PRTFILECOPYPARTBUFSTATE pBufState)
     79#else
     80static void rtFileCopyPartCleanupFallback(PRTFILECOPYPARTBUFSTATE pBufState)
     81#endif
    7482{
    7583    AssertReturnVoid(pBufState->uMagic == RTFILECOPYPARTBUFSTATE_MAGIC);
     
    8492
    8593
     94#ifndef IPRT_FALLBACK_VERSION
    8695RTDECL(int) RTFileCopyPartEx(RTFILE hFileSrc, RTFOFF offSrc, RTFILE hFileDst, RTFOFF offDst, uint64_t cbToCopy,
    8796                             uint32_t fFlags, PRTFILECOPYPARTBUFSTATE pBufState, uint64_t *pcbCopied)
     97#else
     98static int rtFileCopyPartExFallback(RTFILE hFileSrc, RTFOFF offSrc, RTFILE hFileDst, RTFOFF offDst, uint64_t cbToCopy,
     99                                    uint32_t fFlags, PRTFILECOPYPARTBUFSTATE pBufState, uint64_t *pcbCopied)
     100#endif
    88101{
    89102    /*
     
    117130    do
    118131    {
    119         size_t cbThisCopy = (size_t)RT_MIN(cbToCopy, pBufState->cbBuf);
     132        size_t cbThisCopy = (size_t)RT_MIN(cbToCopy - cbCopied, pBufState->cbBuf);
    120133        size_t cbActual   = 0;
    121134        rc = RTFileReadAt(hFileSrc, offSrc + cbCopied, pBufState->pbBuf, cbThisCopy, &cbActual);
     
    141154    return rc;
    142155}
    143 RT_EXPORT_SYMBOL(RTFileCopyPartEx);
    144156
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