VirtualBox

Changeset 33082 in vbox


Ignore:
Timestamp:
Oct 12, 2010 8:26:27 PM (14 years ago)
Author:
vboxsync
Message:

Storage/VBoxHDD: allow specifying the open mode explicitly, it makes no sense to copy the open mode (even with the readonly hacks we had)

Location:
trunk
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • trunk/include/VBox/VBoxHDD.h

    r32691 r33082  
    21772177 *                          This parameter is used if and only if a true copy is created.
    21782178 *                          In all rename/move cases or copy to existing image cases the modification UUIDs are copied over.
     2179 * @param   uOpenFlags      Image file open mode, see VD_OPEN_FLAGS_* constants.
     2180 *                          Only used if the destination image is created.
    21792181 * @param   pVDIfsOperation Pointer to the per-operation VD interface list.
    21802182 * @param   pDstVDIfsImage  Pointer to the per-image VD interface list, for the
     
    21872189                         bool fMoveByRename, uint64_t cbSize,
    21882190                         unsigned uImageFlags, PCRTUUID pDstUuid,
    2189                          PVDINTERFACE pVDIfsOperation,
     2191                         unsigned uOpenFlags, PVDINTERFACE pVDIfsOperation,
    21902192                         PVDINTERFACE pDstVDIfsImage,
    21912193                         PVDINTERFACE pDstVDIfsOperation);
  • trunk/src/VBox/Devices/Storage/VBoxHDD.cpp

    r32858 r33082  
    54465446 *                          This parameter is used if and only if a true copy is created.
    54475447 *                          In all rename/move cases the UUIDs are copied over.
     5448 * @param   uOpenFlags      Image file open mode, see VD_OPEN_FLAGS_* constants.
     5449 *                          Only used if the destination image is created.
    54485450 * @param   pVDIfsOperation Pointer to the per-operation VD interface list.
    54495451 * @param   pDstVDIfsImage  Pointer to the per-image VD interface list, for the
     
    54565458                         bool fMoveByRename, uint64_t cbSize,
    54575459                         unsigned uImageFlags, PCRTUUID pDstUuid,
    5458                          PVDINTERFACE pVDIfsOperation,
     5460                         unsigned uOpenFlags, PVDINTERFACE pVDIfsOperation,
    54595461                         PVDINTERFACE pDstVDIfsImage,
    54605462                         PVDINTERFACE pDstVDIfsOperation)
     
    54665468    PVDIMAGE pImageTo = NULL;
    54675469
    5468     LogFlowFunc(("pDiskFrom=%#p nImage=%u pDiskTo=%#p pszBackend=\"%s\" pszFilename=\"%s\" fMoveByRename=%d cbSize=%llu pVDIfsOperation=%#p pDstVDIfsImage=%#p pDstVDIfsOperation=%#p\n",
    5469                  pDiskFrom, nImage, pDiskTo, pszBackend, pszFilename, fMoveByRename, cbSize, pVDIfsOperation, pDstVDIfsImage, pDstVDIfsOperation));
     5470    LogFlowFunc(("pDiskFrom=%#p nImage=%u pDiskTo=%#p pszBackend=\"%s\" pszFilename=\"%s\" fMoveByRename=%d cbSize=%llu uImageFlags=%#x pDstUuid=%#p uOpenFlags=%#x pVDIfsOperation=%#p pDstVDIfsImage=%#p pDstVDIfsOperation=%#p\n",
     5471                 pDiskFrom, nImage, pDiskTo, pszBackend, pszFilename, fMoveByRename, cbSize, uImageFlags, pDstUuid, uOpenFlags, pVDIfsOperation, pDstVDIfsImage, pDstVDIfsOperation));
    54705472
    54715473    PVDINTERFACE pIfProgress = VDInterfaceGet(pVDIfsOperation,
     
    55685570            szComment[sizeof(szComment) - 1] = '\0';
    55695571
    5570         unsigned uOpenFlagsFrom;
    5571         uOpenFlagsFrom = pImageFrom->Backend->pfnGetOpenFlags(pImageFrom->pBackendData);
    5572 
    55735572        rc2 = vdThreadFinishRead(pDiskFrom);
    55745573        AssertRC(rc2);
     
    55955594                                  uImageFlags, szComment, &ImageUuid,
    55965595                                  NULL /* pParentUuid */,
    5597                                   uOpenFlagsFrom & ~VD_OPEN_FLAGS_READONLY,
     5596                                  uOpenFlags & ~VD_OPEN_FLAGS_READONLY,
    55985597                                  pDstVDIfsImage, NULL);
    55995598
     
    56255624                                  uImageFlags, szComment,
    56265625                                  &PCHSGeometryFrom, &LCHSGeometryFrom,
    5627                                   NULL, uOpenFlagsFrom & ~VD_OPEN_FLAGS_READONLY, pDstVDIfsImage, NULL);
     5626                                  NULL, uOpenFlags & ~VD_OPEN_FLAGS_READONLY,
     5627                                  pDstVDIfsImage, NULL);
    56285628
    56295629                rc2 = vdThreadStartWrite(pDiskTo);
     
    57595759            if (!RTUuidIsNull(&ImageModificationUuid))
    57605760                pImageTo->Backend->pfnSetModificationUuid(pImageTo->pBackendData, &ImageModificationUuid);
     5761
     5762            /* Set the requested open flags if they differ from the value
     5763             * required for creating the image and copying the contents. */
     5764            if (   pImageTo && pszFilename
     5765                && uOpenFlags != (uOpenFlags & ~VD_OPEN_FLAGS_READONLY))
     5766                rc = pImageTo->Backend->pfnSetOpenFlags(pImageTo->pBackendData,
     5767                                                        uOpenFlags);
    57615768        }
    57625769    } while (0);
  • trunk/src/VBox/Frontends/VBoxManage/VBoxInternalManage.cpp

    r32718 r33082  
    15561556        else
    15571557        {
    1558             vrc = VDCopy(pDisk, 0, pDisk, "VMDK", dst.c_str(), true, 0, VD_IMAGE_FLAGS_NONE, NULL, NULL, NULL, NULL);
     1558            vrc = VDCopy(pDisk, 0, pDisk, "VMDK", dst.c_str(), true, 0,
     1559                         VD_IMAGE_FLAGS_NONE, NULL, VD_OPEN_FLAGS_NORMAL,
     1560                         NULL, NULL, NULL);
    15591561            if (RT_FAILURE(vrc))
    15601562            {
     
    18381840        vrc = VDCopy(pSrcDisk, VD_LAST_IMAGE, pDstDisk, dstformat.c_str(),
    18391841                     dst.c_str(), false, 0, VD_VMDK_IMAGE_FLAGS_STREAM_OPTIMIZED,
    1840                      NULL, NULL, NULL, NULL);
     1842                     NULL, VD_OPEN_FLAGS_NORMAL, NULL, NULL, NULL);
    18411843        if (RT_FAILURE(vrc))
    18421844        {
  • trunk/src/VBox/Main/MediumImpl.cpp

    r33078 r33082  
    65186518                             task.mVariant,
    65196519                             targetId.raw(),
     6520                             VD_OPEN_FLAGS_NORMAL,
    65206521                             NULL /* pVDIfsOperation */,
    65216522                             pTarget->m->vdImageIfaces,
     
    71077108                             task.mVariant,
    71087109                             NULL /* pDstUuid */,
     7110                             VD_OPEN_FLAGS_NORMAL,
    71097111                             NULL /* pVDIfsOperation */,
    71107112                             task.mVDImageIfaces,
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