VirtualBox

Changeset 71817 in vbox for trunk/src/VBox/Main/include


Ignore:
Timestamp:
Apr 11, 2018 10:48:34 AM (7 years ago)
Author:
vboxsync
Message:

Guest Control/Main: Derived the copyTo/copyFrom tasks from a new base class GuestSessionCopyTask and also support copying entire directories (instead of just copying their contents).

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Main/include/GuestSessionImplTasks.h

    r71796 r71817  
    7979    /** @name File handling primitives.
    8080     * @{ */
    81     int fileCopyFromEx(ComObjPtr<GuestFile> &srcFile, PRTFILE phDstFile, FileCopyFlag_T enmFileCopyFlags,
    82                        uint64_t cbOffset, uint64_t cbSize);
    83     int fileCopyFrom(const Utf8Str &strSource, const Utf8Str &strDest, FileCopyFlag_T enmFileCopyFlags);
    84     int fileCopyToEx(const Utf8Str &strSource, const Utf8Str &strDest, FileCopyFlag_T enmFileCopyFlags, PRTFILE pFile,
    85                      uint64_t cbOffset, uint64_t cbSize); /**< r=bird: 'cbOffset' makes no sense what so ever. It should be 'off', or do you mean sizeof(uint64_t)? */
    86     int fileCopyTo(const Utf8Str &strSource, const Utf8Str &strDest, FileCopyFlag_T enmFileCopyFlags);
     81    int fileCopyFromGuestInner(ComObjPtr<GuestFile> &srcFile, PRTFILE phDstFile, FileCopyFlag_T fFileCopyFlags,
     82                               uint64_t offCopy, uint64_t cbSize);
     83    int fileCopyFromGuest(const Utf8Str &strSource, const Utf8Str &strDest, FileCopyFlag_T fFileCopyFlags);
     84    int fileCopyToGuestInner(PRTFILE phSrcFile, ComObjPtr<GuestFile> &dstFile, FileCopyFlag_T fFileCopyFlags,
     85                             uint64_t offCopy, uint64_t cbSize);
     86    int fileCopyToGuest(const Utf8Str &strSource, const Utf8Str &strDest, FileCopyFlag_T fFileCopyFlags);
    8787    /** @}  */
    8888
     
    139139};
    140140
     141class GuestSessionCopyTask : public GuestSessionTask
     142{
     143public:
     144
     145    GuestSessionCopyTask(GuestSession *pSession)
     146        : GuestSessionTask(pSession) { RT_ZERO(u); }
     147
     148    virtual ~GuestSessionCopyTask() { }
     149
     150protected:
     151
     152    Utf8Str mSource;
     153    Utf8Str mDest;
     154    Utf8Str mFilter;
     155
     156    union
     157    {
     158        struct
     159        {
     160            DirectoryCopyFlag_T fCopyFlags;
     161        } Dir;
     162        struct
     163        {
     164            FileCopyFlag_T      fCopyFlags;
     165            PRTFILE             phFile;
     166            size_t              offStart;
     167            uint64_t            cbSize;
     168        } File;
     169    } u;
     170};
     171
    141172/**
    142173 * Task for copying directories from guest to the host.
    143174 */
    144 class SessionTaskCopyDirFrom : public GuestSessionTask
     175class SessionTaskCopyDirFrom : public GuestSessionCopyTask
    145176{
    146177public:
    147178
    148179    SessionTaskCopyDirFrom(GuestSession *pSession, const Utf8Str &strSource, const Utf8Str &strDest, const Utf8Str &strFilter,
    149                            DirectoryCopyFlag_T enmDirCopyFlags);
     180                           DirectoryCopyFlag_T fDirCopyFlags);
    150181    virtual ~SessionTaskCopyDirFrom(void);
    151182    int Run(void);
     
    155186    int directoryCopyToHost(const Utf8Str &strSource, const Utf8Str &strFilter, const Utf8Str &strDest, bool fRecursive,
    156187                            bool fFollowSymlinks, const Utf8Str &strSubDir /* For recursion. */);
    157 protected:
    158 
    159     Utf8Str             mSource;
    160     Utf8Str             mDest;
    161     Utf8Str             mFilter;
    162     DirectoryCopyFlag_T mDirCopyFlags;
    163188};
    164189
     
    166191 * Task for copying directories from host to the guest.
    167192 */
    168 class SessionTaskCopyDirTo : public GuestSessionTask
     193class SessionTaskCopyDirTo : public GuestSessionCopyTask
    169194{
    170195public:
    171196
    172197    SessionTaskCopyDirTo(GuestSession *pSession, const Utf8Str &strSource, const Utf8Str &strDest, const Utf8Str &strFilter,
    173                          DirectoryCopyFlag_T enmDirCopyFlags);
     198                         DirectoryCopyFlag_T fDirCopyFlags);
    174199    virtual ~SessionTaskCopyDirTo(void);
    175200    int Run(void);
     
    179204    int directoryCopyToGuest(const Utf8Str &strSource, const Utf8Str &strFilter, const Utf8Str &strDest, bool fRecursive,
    180205                             bool fFollowSymlinks, const Utf8Str &strSubDir /* For recursion. */);
    181 protected:
    182 
    183     Utf8Str             mSource;
    184     Utf8Str             mDest;
    185     Utf8Str             mFilter;
    186     DirectoryCopyFlag_T mDirCopyFlags;
    187206};
    188207
     
    190209 * Task for copying files from host to the guest.
    191210 */
    192 class SessionTaskCopyFileTo : public GuestSessionTask
     211class SessionTaskCopyFileTo : public GuestSessionCopyTask
    193212{
    194213public:
    195214
    196215    SessionTaskCopyFileTo(GuestSession *pSession,
    197                           const Utf8Str &strSource, const Utf8Str &strDest, FileCopyFlag_T enmFileCopyFlags);
    198     SessionTaskCopyFileTo(GuestSession *pSession,
    199                           PRTFILE pSourceFile, size_t cbSourceOffset, uint64_t cbSourceSize,
    200                           const Utf8Str &strDest, FileCopyFlag_T enmFileCopyFlags);
     216                          const Utf8Str &strSource, const Utf8Str &strDest, FileCopyFlag_T fFileCopyFlags);
    201217    virtual ~SessionTaskCopyFileTo(void);
    202218    int Run(void);
    203 
    204 protected:
    205 
    206     Utf8Str        mSource;
    207     PRTFILE        mSourceFile;
    208     size_t         mSourceOffset;
    209     uint64_t       mSourceSize;
    210     Utf8Str        mDest;
    211     FileCopyFlag_T mFileCopyFlags;
    212219};
    213220
     
    215222 * Task for copying files from guest to the host.
    216223 */
    217 class SessionTaskCopyFileFrom : public GuestSessionTask
     224class SessionTaskCopyFileFrom : public GuestSessionCopyTask
    218225{
    219226public:
    220227
    221228    SessionTaskCopyFileFrom(GuestSession *pSession,
    222                         const Utf8Str &strSource, const Utf8Str &strDest, FileCopyFlag_T enmFileCopyFlags);
     229                            const Utf8Str &strSource, const Utf8Str &strDest, FileCopyFlag_T fFileCopyFlags);
    223230    virtual ~SessionTaskCopyFileFrom(void);
    224231    int Run(void);
    225 
    226 protected:
    227 
    228     Utf8Str        mSource;
    229     Utf8Str        mDest;
    230     FileCopyFlag_T mFileCopyFlags;
    231232};
    232233
     
    240241    SessionTaskUpdateAdditions(GuestSession *pSession,
    241242                               const Utf8Str &strSource, const ProcessArguments &aArguments,
    242                                uint32_t uFlags);
     243                               uint32_t fFlags);
    243244    virtual ~SessionTaskUpdateAdditions(void);
    244245    int Run(void);
     
    296297
    297298    int addProcessArguments(ProcessArguments &aArgumentsDest, const ProcessArguments &aArgumentsSource);
    298     int copyFileToGuest(GuestSession *pSession, PRTISOFSFILE pISO, Utf8Str const &strFileSource, const Utf8Str &strFileDest, bool fOptional, uint32_t *pcbSize);
     299    int copyFileToGuest(GuestSession *pSession, PRTISOFSFILE pISO, Utf8Str const &strFileSource, const Utf8Str &strFileDest, bool fOptional);
    299300    int runFileOnGuest(GuestSession *pSession, GuestProcessStartupInfo &procInfo);
    300301
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