VirtualBox

Changeset 44409 in vbox for trunk/src


Ignore:
Timestamp:
Jan 28, 2013 9:56:52 AM (12 years ago)
Author:
vboxsync
Message:

Main/Medium: resizing needs to update the image size information, and finally rip out the useless and weird logic which always returned the capacity for the base medium for all diff images,

Location:
trunk/src/VBox/Main
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Main/idl/VirtualBox.xidl

    r44365 r44409  
    1245112451
    1245212452        <note>
    12453           Reading this property on a differencing medium will return the size
    12454           of its <link to="#base"/> medium.
    12455         </note>
    12456         <note>
    1245712453          For media whose state is <link to="#state"/> is <link
    1245812454          to="MediumState_Inaccessible"/>, the value of this property is the
  • trunk/src/VBox/Main/src-server/MediumImpl.cpp

    r44395 r44409  
    18941894    CheckComArgOutPointerValid(aLogicalSize);
    18951895
    1896     {
    1897         AutoCaller autoCaller(this);
    1898         if (FAILED(autoCaller.rc())) return autoCaller.rc();
    1899 
    1900         /* we access mParent */
    1901         AutoReadLock treeLock(m->pVirtualBox->getMediaTreeLockHandle() COMMA_LOCKVAL_SRC_POS);
    1902 
    1903         AutoReadLock alock(this COMMA_LOCKVAL_SRC_POS);
    1904 
    1905         if (m->pParent.isNull())
    1906         {
    1907             *aLogicalSize = m->logicalSize;
    1908 
    1909             return S_OK;
    1910         }
    1911     }
    1912 
    1913     /* We assume that some backend may decide to return a meaningless value in
    1914      * response to VDGetSize() for differencing media and therefore always
    1915      * ask the base medium ourselves. */
    1916 
    1917     /* base() will do callers/locking */
    1918 
    1919     return getBase()->COMGETTER(LogicalSize)(aLogicalSize);
     1896    AutoCaller autoCaller(this);
     1897    if (FAILED(autoCaller.rc())) return autoCaller.rc();
     1898
     1899    AutoReadLock alock(this COMMA_LOCKVAL_SRC_POS);
     1900
     1901    *aLogicalSize = m->logicalSize;
     1902
     1903    return S_OK;
    19201904}
    19211905
     
    57415725                else
    57425726                {
    5743                      Assert(!mediumId.isZero());
     5727                    Assert(!mediumId.isZero());
    57445728
    57455729                    if (mediumId != uuid)
     
    79937977    HRESULT rc = S_OK;
    79947978
    7995     /* Lock all in {parent,child} order. The lock is also used as a
    7996      * signal from the task initiator (which releases it only after
    7997      * RTThreadCreate()) that we can start the job. */
    7998     AutoWriteLock thisLock(this COMMA_LOCKVAL_SRC_POS);
     7979    uint64_t size = 0, logicalSize = 0;
    79997980
    80007981    try
    80017982    {
     7983        /* The lock is also used as a signal from the task initiator (which
     7984         * releases it only after RTThreadCreate()) that we can start the job */
     7985        AutoWriteLock thisLock(this COMMA_LOCKVAL_SRC_POS);
     7986
    80027987        PVBOXHDD hdd;
    80037988        int vrc = VDCreate(m->vdDiskIfaces, convertDeviceType(), &hdd);
     
    80688053                                   vdError(vrc).c_str());
    80698054            }
     8055            size = VDGetFileSize(hdd, VD_LAST_IMAGE);
     8056            logicalSize = VDGetSize(hdd, VD_LAST_IMAGE);
    80708057        }
    80718058        catch (HRESULT aRC) { rc = aRC; }
     
    80748061    }
    80758062    catch (HRESULT aRC) { rc = aRC; }
     8063
     8064    if (SUCCEEDED(rc))
     8065    {
     8066        AutoWriteLock thisLock(this COMMA_LOCKVAL_SRC_POS);
     8067        m->size = size;
     8068        m->logicalSize = logicalSize;
     8069    }
    80768070
    80778071    /* Everything is explicitly unlocked when the task exits,
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