VirtualBox

Changeset 35810 in vbox


Ignore:
Timestamp:
Feb 1, 2011 1:00:24 PM (14 years ago)
Author:
vboxsync
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
Files:
12 edited

Legend:

Unmodified
Added
Removed
  • trunk/include/VBox/err.h

    r35592 r35810  
    932932/** Reason for leaving RZ: Illegal call to ring-3. */
    933933#define VERR_VMM_RING3_CALL_DISABLED        (-2703)
     934/** The VMMR0.r0 module version does not match VBoxVMM.dll/so/dylib.
     935 * If you just upgraded VirtualBox, please make terminate all VMs and make sure
     936 * VBoxNetDHCP is not running.  Then try again.  If this error persists, try
     937 * re-installing VirtualBox. */
     938#define VERR_VMM_R0_VERSION_MISMATCH        (-2704)
     939/** The VMMRC.rc module version does not match VBoxVMM.dll/so/dylib.
     940 * Re-install if you are a user.  Developers should make sure the build is
     941 * complete or try with a clean build. */
     942#define VERR_VMM_RC_VERSION_MISMATCH        (-2705)
    934943/** @} */
    935944
     
    11301139/** Too many instances of a usb device. */
    11311140#define VERR_PDM_TOO_MANY_USB_DEVICE_INSTANCES      (-2869)
     1141/** Too many instances of a usb device. */
     1142#define VERR_PDM_TOO_MANY_USB_DEVICE_INSTANCES      (-2869)
     1143/** The device instance structure version has changed.
     1144 *
     1145 * If you have upgraded VirtualBox recently, please make sure you have
     1146 * terminated all VMs and upgraded any extension packs.  If this error
     1147 * persists, try re-install VirtualBox. */
     1148#define VERR_PDM_DEVINS_VERSION_MISMATCH            (-2870)
     1149/** The device helper structure version has changed.
     1150 *
     1151 * If you have upgraded VirtualBox recently, please make sure you have
     1152 * terminated all VMs and upgraded any extension packs.  If this error
     1153 * persists, try re-install VirtualBox. */
     1154#define VERR_PDM_DEVHLPR3_VERSION_MISMATCH          (-2871)
     1155/** The USB device instance structure version has changed.
     1156 *
     1157 * If you have upgraded VirtualBox recently, please make sure you have
     1158 * terminated all VMs and upgraded any extension packs.  If this error
     1159 * persists, try re-install VirtualBox. */
     1160#define VERR_PDM_USBINS_VERSION_MISMATCH            (-2872)
     1161/** The USB device helper structure version has changed.
     1162 *
     1163 * If you have upgraded VirtualBox recently, please make sure you have
     1164 * terminated all VMs and upgraded any extension packs.  If this error
     1165 * persists, try re-install VirtualBox. */
     1166#define VERR_PDM_USBHLPR3_VERSION_MISMATCH          (-2873)
     1167/** The driver instance structure version has changed.
     1168 *
     1169 * If you have upgraded VirtualBox recently, please make sure you have
     1170 * terminated all VMs and upgraded any extension packs.  If this error
     1171 * persists, try re-install VirtualBox. */
     1172#define VERR_PDM_DRVINS_VERSION_MISMATCH            (-2874)
     1173/** The driver helper structure version has changed.
     1174 *
     1175 * If you have upgraded VirtualBox recently, please make sure you have
     1176 * terminated all VMs and upgraded any extension packs.  If this error
     1177 * persists, try re-install VirtualBox. */
     1178#define VERR_PDM_DRVHLPR3_VERSION_MISMATCH          (-2875)
     1179/** Generic device structure version mismatch.
     1180 *
     1181 * If you have upgraded VirtualBox recently, please make sure you have
     1182 * terminated all VMs and upgraded any extension packs.  If this error
     1183 * persists, try re-install VirtualBox. */
     1184#define VERR_PDM_DEVICE_VERSION_MISMATCH            (-2876)
     1185/** Generic USB device structure version mismatch.
     1186 *
     1187 * If you have upgraded VirtualBox recently, please make sure you have
     1188 * terminated all VMs and upgraded any extension packs.  If this error
     1189 * persists, try re-install VirtualBox. */
     1190#define VERR_PDM_USBDEV_VERSION_MISMATCH            (-2877)
     1191/** Generic driver structure version mismatch.
     1192 *
     1193 * If you have upgraded VirtualBox recently, please make sure you have
     1194 * terminated all VMs and upgraded any extension packs.  If this error
     1195 * persists, try re-install VirtualBox. */
     1196#define VERR_PDM_DRIVER_VERSION_MISMATCH            (-2878)
    11321197/** @} */
    11331198
     
    16601725 * Returned by the VBOXEXTPACKREG::pfnInstalled. */
    16611726#define VERR_EXTPACK_UNSUPPORTED_HOST_UNINSTALL     (-6000)
     1727/** The VirtualBox version is not supported by one of the extension packs.
     1728 *
     1729 * You have probably upgraded VirtualBox recently.  Please upgrade the
     1730 * extension packs to versions compatible with this VirtualBox release.
     1731 */
     1732#define VERR_EXTPACK_VBOX_VERSION_MISMATCH          (-6001)
    16621733/** @} */
    16631734
  • trunk/include/VBox/vmm/pdmdev.h

    r35738 r35810  
    38523852        AssertLogRelMsgReturn(PDM_VERSION_ARE_COMPATIBLE((pDevIns)->u32Version, PDM_DEVINS_VERSION), \
    38533853                              ("DevIns=%#x  mine=%#x\n", (pDevIns)->u32Version, PDM_DEVINS_VERSION), \
    3854                               VERR_VERSION_MISMATCH); \
     3854                              VERR_PDM_DEVINS_VERSION_MISMATCH); \
    38553855        AssertLogRelMsgReturn(PDM_VERSION_ARE_COMPATIBLE((pDevIns)->pHlpR3->u32Version, PDM_DEVHLPR3_VERSION), \
    38563856                              ("DevHlp=%#x  mine=%#x\n", (pDevIns)->pHlpR3->u32Version, PDM_DEVHLPR3_VERSION), \
    3857                               VERR_VERSION_MISMATCH); \
     3857                              VERR_PDM_DEVHLPR3_VERSION_MISMATCH); \
    38583858    } while (0)
    38593859
     
    38703870    { \
    38713871        PPDMDEVINS pDevInsTypeCheck = (pDevIns); NOREF(pDevInsTypeCheck); \
    3872         if (RT_UNLIKELY(   !PDM_VERSION_ARE_COMPATIBLE((pDevIns)->u32Version, PDM_DEVINS_VERSION) \
    3873                         || !PDM_VERSION_ARE_COMPATIBLE((pDevIns)->pHlpR3->u32Version, PDM_DEVHLPR3_VERSION) )) \
    3874             return VERR_VERSION_MISMATCH; \
     3872        if (RT_UNLIKELY(!PDM_VERSION_ARE_COMPATIBLE((pDevIns)->u32Version, PDM_DEVINS_VERSION) )) \
     3873            return VERR_PDM_DEVINS_VERSION_MISMATCH; \
     3874        if (RT_UNLIKELY(!PDM_VERSION_ARE_COMPATIBLE((pDevIns)->pHlpR3->u32Version, PDM_DEVHLPR3_VERSION) )) \
     3875            return VERR_PDM_DEVHLPR3_VERSION_MISMATCH; \
    38753876    } while (0)
    38763877
  • trunk/include/VBox/vmm/pdmdrv.h

    r35676 r35810  
    338338/** SCSI driver. */
    339339#define PDM_DRVREG_CLASS_SCSI           RT_BIT(15)
    340 /** Generic raw PCI device driver. */ 
    341 #define PDM_DRVREG_CLASS_PCIRAW         RT_BIT(16) 
     340/** Generic raw PCI device driver. */
     341#define PDM_DRVREG_CLASS_PCIRAW         RT_BIT(16)
    342342/** @} */
    343343
     
    437437        AssertLogRelMsgReturn(PDM_VERSION_ARE_COMPATIBLE((pDrvIns)->u32Version, PDM_DRVINS_VERSION), \
    438438                              ("DrvIns=%#x  mine=%#x\n", (pDrvIns)->u32Version, PDM_DRVINS_VERSION), \
    439                               VERR_VERSION_MISMATCH); \
     439                              VERR_PDM_DRVINS_VERSION_MISMATCH); \
    440440        AssertLogRelMsgReturn(PDM_VERSION_ARE_COMPATIBLE((pDrvIns)->pHlpR3->u32Version, PDM_DRVHLPR3_VERSION), \
    441441                              ("DrvHlp=%#x  mine=%#x\n", (pDrvIns)->pHlpR3->u32Version, PDM_DRVHLPR3_VERSION), \
    442                               VERR_VERSION_MISMATCH); \
     442                              VERR_PDM_DRVHLPR3_VERSION_MISMATCH); \
    443443    } while (0)
    444444
  • trunk/include/VBox/vmm/pdmusb.h

    r35361 r35810  
    733733        AssertLogRelMsgReturn(PDM_VERSION_ARE_COMPATIBLE((pUsbIns)->u32Version, PDM_USBINS_VERSION), \
    734734                              ("DevIns=%#x  mine=%#x\n", (pUsbIns)->u32Version, PDM_USBINS_VERSION), \
    735                               VERR_VERSION_MISMATCH); \
     735                              VERR_PDM_USBINS_VERSION_MISMATCH); \
    736736        AssertLogRelMsgReturn(PDM_VERSION_ARE_COMPATIBLE((pUsbIns)->pHlpR3->u32Version, PDM_USBHLP_VERSION), \
    737737                              ("DevHlp=%#x  mine=%#x\n", (pUsbIns)->pHlpR3->u32Version, PDM_USBHLP_VERSION), \
    738                               VERR_VERSION_MISMATCH); \
     738                              VERR_PDM_USBHLPR3_VERSION_MISMATCH); \
    739739    } while (0)
    740740
     
    751751    { \
    752752        PPDMUSBINS pUsbInsTypeCheck = (pUsbIns); NOREF(pUsbInsTypeCheck); \
    753         if (RT_UNLIKELY(   !PDM_VERSION_ARE_COMPATIBLE((pUsbIns)->u32Version, PDM_USBINS_VERSION) \
    754                         || !PDM_VERSION_ARE_COMPATIBLE((pUsbIns)->pHlpR3->u32Version, PDM_USBHLPR3_VERSION) )) \
    755             return VERR_VERSION_MISMATCH; \
     753        if (RT_UNLIKELY(!PDM_VERSION_ARE_COMPATIBLE((pUsbIns)->u32Version, PDM_USBINS_VERSION) )) \
     754            return VERR_PDM_USBINS_VERSION_MISMATCH; \
     755        if (RT_UNLIKELY(!PDM_VERSION_ARE_COMPATIBLE((pUsbIns)->pHlpR3->u32Version, PDM_USBHLPR3_VERSION) )) \
     756            return VERR_PDM_USBHLPR3_VERSION_MISMATCH; \
    756757    } while (0)
    757758
  • trunk/include/VBox/vmm/vmapi.h

    r35361 r35810  
    365365VMMR3DECL(void)     VMR3SetErrorWorker(PVM pVM);
    366366VMMR3DECL(uint32_t) VMR3GetErrorCount(PVM pVM);
     367VMMR3DECL(uint32_t) VMR3GetErrorCountU(PUVM pUVM);
    367368VMMR3DECL(int)      VMR3AtRuntimeErrorRegister(PVM pVM, PFNVMATRUNTIMEERROR pfnAtRuntimeError, void *pvUser);
    368369VMMR3DECL(int)      VMR3AtRuntimeErrorDeregister(PVM pVM, PFNVMATRUNTIMEERROR pfnAtRuntimeError, void *pvUser);
  • trunk/src/VBox/Runtime/common/err/errmsg.sed

    r28800 r35810  
    9494# terminate the string
    9595s/[[:space:]]*\*\//\"\,/
     96
     97# translate empty lines into new-lines (only one, please).
     98s/[[:space:]]*[[:space:]]\*[[:space:]][[:space:]]*\*[[:space:]][[:space:]]*/\\n/g
     99
     100# remove asterics.
    96101s/[[:space:]]*[[:space:]]\*[[:space:]][[:space:]]*/ /g
    97102b end
  • 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.

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