VirtualBox

Changeset 24439 in vbox for trunk/src


Ignore:
Timestamp:
Nov 6, 2009 1:16:47 PM (15 years ago)
Author:
vboxsync
Message:

Storage/VBoxHDD: tweak PCHS handling in VDCopy (contributed by Huihong Luo)

File:
1 edited

Legend:

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

    r23973 r24439  
    22442244                    uImageFlags |= VD_IMAGE_FLAGS_FIXED;
    22452245
     2246                /* Fix broken PCHS geometry. Can happen for two reasons: either
     2247                 * the backend mixes up PCHS and LCHS, or the application used
     2248                 * to create the source image has put garbage in it. */
     2249                /** @todo double-check if the VHD backend correctly handles
     2250                 * PCHS and LCHS geometry. also reconsider our current paranoia
     2251                 * level when it comes to geometry settings here and in the
     2252                 * backends. */
     2253                if (PCHSGeometryFrom.cHeads > 16 || PCHSGeometryFrom.cSectors > 63)
     2254                {
     2255                    Assert(RT_MIN(cbSize / 512 / 16 / 63, 16383) - (uint32_t)RT_MIN(cbSize / 512 / 16 / 63, 16383));
     2256                    PCHSGeometryFrom.cCylinders = (uint32_t)RT_MIN(cbSize / 512 / 16 / 63, 16383);
     2257                    PCHSGeometryFrom.cHeads = 16;
     2258                    PCHSGeometryFrom.cSectors = 63;
     2259                }
     2260
    22462261                rc = VDCreateBase(pDiskTo, pszBackend, pszFilename, cbSize,
    22472262                                  uImageFlags, szComment,
     
    23272342        if (RT_SUCCESS(rc))
    23282343        {
    2329             pImageTo->Backend->pfnSetModificationUuid(pImageTo->pvBackendData, &ImageModificationUuid);
     2344            /* Only set modification UUID if it is non-null, since the source
     2345             * backend might not provide a valid modification UUID. */
     2346            if (!RTUuidIsNull(&ImageModificationUuid))
     2347                pImageTo->Backend->pfnSetModificationUuid(pImageTo->pvBackendData, &ImageModificationUuid);
    23302348            /** @todo double-check this - it makes little sense to copy over the parent modification uuid,
    23312349             * as the destination image can have a totally different parent. */
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