VirtualBox

Changeset 10781 in vbox for trunk/src/VBox/Devices/Storage


Ignore:
Timestamp:
Jul 21, 2008 2:45:28 PM (16 years ago)
Author:
vboxsync
Message:

Fix incorrect image flags handling - the values in the image and used by VBoxHDD-new are not identical.

Location:
trunk/src/VBox/Devices/Storage
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Devices/Storage/VDICore.h

    r10715 r10781  
    310310}
    311311
     312#ifdef VBOX_VDICORE_VD
     313DECLINLINE(unsigned) getImageFlags(PVDIHEADER ph)
     314{
     315    switch (GET_MAJOR_HEADER_VERSION(ph))
     316    {
     317        case 0:
     318            /* VDI image flag conversion to VD image flags. */
     319            return ph->u.v0.fFlags << 8;
     320        case 1:
     321            /* VDI image flag conversion to VD image flags. */
     322            return ph->u.v1.fFlags << 8;
     323    }
     324    AssertFailed();
     325    return 0;
     326}
     327#else /* !VBOX_VDICORE_VD */
    312328DECLINLINE(unsigned) getImageFlags(PVDIHEADER ph)
    313329{
     
    320336    return 0;
    321337}
     338#endif /* !VBOX_VDICORE_VD */
    322339
    323340DECLINLINE(char *) getImageComment(PVDIHEADER ph)
  • trunk/src/VBox/Devices/Storage/VDIHDDCore.cpp

    r10715 r10781  
    129129                                       ? VDI_IMAGE_TYPE_NORMAL
    130130                                       : VDI_IMAGE_TYPE_DIFF);
    131     pHeader->u.v1.fFlags = uImageFlags;
     131    pHeader->u.v1.fFlags = (uImageFlags & VD_VDI_IMAGE_FLAGS_ZERO_EXPAND) ? 1 : 0;
    132132#ifdef VBOX_STRICT
    133133    char achZero[VDI_IMAGE_COMMENT_SIZE] = {0};
     
    13191319
    13201320    if (pImage)
    1321         uImageFlags = getImageFlags(&pImage->Header);
     1321        uImageFlags = pImage->uImageFlags;
    13221322    else
    13231323        uImageFlags = 0;
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