VirtualBox

Changeset 7370 in vbox


Ignore:
Timestamp:
Mar 7, 2008 2:46:00 PM (17 years ago)
Author:
vboxsync
Message:

A little adjustment of the RTFILECOPY flags.

Location:
trunk
Files:
3 edited

Legend:

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

    r7340 r7370  
    343343 * @{ */
    344344/** Do not use RTFILE_O_DENY_WRITE on the source file to allow for copying files opened for writing. */
    345 #define RTFILECOPY_FLAG_NO_DENY_WRITE   0x0001
     345#define RTFILECOPY_FLAGS_NO_SRC_DENY_WRITE  RT_BIT(0)
     346/** Do not use RTFILE_O_DENY_WRITE on the target file. */
     347#define RTFILECOPY_FLAGS_NO_DST_DENY_WRITE  RT_BIT(1)
     348/** Do not use RTFILE_O_DENY_WRITE on either of the two file. */
     349#define RTFILECOPY_FLAGS_NO_DENY_WRITE      ( RTFILECOPY_FLAGS_NO_SRC_DENY_WRITE | RTFILECOPY_FLAGS_NO_DST_DENY_WRITE )
     350/** */
     351#define RTFILECOPY_FLAGS_MASK               UINT32_C(0x00000003)
    346352/** @} */
    347353
  • trunk/src/VBox/Main/VirtualBoxImpl.cpp

    r7349 r7370  
    43174317    Utf8Str nf = Utf8StrFmt ("%s.%s.bak", of.raw(), aOldFormat.raw());
    43184318
    4319     int vrc = RTFileCopyEx (of, nf, RTFILECOPY_FLAG_NO_DENY_WRITE,
     4319    int vrc = RTFileCopyEx (of, nf, RTFILECOPY_FLAGS_NO_SRC_DENY_WRITE,
    43204320                            NULL, NULL);
    43214321
     
    43274327        {
    43284328            nf = Utf8StrFmt ("%s.%d", tmp.raw(), i);
    4329             vrc = RTFileCopyEx (of, nf, RTFILECOPY_FLAG_NO_DENY_WRITE,
     4329            vrc = RTFileCopyEx (of, nf, RTFILECOPY_FLAGS_NO_SRC_DENY_WRITE,
    43304330                                NULL, NULL);
    43314331        }
  • trunk/src/VBox/Runtime/r3/fileio.cpp

    r7340 r7370  
    327327    AssertMsgReturn(*pszDst, ("pszDst=%p\n", pszDst), VERR_INVALID_PARAMETER);
    328328    AssertMsgReturn(!pfnProgress || VALID_PTR(pfnProgress), ("pfnProgress=%p\n", pfnProgress), VERR_INVALID_PARAMETER);
     329    AssertMsgReturn(!(fFlags & ~RTFILECOPY_FLAGS_MASK), ("%#x\n", fFlags), VERR_INVALID_PARAMETER);
    329330
    330331    /*
     
    332333     */
    333334    RTFILE FileSrc;
    334     uint32_t fSrcOpen = RTFILE_O_READ | RTFILE_O_OPEN;
    335     if (!(fFlags & RTFILECOPY_FLAG_NO_DENY_WRITE))
    336         fSrcOpen |= RTFILE_O_DENY_WRITE;
    337     int rc = RTFileOpen(&FileSrc, pszSrc, fSrcOpen);
     335    int rc = RTFileOpen(&FileSrc, pszSrc,
     336                        RTFILE_O_READ | (fFlags & RTFILECOPY_FLAGS_NO_SRC_DENY_WRITE ? 0 : RTFILE_O_DENY_WRITE) | RTFILE_O_OPEN);
    338337    if (RT_SUCCESS(rc))
    339338    {
    340339        RTFILE FileDst;
    341         rc = RTFileOpen(&FileDst, pszDst, RTFILE_O_WRITE | RTFILE_O_DENY_WRITE | RTFILE_O_CREATE);
     340        rc = RTFileOpen(&FileDst, pszDst,
     341                        RTFILE_O_READ | (fFlags & RTFILECOPY_FLAGS_NO_DST_DENY_WRITE ? 0 : RTFILE_O_DENY_WRITE) | RTFILE_O_OPEN);
    342342        if (RT_SUCCESS(rc))
    343343        {
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