VirtualBox

Changeset 44393 in vbox for trunk/src/VBox/Main/src-client


Ignore:
Timestamp:
Jan 25, 2013 9:21:05 PM (12 years ago)
Author:
vboxsync
svn:sync-xref-src-repo-rev:
83364
Message:

VM,++: Changed the VM callbacks (at error, at runtime error, at state change) to use PUVM instead of PVM.

Location:
trunk/src/VBox/Main/src-client
Files:
3 edited

Legend:

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

    r44374 r44393  
    38993899        {
    39003900            /* too bad, we failed. try to sync the console state with the VMM state */
    3901             vmstateChangeCallback(VMR3GetVM(pUVM), VMSTATE_SUSPENDED, enmVMState, pConsole);
     3901            vmstateChangeCallback(pUVM, VMSTATE_SUSPENDED, enmVMState, pConsole);
    39023902        }
    39033903        /// @todo (r=dmik) if we failed with drive mount, then the VMR3Resume
     
    41444144        {
    41454145            /* too bad, we failed. try to sync the console state with the VMM state */
    4146             vmstateChangeCallback(VMR3GetVM(pUVM), VMSTATE_SUSPENDED, enmVMState, pConsole);
    4147         }
    4148         /** @todo: if we failed with drive mount, then the VMR3Resume
     4146            vmstateChangeCallback(pUVM, VMSTATE_SUSPENDED, enmVMState, pConsole);
     4147        }
     4148        /** @todo  if we failed with drive mount, then the VMR3Resume
    41494149         * error (if any) will be hidden from the caller. For proper reporting
    41504150         * of such multiple errors to the caller we need to enhance the
     
    43974397        {
    43984398            /* too bad, we failed. try to sync the console state with the VMM state */
    4399             vmstateChangeCallback(VMR3GetVM(pUVM), VMSTATE_SUSPENDED, enmVMState, pConsole);
     4399            vmstateChangeCallback(pUVM, VMSTATE_SUSPENDED, enmVMState, pConsole);
    44004400        }
    44014401        /** @todo: if we failed with drive mount, then the VMR3Resume
     
    47754775        {
    47764776            /* too bad, we failed. try to sync the console state with the VMM state */
    4777             vmstateChangeCallback(VMR3GetVM(pUVM), VMSTATE_SUSPENDED, enmVMState, pThis);
     4777            vmstateChangeCallback(pUVM, VMSTATE_SUSPENDED, enmVMState, pThis);
    47784778        }
    47794779        /// @todo (r=dmik) if we failed with drive mount, then the VMR3Resume
     
    57515751            /* too bad, we failed. try to sync the console state with the VMM state */
    57525752            AssertLogRelRC(vrc2);
    5753             vmstateChangeCallback(ptrVM.raw(), VMSTATE_SUSPENDED, enmVMState, this);
     5753            vmstateChangeCallback(ptrVM.rawUVM(), VMSTATE_SUSPENDED, enmVMState, this);
    57545754        }
    57555755    }
     
    58275827        {
    58285828            /* too bad, we failed. try to sync the console state with the VMM state */
    5829             vmstateChangeCallback(ptrVM.raw(), VMSTATE_SUSPENDED, enmVMState, this);
     5829            vmstateChangeCallback(ptrVM.rawUVM(), VMSTATE_SUSPENDED, enmVMState, this);
    58305830        }
    58315831    }
     
    74967496}
    74977497
    7498 /**
    7499  * VM state callback function. Called by the VMM
    7500  * using its state machine states.
    7501  *
    7502  * Primarily used to handle VM initiated power off, suspend and state saving,
    7503  * but also for doing termination completed work (VMSTATE_TERMINATE).
    7504  *
    7505  * In general this function is called in the context of the EMT.
    7506  *
    7507  * @param   aVM         The VM handle.
    7508  * @param   aState      The new state.
    7509  * @param   aOldState   The old state.
    7510  * @param   aUser       The user argument (pointer to the Console object).
    7511  *
    7512  * @note Locks the Console object for writing.
     7498/** @callback_method_impl{FNVMATSTATE}
     7499 *
     7500 * @note    Locks the Console object for writing.
     7501 * @remarks The @a pUVM parameter can be NULL in one case where powerUpThread()
     7502 *          calls after the VM was destroyed.
    75137503 */
    7514 DECLCALLBACK(void) Console::vmstateChangeCallback(PVM aVM,
    7515                                                   VMSTATE aState,
    7516                                                   VMSTATE aOldState,
    7517                                                   void *aUser)
    7518 {
    7519     LogFlowFunc(("Changing state from %s to %s (aVM=%p)\n",
    7520                  VMR3GetStateName(aOldState), VMR3GetStateName(aState), aVM));
    7521 
    7522     Console *that = static_cast<Console *>(aUser);
     7504DECLCALLBACK(void) Console::vmstateChangeCallback(PUVM pUVM, VMSTATE enmState, VMSTATE enmOldState, void *pvUser)
     7505{
     7506    LogFlowFunc(("Changing state from %s to %s (pUVM=%p)\n",
     7507                 VMR3GetStateName(enmOldState), VMR3GetStateName(enmState),     pUVM));
     7508
     7509    Console *that = static_cast<Console *>(pvUser);
    75237510    AssertReturnVoid(that);
    75247511
     
    75327519                     || autoCaller.state() == InUninit);
    75337520
    7534     switch (aState)
     7521    switch (enmState)
    75357522    {
    75367523        /*
     
    76207607                break;
    76217608
    7622             /* Terminate host interface networking. If aVM is NULL, we've been
     7609            /* Terminate host interface networking. If pUVM is NULL, we've been
    76237610             * manually called from powerUpThread() either before calling
    76247611             * VMR3Create() or after VMR3Create() failed, so no need to touch
    76257612             * networking.
    76267613             */
    7627             if (aVM)
     7614            if (pUVM)
    76287615                that->powerDownHostInterfaces();
    76297616
     
    77407727
    77417728                default:
    7742                     AssertMsgFailed(("%s/%s -> %s\n", Global::stringifyMachineState(that->mMachineState), VMR3GetStateName(aOldState),  VMR3GetStateName(aState) ));
     7729                    AssertMsgFailed(("%s/%s -> %s\n", Global::stringifyMachineState(that->mMachineState), VMR3GetStateName(enmOldState),  VMR3GetStateName(enmState) ));
    77437730                    that->setMachineState(MachineState_Paused);
    77447731                    break;
     
    77497736        case VMSTATE_RUNNING:
    77507737        {
    7751             if (   aOldState == VMSTATE_POWERING_ON
    7752                 || aOldState == VMSTATE_RESUMING
    7753                 || aOldState == VMSTATE_RUNNING_FT)
     7738            if (   enmOldState == VMSTATE_POWERING_ON
     7739                || enmOldState == VMSTATE_RESUMING
     7740                || enmOldState == VMSTATE_RUNNING_FT)
    77547741            {
    77557742                AutoWriteLock alock(that COMMA_LOCKVAL_SRC_POS);
     
    77607747                Assert(   (   (   that->mMachineState == MachineState_Starting
    77617748                               || that->mMachineState == MachineState_Paused)
    7762                            && aOldState == VMSTATE_POWERING_ON)
     7749                           && enmOldState == VMSTATE_POWERING_ON)
    77637750                       || (   (   that->mMachineState == MachineState_Restoring
    77647751                               || that->mMachineState == MachineState_TeleportingIn
     
    77667753                               || that->mMachineState == MachineState_Saving
    77677754                              )
    7768                            && aOldState == VMSTATE_RESUMING)
     7755                           && enmOldState == VMSTATE_RESUMING)
    77697756                       || (   that->mMachineState == MachineState_FaultTolerantSyncing
    7770                            && aOldState == VMSTATE_RUNNING_FT));
     7757                           && enmOldState == VMSTATE_RUNNING_FT));
    77717758
    77727759                that->setMachineState(MachineState_Running);
     
    77797766            AssertMsg(   that->mMachineState == MachineState_LiveSnapshotting
    77807767                      || that->mMachineState == MachineState_Teleporting,
    7781                       ("%s/%s -> %s\n", Global::stringifyMachineState(that->mMachineState), VMR3GetStateName(aOldState),  VMR3GetStateName(aState) ));
     7768                      ("%s/%s -> %s\n", Global::stringifyMachineState(that->mMachineState), VMR3GetStateName(enmOldState),  VMR3GetStateName(enmState) ));
    77827769            break;
    77837770
    77847771        case VMSTATE_RUNNING_FT:
    77857772            AssertMsg(that->mMachineState == MachineState_FaultTolerantSyncing,
    7786                       ("%s/%s -> %s\n", Global::stringifyMachineState(that->mMachineState), VMR3GetStateName(aOldState),  VMR3GetStateName(aState) ));
     7773                      ("%s/%s -> %s\n", Global::stringifyMachineState(that->mMachineState), VMR3GetStateName(enmOldState),  VMR3GetStateName(enmState) ));
    77877774            break;
    77887775
     
    84088395 * and VMR3Teleport.
    84098396 *
    8410  * @param   pVM         The VM handle.
     8397 * @param   pUVM        The user mode VM handle.
    84118398 * @param   uPercent    Completion percentage (0-100).
    84128399 * @param   pvUser      Pointer to an IProgress instance.
     
    84148401 */
    84158402/*static*/
    8416 DECLCALLBACK(int) Console::stateProgressCallback(PVM pVM, unsigned uPercent, void *pvUser)
     8403DECLCALLBACK(int) Console::stateProgressCallback(PUVM pUVM, unsigned uPercent, void *pvUser)
    84178404{
    84188405    IProgress *pProgress = static_cast<IProgress *>(pvUser);
     
    84228409        pProgress->SetCurrentOperationProgress(uPercent);
    84238410
     8411    NOREF(pUVM);
    84248412    return VINF_SUCCESS;
    84258413}
     
    84328420 */
    84338421/*static*/ DECLCALLBACK(void)
    8434 Console::genericVMSetErrorCallback(PVM pVM, void *pvUser, int rc, RT_SRC_POS_DECL,
     8422Console::genericVMSetErrorCallback(PUVM pUVM, void *pvUser, int rc, RT_SRC_POS_DECL,
    84358423                                   const char *pszErrorFmt, va_list va)
    84368424{
     
    84508438
    84518439    va_end(va2);
     8440
     8441    NOREF(pUVM);
    84528442}
    84538443
     
    84568446 * See VMSetRuntimeError for the detailed description of parameters.
    84578447 *
    8458  * @param   pVM             The VM handle.  Ignored, so passing NULL is fine.
     8448 * @param   pUVM            The user mode VM handle.  Ignored, so passing NULL
     8449 *                          is fine.
    84598450 * @param   pvUser          The user argument, pointer to the Console instance.
    84608451 * @param   fFlags          The action flags. See VMSETRTERR_FLAGS_*.
     
    84658456 */
    84668457/* static */ DECLCALLBACK(void)
    8467 Console::setVMRuntimeErrorCallback(PVM pVM, void *pvUser, uint32_t fFlags,
     8458Console::setVMRuntimeErrorCallback(PUVM pUVM, void *pvUser, uint32_t fFlags,
    84688459                                   const char *pszErrorId,
    84698460                                   const char *pszFormat, va_list va)
     
    84788469
    84798470    LogRel(("Console: VM runtime error: fatal=%RTbool, errorID=%s message=\"%s\"\n",
    8480              fFatal, pszErrorId, message.c_str()));
    8481 
    8482     that->onRuntimeError(BOOL(fFatal), Bstr(pszErrorId).raw(),
    8483                          Bstr(message).raw());
    8484 
    8485     LogFlowFuncLeave();
     8471            fFatal, pszErrorId, message.c_str()));
     8472
     8473    that->onRuntimeError(BOOL(fFatal), Bstr(pszErrorId).raw(), Bstr(message).raw());
     8474
     8475    LogFlowFuncLeave(); NOREF(pUVM);
    84868476}
    84878477
     
    91529142
    91539143        Assert(pConsole->mpUVM == NULL);
    9154         vmstateChangeCallback(NULL, VMSTATE_TERMINATED, VMSTATE_CREATING,
    9155                               pConsole);
     9144        vmstateChangeCallback(NULL, VMSTATE_TERMINATED, VMSTATE_CREATING, pConsole);
    91569145    }
    91579146
  • trunk/src/VBox/Main/src-client/ConsoleImpl2.cpp

    r44387 r44393  
    161161    for (int i = 0; i < 2; i++)
    162162    {
    163         inputStruct.key = (uint32_t)((i == 0) ? 'OSK0' : 'OSK1');
     163        inputStruct.key = (uint32_t)(i == 0 ? 'OSK0' : 'OSK1');
    164164        kr = IOConnectCallStructMethod((mach_port_t)port,
    165165                                       (uint32_t)2,
  • trunk/src/VBox/Main/src-client/ConsoleImplTeleporter.cpp

    r44347 r44393  
    585585 * @copydoc PFNVMPROGRESS
    586586 */
    587 static DECLCALLBACK(int) teleporterProgressCallback(PVM pVM, unsigned uPercent, void *pvUser)
     587static DECLCALLBACK(int) teleporterProgressCallback(PUVM pUVM, unsigned uPercent, void *pvUser)
    588588{
    589589    TeleporterState *pState = (TeleporterState *)pvUser;
     
    604604    }
    605605
     606    NOREF(pUVM);
    606607    return VINF_SUCCESS;
    607608}
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