MediumImpl.h revision ad9723bdd9a951b0ba2f4338f03cad23c7ff7f3d
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync/* $Id$ */
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync/** @file
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync *
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync * VirtualBox COM class implementation
1e29d016a09a61485fda74f7fca39e171ff5dda8vboxsync */
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync/*
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync * Copyright (C) 2008-2010 Oracle Corporation
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync *
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync * This file is part of VirtualBox Open Source Edition (OSE), as
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync * available from http://www.virtualbox.org. This file is free software;
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync * you can redistribute it and/or modify it under the terms of the GNU
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync * General Public License (GPL) as published by the Free Software
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync * Foundation, in version 2 as it comes in the "COPYING" file of the
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync * VirtualBox OSE distribution. VirtualBox OSE is distributed in the
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync * hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync */
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync#ifndef ____H_MEDIUMIMPL
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync#define ____H_MEDIUMIMPL
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync#include "VirtualBoxBase.h"
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync#include "MediumLock.h"
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsyncclass Progress;
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsyncclass MediumFormat;
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsyncnamespace settings
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync{
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync struct Medium;
7220367ea1944fa8a7694534401321ad86eb70c6vboxsync}
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync////////////////////////////////////////////////////////////////////////////////
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync/**
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync * Medium component class for all media types.
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync */
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsyncclass ATL_NO_VTABLE Medium :
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync public VirtualBoxBase,
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync public com::SupportErrorInfoImpl<Medium, IMedium>,
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync public VirtualBoxSupportTranslation<Medium>,
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync VBOX_SCRIPTABLE_IMPL(IMedium)
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync{
1e29d016a09a61485fda74f7fca39e171ff5dda8vboxsyncpublic:
1e29d016a09a61485fda74f7fca39e171ff5dda8vboxsync VIRTUALBOXBASE_ADD_ERRORINFO_SUPPORT(Medium)
1e29d016a09a61485fda74f7fca39e171ff5dda8vboxsync
1e29d016a09a61485fda74f7fca39e171ff5dda8vboxsync DECLARE_NOT_AGGREGATABLE(Medium)
1e29d016a09a61485fda74f7fca39e171ff5dda8vboxsync
1e29d016a09a61485fda74f7fca39e171ff5dda8vboxsync DECLARE_PROTECT_FINAL_CONSTRUCT()
1e29d016a09a61485fda74f7fca39e171ff5dda8vboxsync
1e29d016a09a61485fda74f7fca39e171ff5dda8vboxsync BEGIN_COM_MAP(Medium)
1e29d016a09a61485fda74f7fca39e171ff5dda8vboxsync COM_INTERFACE_ENTRY(ISupportErrorInfo)
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync COM_INTERFACE_ENTRY(IMedium)
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync COM_INTERFACE_ENTRY(IDispatch)
1e29d016a09a61485fda74f7fca39e171ff5dda8vboxsync END_COM_MAP()
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync DECLARE_EMPTY_CTOR_DTOR(Medium)
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync HRESULT FinalConstruct();
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync void FinalRelease();
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync enum HDDOpenMode { OpenReadWrite, OpenReadOnly };
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync // have to use a special enum for the overloaded init() below;
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync // can't use AccessMode_T from XIDL because that's mapped to an int
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync // and would be ambiguous
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync // public initializer/uninitializer for internal purposes only
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync HRESULT init(VirtualBox *aVirtualBox,
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync CBSTR aFormat,
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync CBSTR aLocation,
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync bool *pfNeedsSaveSettings);
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync HRESULT init(VirtualBox *aVirtualBox,
1e29d016a09a61485fda74f7fca39e171ff5dda8vboxsync CBSTR aLocation,
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync HDDOpenMode enOpenMode,
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync DeviceType_T aDeviceType,
1e29d016a09a61485fda74f7fca39e171ff5dda8vboxsync BOOL aSetImageId,
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync const Guid &aImageId,
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync BOOL aSetParentId,
1e29d016a09a61485fda74f7fca39e171ff5dda8vboxsync const Guid &aParentId);
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync // initializer used when loading settings
1e29d016a09a61485fda74f7fca39e171ff5dda8vboxsync HRESULT init(VirtualBox *aVirtualBox,
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync Medium *aParent,
1e29d016a09a61485fda74f7fca39e171ff5dda8vboxsync DeviceType_T aDeviceType,
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync const settings::Medium &data);
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync // initializer for host floppy/DVD
1e29d016a09a61485fda74f7fca39e171ff5dda8vboxsync HRESULT init(VirtualBox *aVirtualBox,
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync DeviceType_T aDeviceType,
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync CBSTR aLocation,
1e29d016a09a61485fda74f7fca39e171ff5dda8vboxsync CBSTR aDescription = NULL);
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync void uninit();
1e29d016a09a61485fda74f7fca39e171ff5dda8vboxsync
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync void deparent();
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync void setParent(const ComObjPtr<Medium> &pParent);
1e29d016a09a61485fda74f7fca39e171ff5dda8vboxsync
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync // IMedium properties
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync STDMETHOD(COMGETTER(Id))(BSTR *aId);
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync STDMETHOD(COMGETTER(Description))(BSTR *aDescription);
1e29d016a09a61485fda74f7fca39e171ff5dda8vboxsync STDMETHOD(COMSETTER(Description))(IN_BSTR aDescription);
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync STDMETHOD(COMGETTER(State))(MediumState_T *aState);
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync STDMETHOD(COMGETTER(Location))(BSTR *aLocation);
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync STDMETHOD(COMSETTER(Location))(IN_BSTR aLocation);
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync STDMETHOD(COMGETTER(Name))(BSTR *aName);
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync STDMETHOD(COMGETTER(DeviceType))(DeviceType_T *aDeviceType);
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync STDMETHOD(COMGETTER(HostDrive))(BOOL *aHostDrive);
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync STDMETHOD(COMGETTER(Size))(ULONG64 *aSize);
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync STDMETHOD(COMGETTER(Format))(BSTR *aFormat);
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync STDMETHOD(COMGETTER(MediumFormat))(IMediumFormat **aMediumFormat);
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync STDMETHOD(COMGETTER(Type))(MediumType_T *aType);
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync STDMETHOD(COMSETTER(Type))(MediumType_T aType);
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync STDMETHOD(COMGETTER(Parent))(IMedium **aParent);
1e29d016a09a61485fda74f7fca39e171ff5dda8vboxsync STDMETHOD(COMGETTER(Children))(ComSafeArrayOut(IMedium *, aChildren));
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync STDMETHOD(COMGETTER(Base))(IMedium **aBase);
1e29d016a09a61485fda74f7fca39e171ff5dda8vboxsync STDMETHOD(COMGETTER(ReadOnly))(BOOL *aReadOnly);
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync STDMETHOD(COMGETTER(LogicalSize))(ULONG64 *aLogicalSize);
1e29d016a09a61485fda74f7fca39e171ff5dda8vboxsync STDMETHOD(COMGETTER(AutoReset))(BOOL *aAutoReset);
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync STDMETHOD(COMSETTER(AutoReset))(BOOL aAutoReset);
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync STDMETHOD(COMGETTER(LastAccessError))(BSTR *aLastAccessError);
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync STDMETHOD(COMGETTER(MachineIds))(ComSafeArrayOut(BSTR, aMachineIds));
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync // IMedium methods
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync STDMETHOD(RefreshState)(MediumState_T *aState);
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync STDMETHOD(GetSnapshotIds)(IN_BSTR aMachineId,
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync ComSafeArrayOut(BSTR, aSnapshotIds));
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync STDMETHOD(LockRead)(MediumState_T *aState);
1e29d016a09a61485fda74f7fca39e171ff5dda8vboxsync STDMETHOD(UnlockRead)(MediumState_T *aState);
1e29d016a09a61485fda74f7fca39e171ff5dda8vboxsync STDMETHOD(LockWrite)(MediumState_T *aState);
1e29d016a09a61485fda74f7fca39e171ff5dda8vboxsync STDMETHOD(UnlockWrite)(MediumState_T *aState);
1e29d016a09a61485fda74f7fca39e171ff5dda8vboxsync STDMETHOD(Close)();
1e29d016a09a61485fda74f7fca39e171ff5dda8vboxsync STDMETHOD(GetProperty)(IN_BSTR aName, BSTR *aValue);
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync STDMETHOD(SetProperty)(IN_BSTR aName, IN_BSTR aValue);
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync STDMETHOD(GetProperties)(IN_BSTR aNames,
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync ComSafeArrayOut(BSTR, aReturnNames),
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync ComSafeArrayOut(BSTR, aReturnValues));
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync STDMETHOD(SetProperties)(ComSafeArrayIn(IN_BSTR, aNames),
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync ComSafeArrayIn(IN_BSTR, aValues));
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync STDMETHOD(CreateBaseStorage)(ULONG64 aLogicalSize,
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync MediumVariant_T aVariant,
1e29d016a09a61485fda74f7fca39e171ff5dda8vboxsync IProgress **aProgress);
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync STDMETHOD(DeleteStorage)(IProgress **aProgress);
1e29d016a09a61485fda74f7fca39e171ff5dda8vboxsync STDMETHOD(CreateDiffStorage)(IMedium *aTarget,
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync MediumVariant_T aVariant,
1e29d016a09a61485fda74f7fca39e171ff5dda8vboxsync IProgress **aProgress);
a2179871c3ee5a00079f273fbc72b6e2d704c68dvboxsync STDMETHOD(MergeTo)(IMedium *aTarget, IProgress **aProgress);
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync STDMETHOD(CloneTo)(IMedium *aTarget, MediumVariant_T aVariant,
1e29d016a09a61485fda74f7fca39e171ff5dda8vboxsync IMedium *aParent, IProgress **aProgress);
1e29d016a09a61485fda74f7fca39e171ff5dda8vboxsync STDMETHOD(Compact)(IProgress **aProgress);
1e29d016a09a61485fda74f7fca39e171ff5dda8vboxsync STDMETHOD(Resize)(ULONG64 aLogicalSize, IProgress **aProgress);
1e29d016a09a61485fda74f7fca39e171ff5dda8vboxsync STDMETHOD(Reset)(IProgress **aProgress);
e4c4f1dc57eeabb8863d43b128783766afee2000vboxsync
1e29d016a09a61485fda74f7fca39e171ff5dda8vboxsync // public methods for internal purposes only
1e29d016a09a61485fda74f7fca39e171ff5dda8vboxsync const ComObjPtr<Medium>& getParent() const;
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync const MediaList& getChildren() const;
1e29d016a09a61485fda74f7fca39e171ff5dda8vboxsync
1e29d016a09a61485fda74f7fca39e171ff5dda8vboxsync // unsafe methods for internal purposes only (ensure there is
1e29d016a09a61485fda74f7fca39e171ff5dda8vboxsync // a caller and a read lock before calling them!)
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync const Guid& getId() const;
1e29d016a09a61485fda74f7fca39e171ff5dda8vboxsync MediumState_T getState() const;
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync const Utf8Str& getLocation() const;
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync const Utf8Str& getLocationFull() const;
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync const Utf8Str& getFormat() const;
1e29d016a09a61485fda74f7fca39e171ff5dda8vboxsync const ComObjPtr<MediumFormat> & getMediumFormat() const;
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync uint64_t getSize() const;
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync MediumType_T getType() const;
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync Utf8Str getName();
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync
1e29d016a09a61485fda74f7fca39e171ff5dda8vboxsync HRESULT attachTo(const Guid &aMachineId,
1e29d016a09a61485fda74f7fca39e171ff5dda8vboxsync const Guid &aSnapshotId = Guid::Empty);
1e29d016a09a61485fda74f7fca39e171ff5dda8vboxsync HRESULT detachFrom(const Guid &aMachineId,
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync const Guid &aSnapshotId = Guid::Empty);
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync const Guid* getFirstMachineBackrefId() const;
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync const Guid* getFirstMachineBackrefSnapshotId() const;
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync#ifdef DEBUG
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync void dumpBackRefs();
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync#endif
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync HRESULT updatePath(const char *aOldPath, const char *aNewPath);
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync void updatePaths(const char *aOldPath, const char *aNewPath);
1e29d016a09a61485fda74f7fca39e171ff5dda8vboxsync
1e29d016a09a61485fda74f7fca39e171ff5dda8vboxsync ComObjPtr<Medium> getBase(uint32_t *aLevel = NULL);
1e29d016a09a61485fda74f7fca39e171ff5dda8vboxsync
1e29d016a09a61485fda74f7fca39e171ff5dda8vboxsync bool isReadOnly();
1e29d016a09a61485fda74f7fca39e171ff5dda8vboxsync
1e29d016a09a61485fda74f7fca39e171ff5dda8vboxsync HRESULT saveSettings(settings::Medium &data);
1e29d016a09a61485fda74f7fca39e171ff5dda8vboxsync
1e29d016a09a61485fda74f7fca39e171ff5dda8vboxsync HRESULT compareLocationTo(const char *aLocation, int &aResult);
1e29d016a09a61485fda74f7fca39e171ff5dda8vboxsync
1e29d016a09a61485fda74f7fca39e171ff5dda8vboxsync HRESULT createMediumLockList(bool fFailIfInaccessible,
1e29d016a09a61485fda74f7fca39e171ff5dda8vboxsync bool fMediumWritable,
1e29d016a09a61485fda74f7fca39e171ff5dda8vboxsync Medium *pToBeParent,
1e29d016a09a61485fda74f7fca39e171ff5dda8vboxsync MediumLockList &mediumLockList);
1e29d016a09a61485fda74f7fca39e171ff5dda8vboxsync
1e29d016a09a61485fda74f7fca39e171ff5dda8vboxsync HRESULT createDiffStorage(ComObjPtr<Medium> &aTarget,
1e29d016a09a61485fda74f7fca39e171ff5dda8vboxsync MediumVariant_T aVariant,
1e29d016a09a61485fda74f7fca39e171ff5dda8vboxsync MediumLockList *pMediumLockList,
1e29d016a09a61485fda74f7fca39e171ff5dda8vboxsync ComObjPtr<Progress> *aProgress,
1e29d016a09a61485fda74f7fca39e171ff5dda8vboxsync bool aWait,
1e29d016a09a61485fda74f7fca39e171ff5dda8vboxsync bool *pfNeedsSaveSettings);
1e29d016a09a61485fda74f7fca39e171ff5dda8vboxsync
1e29d016a09a61485fda74f7fca39e171ff5dda8vboxsync HRESULT deleteStorage(ComObjPtr<Progress> *aProgress, bool aWait, bool *pfNeedsSaveSettings);
1e29d016a09a61485fda74f7fca39e171ff5dda8vboxsync HRESULT markForDeletion();
1e29d016a09a61485fda74f7fca39e171ff5dda8vboxsync HRESULT unmarkForDeletion();
1e29d016a09a61485fda74f7fca39e171ff5dda8vboxsync HRESULT markLockedForDeletion();
1e29d016a09a61485fda74f7fca39e171ff5dda8vboxsync HRESULT unmarkLockedForDeletion();
1e29d016a09a61485fda74f7fca39e171ff5dda8vboxsync
1e29d016a09a61485fda74f7fca39e171ff5dda8vboxsync HRESULT prepareMergeTo(const ComObjPtr<Medium> &pTarget,
1e29d016a09a61485fda74f7fca39e171ff5dda8vboxsync const Guid *aMachineId,
1e29d016a09a61485fda74f7fca39e171ff5dda8vboxsync const Guid *aSnapshotId,
1e29d016a09a61485fda74f7fca39e171ff5dda8vboxsync bool fLockMedia,
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync bool &fMergeForward,
31771163041e3661403a806eb3382d2a165c003bvboxsync ComObjPtr<Medium> &pParentForTarget,
e3ddc294f1a80edb513f054d4c24ab79d7dfd3ddvboxsync MediaList &aChildrenToReparent,
e3ddc294f1a80edb513f054d4c24ab79d7dfd3ddvboxsync MediumLockList * &aMediumLockList);
31771163041e3661403a806eb3382d2a165c003bvboxsync HRESULT mergeTo(const ComObjPtr<Medium> &pTarget,
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync bool fMergeForward,
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync const ComObjPtr<Medium> &pParentForTarget,
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync const MediaList &aChildrenToReparent,
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync MediumLockList *aMediumLockList,
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync ComObjPtr<Progress> *aProgress,
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync bool aWait,
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync bool *pfNeedsSaveSettings);
7220367ea1944fa8a7694534401321ad86eb70c6vboxsync void cancelMergeTo(const MediaList &aChildrenToReparent,
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync MediumLockList *aMediumLockList);
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync
HRESULT fixParentUuidOfChildren(const MediaList &childrenToReparent);
/** Returns a preferred format for a differencing hard disk. */
Bstr preferredDiffFormat();
/** For com::SupportErrorInfoImpl. */
static const char *ComponentName() { return "Medium"; }
private:
HRESULT queryInfo();
/**
* Performs extra checks if the medium can be closed and returns S_OK in
* this case. Otherwise, returns a respective error message. Called by
* Close() under the medium tree lock and the medium lock.
*/
HRESULT canClose();
/**
* Unregisters this medium with mVirtualBox. Called by Close() under
* the medium tree lock.
*/
HRESULT unregisterWithVirtualBox(bool *pfNeedsSaveSettings);
HRESULT setStateError();
HRESULT setLocation(const Utf8Str &aLocation, const Utf8Str &aFormat = Utf8Str());
HRESULT setFormat(CBSTR aFormat);
Utf8Str vdError(int aVRC);
static DECLCALLBACK(void) vdErrorCall(void *pvUser, int rc, RT_SRC_POS_DECL,
const char *pszFormat, va_list va);
static DECLCALLBACK(bool) vdConfigAreKeysValid(void *pvUser,
const char *pszzValid);
static DECLCALLBACK(int) vdConfigQuerySize(void *pvUser, const char *pszName,
size_t *pcbValue);
static DECLCALLBACK(int) vdConfigQuery(void *pvUser, const char *pszName,
char *pszValue, size_t cchValue);
class Task;
class CreateBaseTask;
class CreateDiffTask;
class CloneTask;
class CompactTask;
class ResetTask;
class DeleteTask;
class MergeTask;
friend class Task;
friend class CreateBaseTask;
friend class CreateDiffTask;
friend class CloneTask;
friend class CompactTask;
friend class ResetTask;
friend class DeleteTask;
friend class MergeTask;
HRESULT startThread(Medium::Task *pTask);
HRESULT runNow(Medium::Task *pTask, bool *pfNeedsSaveSettings);
HRESULT taskCreateBaseHandler(Medium::CreateBaseTask &task);
HRESULT taskCreateDiffHandler(Medium::CreateDiffTask &task);
HRESULT taskMergeHandler(Medium::MergeTask &task);
HRESULT taskCloneHandler(Medium::CloneTask &task);
HRESULT taskDeleteHandler(Medium::DeleteTask &task);
HRESULT taskResetHandler(Medium::ResetTask &task);
HRESULT taskCompactHandler(Medium::CompactTask &task);
struct Data; // opaque data struct, defined in MediumImpl.cpp
Data *m;
};
#endif /* ____H_MEDIUMIMPL */