VirtualBox

Changeset 48297 in vbox for trunk/src/VBox/Main/include


Ignore:
Timestamp:
Sep 5, 2013 9:57:44 AM (11 years ago)
Author:
vboxsync
Message:

Main/Medium: redesign API level medium locking, needed conversions from MediaList to MediumLockLists in several places, forced cleanups elsewhere, too
Main/Token: introduced token objects for controlling the unlocking, will be used as a general concept in the future
Main/Snapshot: snapshot deletion needed significant cleanups as it was still using many shortcuts, directly calling the API to lock media instead of using lock lists. Now much better, and the online snapshot deletion is also a lot cleaner as it no longer passes unnecessary parameters around which are already known in the machine/snapshot code
Main/MediumLock: small improvements, now has a mode which skips locking already locked media, needed by the Snapshot code where we have overlapping lock lists and have to update the original one instead
Main/Console+Session+Machine: follow-up changes for the online snapshot merging parameter passing simplification, plus an unrelated lock order violation fix in Machine which happens only for inaccessible machines
Main/testcase: update correspondingly
doc: update SDK reference

Location:
trunk/src/VBox/Main/include
Files:
1 added
6 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Main/include/ConsoleImpl.h

    r48054 r48297  
    230230    HRESULT onlineMergeMedium(IMediumAttachment *aMediumAttachment,
    231231                              ULONG aSourceIdx, ULONG aTargetIdx,
    232                               IMedium *aSource, IMedium *aTarget,
    233                               BOOL aMergeForward, IMedium *aParentForTarget,
    234                               ComSafeArrayIn(IMedium *, aChildrenToReparent),
    235232                              IProgress *aProgress);
    236233    VMMDev *getVMMDev() { return m_pVMMDev; }
  • trunk/src/VBox/Main/include/MachineImpl.h

    r47991 r48297  
    10701070                              IN_BSTR aEndID, BOOL fDeleteAllChildren,
    10711071                              MachineState_T *aMachineState, IProgress **aProgress);
    1072     STDMETHOD(FinishOnlineMergeMedium)(IMediumAttachment *aMediumAttachment,
    1073                                        IMedium *aSource, IMedium *aTarget,
    1074                                        BOOL fMergeForward,
    1075                                        IMedium *pParentForTarget,
    1076                                        ComSafeArrayIn(IMedium *, aChildrenToReparent));
     1072    STDMETHOD(FinishOnlineMergeMedium)();
    10771073    STDMETHOD(RestoreSnapshot)(IConsole *aInitiator,
    10781074                               ISnapshot *aSnapshot,
     
    11431139    {
    11441140        ConsoleTaskData()
    1145             : mLastState(MachineState_Null)
     1141            : mLastState(MachineState_Null), mDeleteSnapshotInfo(NULL)
    11461142        { }
    11471143
     
    11511147        // used when taking snapshot
    11521148        ComObjPtr<Snapshot> mSnapshot;
     1149
     1150        // used when deleting online snapshot
     1151        void *mDeleteSnapshotInfo;
    11531152
    11541153        // used when saving state (either as part of a snapshot or separate)
     
    11851184                                        bool &fMergeForward,
    11861185                                        ComObjPtr<Medium> &pParentForTarget,
    1187                                         MediaList &aChildrenToReparent,
     1186                                        MediumLockList * &aChildrenToReparent,
    11881187                                        bool &fNeedOnlineMerge,
    1189                                         MediumLockList * &aMediumLockList);
     1188                                        MediumLockList * &aMediumLockList,
     1189                                        ComPtr<IToken> &aHDLockToken);
    11901190    void cancelDeleteSnapshotMedium(const ComObjPtr<Medium> &aHD,
    11911191                                    const ComObjPtr<Medium> &aSource,
    1192                                     const MediaList &aChildrenToReparent,
     1192                                    MediumLockList *aChildrenToReparent,
    11931193                                    bool fNeedsOnlineMerge,
    11941194                                    MediumLockList *aMediumLockList,
     1195                                    const ComPtr<IToken> &aHDLockToken,
    11951196                                    const Guid &aMediumId,
    11961197                                    const Guid &aSnapshotId);
     
    12001201                              bool fMergeForward,
    12011202                              const ComObjPtr<Medium> &pParentForTarget,
    1202                               const MediaList &aChildrenToReparent,
     1203                              MediumLockList *aChildrenToReparent,
    12031204                              MediumLockList *aMediumLockList,
    12041205                              ComObjPtr<Progress> &aProgress,
  • trunk/src/VBox/Main/include/MediumImpl.h

    r44528 r48297  
    132132    STDMETHOD(GetSnapshotIds)(IN_BSTR aMachineId,
    133133                              ComSafeArrayOut(BSTR, aSnapshotIds));
    134     STDMETHOD(LockRead)(MediumState_T *aState);
    135     STDMETHOD(UnlockRead)(MediumState_T *aState);
    136     STDMETHOD(LockWrite)(MediumState_T *aState);
    137     STDMETHOD(UnlockWrite)(MediumState_T *aState);
     134    STDMETHOD(LockRead)(IToken **aToken);
     135    STDMETHOD(LockWrite)(IToken **aToken);
    138136    STDMETHOD(Close)();
    139137    STDMETHOD(GetProperty)(IN_BSTR aName, BSTR *aValue);
     
    226224
    227225    HRESULT close(AutoCaller &autoCaller);
     226    HRESULT unlockRead(MediumState_T *aState);
     227    HRESULT unlockWrite(MediumState_T *aState);
    228228    HRESULT deleteStorage(ComObjPtr<Progress> *aProgress, bool aWait);
    229229    HRESULT markForDeletion();
     
    241241                           bool &fMergeForward,
    242242                           ComObjPtr<Medium> &pParentForTarget,
    243                            MediaList &aChildrenToReparent,
     243                           MediumLockList * &aChildrenToReparent,
    244244                           MediumLockList * &aMediumLockList);
    245245    HRESULT mergeTo(const ComObjPtr<Medium> &pTarget,
    246246                    bool fMergeForward,
    247247                    const ComObjPtr<Medium> &pParentForTarget,
    248                     const MediaList &aChildrenToReparent,
     248                    MediumLockList *aChildrenToReparent,
    249249                    MediumLockList *aMediumLockList,
    250250                    ComObjPtr<Progress> *aProgress,
    251251                    bool aWait);
    252     void cancelMergeTo(const MediaList &aChildrenToReparent,
     252    void cancelMergeTo(MediumLockList *aChildrenToReparent,
    253253                       MediumLockList *aMediumLockList);
    254254
    255     HRESULT fixParentUuidOfChildren(const MediaList &childrenToReparent);
     255    HRESULT fixParentUuidOfChildren(MediumLockList *pChildrenToReparent);
    256256
    257257    HRESULT exportFile(const char *aFilename,
  • trunk/src/VBox/Main/include/MediumLock.h

    r44529 r48297  
    77
    88/*
    9  * Copyright (C) 2010-2012 Oracle Corporation
     9 * Copyright (C) 2010-2013 Oracle Corporation
    1010 *
    1111 * This file is part of VirtualBox Open Source Edition (OSE), as
     
    9090
    9191    /**
     92     * Check if this medium object has been locked by this MediumLock.
     93     */
     94    bool IsLocked() const;
     95
     96    /**
    9297     * Acquire a medium lock.
    9398     *
    9499     * @return COM status code
    95      */
    96     HRESULT Lock();
     100     * @param aIgnoreLockedMedia    If set ignore all media which is already
     101     *                              locked in an incompatible way.
     102     */
     103    HRESULT Lock(bool aIgnoreLockedMedia = false);
    97104
    98105    /**
     
    105112private:
    106113    ComObjPtr<Medium> mMedium;
     114    ComPtr<IToken> mToken;
    107115    AutoCaller mMediumCaller;
    108116    bool mLockWrite;
     
    208216     *
    209217     * @return COM status code
    210      */
    211     HRESULT Lock();
     218     * @param aSkipOverLockedMedia  If set ignore all media which is already
     219     *                              locked for reading or writing. For callers
     220     *                              which need to know which medium objects
     221     *                              have been locked by this lock list you
     222     *                              can iterate over the list and check the
     223     *                              MediumLock state.
     224     */
     225    HRESULT Lock(bool aSkipOverLockedMedia = false);
    212226
    213227    /**
  • trunk/src/VBox/Main/include/SessionImpl.h

    r48282 r48297  
    103103    STDMETHOD(OnlineMergeMedium)(IMediumAttachment *aMediumAttachment,
    104104                                 ULONG aSourceIdx, ULONG aTargetIdx,
    105                                  IMedium *aSource, IMedium *aTarget,
    106                                  BOOL aMergeForward, IMedium *aParentForTarget,
    107                                  ComSafeArrayIn(IMedium *, aChildrenToReparent),
    108105                                 IProgress *aProgress);
    109106    STDMETHOD(EnableVMMStatistics)(BOOL aEnable);
  • trunk/src/VBox/Main/include/VirtualBoxImpl.h

    r47561 r48297  
    311311    AutostartDb* getAutostartDb() const;
    312312
     313    RWLockHandle& getMachinesListLockHandle();
    313314    RWLockHandle& getMediaTreeLockHandle();
    314315
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