VirtualBox

Changeset 92822 in vbox


Ignore:
Timestamp:
Dec 8, 2021 2:55:45 PM (3 years ago)
Author:
vboxsync
Message:

Guest Control: Resolved a @todo: Implemented DirectoryCopyFlag_Recursive + DirectoryCopyFlag_FollowLinks and no longer do this implicitly internally.

Location:
trunk
Files:
7 edited

Legend:

Unmodified
Added
Removed
  • trunk/doc/manual/en_US/SDKRef.xml

    r87265 r92822  
    41394139    interfaces, methods or attributes or other changes that do not affect
    41404140    existing client code.</para>
     4141
     4142    <sect1>
     4143      <title>Incompatible API changes with version 7.0</title>
     4144
     4145      <itemizedlist>
     4146
     4147        <listitem><para><link linkend="IGuestSession__directoryCopyFromGuest">IGuestSession::directoryCopyFromGuest()</link> and
     4148          <link linkend="IGuestSession__directoryCopyToGuest">IGuestSession::directoryCopyToGuest()</link> no longer implicitly
     4149          copy recursively and follow symbolic links -- for this to continue working, the newly introduced flags
     4150          <link linkend="DirectoryCopyFlag_Recursive">DirectoryCopyFlag_Recursive</link> and/or
     4151          <link linkend="DirectoryCopyFlag_FollowLinks">DirectoryCopyFlag_FollowLinks</link> have to be used.</para>
     4152        </listitem>
     4153
     4154      </itemizedlist>
     4155
     4156    </sect1>
    41414157
    41424158    <sect1>
  • trunk/src/VBox/Frontends/VBoxManage/VBoxManageGuestCtrl.cpp

    r92594 r92822  
    18901890                            RTPrintf(GuestCtrl::tr("Directory '%s' -> '%s'\n"), szAbsSrc, pszDst);
    18911891
    1892                         SafeArray<DirectoryCopyFlag_T> copyFlags;
    1893                         copyFlags.push_back(DirectoryCopyFlag_CopyIntoExisting);
     1892                        SafeArray<DirectoryCopyFlag_T> aCopyFlags;
     1893                        aCopyFlags.push_back(DirectoryCopyFlag_CopyIntoExisting);
     1894                        if (fRecursive)
     1895                            aCopyFlags.push_back(DirectoryCopyFlag_Recursive);
     1896                        if (fFollow)
     1897                            aCopyFlags.push_back(DirectoryCopyFlag_FollowLinks);
    18941898                        rc = pCtx->pGuestSession->DirectoryCopyToGuest(Bstr(szAbsSrc).raw(), Bstr(pszDst).raw(),
    1895                                                                        ComSafeArrayAsInParam(copyFlags), pProgress.asOutParam());
     1899                                                                       ComSafeArrayAsInParam(aCopyFlags), pProgress.asOutParam());
    18961900                    }
    18971901                    else
     
    19261930                        SafeArray<DirectoryCopyFlag_T> aCopyFlags;
    19271931                        aCopyFlags.push_back(DirectoryCopyFlag_CopyIntoExisting);
     1932                        if (fRecursive)
     1933                            aCopyFlags.push_back(DirectoryCopyFlag_Recursive);
     1934                        if (fFollow)
     1935                            aCopyFlags.push_back(DirectoryCopyFlag_FollowLinks);
    19281936                        rc = pCtx->pGuestSession->DirectoryCopyFromGuest(Bstr(pszSource).raw(), Bstr(pszDst).raw(),
    19291937                                                                         ComSafeArrayAsInParam(aCopyFlags), pProgress.asOutParam());
     
    19351943
    19361944                        SafeArray<FileCopyFlag_T> aCopyFlags;
     1945                        if (fFollow)
     1946                            aCopyFlags.push_back(FileCopyFlag_FollowLinks);
    19371947                        rc = pCtx->pGuestSession->FileCopyFromGuest(Bstr(pszSource).raw(), Bstr(pszDst).raw(),
    19381948                                                                    ComSafeArrayAsInParam(aCopyFlags), pProgress.asOutParam());
  • trunk/src/VBox/Main/idl/VirtualBox.xidl

    r92813 r92822  
    1319213192  <enum
    1319313193    name="DirectoryCopyFlag"
    13194     uuid="b5901856-d064-4fbc-ab06-2909ba106154"
     13194    uuid="20108C67-B1EB-4EF6-869B-25539A47A18E"
    1319513195    >
    1319613196    <desc>
     
    1320213202    <const name="CopyIntoExisting"      value="1">
    1320313203      <desc>Allow copying into an existing destination directory.</desc>
     13204    </const>
     13205    <const name="Recursive"             value="2">
     13206      <desc>Copy directories recursively.</desc>
     13207    </const>
     13208    <const name="FollowLinks"           value="4">
     13209      <desc>Follow symbolic links.</desc>
    1320413210    </const>
    1320513211    <!-- Later, basically have to see what cp and xcopy offers. -->
  • trunk/src/VBox/Main/include/GuestSessionImplTasks.h

    r91312 r92822  
    6767            /** Directory copy flags. */
    6868            DirectoryCopyFlag_T fCopyFlags;
    69             /** Whether to follow symbolic links or not. */
    70             bool                fFollowSymlinks; /** @todo Remove once we have that parameter in DirectoryCopyFlag_T. */
    71             /** Whether to copy the directory recursively or not. */
    72             bool                fRecursive;
    7369        } Dir;
    7470        /** File-specific data. */
  • trunk/src/VBox/Main/src-client/GuestSessionImpl.cpp

    r92817 r92822  
    869869                if (MATCH_KEYWORD("CopyIntoExisting"))
    870870                    fFlags |= (unsigned)DirectoryCopyFlag_CopyIntoExisting;
     871                else if (MATCH_KEYWORD("Recursive"))
     872                    fFlags |= (unsigned)DirectoryCopyFlag_Recursive;
     873                else if (MATCH_KEYWORD("FollowLinks"))
     874                    fFlags |= (unsigned)DirectoryCopyFlag_FollowLinks;
    871875                else
    872876                    return setError(E_INVALIDARG, tr("Invalid directory copy flag: %.*s"), (int)cchKeyword, pszNext);
     
    32013205        {
    32023206            hrc = GuestSession::i_directoryCopyFlagFromStr(strFlags, &source.Type.Dir.fCopyFlags);
    3203             source.Type.Dir.fRecursive = true; /* Implicit. */
    32043207        }
    32053208        else if (source.enmType == FsObjType_File)
    32063209            hrc = GuestSession::i_fileCopyFlagFromStr(strFlags, &source.Type.File.fCopyFlags);
    32073210        else
    3208             return setError(E_INVALIDARG, tr("Source type %d invalid / not supported"), source.enmType);
     3211            return setError(E_INVALIDARG, tr("Source type %#x invalid / not supported"), source.enmType);
    32093212        if (FAILED(hrc))
    32103213            return hrc;
     
    32723275        {
    32733276            hrc = GuestSession::i_directoryCopyFlagFromStr(strFlags, &source.Type.Dir.fCopyFlags);
    3274             source.Type.Dir.fFollowSymlinks = true; /** @todo Add a flag for that in DirectoryCopyFlag_T. Later. */
    3275             source.Type.Dir.fRecursive      = true; /* Implicit. */
    32763277        }
    32773278        else if (source.enmType == FsObjType_File)
    32783279            hrc = GuestSession::i_fileCopyFlagFromStr(strFlags, &source.Type.File.fCopyFlags);
    32793280        else
    3280             return setError(E_INVALIDARG, tr("Source type %d invalid / not supported"), source.enmType);
     3281            return setError(E_INVALIDARG, tr("Source type %#x invalid / not supported"), source.enmType);
    32813282        if (FAILED(hrc))
    32823283            return hrc;
     
    33143315            fFlags |= aFlags[i];
    33153316
    3316         const uint32_t fValidFlags = DirectoryCopyFlag_None | DirectoryCopyFlag_CopyIntoExisting;
     3317        const uint32_t fValidFlags =   DirectoryCopyFlag_None | DirectoryCopyFlag_CopyIntoExisting | DirectoryCopyFlag_Recursive
     3318                                     | DirectoryCopyFlag_FollowLinks;
    33173319        if (fFlags & ~fValidFlags)
    33183320            return setError(E_INVALIDARG,tr("Unknown flags: flags value %#x, invalid: %#x"), fFlags, fFlags & ~fValidFlags);
     
    33273329    source.fDryRun              = false; /** @todo Implement support for a dry run. */
    33283330    source.Type.Dir.fCopyFlags  = (DirectoryCopyFlag_T)fFlags;
    3329     source.Type.Dir.fRecursive  = true; /* Implicit. */
    33303331
    33313332    SourceSet.push_back(source);
     
    33433344            fFlags |= aFlags[i];
    33443345
    3345         const uint32_t fValidFlags = DirectoryCopyFlag_None | DirectoryCopyFlag_CopyIntoExisting;
     3346        const uint32_t fValidFlags =   DirectoryCopyFlag_None | DirectoryCopyFlag_CopyIntoExisting | DirectoryCopyFlag_Recursive
     3347                                     | DirectoryCopyFlag_FollowLinks;
    33463348        if (fFlags & ~fValidFlags)
    33473349            return setError(E_INVALIDARG,tr("Unknown flags: flags value %#x, invalid: %#x"), fFlags, fFlags & ~fValidFlags);
     
    33563358    source.fDryRun             = false; /** @todo Implement support for a dry run. */
    33573359    source.Type.Dir.fCopyFlags = (DirectoryCopyFlag_T)fFlags;
    3358     source.Type.Dir.fFollowSymlinks = true; /** @todo Add a flag for that in DirectoryCopyFlag_T. Later. */
    3359     source.Type.Dir.fRecursive      = true; /* Implicit. */
    33603360
    33613361    SourceSet.push_back(source);
  • trunk/src/VBox/Main/src-client/GuestSessionImplTasks.cpp

    r92715 r92822  
    10041004     *       will be done directly when working on those. See @bugref{10139}. */
    10051005
    1006     LogFlowFunc(("mSrcRootAbs=%s, mDstRootAbs=%s, fCopyFlags=%#x, fFollowSymlinks=%RTbool, fRecursive=%RTbool\n",
    1007                  mSrcRootAbs.c_str(), mDstRootAbs.c_str(), mSourceSpec.Type.Dir.fCopyFlags,
    1008                  mSourceSpec.Type.Dir.fFollowSymlinks, mSourceSpec.Type.Dir.fRecursive));
     1006    LogFlowFunc(("mSrcRootAbs=%s, mDstRootAbs=%s, fCopyFlags=%#x\n",
     1007                 mSrcRootAbs.c_str(), mDstRootAbs.c_str(), mSourceSpec.Type.Dir.fCopyFlags));
    10091008
    10101009    return VINF_SUCCESS;
     
    11231122                    LogRel2(("Guest Control: Directory '%s'\n", strEntry.c_str()));
    11241123
    1125                     if (!(mSourceSpec.Type.Dir.fRecursive))
     1124                    if (!(mSourceSpec.Type.Dir.fCopyFlags & DirectoryCopyFlag_Recursive))
    11261125                        break;
    11271126
     
    11321131                case FsObjType_Symlink:
    11331132                {
    1134                     if (mSourceSpec.Type.Dir.fFollowSymlinks)
     1133                    if (mSourceSpec.Type.Dir.fCopyFlags & DirectoryCopyFlag_FollowLinks)
    11351134                    {
    11361135                        /** @todo Symlink handling from guest is not implemented yet.
     
    12341233                                LogRel2(("Guest Control: Directory '%s'\n", strEntry.c_str()));
    12351234
    1236                                 if (!(mSourceSpec.Type.Dir.fRecursive))
     1235                                if (!(mSourceSpec.Type.Dir.fCopyFlags & DirectoryCopyFlag_Recursive))
    12371236                                    break;
    12381237
     
    12511250                            case RTFS_TYPE_SYMLINK:
    12521251                            {
    1253                                 if (mSourceSpec.Type.Dir.fFollowSymlinks)
     1252                                if (mSourceSpec.Type.Dir.fCopyFlags & DirectoryCopyFlag_FollowLinks)
    12541253                                {
    12551254                                    Utf8Str strEntryAbs = strPathAbs + Utf8Str(Entry.szName);
     
    14431442                }
    14441443
    1445                 fFollowSymlinks = itSrc->Type.Dir.fFollowSymlinks;
     1444                fFollowSymlinks = itSrc->Type.Dir.fCopyFlags & DirectoryCopyFlag_FollowLinks;
    14461445            }
    14471446            else
     
    18381837        GuestFsObjData dstObjData;
    18391838        int rcGuest;
    1840         rc = mSession->i_fsQueryInfo(strDstRootAbs, pList->mSourceSpec.Type.Dir.fFollowSymlinks, dstObjData, &rcGuest);
     1839        rc = mSession->i_fsQueryInfo(strDstRootAbs, pList->mSourceSpec.Type.Dir.fCopyFlags & DirectoryCopyFlag_FollowLinks,
     1840                                     dstObjData, &rcGuest);
    18411841        if (RT_FAILURE(rc))
    18421842        {
     
    18791879        {
    18801880            fCopyIntoExisting = RT_BOOL(pList->mSourceSpec.Type.Dir.fCopyFlags & DirectoryCopyFlag_CopyIntoExisting);
    1881             fFollowSymlinks   = pList->mSourceSpec.Type.Dir.fFollowSymlinks;
     1881            fFollowSymlinks   = RT_BOOL(pList->mSourceSpec.Type.Dir.fCopyFlags & DirectoryCopyFlag_FollowLinks);
    18821882
    18831883            LogFlowFunc(("Directory: fDirCopyFlags=%#x, fCopyIntoExisting=%RTbool, fFollowSymlinks=%RTbool\n",
  • trunk/src/VBox/ValidationKit/tests/additions/tdAddGuestCtrl.py

    r92681 r92822  
    18411841        reporter.log2('Copying guest dir "%s" to host "%s"' % (limitString(oTest.sSrc), limitString(oTest.sDst)));
    18421842        try:
     1843            if self.oTstDrv.fpApiVer >= 7.0:
     1844                ## @todo Make the following new flags implicit for 7.0 for now. Develop dedicated tests for this later and remove.
     1845                if vboxcon.DirectoryCopyFlag_Recursive not in oTest.afFlags:
     1846                    oTest.afFlags.extend([ vboxcon.DirectoryCopyFlag_Recursive ]);
     1847                ## @todo Ditto.
     1848                if vboxcon.DirectoryCopyFlag_FollowLinks not in oTest.afFlags:
     1849                    oTest.afFlags.extend([ vboxcon.DirectoryCopyFlag_FollowLinks ]);
    18431850            oCurProgress = oGuestSession.directoryCopyFromGuest(oTest.sSrc, oTest.sDst, oTest.afFlags);
    18441851        except:
     
    18981905    def gctrlCopyDirTo(self, oGuestSession, sSrc, sDst, afFlags, fIsError):
    18991906        """
    1900         Helper function to copy a directory tree from the host to the guest.
     1907        Helper function to copy a directory (tree) from the host to the guest.
    19011908        """
    19021909        reporter.log2('Copying host directory "%s" to guest "%s" (flags %s)' % (limitString(sSrc), limitString(sDst), afFlags));
    19031910        try:
     1911            if self.oTstDrv.fpApiVer >= 7.0:
     1912                ## @todo Make the following new flags implicit for 7.0 for now. Develop dedicated tests for this later and remove.
     1913                if vboxcon.DirectoryCopyFlag_Recursive not in afFlags:
     1914                    afFlags.extend([ vboxcon.DirectoryCopyFlag_Recursive ]);
     1915                ## @todo Ditto.
     1916                if vboxcon.DirectoryCopyFlag_FollowLinks not in afFlags:
     1917                    afFlags.extend([ vboxcon.DirectoryCopyFlag_FollowLinks ]);
    19041918            oCurProgress = oGuestSession.directoryCopyToGuest(sSrc, sDst, afFlags);
    19051919        except:
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