VirtualBox

Changeset 31185 in vbox


Ignore:
Timestamp:
Jul 28, 2010 8:40:14 PM (14 years ago)
Author:
vboxsync
Message:

VBoxHDD: Add a flag to disable locking of an image file

Location:
trunk
Files:
6 edited

Legend:

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

    r31180 r31185  
    467467
    468468/** Open the storage readonly. */
    469 #define VD_INTERFACEASYNCIO_OPEN_FLAGS_READONLY RT_BIT(0)
     469#define VD_INTERFACEASYNCIO_OPEN_FLAGS_READONLY  RT_BIT(0)
    470470/** Create the storage backend if it doesn't exist. */
    471 #define VD_INTERFACEASYNCIO_OPEN_FLAGS_CREATE RT_BIT(1)
     471#define VD_INTERFACEASYNCIO_OPEN_FLAGS_CREATE    RT_BIT(1)
     472/** Don't write lock the opened file. */
     473#define VD_INTERFACEASYNCIO_OPEN_FLAGS_DONT_LOCK RT_BIT(2)
    472474
    473475/**
  • trunk/src/VBox/Devices/Storage/DrvVD.cpp

    r31180 r31185  
    348348                                   : 0;
    349349                if (pThis->fShareable)
     350                {
     351                    Assert(fFlags & VD_INTERFACEASYNCIO_OPEN_FLAGS_DONT_LOCK);
     352
    350353                    fFlags |= PDMACEP_FILE_FLAGS_DONT_LOCK;
     354                }
    351355                else
    352356                    fFlags |= PDMACEP_FILE_FLAGS_CACHING;
  • trunk/src/VBox/Devices/Storage/VBoxHDD.cpp

    r30863 r31185  
    16121612                /* Set the state to growing. */
    16131613                LogFlowFunc(("Disk is growing because of pIoCtx=%#p pIoCtxWrite=%#p\n",
     1614
    16141615                             pIoCtx, pIoCtxWrite));
    16151616                ASMAtomicWriteBool(&pDisk->fGrowing, true);
     
    18241825
    18251826    if (uOpenFlags & VD_INTERFACEASYNCIO_OPEN_FLAGS_READONLY)
    1826         fOpen |= RTFILE_O_READ      | RTFILE_O_DENY_NONE;
     1827        fOpen |= RTFILE_O_READ | RTFILE_O_DENY_NONE;
    18271828    else
    1828         fOpen |= RTFILE_O_READWRITE | RTFILE_O_DENY_WRITE;
     1829    {
     1830        fOpen |= RTFILE_O_READWRITE;
     1831
     1832        if (uOpenFlags & VD_INTERFACEASYNCIO_OPEN_FLAGS_DONT_LOCK)
     1833            fOpen |= RTFILE_O_DENY_NONE;
     1834        else
     1835            fOpen |= RTFILE_O_DENY_WRITE;
     1836    }
    18291837
    18301838    if (uOpenFlags & VD_INTERFACEASYNCIO_OPEN_FLAGS_CREATE)
  • trunk/src/VBox/Devices/Storage/VDIHDDCore.cpp

    r31184 r31185  
    102102    if (fCreate)
    103103        uOpenFlags |= VD_INTERFACEASYNCIO_OPEN_FLAGS_CREATE;
     104
     105    if (fShareable)
     106        uOpenFlags |= VD_INTERFACEASYNCIO_OPEN_FLAGS_DONT_LOCK;
    104107
    105108    rc = pImage->pInterfaceIOCallbacks->pfnOpen(pImage->pInterfaceIO->pvUser,
  • trunk/src/VBox/Devices/Storage/VHDHDDCore.cpp

    r31184 r31185  
    284284    if (fCreate)
    285285        uOpenFlags |= VD_INTERFACEASYNCIO_OPEN_FLAGS_CREATE;
     286
     287    if (fShareable)
     288        uOpenFlags |= VD_INTERFACEASYNCIO_OPEN_FLAGS_DONT_LOCK;
    286289
    287290    rc = pImage->pInterfaceIOCallbacks->pfnOpen(pImage->pInterfaceIO->pvUser,
  • trunk/src/VBox/Devices/Storage/VmdkHDDCore.cpp

    r31184 r31185  
    628628    if ((fOpen & RTFILE_O_ACTION_MASK) == RTFILE_O_CREATE)
    629629        uOpenFlags |= VD_INTERFACEASYNCIO_OPEN_FLAGS_CREATE;
     630    if ((fOpen & RTFILE_O_DENY_MASK) == RTFILE_O_DENY_NONE)
     631        uOpenFlags |= VD_INTERFACEASYNCIO_OPEN_FLAGS_DONT_LOCK;
    630632
    631633    rc = pImage->pInterfaceIOCallbacks->pfnOpen(pImage->pInterfaceIO->pvUser,
     
    20572059    rc = vmdkDescDDBSetU32(pImage, &pImage->Descriptor,
    20582060                           VMDK_DDB_GEO_LCHS_HEADS,
     2061
    20592062                           pLCHSGeometry->cHeads);
    20602063    if (RT_FAILURE(rc))
     
    22572260        else
    22582261            return vmdkError(pImage, VERR_VD_VMDK_INVALID_HEADER, RT_SRC_POS, N_("VMDK: parse error in extent description in '%s'"), pImage->pszFilename);
     2262
    22592263        if (pImage->pExtents[i].enmType == VMDKETYPE_ZERO)
    22602264        {
     
    40664070
    40674071    if (RT_FAILURE(rc))
     4072
    40684073        goto out;
    40694074
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