VirtualBox

Ignore:
Timestamp:
Nov 14, 2008 5:55:28 PM (16 years ago)
Author:
vboxsync
svn:sync-xref-src-repo-rev:
39341
Message:

Main: Use the parent's hard disk format when implicitly creating differencing hard disks (or the default hard disk format if the parent format doesn't support differencing).

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Main/HardDisk2Impl.cpp

    r14224 r14225  
    16531653    /* delegate the rest to the profi */
    16541654    cancelMergeTo (aChain);
     1655}
     1656
     1657/**
     1658 * Returns a preferred format for differencing hard disks.
     1659 */
     1660Bstr HardDisk2::preferredDiffFormat()
     1661{
     1662    Bstr format;
     1663
     1664    AutoCaller autoCaller (this);
     1665    AssertComRCReturn (autoCaller.rc(), format);
     1666
     1667    /* mm.format is const, no need to lock */
     1668    format = mm.format;
     1669
     1670    /* check that our own format supports diffs */
     1671
     1672    /* lock system properties now to make the format check atomic with
     1673     * defaultHardDiskFormat() */
     1674    AutoReadLock propsLock (mVirtualBox->systemProperties());
     1675
     1676    ComObjPtr <HardDiskFormat> formatObj =
     1677        mVirtualBox->systemProperties()->hardDiskFormat (format);
     1678    AssertReturn (!formatObj.isNull(), format);
     1679
     1680    if (!(formatObj->capabilities() & HardDiskFormatCapabilities_Differencing))
     1681        format = mVirtualBox->systemProperties()->defaultHardDiskFormat();
     1682
     1683    return format;
    16551684}
    16561685
Note: See TracChangeset for help on using the changeset viewer.

© 2025 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette