VirtualBox

Changeset 24511 in vbox for trunk/src/VBox


Ignore:
Timestamp:
Nov 9, 2009 3:27:28 PM (15 years ago)
Author:
vboxsync
svn:sync-xref-src-repo-rev:
54606
Message:

Main/MediumAttchment: back out API change which changed the return type of the Controller attribute from string to IStorageController *

Location:
trunk/src/VBox
Files:
9 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Frontends/VirtualBox/src/VBoxConsoleWnd.cpp

    r24501 r24511  
    21712171    Assert (mediumType != VBoxDefs::MediumType_Invalid);
    21722172
    2173     const CMediumAttachmentVector &attachments = mSession.GetMachine().GetMediumAttachments();
     2173    CMachine machine = mSession.GetMachine();
     2174    const CMediumAttachmentVector &attachments = machine.GetMediumAttachments();
    21742175    foreach (const CMediumAttachment &attachment, attachments)
    21752176    {
    2176         CStorageController controller = attachment.GetController();
     2177        CStorageController controller = machine.GetStorageControllerByName (attachment.GetController());
    21772178        if (   !controller.isNull()
    21782179            && (attachment.GetType() == deviceType))
  • trunk/src/VBox/Frontends/VirtualBox/src/VBoxMediaManagerDlg.cpp

    r24493 r24511  
    11791179                if (attachment.GetMedium().GetId() == aMedium.id())
    11801180                {
    1181                     CStorageController controller = attachment.GetController();
    1182                     machine.DetachDevice (controller.GetName(), attachment.GetPort(), attachment.GetDevice());
     1181                    machine.DetachDevice (attachment.GetController(), attachment.GetPort(), attachment.GetDevice());
    11831182                    if (!machine.isOk())
    11841183                    {
     1184                        CStorageController controller = machine.GetStorageControllerByName (attachment.GetController());
    11851185                        vboxProblem().cannotDetachDevice (this, machine, VBoxDefs::MediumType_HardDisk, aMedium.location(),
    11861186                                                          controller.GetBus(), attachment.GetPort(), attachment.GetDevice());
     
    12021202                if (medium.id() == aMedium.id())
    12031203                {
    1204                     machine.MountMedium (attachment.GetController().GetName(), attachment.GetPort(), attachment.GetDevice(), QString(""), false /* force */);
     1204                    machine.MountMedium (attachment.GetController(), attachment.GetPort(), attachment.GetDevice(), QString(""), false /* force */);
    12051205                    if (!machine.isOk())
    12061206                    {
     1207                        CStorageController controller = machine.GetStorageControllerByName (attachment.GetController());
    12071208                        vboxProblem().cannotUnmountMedium (this, machine, aMedium);
    12081209                        success = false;
     
    12231224                if (medium.id() == aMedium.id())
    12241225                {
    1225                     machine.MountMedium (attachment.GetController().GetName(), attachment.GetPort(), attachment.GetDevice(), QString(""), false /* force */);
     1226                    machine.MountMedium (attachment.GetController(), attachment.GetPort(), attachment.GetDevice(), QString(""), false /* force */);
    12261227                    if (!machine.isOk())
    12271228                    {
     1229                        CStorageController controller = machine.GetStorageControllerByName (attachment.GetController());
    12281230                        vboxProblem().cannotUnmountMedium (this, machine, aMedium);
    12291231                        success = false;
  • trunk/src/VBox/Frontends/VirtualBox/src/VBoxSelectorWnd.cpp

    r24301 r24511  
    911911            {
    912912                CMediumAttachment hda = vec [i];
    913                 CStorageController controller = hda.GetController();
    914                 machine.DetachDevice(controller.GetName(), hda.GetPort(), hda.GetDevice());
     913                const QString ctlName = hda.GetController();
     914
     915                machine.DetachDevice(ctlName, hda.GetPort(), hda.GetDevice());
    915916                if (!machine.isOk())
    916917                {
     918                    CStorageController ctl = machine.GetStorageControllerByName(ctlName);
    917919                    vboxProblem().cannotDetachDevice (this, machine, VBoxDefs::MediumType_HardDisk,
    918920                        vboxGlobal().getMedium (CMedium (hda.GetMedium())).location(),
    919                         controller.GetBus(), hda.GetPort(), hda.GetDevice());
     921                        ctl.GetBus(), hda.GetPort(), hda.GetDevice());
    920922                }
    921923            }
  • trunk/src/VBox/Main/ApplianceImpl.cpp

    r24494 r24511  
    44464446            ComPtr<IMedium> pMedium;
    44474447            ComPtr<IStorageController> ctl;
    4448 
    4449             rc = pHDA->COMGETTER(Controller)(ctl.asOutParam());
     4448            Bstr controllerName;
     4449
     4450            rc = pHDA->COMGETTER(Controller)(controllerName.asOutParam());
     4451            if (FAILED(rc)) throw rc;
     4452
     4453            rc = GetStorageControllerByName(controllerName, ctl.asOutParam());
    44504454            if (FAILED(rc)) throw rc;
    44514455
  • trunk/src/VBox/Main/ConsoleImpl.cpp

    r24493 r24511  
    27692769    rc = mMachine->COMGETTER(StorageControllers)(ComSafeArrayAsOutParam(ctrls));
    27702770    AssertComRC(rc);
     2771    Bstr attCtrlName;
     2772    rc = aMediumAttachment->COMGETTER(Controller)(attCtrlName.asOutParam());
     2773    AssertComRC(rc);
    27712774    ComPtr<IStorageController> ctrl;
    2772     rc = aMediumAttachment->COMGETTER(Controller)(ctrl.asOutParam());
    2773     AssertComRC(rc);
     2775    for (size_t i = 0; i < ctrls.size(); ++i)
     2776    {
     2777        Bstr ctrlName;
     2778        rc = ctrls[i]->COMGETTER(Name)(ctrlName.asOutParam());
     2779        AssertComRC(rc);
     2780        if (attCtrlName == ctrlName)
     2781        {
     2782            ctrl = ctrls[i];
     2783            break;
     2784        }
     2785    }
     2786    if (ctrl.isNull())
     2787    {
     2788        return setError(E_FAIL,
     2789                        tr("Could not find storage controller '%ls'"), attCtrlName.raw());
     2790    }
    27742791    StorageControllerType_T enmCtrlType;
    27752792    rc = ctrl->COMGETTER(ControllerType)(&enmCtrlType);
     
    73217338            {
    73227339                ComPtr<IStorageController> controller;
     7340                BSTR controllerName;
    73237341                ULONG lInstance;
    73247342                StorageControllerType_T enmController;
     
    73297347                * so we have to query needed values here and pass them.
    73307348                */
    7331                 rc = atts[i]->COMGETTER(Controller)(controller.asOutParam());
     7349                rc = atts[i]->COMGETTER(Controller)(&controllerName);
     7350                if (FAILED(rc))
     7351                    break;
     7352
     7353                rc = that->mMachine->GetStorageControllerByName(controllerName, controller.asOutParam());
    73327354                if (FAILED(rc)) throw rc;
     7355
    73337356                rc = controller->COMGETTER(ControllerType)(&enmController);
    7334                 if (FAILED (rc)) throw rc;
    73357357                rc = controller->COMGETTER(Instance)(&lInstance);
    7336                 if (FAILED (rc)) throw rc;
    73377358
    73387359                /*
  • trunk/src/VBox/Main/MachineImpl.cpp

    r24493 r24511  
    25842584                         * descendant of medium will be used
    25852585                         */
    2586                         if (pAttach->matches(aControllerName, aControllerPort, aDevice))
     2586                        if (    (*it)->device() == aDevice
     2587                             && (*it)->port() == aControllerPort
     2588                             && (*it)->controllerName() == aControllerName
     2589                           )
    25872590                        {
    25882591                            foundIt = it;
     
    38723875         ++it)
    38733876    {
    3874         if (Bstr((*it)->controllerName()) == aName)
     3877        if ((*it)->controllerName() == aName)
    38753878            return setError(VBOX_E_OBJECT_IN_USE,
    38763879                            tr("Storage controller named '%ls' has still devices attached"),
     
    60406043            break;
    60416044
     6045        const Bstr controllerName = aStorageController->name();
    60426046        ComObjPtr<MediumAttachment> pAttachment;
    60436047        pAttachment.createObject();
    60446048        rc = pAttachment->init(this,
    60456049                               medium,
    6046                                aStorageController->name(),
     6050                               controllerName,
    60476051                               dev.lPort,
    60486052                               dev.lDevice,
     
    61886192         ++it)
    61896193    {
    6190         if (Bstr((*it)->controllerName()) == aName)
     6194        if ((*it)->controllerName() == aName)
    61916195            atts.push_back(*it);
    61926196    }
  • trunk/src/VBox/Main/MediumAttachmentImpl.cpp

    r24401 r24511  
    180180}
    181181
    182 STDMETHODIMP MediumAttachment::COMGETTER(Controller)(IStorageController **aController)
     182STDMETHODIMP MediumAttachment::COMGETTER(Controller)(BSTR *aController)
    183183{
    184184    LogFlowThisFuncEnter();
     
    190190
    191191    /* m->controller is constant during life time, no need to lock */
    192     /** @todo ugly hack, MediumAttachment should have a direct reference
    193      * to the storage controller, but can't have that right now due to
    194      * how objects are created for settings rollback support. */
    195     HRESULT rc = E_FAIL;
    196 
    197     if (mParent)
    198         rc = mParent->GetStorageControllerByName(m->controllerName, aController);
    199 
    200     LogFlowThisFuncLeave();
    201     return rc;
     192    m->controllerName.cloneTo(aController);
     193
     194    LogFlowThisFuncLeave();
     195    return S_OK;
    202196}
    203197
  • trunk/src/VBox/Main/idl/VirtualBox.xidl

    r24493 r24511  
    87808780  <interface
    87818781    name="IMediumAttachment" extends="$unknown"
    8782     uuid="7bb6ac41-8c03-4863-9eea-d9c76561b8d1"
     8782    uuid="e58eb3eb-8627-428b-bdf8-34487c848de5"
    87838783    wsmap="struct"
    87848784  >
     
    88008800    </attribute>
    88018801
    8802     <attribute name="controller" type="IStorageController" readonly="yes">
    8803       <desc>Storage controller object to which this attachment belongs.</desc>
     8802    <attribute name="controller" type="wstring" readonly="yes">
     8803      <desc>Name of the storage controller of this attachment; this
     8804        refers to one of the controllers in <link to="IMachine::storageControllers" />
     8805        by name.</desc>
    88048806    </attribute>
    88058807
  • trunk/src/VBox/Main/include/MediumAttachmentImpl.h

    r24160 r24511  
    2626
    2727#include "MediumImpl.h"
    28 #include "StorageControllerImpl.h"
    2928
    3029class Machine;
     
    6968    // IMediumAttachment properties
    7069    STDMETHOD(COMGETTER(Medium))(IMedium **aMedium);
    71     STDMETHOD(COMGETTER(Controller))(IStorageController **aController);
     70    STDMETHOD(COMGETTER(Controller))(BSTR *aController);
    7271    STDMETHOD(COMGETTER(Port))(LONG *aPort);
    7372    STDMETHOD(COMGETTER(Device))(LONG *aDevice);
     
    136135         * to the old, uninitialized instance. Changing this requires
    137136         * substantial changes to MediumImpl.cpp. */
    138         Bstr controllerName;
     137        const Bstr controllerName;
    139138        const LONG port;
    140139        const LONG device;
Note: See TracChangeset for help on using the changeset viewer.

© 2025 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette