VirtualBox

Changeset 35810 in vbox for trunk/src/VBox/VMM


Ignore:
Timestamp:
Feb 1, 2011 1:00:24 PM (14 years ago)
Author:
vboxsync
svn:sync-xref-src-repo-rev:
69788
Message:

VMM: Replace most VERR_VERSION_MISMATCH by more specific error statuses. Translating the errors returned by device, driver and USB device constructors into specific ones for the benefit of old extension pack and misc use of the status.

Location:
trunk/src/VBox/VMM
Files:
6 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/VMM/VMMR0/VMMR0.cpp

    r35346 r35810  
    210210        LogRel(("VMMR0InitVM: Revision mismatch, r3=%d r0=%d\n", uSvnRev, VMMGetSvnRev()));
    211211        SUPR0Printf("VMMR0InitVM: Revision mismatch, r3=%d r0=%d\n", uSvnRev, VMMGetSvnRev());
    212         return VERR_VERSION_MISMATCH;
     212        return VERR_VMM_R0_VERSION_MISMATCH;
    213213    }
    214214    if (    !VALID_PTR(pVM)
  • trunk/src/VBox/VMM/VMMR3/PDMDevice.cpp

    r35346 r35810  
    404404            paDevs[i].pDev->cInstances--;
    405405            /* because we're damn lazy right now, we'll say that the destructor will be called even if the constructor fails. */
    406             return rc;
     406            return rc == VERR_VERSION_MISMATCH ? VERR_PDM_DEVICE_VERSION_MISMATCH : rc;
    407407        }
    408408    } /* for device instances */
  • trunk/src/VBox/VMM/VMMR3/PDMDriver.cpp

    r35346 r35810  
    508508                    }
    509509                    else
     510                    {
    510511                        pdmR3DrvDestroyChain(pNew, PDM_TACH_FLAGS_NO_CALLBACKS);
     512                        if (rc == VERR_VERSION_MISMATCH)
     513                            rc = VERR_PDM_DRIVER_VERSION_MISMATCH;
     514                    }
    511515                }
    512516                else
  • trunk/src/VBox/VMM/VMMR3/PDMUsb.cpp

    r35346 r35810  
    637637    }
    638638    else
     639    {
    639640        AssertMsgFailed(("Failed to construct '%s'/%d! %Rra\n", pUsbIns->pReg->szName, pUsbIns->iInstance, rc));
     641        if (rc == VERR_VERSION_MISMATCH)
     642            rc = VERR_PDM_DRIVER_VERSION_MISMATCH;
     643    }
    640644    if (fAtRuntime)
    641645        pdmR3UsbDestroyDevice(pVM, pUsbIns);
  • trunk/src/VBox/VMM/VMMR3/VM.cpp

    r35794 r35810  
    269269
    270270            /*
    271              * An error occurred during VM creation. Set the error message directly
    272              * using the initial callback, as the callback list doesn't exist yet.
     271             * An error occurred during VM creation.  Set the error message directly
     272             * using the initial callback, as the callback list might not exist yet.
    273273             */
    274             const char *pszError = NULL;
     274            const char *pszError;
    275275            switch (rc)
    276276            {
     
    298298                    pszError = N_("VirtualBox can't enable the AMD-V extension. Please close all other virtualization programs.");
    299299#endif
    300                     break;
    301 
    302                 case VERR_VERSION_MISMATCH:
    303                     pszError = N_("VMMR0 driver version mismatch:\n"
    304                                   "Either there is an older extension package installed which does not "
    305                                   "fit to this version of VirtualBox. In that case update the extension "
    306                                   "pack. Make sure to terminate all VMs before.\n"
    307                                   "Or VirtualBox was recently upgraded and there is still some process "
    308                                   "of the older version active. Please terminate all VMs, make sure that "
    309                                   "VBoxNetDHCP is not running and try again. If you still get this error, "
    310                                   "re-install VirtualBox");
    311300                    break;
    312301
     
    350339
    351340                default:
    352                     pszError = N_("Unknown error creating VM");
     341                    if (VMR3GetErrorCountU(pUVM) == 0)
     342                        pszError = RTErrGetFull(rc);
     343                    else
     344                        pszError = NULL; /* already set. */
    353345                    break;
    354346            }
    355             vmR3SetErrorU(pUVM, rc, RT_SRC_POS, pszError, rc);
     347            if (pszError)
     348                vmR3SetErrorU(pUVM, rc, RT_SRC_POS, pszError, rc);
    356349        }
    357350        else
     
    36523645VMMR3DECL(uint32_t) VMR3GetErrorCount(PVM pVM)
    36533646{
    3654     return pVM->pUVM->vm.s.cErrors;
     3647    AssertPtrReturn(pVM, 0);
     3648    return VMR3GetErrorCountU(pVM->pUVM);
     3649}
     3650
     3651
     3652/**
     3653 * Gets the number of errors raised via VMSetError.
     3654 *
     3655 * This can be used avoid double error messages.
     3656 *
     3657 * @returns The error count.
     3658 * @param   pVM             The VM handle.
     3659 */
     3660VMMR3DECL(uint32_t) VMR3GetErrorCountU(PUVM pUVM)
     3661{
     3662    AssertPtrReturn(pUVM, 0);
     3663    AssertReturn(pUVM->u32Magic == UVM_MAGIC, 0);
     3664    return pUVM->vm.s.cErrors;
    36553665}
    36563666
  • trunk/src/VBox/VMM/VMMRC/VMMRC.cpp

    r35346 r35810  
    7373             */
    7474            if (uArg != VMMGetSvnRev())
    75                 return VERR_VERSION_MISMATCH;
     75                return VERR_VMM_RC_VERSION_MISMATCH;
    7676
    7777            /*
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