VirtualBox

Ignore:
Timestamp:
Mar 24, 2009 1:25:13 PM (16 years ago)
Author:
vboxsync
Message:

Storage/VMDK: Make the descriptor bigger if it is unreasonably small and we might want to add more data to it.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Devices/Storage/VmdkHDDCore.cpp

    r18149 r18179  
    29052905        if (RT_FAILURE(rc))
    29062906            goto out;
     2907
    29072908        /* As we're dealing with a monolithic image here, there must
    29082909         * be a descriptor embedded in the image file. */
     
    29112912            rc = vmdkError(pImage, VERR_VD_VMDK_INVALID_HEADER, RT_SRC_POS, N_("VMDK: monolithic image without descriptor in '%s'"), pImage->pszFilename);
    29122913            goto out;
     2914        }
     2915        /* HACK: extend the descriptor if it is unusually small and it fits in
     2916         * the unused space after the image header. Allows opening VMDK files
     2917         * with extremely small descriptor in read/write mode. */
     2918        if (    !(pImage->uOpenFlags & VD_OPEN_FLAGS_READONLY)
     2919            &&  pExtent->cDescriptorSectors < 3
     2920            &&  (int64_t)pExtent->uSectorGD - pExtent->uDescriptorSector >= 4
     2921            &&  (!pExtent->uSectorRGD || (int64_t)pExtent->uSectorRGD - pExtent->uDescriptorSector >= 4))
     2922        {
     2923            pExtent->cDescriptorSectors = 4;
     2924            pExtent->fMetaDirty = true;
    29132925        }
    29142926        /* Read the descriptor from the extent. */
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