VirtualBox

Changeset 24493 in vbox for trunk/src/VBox/Main


Ignore:
Timestamp:
Nov 9, 2009 11:59:49 AM (15 years ago)
Author:
vboxsync
Message:

API/Machine,Session: add a force mount parameter to MountMedium and the associated other places

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

Legend:

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

    r24441 r24493  
    27452745 *
    27462746 * @param aMediumAttachment The medium attachment with the new medium state.
     2747 * @param fForce            Force medium chance, if it is locked or not.
    27472748 *
    27482749 * @note Locks this object for writing.
    27492750 */
    2750 HRESULT Console::doMediumChange(IMediumAttachment *aMediumAttachment)
     2751HRESULT Console::doMediumChange(IMediumAttachment *aMediumAttachment, bool fForce)
    27512752{
    27522753    AutoCaller autoCaller(this);
     
    28202821    PVMREQ pReq;
    28212822    int vrc = VMR3ReqCall(mpVM, VMCPUID_ANY, &pReq, 0 /* no wait! */, VMREQFLAGS_VBOX_STATUS,
    2822                           (PFNRT)Console::changeDrive, 8,
    2823                           this, pszDevice, uInstance, uLun, !!fHostDrive, location.raw(), format.raw(), !!fPassthrough);
     2823                          (PFNRT)Console::changeDrive, 9,
     2824                          this, pszDevice, uInstance, uLun, !!fHostDrive, location.raw(), format.raw(), !!fPassthrough, fForce);
    28242825
    28252826    /* leave the lock before waiting for a result (EMT will call us back!) */
     
    28732874 */
    28742875DECLCALLBACK(int) Console::changeDrive(Console *pThis, const char *pszDevice, unsigned uInstance, unsigned uLun,
    2875                                        bool fHostDrive, const char *pszPath, const char *pszFormat, bool fPassthrough)
     2876                                       bool fHostDrive, const char *pszPath, const char *pszFormat, bool fPassthrough, bool fForce)
    28762877{
    28772878/// @todo change this to use the same code as in ConsoleImpl2.cpp
    2878     LogFlowFunc(("pThis=%p pszDevice=%p:{%s} uInstance=%u uLun=%u fHostDrive=%d pszPath=%p:{%s} pszFormat=%p:{%s} fPassthrough=%d\n",
    2879                  pThis, pszDevice, pszDevice, uInstance, uLun, fHostDrive, pszPath, pszPath, pszFormat, pszFormat, fPassthrough));
     2879    LogFlowFunc(("pThis=%p pszDevice=%p:{%s} uInstance=%u uLun=%u fHostDrive=%d pszPath=%p:{%s} pszFormat=%p:{%s} fPassthrough=%d fForce=%d\n",
     2880                 pThis, pszDevice, pszDevice, uInstance, uLun, fHostDrive, pszPath, pszPath, pszFormat, pszFormat, fPassthrough, fForce));
    28802881
    28812882    AssertReturn(pThis, VERR_INVALID_PARAMETER);
     
    29622963             * Unmount the media.
    29632964             */
    2964             rc = pIMount->pfnUnmount(pIMount, false);
     2965            rc = pIMount->pfnUnmount(pIMount, fForce);
    29652966            if (rc == VERR_PDM_MEDIA_NOT_MOUNTED)
    29662967                rc = VINF_SUCCESS;
     
    35263527 * @note Locks this object for writing.
    35273528 */
    3528 HRESULT Console::onMediumChange(IMediumAttachment *aMediumAttachment)
     3529HRESULT Console::onMediumChange(IMediumAttachment *aMediumAttachment, BOOL aForce)
    35293530{
    35303531    LogFlowThisFunc(("\n"));
     
    35453546    CheckComRCReturnRC(autoVMCaller.rc());
    35463547
    3547     rc = doMediumChange(aMediumAttachment);
     3548    rc = doMediumChange(aMediumAttachment, !!aForce);
    35483549
    35493550    /* notify console callbacks on success */
  • trunk/src/VBox/Main/MachineImpl.cpp

    r24490 r24493  
    27972797                                  LONG aControllerPort,
    27982798                                  LONG aDevice,
    2799                                   IN_BSTR aId)
     2799                                  IN_BSTR aId,
     2800                                  BOOL aForce)
    28002801{
    28012802    int rc = S_OK;
    2802     LogFlowThisFunc(("aControllerName=\"%ls\" aControllerPort=%ld aDevice=%ld\n",
    2803                      aControllerName, aControllerPort, aDevice));
     2803    LogFlowThisFunc(("aControllerName=\"%ls\" aControllerPort=%ld aDevice=%ld aForce=%d\n",
     2804                     aControllerName, aControllerPort, aDevice, aForce));
    28042805
    28052806    CheckComArgNotNull(aControllerName);
     
    28972898
    28982899    alock.unlock();
    2899     onMediumChange(pAttach);
     2900    onMediumChange(pAttach, aForce);
    29002901
    29012902    return rc;
     
    92149215 *  @note Locks this object for reading.
    92159216 */
    9216 HRESULT SessionMachine::onMediumChange(IMediumAttachment *aAttachment)
     9217HRESULT SessionMachine::onMediumChange(IMediumAttachment *aAttachment, BOOL aForce)
    92179218{
    92189219    LogFlowThisFunc(("\n"));
     
    92319232        return S_OK;
    92329233
    9233     return directControl->OnMediumChange(aAttachment);
     9234    return directControl->OnMediumChange(aAttachment, aForce);
    92349235}
    92359236
  • trunk/src/VBox/Main/SessionImpl.cpp

    r24079 r24493  
    558558}
    559559
    560 STDMETHODIMP Session::OnMediumChange(IMediumAttachment *aMediumAttachment)
     560STDMETHODIMP Session::OnMediumChange(IMediumAttachment *aMediumAttachment, BOOL aForce)
    561561{
    562562    LogFlowThisFunc(("\n"));
     
    569569    AssertReturn(mType == SessionType_Direct, VBOX_E_INVALID_OBJECT_STATE);
    570570
    571     return mConsole->onMediumChange(aMediumAttachment);
     571    return mConsole->onMediumChange(aMediumAttachment, aForce);
    572572}
    573573
  • trunk/src/VBox/Main/idl/VirtualBox.xidl

    r24490 r24493  
    40974097  <interface
    40984098     name="IMachine" extends="$unknown"
    4099      uuid="25472915-3da2-42f6-82f2-70a3bc74d73c"
     4099     uuid="c5669e1a-491a-4367-99c6-28110dd474c6"
    41004100     wsmap="managed"
    41014101     >
     
    48844884          currently mounted medium.</desc>
    48854885      </param>
     4886      <param name="force" type="boolean" dir="in">
     4887        <desc>Allows to force unmount/mount of a medium which is locked by
     4888          theDevice slot in the given port to attach the medium to.</desc>
     4889      </param>
    48864890    </method>
    48874891
     
    1251012514  <interface
    1251112515     name="IInternalSessionControl" extends="$unknown"
    12512      uuid="989e2c33-8dfa-437a-9a15-5ad441d50dbf"
     12516     uuid="f9aac6d0-41b3-46b7-bea4-6370b4036de6"
    1251312517     internal="yes"
    1251412518     wsmap="suppress"
     
    1267512679
    1267612680      <param name="mediumAttachment" type="IMediumAttachment" dir="in"/>
     12681      <param name="force" type="boolean" dir="in"/>
    1267712682    </method>
    1267812683
  • trunk/src/VBox/Main/include/ConsoleImpl.h

    r24353 r24493  
    178178    HRESULT onParallelPortChange (IParallelPort *aParallelPort);
    179179    HRESULT onStorageControllerChange ();
    180     HRESULT onMediumChange(IMediumAttachment *aMediumAttachment);
     180    HRESULT onMediumChange(IMediumAttachment *aMediumAttachment, BOOL aForce);
    181181    HRESULT onVRDPServerChange();
    182182    HRESULT onUSBControllerChange();
     
    441441                                          unsigned uInstance, unsigned uLun,
    442442                                          bool fHostDrive, const char *pszPath,
    443                                           const char *pszFormat, bool fPassthrough);
     443                                          const char *pszFormat, bool fPassthrough,
     444                                          bool fForce);
    444445    const char *controllerTypeToDev(StorageControllerType_T enmCtrlType);
    445446    HRESULT convertBusPortDeviceToLun(StorageBus_T enmBus, LONG port, LONG device, unsigned &uLun);
    446     HRESULT doMediumChange(IMediumAttachment *aMediumAttachment);
     447    HRESULT doMediumChange(IMediumAttachment *aMediumAttachment, bool fForce);
    447448
    448449#ifdef VBOX_DYNAMIC_NET_ATTACH
  • trunk/src/VBox/Main/include/MachineImpl.h

    r24490 r24493  
    586586    STDMETHOD(PassthroughDevice)(IN_BSTR aControllerName, LONG aControllerPort, LONG aDevice, BOOL aPassthrough);
    587587    STDMETHOD(MountMedium)(IN_BSTR aControllerName, LONG aControllerPort,
    588                            LONG aDevice, IN_BSTR aId);
     588                           LONG aDevice, IN_BSTR aId, BOOL aForce);
    589589    STDMETHOD(GetMedium)(IN_BSTR aControllerName, LONG aControllerPort, LONG aDevice,
    590590                         IMedium **aMedium);
     
    701701    virtual HRESULT onUSBControllerChange() { return S_OK; }
    702702    virtual HRESULT onStorageControllerChange() { return S_OK; }
    703     virtual HRESULT onMediumChange(IMediumAttachment * /* mediumAttachment */) { return S_OK; }
     703    virtual HRESULT onMediumChange(IMediumAttachment * /* mediumAttachment */, BOOL /* force */) { return S_OK; }
    704704    virtual HRESULT onSharedFolderChange() { return S_OK; }
    705705
     
    10081008    HRESULT onNetworkAdapterChange(INetworkAdapter *networkAdapter, BOOL changeAdapter);
    10091009    HRESULT onStorageControllerChange();
    1010     HRESULT onMediumChange(IMediumAttachment *aMediumAttachment);
     1010    HRESULT onMediumChange(IMediumAttachment *aMediumAttachment, BOOL aForce);
    10111011    HRESULT onSerialPortChange(ISerialPort *serialPort);
    10121012    HRESULT onParallelPortChange(IParallelPort *parallelPort);
  • trunk/src/VBox/Main/include/SessionImpl.h

    r23223 r24493  
    9595    STDMETHOD(OnParallelPortChange)(IParallelPort *parallelPort);
    9696    STDMETHOD(OnStorageControllerChange)();
    97     STDMETHOD(OnMediumChange)(IMediumAttachment *aMediumAttachment);
     97    STDMETHOD(OnMediumChange)(IMediumAttachment *aMediumAttachment, BOOL aForce);
    9898    STDMETHOD(OnVRDPServerChange)();
    9999    STDMETHOD(OnUSBControllerChange)();
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