VirtualBox

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


Ignore:
Timestamp:
Feb 16, 2007 3:45:20 PM (18 years ago)
Author:
vboxsync
Message:

Main: Prototyped IVMDKImage.

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

Legend:

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

    r911 r953  
    174174    const Bstr &lastAccessError() const { return mLastAccessError; }
    175175
     176    static HRESULT openHardDisk (VirtualBox *aVirtualBox, INPTR BSTR aLocation,
     177                                 ComObjPtr <HardDisk> &hardDisk);
     178
    176179    // for VirtualBoxSupportErrorInfoImpl
    177180    static const wchar_t *getComponentName() { return L"HardDisk"; }
     
    424427};
    425428
     429////////////////////////////////////////////////////////////////////////////////
     430
     431class ATL_NO_VTABLE HVMDKImage :
     432    public HardDisk,
     433    public VirtualBoxSupportTranslation <HVMDKImage>,
     434    public IVMDKImage
     435{
     436
     437public:
     438
     439    VIRTUALBOXSUPPORTTRANSLATION_OVERRIDE(HVMDKImage)
     440
     441    DECLARE_NOT_AGGREGATABLE(HVMDKImage)
     442
     443    DECLARE_PROTECT_FINAL_CONSTRUCT()
     444
     445    BEGIN_COM_MAP(HVMDKImage)
     446        COM_INTERFACE_ENTRY(ISupportErrorInfo)
     447        COM_INTERFACE_ENTRY(IHardDisk)
     448        COM_INTERFACE_ENTRY(IVMDKImage)
     449    END_COM_MAP()
     450
     451    NS_DECL_ISUPPORTS
     452
     453    HRESULT FinalConstruct();
     454    void FinalRelease();
     455
     456    // public initializer/uninitializer for internal purposes only
     457
     458    HRESULT init (VirtualBox *aVirtualBox, HardDisk *aParent,
     459                  CFGNODE aHDNode, CFGNODE aVMDKNode);
     460    HRESULT init (VirtualBox *aVirtualBox, HardDisk *aParent,
     461                  INPTR BSTR aFilePath, BOOL aRegistered = FALSE);
     462    void uninit();
     463
     464    // IHardDisk properties
     465    STDMETHOD(COMGETTER(Description)) (BSTR *aDescription);
     466    STDMETHOD(COMSETTER(Description)) (INPTR BSTR aDescription);
     467    STDMETHOD(COMGETTER(Size)) (ULONG64 *aSize);
     468    STDMETHOD(COMGETTER(ActualSize)) (ULONG64 *aActualSize);
     469
     470    // IVirtualDiskImage properties
     471    STDMETHOD(COMGETTER(FilePath)) (BSTR *aFilePath);
     472    STDMETHOD(COMSETTER(FilePath)) (INPTR BSTR aFilePath);
     473    STDMETHOD(COMGETTER(Created)) (BOOL *aCreated);
     474
     475    // IVirtualDiskImage methods
     476    STDMETHOD(CreateDynamicImage) (ULONG64 aSize, IProgress **aProgress);
     477    STDMETHOD(CreateFixedImage) (ULONG64 aSize, IProgress **aProgress);
     478    STDMETHOD(DeleteImage)();
     479
     480    // public methods for internal purposes only
     481
     482    const Bstr &filePath() const { return mFilePath; }
     483    const Bstr &filePathFull() const { return mFilePathFull; }
     484
     485    HRESULT trySetRegistered (BOOL aRegistered);
     486    HRESULT getAccessible (Bstr &aAccessError);
     487
     488    HRESULT saveSettings (CFGNODE aHDNode, CFGNODE aStorageNode);
     489
     490    void updatePath (const char *aOldPath, const char *aNewPath);
     491
     492    Bstr toString (bool aShort = false);
     493
     494    HRESULT cloneToImage (const Guid &aId, const Utf8Str &aTargetPath,
     495                          Progress *aProgress);
     496    HRESULT createDiffImage (const Guid &aId, const Utf8Str &aTargetPath,
     497                             Progress *aProgress);
     498
     499    // for VirtualBoxSupportErrorInfoImpl
     500    static const wchar_t *getComponentName() { return L"VMDKImage"; }
     501
     502private:
     503
     504    HRESULT setFilePath (const BSTR aFilePath);
     505    HRESULT queryInformation (Bstr *aAccessError);
     506    HRESULT createImage (ULONG64 aSize, BOOL aDynamic, IProgress **aProgress);
     507
     508    /** VDI asynchronous operation thread function */
     509    static DECLCALLBACK(int) vdiTaskThread (RTTHREAD thread, void *pvUser);
     510
     511    enum State
     512    {
     513        NotCreated,
     514        Created,
     515        /* the following must be greater than Created */
     516        Accessible,
     517    };
     518
     519    State mState;
     520   
     521    RTSEMEVENTMULTI mStateCheckSem;
     522    ULONG mStateCheckWaiters;
     523
     524    Bstr mDescription;
     525
     526    ULONG64 mSize;
     527    ULONG64 mActualSize;
     528
     529    Bstr mFilePath;
     530    Bstr mFilePathFull;
     531
     532    friend class HardDisk;
     533};
     534
    426535
    427536COM_DECL_READONLY_ENUM_AND_COLLECTION (HardDisk)
  • trunk/src/VBox/Main/include/VirtualBoxImpl.h

    r606 r953  
    138138
    139139    STDMETHOD(CreateHardDisk) (HardDiskStorageType_T aStorageType, IHardDisk **aHardDisk);
     140    STDMETHOD(OpenHardDisk) (INPTR BSTR aLocation, IHardDisk **aHardDisk);
    140141    STDMETHOD(OpenVirtualDiskImage) (INPTR BSTR aFilePath, IVirtualDiskImage **aImage);
    141142    STDMETHOD(RegisterHardDisk) (IHardDisk *aHardDisk);
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