VirtualBox

Changeset 54608 in vbox for trunk/src


Ignore:
Timestamp:
Mar 3, 2015 8:28:01 PM (10 years ago)
Author:
vboxsync
Message:

VBoxGuest: cleanups, mainly fixing and shortening function name prefixes.

Location:
trunk/src/VBox/Additions/common/VBoxGuest
Files:
19 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Additions/common/VBoxGuest/VBoxDev-haiku.c

    r43409 r54608  
    55
    66/*
    7  * Copyright (C) 2012 Oracle Corporation
     7 * Copyright (C) 2012-2015 Oracle Corporation
    88 *
    99 * This file is part of VirtualBox Open Source Edition (OSE), as
     
    113113     * Create a new session.
    114114     */
    115     rc = VBoxGuestCreateUserSession(&g_DevExt, &pSession);
     115    rc = VbgdCommonCreateUserSession(&g_DevExt, &pSession);
    116116    if (RT_SUCCESS(rc))
    117117    {
     
    172172    if (VALID_PTR(pSession))
    173173    {
    174         VBoxGuestCloseSession(&g_DevExt, pSession);
     174        VbgdCommonCloseSession(&g_DevExt, pSession);
    175175        ASMAtomicDecU32(&cUsers);
    176176    }
     
    255255     */
    256256    size_t cbDataReturned;
    257     rc = VBoxGuestCommonIOCtl(op, &g_DevExt, pSession, pvBuf, len, &cbDataReturned);
     257    rc = VbgdCommonIoCtl(op, &g_DevExt, pSession, pvBuf, len, &cbDataReturned);
    258258    if (RT_SUCCESS(rc))
    259259    {
     
    276276    else
    277277    {
    278         Log((DRIVER_NAME ":VBoxGuestHaikuIOCtl: VBoxGuestCommonIOCtl failed. rc=%d\n", rc));
     278        Log((DRIVER_NAME ":VBoxGuestHaikuIOCtl: VbgdCommonIoCtl failed. rc=%d\n", rc));
    279279        rc = EFAULT;
    280280    }
  • trunk/src/VBox/Additions/common/VBoxGuest/VBoxGuest-darwin.cpp

    r52618 r54608  
    55
    66/*
    7  * Copyright (C) 2006-2014 Oracle Corporation
     7 * Copyright (C) 2006-2015 Oracle Corporation
    88 *
    99 * This file is part of VirtualBox Open Source Edition (OSE), as
     
    560560     */
    561561    size_t cbReqRet = 0;
    562     int rc = VBoxGuestCommonIOCtl(iCmd, &g_DevExt, pSession, pvReqData, cbReq, &cbReqRet);
     562    int rc = VbgdCommonIoCtl(iCmd, &g_DevExt, pSession, pvReqData, cbReq, &cbReqRet);
    563563    if (RT_SUCCESS(rc))
    564564    {
     
    617617
    618618
    619 void VBoxGuestNativeISRMousePollEvent(PVBOXGUESTDEVEXT pDevExt)
     619void VbgdNativeISRMousePollEvent(PVBOXGUESTDEVEXT pDevExt)
    620620{
    621621    NOREF(pDevExt);
     
    725725    NOREF(pOwner); NOREF(pSrc); NOREF(cInts);
    726726
    727     VBoxGuestWaitDoWakeUps(&g_DevExt);
     727    VbgdCommonWaitDoWakeUps(&g_DevExt);
    728728}
    729729
     
    737737        return false;
    738738
    739     bool fTaken = VBoxGuestCommonISR(&g_DevExt);
     739    bool fTaken = VbgdCommonISR(&g_DevExt);
    740740    if (!fTaken) /** @todo r=bird: This looks bogus as we might actually be sharing interrupts with someone. */
    741         PDEBUG("VBoxGuestCommonISR error\n");
     741        PDEBUG("VbgdCommonISR error\n");
    742742
    743743    return fTaken;
     
    848848                    }
    849849
    850                     int rc = VBoxGuestInitDevExt(&g_DevExt,
    851                                                  IOPortBase,
    852                                                  pvMMIOBase,
    853                                                  cbMMIO,
     850                    int rc = VbgdCommonInitDevExt(&g_DevExt,
     851                                                  IOPortBase,
     852                                                  pvMMIOBase,
     853                                                  cbMMIO,
    854854#if ARCH_BITS == 64
    855                                                  VBOXOSTYPE_MacOS_x64,
     855                                                  VBOXOSTYPE_MacOS_x64,
    856856#else
    857                                                  VBOXOSTYPE_MacOS,
     857                                                  VBOXOSTYPE_MacOS,
    858858#endif
    859                                                  0);
     859                                                  0);
    860860                    if (RT_SUCCESS(rc))
    861861                    {
     
    877877                            LogRel(("VBoxGuest: Failed to initialize character device (rc=%d).\n", rc));
    878878
    879                         VBoxGuestDeleteDevExt(&g_DevExt);
     879                        VbgdCommonDeleteDevExt(&g_DevExt);
    880880                    }
    881881                    else
     
    923923
    924924    VbgdDarwinCharDevRemove();
    925     VBoxGuestDeleteDevExt(&g_DevExt);
     925    VbgdCommonDeleteDevExt(&g_DevExt);
    926926
    927927    if (m_pMap)
     
    10201020             * Create a new session.
    10211021             */
    1022             int rc = VBoxGuestCreateUserSession(&g_DevExt, &m_pSession);
     1022            int rc = VbgdCommonCreateUserSession(&g_DevExt, &m_pSession);
    10231023            if (RT_SUCCESS(rc))
    10241024            {
     
    10581058
    10591059                LogFlow(("org_virtualbox_VBoxGuestClient::start: already got a session for this process (%p)\n", pCur));
    1060                 VBoxGuestCloseSession(&g_DevExt, m_pSession);
     1060                VbgdCommonCloseSession(&g_DevExt, m_pSession);
    10611061            }
    10621062
     
    11341134     * Close the session.
    11351135     */
    1136     VBoxGuestCloseSession(&g_DevExt, pSession);
     1136    VbgdCommonCloseSession(&g_DevExt, pSession);
    11371137}
    11381138
  • trunk/src/VBox/Additions/common/VBoxGuest/VBoxGuest-freebsd.c

    r44529 r54608  
    55
    66/*
    7  * Copyright (C) 2007-2011 Oracle Corporation
     7 * Copyright (C) 2007-2015 Oracle Corporation
    88 *
    99 * This file is part of VirtualBox Open Source Edition (OSE), as
     
    220220     * Create a new session.
    221221     */
    222     rc = VBoxGuestCreateUserSession(&g_DevExt, &pSession);
     222    rc = VbgdCommonCreateUserSession(&g_DevExt, &pSession);
    223223    if (RT_SUCCESS(rc))
    224224    {
     
    230230        }
    231231
    232         VBoxGuestCloseSession(&g_DevExt, pSession);
     232        VbgdCommonCloseSession(&g_DevExt, pSession);
    233233    }
    234234
     
    251251    if (VALID_PTR(pSession))
    252252    {
    253         VBoxGuestCloseSession(&g_DevExt, pSession);
     253        VbgdCommonCloseSession(&g_DevExt, pSession);
    254254        if (!ASMAtomicCmpXchgPtr(&pDev->si_drv1, NULL, pSession))
    255255            Log(("VBoxGuestFreeBSDClose: si_drv1=%p expected %p!\n", pDev->si_drv1, pSession));
     
    332332     */
    333333    size_t cbDataReturned;
    334     rc = VBoxGuestCommonIOCtl(ulCmd, &g_DevExt, pSession, pvBuf, ReqWrap->cbData, &cbDataReturned);
     334    rc = VbgdCommonIoCtl(ulCmd, &g_DevExt, pSession, pvBuf, ReqWrap->cbData, &cbDataReturned);
    335335    if (RT_SUCCESS(rc))
    336336    {
     
    353353    else
    354354    {
    355         Log((DEVICE_NAME ":VBoxGuestFreeBSDIOCtl: VBoxGuestCommonIOCtl failed. rc=%d\n", rc));
     355        Log((DEVICE_NAME ":VBoxGuestFreeBSDIOCtl: VbgdCommonIoCtl failed. rc=%d\n", rc));
    356356        rc = EFAULT;
    357357    }
     
    420420        bus_release_resource(pDevice, SYS_RES_IOPORT, pState->iIOPortResId, pState->pIOPortRes);
    421421
    422     VBoxGuestDeleteDevExt(&g_DevExt);
     422    VbgdCommonDeleteDevExt(&g_DevExt);
    423423
    424424    RTR0Term();
     
    437437    LogFlow((DEVICE_NAME ":VBoxGuestFreeBSDISR pvState=%p\n", pvState));
    438438
    439     bool fOurIRQ = VBoxGuestCommonISR(&g_DevExt);
     439    bool fOurIRQ = VbgdCommonISR(&g_DevExt);
    440440
    441441    return fOurIRQ ? 0 : 1;
    442442}
    443443
    444 void VBoxGuestNativeISRMousePollEvent(PVBOXGUESTDEVEXT pDevExt)
     444void VbgdNativeISRMousePollEvent(PVBOXGUESTDEVEXT pDevExt)
    445445{
    446446    LogFlow((DEVICE_NAME "::NativeISRMousePollEvent:\n"));
     
    546546             * Call the common device extension initializer.
    547547             */
    548             rc = VBoxGuestInitDevExt(&g_DevExt, pState->uIOPortBase,
    549                                      pState->pMMIOBase, pState->VMMDevMemSize,
     548            rc = VbgdCommonInitDevExt(&g_DevExt, pState->uIOPortBase,
     549                                      pState->pMMIOBase, pState->VMMDevMemSize,
    550550#if ARCH_BITS == 64
    551                                      VBOXOSTYPE_FreeBSD_x64,
     551                                      VBOXOSTYPE_FreeBSD_x64,
    552552#else
    553                                      VBOXOSTYPE_FreeBSD,
     553                                      VBOXOSTYPE_FreeBSD,
    554554#endif
    555                                      VMMDEV_EVENT_MOUSE_POSITION_CHANGED);
     555                                      VMMDEV_EVENT_MOUSE_POSITION_CHANGED);
    556556            if (RT_SUCCESS(rc))
    557557            {
     
    578578                }
    579579                else
    580                     printf((DEVICE_NAME ":VBoxGuestInitDevExt failed.\n"));
    581                 VBoxGuestDeleteDevExt(&g_DevExt);
     580                    printf((DEVICE_NAME ":VbgdCommonInitDevExt failed.\n"));
     581                VbgdCommonDeleteDevExt(&g_DevExt);
    582582            }
    583583            else
  • trunk/src/VBox/Additions/common/VBoxGuest/VBoxGuest-haiku-stubs.c

    r52618 r54608  
    55
    66/*
    7  * Copyright (C) 2012-2014 Oracle Corporation
     7 * Copyright (C) 2012-2015 Oracle Corporation
    88 *
    99 * This file is part of VirtualBox Open Source Edition (OSE), as
     
    339339    return g_VBoxGuest->_RTErrConvertToErrno(iErr);
    340340}
    341 int VBoxGuestCommonIOCtl(unsigned iFunction, PVBOXGUESTDEVEXT pDevExt, PVBOXGUESTSESSION pSession, void *pvData, size_t cbData, size_t *pcbDataReturned)
    342 {
    343     return g_VBoxGuest->_VBoxGuestCommonIOCtl(iFunction, pDevExt, pSession, pvData, cbData, pcbDataReturned);
    344 }
    345 int VBoxGuestCreateUserSession(PVBOXGUESTDEVEXT pDevExt, PVBOXGUESTSESSION *ppSession)
    346 {
    347     return g_VBoxGuest->_VBoxGuestCreateUserSession(pDevExt, ppSession);
    348 }
    349 void VBoxGuestCloseSession(PVBOXGUESTDEVEXT pDevExt, PVBOXGUESTSESSION pSession)
    350 {
    351     g_VBoxGuest->_VBoxGuestCloseSession(pDevExt, pSession);
     341int VbgdCommonIoCtl(unsigned iFunction, PVBOXGUESTDEVEXT pDevExt, PVBOXGUESTSESSION pSession, void *pvData, size_t cbData, size_t *pcbDataReturned)
     342{
     343    return g_VBoxGuest->_VbgdCommonIoCtl(iFunction, pDevExt, pSession, pvData, cbData, pcbDataReturned);
     344}
     345int VbgdCommonCreateUserSession(PVBOXGUESTDEVEXT pDevExt, PVBOXGUESTSESSION *ppSession)
     346{
     347    return g_VBoxGuest->_VbgdCommonCreateUserSession(pDevExt, ppSession);
     348}
     349void VbgdCommonCloseSession(PVBOXGUESTDEVEXT pDevExt, PVBOXGUESTSESSION pSession)
     350{
     351    g_VBoxGuest->_VbgdCommonCloseSession(pDevExt, pSession);
    352352}
    353353void* VBoxGuestIDCOpen(uint32_t *pu32Version)
  • trunk/src/VBox/Additions/common/VBoxGuest/VBoxGuest-haiku.c

    r52618 r54608  
    55
    66/*
    7  * Copyright (C) 2012-2014 Oracle Corporation
     7 * Copyright (C) 2012-2015 Oracle Corporation
    88 *
    99 * This file is part of VirtualBox Open Source Edition (OSE), as
     
    179179    RTLogRelDefaultInstance,
    180180    RTErrConvertToErrno,
    181     VBoxGuestCommonIOCtl,
    182     VBoxGuestCreateUserSession,
    183     VBoxGuestCloseSession,
     181    VbgdCommonIoCtl,
     182    VbgdCommonCreateUserSession,
     183    VbgdCommonCloseSession,
    184184    VBoxGuestIDCOpen,
    185185    VBoxGuestIDCClose,
     
    278278        delete_area(pState->iVMMDevMemAreaId);
    279279
    280     VBoxGuestDeleteDevExt(&g_DevExt);
     280    VbgdCommonDeleteDevExt(&g_DevExt);
    281281
    282282#ifdef DO_LOG
     
    304304    LogFlow((MODULE_NAME ":VBoxGuestHaikuISR pvState=%p\n", pvState));
    305305
    306     bool fOurIRQ = VBoxGuestCommonISR(&g_DevExt);
     306    bool fOurIRQ = VbgdCommonISR(&g_DevExt);
    307307    if (fOurIRQ)
    308308        return B_HANDLED_INTERRUPT;
     
    311311
    312312
    313 void VBoxGuestNativeISRMousePollEvent(PVBOXGUESTDEVEXT pDevExt)
     313void VbgdNativeISRMousePollEvent(PVBOXGUESTDEVEXT pDevExt)
    314314{
    315315    LogFlow((MODULE_NAME "::NativeISRMousePollEvent:\n"));
     
    446446             * Call the common device extension initializer.
    447447             */
    448             rc = VBoxGuestInitDevExt(&g_DevExt, pState->uIOPortBase, pState->pMMIOBase, pState->VMMDevMemSize,
     448            rc = VbgdCommonInitDevExt(&g_DevExt, pState->uIOPortBase, pState->pMMIOBase, pState->VMMDevMemSize,
    449449#if ARCH_BITS == 64
    450                                      VBOXOSTYPE_Haiku_x64,
     450                                      VBOXOSTYPE_Haiku_x64,
    451451#else
    452                                      VBOXOSTYPE_Haiku,
     452                                      VBOXOSTYPE_Haiku,
    453453#endif
    454                                      VMMDEV_EVENT_MOUSE_POSITION_CHANGED);
     454                                      VMMDEV_EVENT_MOUSE_POSITION_CHANGED);
    455455            if (RT_SUCCESS(rc))
    456456            {
     
    466466                }
    467467
    468                 LogRel((MODULE_NAME ":VBoxGuestInitDevExt failed.\n"));
    469                 VBoxGuestDeleteDevExt(&g_DevExt);
     468                LogRel((MODULE_NAME ":VbgdCommonInitDevExt failed.\n"));
     469                VbgdCommonDeleteDevExt(&g_DevExt);
    470470            }
    471471            else
  • trunk/src/VBox/Additions/common/VBoxGuest/VBoxGuest-haiku.h

    r52618 r54608  
    55
    66/*
    7  * Copyright (C) 2012-2014 Oracle Corporation
     7 * Copyright (C) 2012-2015 Oracle Corporation
    88 *
    99 * This file is part of VirtualBox Open Source Edition (OSE), as
     
    182182    PRTLOGGER(*_RTLogRelDefaultInstance)(void);
    183183    int (*_RTErrConvertToErrno)(int iErr);
    184     int (*_VBoxGuestCommonIOCtl)(unsigned iFunction, PVBOXGUESTDEVEXT pDevExt, PVBOXGUESTSESSION pSession,
     184    int (*_VbgdCommonIoCtl)(unsigned iFunction, PVBOXGUESTDEVEXT pDevExt, PVBOXGUESTSESSION pSession,
    185185                                 void *pvData, size_t cbData, size_t *pcbDataReturned);
    186     int (*_VBoxGuestCreateUserSession)(PVBOXGUESTDEVEXT pDevExt, PVBOXGUESTSESSION *ppSession);
    187     void (*_VBoxGuestCloseSession)(PVBOXGUESTDEVEXT pDevExt, PVBOXGUESTSESSION pSession);
     186    int (*_VbgdCommonCreateUserSession)(PVBOXGUESTDEVEXT pDevExt, PVBOXGUESTSESSION *ppSession);
     187    void (*_VbgdCommonCloseSession)(PVBOXGUESTDEVEXT pDevExt, PVBOXGUESTSESSION pSession);
    188188    void* (*_VBoxGuestIDCOpen)(uint32_t *pu32Version);
    189189    int (*_VBoxGuestIDCClose)(void *pvSession);
  • trunk/src/VBox/Additions/common/VBoxGuest/VBoxGuest-linux.c

    r54606 r54608  
    88
    99/*
    10  * Copyright (C) 2006-2013 Oracle Corporation
     10 * Copyright (C) 2006-2015 Oracle Corporation
    1111 *
    1212 * This file is part of VirtualBox Open Source Edition (OSE), as
     
    341341#endif
    342342{
    343     bool fTaken = VBoxGuestCommonISR(&g_DevExt);
     343    bool fTaken = VbgdCommonISR(&g_DevExt);
    344344    return IRQ_RETVAL(fTaken);
    345345}
     
    386386static int vboxguestLinuxSetMouseStatus(uint32_t fStatus)
    387387{
    388     return VBoxGuestCommonIOCtl(VBOXGUEST_IOCTL_SET_MOUSE_STATUS, &g_DevExt,
    389                                 g_pKernelSession, &fStatus, sizeof(fStatus),
    390                                 NULL);
     388    return VbgdCommonIoCtl(VBOXGUEST_IOCTL_SET_MOUSE_STATUS, &g_DevExt,
     389                           g_pKernelSession, &fStatus, sizeof(fStatus),
     390                           NULL);
    391391}
    392392
     
    595595            VBOXOSTYPE enmOsType = VBOXOSTYPE_Linux;
    596596#endif
    597             rc = VBoxGuestInitDevExt(&g_DevExt,
    598                                      g_IOPortBase,
    599                                      g_pvMMIOBase,
    600                                      g_cbMMIO,
    601                                      enmOSType,
    602                                      VMMDEV_EVENT_MOUSE_POSITION_CHANGED);
     597            rc = VbgdCommonInitDevExt(&g_DevExt,
     598                                      g_IOPortBase,
     599                                      g_pvMMIOBase,
     600                                      g_cbMMIO,
     601                                      enmOSType,
     602                                      VMMDEV_EVENT_MOUSE_POSITION_CHANGED);
    603603            if (RT_SUCCESS(rc))
    604604            {
     
    606606                 * Create the kernel session for this driver.
    607607                 */
    608                 rc = VBoxGuestCreateKernelSession(&g_DevExt,
     608                rc = VbgdCommonCreateKernelSession(&g_DevExt,
    609609                                                  &g_pKernelSession);
    610610                if (RT_SUCCESS(rc))
     
    642642                    }
    643643#endif
    644                     VBoxGuestCloseSession(&g_DevExt, g_pKernelSession);
     644                    VbgdCommonCloseSession(&g_DevExt, g_pKernelSession);
    645645                }
    646                 VBoxGuestDeleteDevExt(&g_DevExt);
     646                VbgdCommonDeleteDevExt(&g_DevExt);
    647647            }
    648648            else
    649649            {
    650                 LogRel((DEVICE_NAME ": VBoxGuestInitDevExt failed with rc=%Rrc\n", rc));
     650                LogRel((DEVICE_NAME ": VbgdCommonInitDevExt failed with rc=%Rrc\n", rc));
    651651                rc = RTErrConvertFromErrno(rc);
    652652            }
     
    679679    vboxguestLinuxTermInputDevice();
    680680#endif
    681     VBoxGuestCloseSession(&g_DevExt, g_pKernelSession);
    682     VBoxGuestDeleteDevExt(&g_DevExt);
     681    VbgdCommonCloseSession(&g_DevExt, g_pKernelSession);
     682    VbgdCommonDeleteDevExt(&g_DevExt);
    683683    vboxguestLinuxTermISR();
    684684    pci_unregister_driver(&g_PciDriver);
     
    705705     * the file so we can access it in the other methods.
    706706     */
    707     rc = VBoxGuestCreateUserSession(&g_DevExt, &pSession);
     707    rc = VbgdCommonCreateUserSession(&g_DevExt, &pSession);
    708708    if (RT_SUCCESS(rc))
    709709    {
     
    736736    vboxguestFAsync(-1, pFilp, 0);
    737737#endif
    738     VBoxGuestCloseSession(&g_DevExt, (PVBOXGUESTSESSION)pFilp->private_data);
     738    VbgdCommonCloseSession(&g_DevExt, (PVBOXGUESTSESSION)pFilp->private_data);
    739739    pFilp->private_data = NULL;
    740740    return 0;
     
    787787         */
    788788        size_t cbDataReturned;
    789         rc = VBoxGuestCommonIOCtl(uCmd, &g_DevExt, pSession, pvBuf, cbData, &cbDataReturned);
     789        rc = VbgdCommonIoCtl(uCmd, &g_DevExt, pSession, pvBuf, cbData, &cbDataReturned);
    790790
    791791        /*
     
    882882 * @remarks This is probably not really used as X11 lets the driver do its own
    883883 *          event reading. The poll condition is therefore also cleared when we
    884  *          see VMMDevReq_GetMouseStatus in VBoxGuestCommonIOCtl_VMMRequest.
     884 *          see VMMDevReq_GetMouseStatus in VbgdCommonIoCtl_VMMRequest.
    885885 */
    886886static ssize_t vboxguestRead(struct file *pFile, char *pbBuf, size_t cbRead, loff_t *poff)
     
    906906
    907907
    908 void VBoxGuestNativeISRMousePollEvent(PVBOXGUESTDEVEXT pDevExt)
     908void VbgdNativeISRMousePollEvent(PVBOXGUESTDEVEXT pDevExt)
    909909{
    910910#ifdef VBOXGUEST_WITH_INPUT_DRIVER
     
    917917     * subscribed to async notifications.
    918918     */
    919     Log3(("VBoxGuestNativeISRMousePollEvent: wake_up_all\n"));
     919    Log3(("VbgdNativeISRMousePollEvent: wake_up_all\n"));
    920920    wake_up_all(&g_PollEventQueue);
    921     Log3(("VBoxGuestNativeISRMousePollEvent: kill_fasync\n"));
     921    Log3(("VbgdNativeISRMousePollEvent: kill_fasync\n"));
    922922    kill_fasync(&g_pFAsyncQueue, SIGIO, POLL_IN);
    923923#ifdef VBOXGUEST_WITH_INPUT_DRIVER
     
    938938    }
    939939#endif
    940     Log3(("VBoxGuestNativeISRMousePollEvent: done\n"));
     940    Log3(("VbgdNativeISRMousePollEvent: done\n"));
    941941}
    942942
  • trunk/src/VBox/Additions/common/VBoxGuest/VBoxGuest-os2.cpp

    r54521 r54608  
    150150             */
    151151            if (g_MemMapMMIO != NIL_RTR0MEMOBJ)
    152                 rc = VBoxGuestInitDevExt(&g_DevExt, g_IOPortBase,
    153                                          RTR0MemObjAddress(g_MemMapMMIO),
    154                                          RTR0MemObjSize(g_MemMapMMIO),
    155                                          vboxGuestOS2DetectVersion(),
    156                                          0);
     152                rc = VbgdCommonInitDevExt(&g_DevExt, g_IOPortBase,
     153                                          RTR0MemObjAddress(g_MemMapMMIO),
     154                                          RTR0MemObjSize(g_MemMapMMIO),
     155                                          vboxGuestOS2DetectVersion(),
     156                                          0);
    157157            else
    158                 rc = VBoxGuestInitDevExt(&g_DevExt, g_IOPortBase, NULL, 0,
    159                                          vboxGuestOS2DetectVersion(),
    160                                          0);
     158                rc = VbgdCommonInitDevExt(&g_DevExt, g_IOPortBase, NULL, 0, vboxGuestOS2DetectVersion(), 0);
    161159            if (RT_SUCCESS(rc))
    162160            {
     
    201199                else
    202200                    g_cchInitText = RTStrPrintf(&g_szInitText[0], g_cchInitTextMax, "VBoxGuest.sys: RTSpinlockCreate failed, rc=%Rrc\n", rc);
    203                 VBoxGuestDeleteDevExt(&g_DevExt);
     201                VbgdCommonDeleteDevExt(&g_DevExt);
    204202            }
    205203            else
     
    361359     * Create a new session.
    362360     */
    363     rc = VBoxGuestCreateUserSession(&g_DevExt, &pSession);
     361    rc = VbgdCommonCreateUserSession(&g_DevExt, &pSession);
    364362    if (RT_SUCCESS(rc))
    365363    {
     
    432430     * Close the session.
    433431     */
    434     VBoxGuestCloseSession(&g_DevExt, pSession);
     432    VbgdCommonCloseSession(&g_DevExt, pSession);
    435433    return 0;
    436434}
     
    465463     * Dispatch the fast IOCtl.
    466464     */
    467     *prc = VBoxGuestCommonIOCtlFast(iFunction, &g_DevExt, pSession);
     465    *prc = VbgdCommonIoCtlFast(iFunction, &g_DevExt, pSession);
    468466    return 0;
    469467}
     
    497495    {
    498496        default:
    499             rc = VBoxGuestCommonIOCtl(iFunction, &g_DevExt, pSession, pvData, cbData, pcbDataReturned);
     497            rc = VbgdCommonIoCtl(iFunction, &g_DevExt, pSession, pvData, cbData, pcbDataReturned);
    500498            break;
    501499
    502500        case VBOXGUEST_IOCTL_OS2_IDC_DISCONNECT:
    503501            pSession->sfn = 0;
    504             VBoxGuestCloseSession(&g_DevExt, pSession);
     502            VbgdCommonCloseSession(&g_DevExt, pSession);
    505503            rc = VINF_SUCCESS;
    506504            break;
     
    518516{
    519517    PVBOXGUESTSESSION pSession;
    520     int rc = VBoxGuestCreateKernelSession(&g_DevExt, &pSession);
     518    int rc = VbgdCommonCreateKernelSession(&g_DevExt, &pSession);
    521519    if (RT_SUCCESS(rc))
    522520    {
     
    600598         */
    601599        size_t cbDataReturned;
    602         rc = VBoxGuestCommonIOCtl(iFunction, &g_DevExt, pSession, pvParm, *pcbParm, &cbDataReturned);
     600        rc = VbgdCommonIoCtl(iFunction, &g_DevExt, pSession, pvParm, *pcbParm, &cbDataReturned);
    603601
    604602        /*
     
    639637    Log(("VBoxGuestOS2ISR\n"));
    640638
    641     return VBoxGuestCommonISR(&g_DevExt);
    642 }
    643 
    644 
    645 void VBoxGuestNativeISRMousePollEvent(PVBOXGUESTDEVEXT pDevExt)
     639    return VbgdCommonISR(&g_DevExt);
     640}
     641
     642
     643void VbgdNativeISRMousePollEvent(PVBOXGUESTDEVEXT pDevExt)
    646644{
    647645    /* No polling on OS/2 */
  • trunk/src/VBox/Additions/common/VBoxGuest/VBoxGuest-solaris.c

    r50753 r54608  
    55
    66/*
    7  * Copyright (C) 2007-2012 Oracle Corporation
     7 * Copyright (C) 2007-2015 Oracle Corporation
    88 *
    99 * This file is part of VirtualBox Open Source Edition (OSE), as
     
    329329                                 * Call the common device extension initializer.
    330330                                 */
    331                                 rc = VBoxGuestInitDevExt(&g_DevExt, g_uIOPortBase, g_pMMIOBase, g_cbMMIO,
     331                                rc = VbgdCommonInitDevExt(&g_DevExt, g_uIOPortBase, g_pMMIOBase, g_cbMMIO,
    332332#if ARCH_BITS == 64
    333                                                          VBOXOSTYPE_Solaris_x64,
     333                                                          VBOXOSTYPE_Solaris_x64,
    334334#else
    335                                                          VBOXOSTYPE_Solaris,
     335                                                          VBOXOSTYPE_Solaris,
    336336#endif
    337                                                          VMMDEV_EVENT_MOUSE_POSITION_CHANGED);
     337                                                          VMMDEV_EVENT_MOUSE_POSITION_CHANGED);
    338338                                if (RT_SUCCESS(rc))
    339339                                {
     
    347347
    348348                                    LogRel((DEVICE_NAME "::Attach: ddi_create_minor_node failed.\n"));
    349                                     VBoxGuestDeleteDevExt(&g_DevExt);
     349                                    VbgdCommonDeleteDevExt(&g_DevExt);
    350350                                }
    351351                                else
    352                                     LogRel((DEVICE_NAME "::Attach: VBoxGuestInitDevExt failed.\n"));
     352                                    LogRel((DEVICE_NAME "::Attach: VbgdCommonInitDevExt failed.\n"));
    353353                                VBoxGuestSolarisRemoveIRQ(pDip);
    354354                            }
     
    404404            ddi_regs_map_free(&g_PciMMIOHandle);
    405405            ddi_remove_minor_node(pDip, NULL);
    406             VBoxGuestDeleteDevExt(&g_DevExt);
     406            VbgdCommonDeleteDevExt(&g_DevExt);
    407407            g_pDip = NULL;
    408408            return DDI_SUCCESS;
     
    515515     * Create a new session.
    516516     */
    517     rc = VBoxGuestCreateUserSession(&g_DevExt, &pSession);
     517    rc = VbgdCommonCreateUserSession(&g_DevExt, &pSession);
    518518    if (RT_SUCCESS(rc))
    519519    {
     
    528528    ddi_soft_state_free(g_pVBoxGuestSolarisState, iOpenInstance);
    529529
    530     LogRel((DEVICE_NAME "::Open: VBoxGuestCreateUserSession failed. rc=%d\n", rc));
     530    LogRel((DEVICE_NAME "::Open: VbgdCommonCreateUserSession failed. rc=%d\n", rc));
    531531    return EFAULT;
    532532}
     
    559559     * Close the session.
    560560     */
    561     VBoxGuestCloseSession(&g_DevExt, pSession);
     561    VbgdCommonCloseSession(&g_DevExt, pSession);
    562562    return 0;
    563563}
     
    694694     */
    695695    size_t cbDataReturned = 0;
    696     rc = VBoxGuestCommonIOCtl(Cmd, &g_DevExt, pSession, pvBuf, ReqWrap.cbData, &cbDataReturned);
     696    rc = VbgdCommonIoCtl(Cmd, &g_DevExt, pSession, pvBuf, ReqWrap.cbData, &cbDataReturned);
    697697    if (RT_SUCCESS(rc))
    698698    {
     
    721721         * which are not really failures that require logging.
    722722         */
    723         Log((DEVICE_NAME "::IOCtl: VBoxGuestCommonIOCtl failed. Cmd=%#x rc=%d\n", Cmd, rc));
     723        Log((DEVICE_NAME "::IOCtl: VbgdCommonIoCtl failed. Cmd=%#x rc=%d\n", Cmd, rc));
    724724        if (rc == VERR_PERMISSION_DENIED)   /* RTErrConvertToErrno() below will ring-0 debug assert if we don't do this. */
    725725            rc = VERR_ACCESS_DENIED;
     
    894894
    895895    mutex_enter(&g_IrqMtx);
    896     bool fOurIRQ = VBoxGuestCommonISR(&g_DevExt);
     896    bool fOurIRQ = VbgdCommonISR(&g_DevExt);
    897897    mutex_exit(&g_IrqMtx);
    898898
     
    901901
    902902
    903 void VBoxGuestNativeISRMousePollEvent(PVBOXGUESTDEVEXT pDevExt)
     903void VbgdNativeISRMousePollEvent(PVBOXGUESTDEVEXT pDevExt)
    904904{
    905905    LogFlow((DEVICE_NAME "::NativeISRMousePollEvent:\n"));
  • trunk/src/VBox/Additions/common/VBoxGuest/VBoxGuest-win-legacy.cpp

    r44988 r54608  
    55
    66/*
    7  * Copyright (C) 2010-2013 Oracle Corporation
     7 * Copyright (C) 2010-2015 Oracle Corporation
    88 *
    99 * This file is part of VirtualBox Open Source Edition (OSE), as
  • trunk/src/VBox/Additions/common/VBoxGuest/VBoxGuest-win-pnp.cpp

    r45013 r54608  
    55
    66/*
    7  * Copyright (C) 2010-2013 Oracle Corporation
     7 * Copyright (C) 2010-2015 Oracle Corporation
    88 *
    99 * This file is part of VirtualBox Open Source Edition (OSE), as
     
    276276
    277277            /* Destroy device extension and clean up everything else. */
    278             VBoxGuestDeleteDevExt(&pDevExt->Core);
     278            VbgdCommonDeleteDevExt(&pDevExt->Core);
    279279
    280280            /* Remove DOS device + symbolic link. */
     
    467467                                {
    468468                                    Log(("VBoxGuest::vbgdNtGuestPower: Returning from hibernation!\n"));
    469                                     int rc = VBoxGuestReinitDevExtAfterHibernation(&pDevExt->Core,
     469                                    int rc = VbgdCommonReinitDevExtAfterHibernation(&pDevExt->Core,
    470470                                                                                   vbgdNtVersionToOSType(g_enmVbgdNtVer));
    471471                                    if (RT_FAILURE(rc))
  • trunk/src/VBox/Additions/common/VBoxGuest/VBoxGuest-win.cpp

    r54241 r54608  
    55
    66/*
    7  * Copyright (C) 2010-2013 Oracle Corporation
     7 * Copyright (C) 2010-2015 Oracle Corporation
    88 *
    99 * This file is part of VirtualBox Open Source Edition (OSE), as
     
    426426                     pvMMIOBase, pDevExt, pDevExt ? pDevExt->Core.pVMMDevMemory : NULL));
    427427
    428             int vrc = VBoxGuestInitDevExt(&pDevExt->Core,
    429                                           pDevExt->Core.IOPortBase,
    430                                           pvMMIOBase, cbMMIO,
    431                                           vbgdNtVersionToOSType(g_enmVbgdNtVer),
    432                                           VMMDEV_EVENT_MOUSE_POSITION_CHANGED);
     428            int vrc = VbgdCommonInitDevExt(&pDevExt->Core,
     429                                           pDevExt->Core.IOPortBase,
     430                                           pvMMIOBase, cbMMIO,
     431                                           vbgdNtVersionToOSType(g_enmVbgdNtVer),
     432                                           VMMDEV_EVENT_MOUSE_POSITION_CHANGED);
    433433            if (RT_FAILURE(vrc))
    434434            {
     
    515515#ifdef VBOX_WITH_HGCM
    516516    LogFunc(("Allocating kernel session data ...\n"));
    517     int vrc = VBoxGuestCreateKernelSession(&pDevExt->Core, &pDevExt->pKernelSession);
     517    int vrc = VbgdCommonCreateKernelSession(&pDevExt->Core, &pDevExt->pKernelSession);
    518518    if (RT_FAILURE(vrc))
    519519    {
     
    568568        if (pDevExt->pKernelSession)
    569569        {
    570             VBoxGuestCloseSession(pDevExt, pDevExt->pKernelSession);
     570            VbgdCommonCloseSession(pDevExt, pDevExt->pKernelSession);
    571571            pDevExt->pKernelSession = NULL;
    572572        }
     
    608608    /* Destroy device extension and clean up everything else. */
    609609    if (pDrvObj->DeviceObject && pDrvObj->DeviceObject->DeviceExtension)
    610         VBoxGuestDeleteDevExt((PVBOXGUESTDEVEXT)pDrvObj->DeviceObject->DeviceExtension);
     610        VbgdCommonDeleteDevExt((PVBOXGUESTDEVEXT)pDrvObj->DeviceObject->DeviceExtension);
    611611
    612612    /*
     
    673673                 * exists for every R3 process.
    674674                 */
    675                 vrc = VBoxGuestCreateUserSession(&pDevExt->Core, &pSession);
     675                vrc = VbgdCommonCreateUserSession(&pDevExt->Core, &pSession);
    676676            }
    677677            else
    678678            {
    679679                /* ... otherwise we've been called from R0! */
    680                 vrc = VBoxGuestCreateKernelSession(&pDevExt->Core, &pSession);
     680                vrc = VbgdCommonCreateKernelSession(&pDevExt->Core, &pSession);
    681681            }
    682682            if (RT_SUCCESS(vrc))
     
    715715    PVBOXGUESTSESSION pSession = (PVBOXGUESTSESSION)pFileObj->FsContext;
    716716    if (pSession)
    717         VBoxGuestCloseSession(&pDevExt->Core, pSession);
     717        VbgdCommonCloseSession(&pDevExt->Core, pSession);
    718718#endif
    719719
     
    773773         */
    774774        size_t cbDataReturned;
    775         int vrc = VBoxGuestCommonIOCtl(uCmd, &pDevExt->Core, pSession, pBuf, cbData, &cbDataReturned);
     775        int vrc = VbgdCommonIoCtl(uCmd, &pDevExt->Core, pSession, pBuf, cbData, &cbDataReturned);
    776776
    777777        LogFlowFunc(("rc=%Rrc, pBuf=0x%p, cbData=%u, cbDataReturned=%u\n",
     
    976976    /* Process the wake-up list we were asked by the scheduling a DPC
    977977     * in vbgdNtIsrHandler(). */
    978     VBoxGuestWaitDoWakeUps(&pDevExt->Core);
     978    VbgdCommonWaitDoWakeUps(&pDevExt->Core);
    979979}
    980980
     
    996996
    997997    /* Enter the common ISR routine and do the actual work. */
    998     BOOLEAN fIRQTaken = VBoxGuestCommonISR(&pDevExt->Core);
     998    BOOLEAN fIRQTaken = VbgdCommonISR(&pDevExt->Core);
    999999
    10001000    /* If we need to wake up some events we do that in a DPC to make
     
    10191019 * @param pDevExt     Device extension structure.
    10201020 */
    1021 void VBoxGuestNativeISRMousePollEvent(PVBOXGUESTDEVEXT pDevExt)
     1021void VbgdNativeISRMousePollEvent(PVBOXGUESTDEVEXT pDevExt)
    10221022{
    10231023    NOREF(pDevExt);
  • trunk/src/VBox/Additions/common/VBoxGuest/VBoxGuest-win.h

    r53008 r54608  
    55
    66/*
    7  * Copyright (C) 2010-2013 Oracle Corporation
     7 * Copyright (C) 2010-2015 Oracle Corporation
    88 *
    99 * This file is part of VirtualBox Open Source Edition (OSE), as
  • trunk/src/VBox/Additions/common/VBoxGuest/VBoxGuest.cpp

    r54606 r54608  
    8787*******************************************************************************/
    8888#ifdef VBOX_WITH_HGCM
    89 static DECLCALLBACK(int) VBoxGuestHGCMAsyncWaitCallback(VMMDevHGCMRequestHeader *pHdrNonVolatile, void *pvUser, uint32_t u32User);
     89static DECLCALLBACK(int) vbgdHgcmAsyncWaitCallback(VMMDevHGCMRequestHeader *pHdrNonVolatile, void *pvUser, uint32_t u32User);
    9090#endif
    91 static int VBoxGuestCommonIOCtl_CancelAllWaitEvents(PVBOXGUESTDEVEXT pDevExt, PVBOXGUESTSESSION pSession);
     91static int      vbgdIoCtl_CancelAllWaitEvents(PVBOXGUESTDEVEXT pDevExt, PVBOXGUESTSESSION pSession);
    9292static void     vbgdBitUsageTrackerClear(PVBOXGUESTBITUSAGETRACER pTracker);
    9393static uint32_t vbgdGetAllowedEventMaskForSession(PVBOXGUESTDEVEXT pDevExt, PVBOXGUESTSESSION pSession);
     
    109109*   Global Variables                                                           *
    110110*******************************************************************************/
    111 static const uint32_t cbChangeMemBalloonReq = RT_OFFSETOF(VMMDevChangeMemBalloon, aPhysPage[VMMDEV_MEMORY_BALLOON_CHUNK_PAGES]);
     111static const uint32_t g_cbChangeMemBalloonReq = RT_OFFSETOF(VMMDevChangeMemBalloon, aPhysPage[VMMDEV_MEMORY_BALLOON_CHUNK_PAGES]);
    112112
    113113#if defined(RT_OS_DARWIN) || defined(RT_OS_SOLARIS)
     
    145145 * @param   pDevExt     The device extension.
    146146 */
    147 static int vboxGuestInitFixateGuestMappings(PVBOXGUESTDEVEXT pDevExt)
     147static int vbgdInitFixateGuestMappings(PVBOXGUESTDEVEXT pDevExt)
    148148{
    149149    /*
     
    168168     */
    169169    if (pReq->hypervisorSize == 0)
    170         Log(("vboxGuestInitFixateGuestMappings: nothing to do\n"));
     170        Log(("vbgdInitFixateGuestMappings: nothing to do\n"));
    171171    else
    172172    {
     
    180180        uint32_t    iTry;
    181181        bool        fBitched = false;
    182         Log(("vboxGuestInitFixateGuestMappings: cbHypervisor=%#x\n", cbHypervisor));
     182        Log(("vbgdInitFixateGuestMappings: cbHypervisor=%#x\n", cbHypervisor));
    183183        for (iTry = 0; iTry < RT_ELEMENTS(ahTries); iTry++)
    184184        {
     
    275275
    276276/**
    277  * Undo what vboxGuestInitFixateGuestMappings did.
     277 * Undo what vbgdInitFixateGuestMappings did.
    278278 *
    279279 * @param   pDevExt     The device extension.
    280280 */
    281 static void vboxGuestTermUnfixGuestMappings(PVBOXGUESTDEVEXT pDevExt)
     281static void vbgdTermUnfixGuestMappings(PVBOXGUESTDEVEXT pDevExt)
    282282{
    283283    if (pDevExt->hGuestMappings != NIL_RTR0PTR)
     
    302302        }
    303303        else
    304             LogRel(("vboxGuestTermUnfixGuestMappings: Failed to unfix the guest mappings! rc=%Rrc\n", rc));
     304            LogRel(("vbgdTermUnfixGuestMappings: Failed to unfix the guest mappings! rc=%Rrc\n", rc));
    305305
    306306        pDevExt->hGuestMappings = NIL_RTR0MEMOBJ;
     
    308308}
    309309
     310
     311/** @name Memory Ballooning
     312 * @{
     313 */
    310314
    311315/**
     
    318322 * @param   pReq        The pre-allocated request for performing the VMMDev call.
    319323 */
    320 static int vboxGuestBalloonInflate(PRTR0MEMOBJ pMemObj, VMMDevChangeMemBalloon *pReq)
     324static int vbgdBalloonInflate(PRTR0MEMOBJ pMemObj, VMMDevChangeMemBalloon *pReq)
    321325{
    322326    uint32_t iPage;
     
    330334
    331335    pReq->fInflate = true;
    332     pReq->header.size = cbChangeMemBalloonReq;
     336    pReq->header.size = g_cbChangeMemBalloonReq;
    333337    pReq->cPages = VMMDEV_MEMORY_BALLOON_CHUNK_PAGES;
    334338
    335339    rc = VbglGRPerform(&pReq->header);
    336340    if (RT_FAILURE(rc))
    337         LogRel(("vboxGuestBalloonInflate: VbglGRPerform failed. rc=%Rrc\n", rc));
     341        LogRel(("vbgdBalloonInflate: VbglGRPerform failed. rc=%Rrc\n", rc));
    338342    return rc;
    339343}
     
    350354 * @param   pReq        The pre-allocated request for performing the VMMDev call.
    351355 */
    352 static int vboxGuestBalloonDeflate(PRTR0MEMOBJ pMemObj, VMMDevChangeMemBalloon *pReq)
     356static int vbgdBalloonDeflate(PRTR0MEMOBJ pMemObj, VMMDevChangeMemBalloon *pReq)
    353357{
    354358    uint32_t iPage;
     
    362366
    363367    pReq->fInflate = false;
    364     pReq->header.size = cbChangeMemBalloonReq;
     368    pReq->header.size = g_cbChangeMemBalloonReq;
    365369    pReq->cPages = VMMDEV_MEMORY_BALLOON_CHUNK_PAGES;
    366370
     
    368372    if (RT_FAILURE(rc))
    369373    {
    370         LogRel(("vboxGuestBalloonDeflate: VbglGRPerform failed. rc=%Rrc\n", rc));
     374        LogRel(("vbgdBalloonDeflate: VbglGRPerform failed. rc=%Rrc\n", rc));
    371375        return rc;
    372376    }
     
    375379    if (RT_FAILURE(rc))
    376380    {
    377         LogRel(("vboxGuestBalloonDeflate: RTR0MemObjFree(%p,true) -> %Rrc; this is *BAD*!\n", *pMemObj, rc));
     381        LogRel(("vbgdBalloonDeflate: RTR0MemObjFree(%p,true) -> %Rrc; this is *BAD*!\n", *pMemObj, rc));
    378382        return rc;
    379383    }
     
    387391 * Inflate/deflate the memory balloon and notify the host.
    388392 *
    389  * This is a worker used by VBoxGuestCommonIOCtl_CheckMemoryBalloon - it takes
    390  * the mutex.
     393 * This is a worker used by vbgdIoCtl_CheckMemoryBalloon - it takes the mutex.
    391394 *
    392395 * @returns VBox status code.
     
    397400 *                          (VINF_SUCCESS if set).
    398401 */
    399 static int vboxGuestSetBalloonSizeKernel(PVBOXGUESTDEVEXT pDevExt, uint32_t cBalloonChunks, uint32_t *pfHandleInR3)
     402static int vbgdSetBalloonSizeKernel(PVBOXGUESTDEVEXT pDevExt, uint32_t cBalloonChunks, uint32_t *pfHandleInR3)
    400403{
    401404    int rc = VINF_SUCCESS;
     
    408411        if (cBalloonChunks > pDevExt->MemBalloon.cMaxChunks)
    409412        {
    410             LogRel(("vboxGuestSetBalloonSizeKernel: illegal balloon size %u (max=%u)\n",
     413            LogRel(("vbgdSetBalloonSizeKernel: illegal balloon size %u (max=%u)\n",
    411414                    cBalloonChunks, pDevExt->MemBalloon.cMaxChunks));
    412415            return VERR_INVALID_PARAMETER;
     
    422425            if (!pDevExt->MemBalloon.paMemObj)
    423426            {
    424                 LogRel(("vboxGuestSetBalloonSizeKernel: no memory for paMemObj!\n"));
     427                LogRel(("vbgdSetBalloonSizeKernel: no memory for paMemObj!\n"));
    425428                return VERR_NO_MEMORY;
    426429            }
    427430        }
    428431
    429         rc = VbglGRAlloc((VMMDevRequestHeader **)&pReq, cbChangeMemBalloonReq, VMMDevReq_ChangeMemBalloon);
     432        rc = VbglGRAlloc((VMMDevRequestHeader **)&pReq, g_cbChangeMemBalloonReq, VMMDevReq_ChangeMemBalloon);
    430433        if (RT_FAILURE(rc))
    431434            return rc;
     
    454457                }
    455458
    456                 rc = vboxGuestBalloonInflate(&pDevExt->MemBalloon.paMemObj[i], pReq);
     459                rc = vbgdBalloonInflate(&pDevExt->MemBalloon.paMemObj[i], pReq);
    457460                if (RT_FAILURE(rc))
    458461                {
     
    470473            for (i = pDevExt->MemBalloon.cChunks; i-- > cBalloonChunks;)
    471474            {
    472                 rc = vboxGuestBalloonDeflate(&pDevExt->MemBalloon.paMemObj[i], pReq);
     475                rc = vbgdBalloonDeflate(&pDevExt->MemBalloon.paMemObj[i], pReq);
    473476                if (RT_FAILURE(rc))
    474477                {
     
    494497
    495498/**
     499 * Inflate/deflate the balloon by one chunk.
     500 *
     501 * Worker for vbgdIoCtl_ChangeMemoryBalloon - it takes the mutex.
     502 *
     503 * @returns VBox status code.
     504 * @param   pDevExt         The device extension.
     505 * @param   pSession        The session.
     506 * @param   u64ChunkAddr    The address of the chunk to add to / remove from the
     507 *                          balloon.
     508 * @param   fInflate        Inflate if true, deflate if false.
     509 */
     510static int vbgdSetBalloonSizeFromUser(PVBOXGUESTDEVEXT pDevExt, PVBOXGUESTSESSION pSession, uint64_t u64ChunkAddr, bool fInflate)
     511{
     512    VMMDevChangeMemBalloon *pReq;
     513    int rc = VINF_SUCCESS;
     514    uint32_t i;
     515    PRTR0MEMOBJ pMemObj = NULL;
     516
     517    if (fInflate)
     518    {
     519        if (   pDevExt->MemBalloon.cChunks > pDevExt->MemBalloon.cMaxChunks - 1
     520            || pDevExt->MemBalloon.cMaxChunks == 0 /* If called without first querying. */)
     521        {
     522            LogRel(("vboxGuestSetBalloonSize: cannot inflate balloon, already have %u chunks (max=%u)\n",
     523                    pDevExt->MemBalloon.cChunks, pDevExt->MemBalloon.cMaxChunks));
     524            return VERR_INVALID_PARAMETER;
     525        }
     526
     527        if (!pDevExt->MemBalloon.paMemObj)
     528        {
     529            pDevExt->MemBalloon.paMemObj = (PRTR0MEMOBJ)RTMemAlloc(sizeof(RTR0MEMOBJ) * pDevExt->MemBalloon.cMaxChunks);
     530            if (!pDevExt->MemBalloon.paMemObj)
     531            {
     532                LogRel(("VBoxGuestSetBalloonSizeFromUser: no memory for paMemObj!\n"));
     533                return VERR_NO_MEMORY;
     534            }
     535            for (i = 0; i < pDevExt->MemBalloon.cMaxChunks; i++)
     536                pDevExt->MemBalloon.paMemObj[i] = NIL_RTR0MEMOBJ;
     537        }
     538    }
     539    else
     540    {
     541        if (pDevExt->MemBalloon.cChunks == 0)
     542        {
     543            AssertMsgFailed(("vboxGuestSetBalloonSize: cannot decrease balloon, already at size 0\n"));
     544            return VERR_INVALID_PARAMETER;
     545        }
     546    }
     547
     548    /*
     549     * Enumerate all memory objects and check if the object is already registered.
     550     */
     551    for (i = 0; i < pDevExt->MemBalloon.cMaxChunks; i++)
     552    {
     553        if (   fInflate
     554            && !pMemObj
     555            && pDevExt->MemBalloon.paMemObj[i] == NIL_RTR0MEMOBJ)
     556            pMemObj = &pDevExt->MemBalloon.paMemObj[i]; /* found free object pointer */
     557        if (RTR0MemObjAddressR3(pDevExt->MemBalloon.paMemObj[i]) == u64ChunkAddr)
     558        {
     559            if (fInflate)
     560                return VERR_ALREADY_EXISTS; /* don't provide the same memory twice */
     561            pMemObj = &pDevExt->MemBalloon.paMemObj[i];
     562            break;
     563        }
     564    }
     565    if (!pMemObj)
     566    {
     567        if (fInflate)
     568        {
     569            /* no free object pointer found -- should not happen */
     570            return VERR_NO_MEMORY;
     571        }
     572
     573        /* cannot free this memory as it wasn't provided before */
     574        return VERR_NOT_FOUND;
     575    }
     576
     577    /*
     578     * Try inflate / default the balloon as requested.
     579     */
     580    rc = VbglGRAlloc((VMMDevRequestHeader **)&pReq, g_cbChangeMemBalloonReq, VMMDevReq_ChangeMemBalloon);
     581    if (RT_FAILURE(rc))
     582        return rc;
     583
     584    if (fInflate)
     585    {
     586        rc = RTR0MemObjLockUser(pMemObj, (RTR3PTR)u64ChunkAddr, VMMDEV_MEMORY_BALLOON_CHUNK_SIZE,
     587                                RTMEM_PROT_READ | RTMEM_PROT_WRITE, NIL_RTR0PROCESS);
     588        if (RT_SUCCESS(rc))
     589        {
     590            rc = vbgdBalloonInflate(pMemObj, pReq);
     591            if (RT_SUCCESS(rc))
     592                pDevExt->MemBalloon.cChunks++;
     593            else
     594            {
     595                Log(("vboxGuestSetBalloonSize(inflate): failed, rc=%Rrc!\n", rc));
     596                RTR0MemObjFree(*pMemObj, true);
     597                *pMemObj = NIL_RTR0MEMOBJ;
     598            }
     599        }
     600    }
     601    else
     602    {
     603        rc = vbgdBalloonDeflate(pMemObj, pReq);
     604        if (RT_SUCCESS(rc))
     605            pDevExt->MemBalloon.cChunks--;
     606        else
     607            Log(("vboxGuestSetBalloonSize(deflate): failed, rc=%Rrc!\n", rc));
     608    }
     609
     610    VbglGRFree(&pReq->header);
     611    return rc;
     612}
     613
     614
     615/**
     616 * Cleanup the memory balloon of a session.
     617 *
     618 * Will request the balloon mutex, so it must be valid and the caller must not
     619 * own it already.
     620 *
     621 * @param   pDevExt     The device extension.
     622 * @param   pDevExt     The session.  Can be NULL at unload.
     623 */
     624static void vbgdCloseMemBalloon(PVBOXGUESTDEVEXT pDevExt, PVBOXGUESTSESSION pSession)
     625{
     626    RTSemFastMutexRequest(pDevExt->MemBalloon.hMtx);
     627    if (    pDevExt->MemBalloon.pOwner == pSession
     628        ||  pSession == NULL /*unload*/)
     629    {
     630        if (pDevExt->MemBalloon.paMemObj)
     631        {
     632            VMMDevChangeMemBalloon *pReq;
     633            int rc = VbglGRAlloc((VMMDevRequestHeader **)&pReq, g_cbChangeMemBalloonReq, VMMDevReq_ChangeMemBalloon);
     634            if (RT_SUCCESS(rc))
     635            {
     636                uint32_t i;
     637                for (i = pDevExt->MemBalloon.cChunks; i-- > 0;)
     638                {
     639                    rc = vbgdBalloonDeflate(&pDevExt->MemBalloon.paMemObj[i], pReq);
     640                    if (RT_FAILURE(rc))
     641                    {
     642                        LogRel(("vbgdCloseMemBalloon: Deflate failed with rc=%Rrc.  Will leak %u chunks.\n",
     643                                rc, pDevExt->MemBalloon.cChunks));
     644                        break;
     645                    }
     646                    pDevExt->MemBalloon.paMemObj[i] = NIL_RTR0MEMOBJ;
     647                    pDevExt->MemBalloon.cChunks--;
     648                }
     649                VbglGRFree(&pReq->header);
     650            }
     651            else
     652                LogRel(("vbgdCloseMemBalloon: Failed to allocate VMMDev request buffer (rc=%Rrc).  Will leak %u chunks.\n",
     653                        rc, pDevExt->MemBalloon.cChunks));
     654            RTMemFree(pDevExt->MemBalloon.paMemObj);
     655            pDevExt->MemBalloon.paMemObj = NULL;
     656        }
     657
     658        pDevExt->MemBalloon.pOwner = NULL;
     659    }
     660    RTSemFastMutexRelease(pDevExt->MemBalloon.hMtx);
     661}
     662
     663/** @} */
     664
     665
     666
     667/** @name Heartbeat
     668 * @{
     669 */
     670
     671/**
    496672 * Sends heartbeat to host.
    497673 *
    498674 * @returns VBox status code.
    499675 */
    500 static int VBoxGuestHeartbeatSend(PVBOXGUESTDEVEXT pDevExt)
     676static int vbgdHeartbeatSend(PVBOXGUESTDEVEXT pDevExt)
    501677{
    502678    int rc;
     
    504680    {
    505681        rc = VbglGRPerform(pDevExt->pReqGuestHeartbeat);
    506         Log(("VBoxGuestHeartbeatSend: VbglGRPerform VBoxGuestHeartbeatSend completed with rc=%Rrc\n", rc));
     682        Log(("vbgdHeartbeatSend: VbglGRPerform vbgdHeartbeatSend completed with rc=%Rrc\n", rc));
    507683    }
    508684    else
     
    513689
    514690/**
     691 * Callback for heartbeat timer.
     692 */
     693static DECLCALLBACK(void) vbgdHeartbeatTimerHandler(PRTTIMER hTimer, void *pvUser, uint64_t iTick)
     694{
     695    PVBOXGUESTDEVEXT pDevExt = (PVBOXGUESTDEVEXT)pvUser;
     696    int rc;
     697    AssertReturnVoid(pDevExt);
     698
     699    rc = vbgdHeartbeatSend(pDevExt);
     700    if (RT_FAILURE(rc))
     701        Log(("HB Timer: vbgdHeartbeatSend failed: rc=%Rrc\n", rc));
     702
     703    NOREF(hTimer); NOREF(iTick);
     704}
     705
     706
     707/**
    515708 * Configure the host to check guest's heartbeat
    516709 * and get heartbeat interval from the host.
     
    520713 * @param   fEnabled        Set true to enable guest heartbeat checks on host.
    521714 */
    522 static int VBoxGuestHeartbeatHostConfigure(PVBOXGUESTDEVEXT pDevExt, bool fEnabled)
     715static int vbgdHeartbeatHostConfigure(PVBOXGUESTDEVEXT pDevExt, bool fEnabled)
    523716{
    524717    VMMDevReqHeartbeat *pReq;
    525718    int rc = VbglGRAlloc((VMMDevRequestHeader **)&pReq, sizeof(*pReq), VMMDevReq_HeartbeatConfigure);
    526     Log(("VBoxGuestHeartbeatHostConfigure: VbglGRAlloc VBoxGuestHeartbeatHostConfigure completed with rc=%Rrc\n", rc));
     719    Log(("vbgdHeartbeatHostConfigure: VbglGRAlloc vbgdHeartbeatHostConfigure completed with rc=%Rrc\n", rc));
    527720    if (RT_SUCCESS(rc))
    528721    {
     
    530723        pReq->cNsInterval = 0;
    531724        rc = VbglGRPerform(&pReq->header);
    532         Log(("VBoxGuestHeartbeatHostConfigure: VbglGRPerform VBoxGuestHeartbeatHostConfigure completed with rc=%Rrc\n", rc));
     725        Log(("vbgdHeartbeatHostConfigure: VbglGRPerform vbgdHeartbeatHostConfigure completed with rc=%Rrc\n", rc));
    533726        pDevExt->cNsHeartbeatInterval = pReq->cNsInterval;
    534727        VbglGRFree(&pReq->header);
     
    539732
    540733/**
    541  * Callback for heartbeat timer.
    542  */
    543 static DECLCALLBACK(void) VBoxGuestHeartbeatTimerHandler(PRTTIMER p1, void *pvUser, uint64_t p3)
    544 {
    545     NOREF(p1);
    546     NOREF(p3);
    547 
    548     PVBOXGUESTDEVEXT pDevExt = (PVBOXGUESTDEVEXT)pvUser;
    549     if (!pDevExt)
    550         return;
    551 
    552     int rc = VBoxGuestHeartbeatSend(pDevExt);
    553     if (RT_FAILURE(rc))
    554     {
    555         Log(("HB Timer: VBoxGuestHeartbeatSend terminated with rc=%Rrc\n", rc));
    556     }
    557 }
    558 
    559 
    560 /**
    561734 * Initializes the heartbeat timer.
    562735 *
     
    571744     * Make sure that heartbeat checking is disabled.
    572745     */
    573     int rc = VBoxGuestHeartbeatHostConfigure(pDevExt, false);
     746    int rc = vbgdHeartbeatHostConfigure(pDevExt, false);
    574747    if (RT_SUCCESS(rc))
    575748    {
    576         rc = VBoxGuestHeartbeatHostConfigure(pDevExt, true);
     749        rc = vbgdHeartbeatHostConfigure(pDevExt, true);
    577750        if (RT_SUCCESS(rc))
    578751        {
     
    586759            if (RT_SUCCESS(rc))
    587760            {
    588                 LogRel(("VBoxGuestInitDevExt: Setting up heartbeat to trigger every %RU64 sec\n",
     761                LogRel(("VbgdCommonInitDevExt: Setting up heartbeat to trigger every %RU64 sec\n",
    589762                        pDevExt->cNsHeartbeatInterval / RT_NS_1SEC));
    590763                rc = RTTimerCreateEx(&pDevExt->pHeartbeatTimer, pDevExt->cNsHeartbeatInterval, 0 /*fFlags*/,
    591                                      (PFNRTTIMER)VBoxGuestHeartbeatTimerHandler, pDevExt);
     764                                     (PFNRTTIMER)vbgdHeartbeatTimerHandler, pDevExt);
    592765                if (RT_SUCCESS(rc))
    593766                {
     
    596769                        return VINF_SUCCESS;
    597770
    598                     LogRel(("VBoxGuestInitDevExt: Heartbeat timer failed to start, rc=%Rrc\n", rc));
     771                    LogRel(("VbgdCommonInitDevExt: Heartbeat timer failed to start, rc=%Rrc\n", rc));
    599772                }
    600773                else
    601                     LogRel(("VBoxGuestInitDevExt: Failed to create heartbeat timer: %Rrc\n", rc));
     774                    LogRel(("VbgdCommonInitDevExt: Failed to create heartbeat timer: %Rrc\n", rc));
    602775
    603776                VbglGRFree(pDevExt->pReqGuestHeartbeat);
     
    605778            }
    606779            else
    607                 LogRel(("VBoxGuestInitDevExt: VbglGRAlloc(VMMDevReq_GuestHeartbeat): %Rrc\n", rc));
    608 
    609             LogRel(("VBoxGuestInitDevExt: Failed to set up the timer, guest heartbeat is disabled\n"));
    610             VBoxGuestHeartbeatHostConfigure(pDevExt, false);
     780                LogRel(("VbgdCommonInitDevExt: VbglGRAlloc(VMMDevReq_GuestHeartbeat): %Rrc\n", rc));
     781
     782            LogRel(("VbgdCommonInitDevExt: Failed to set up the timer, guest heartbeat is disabled\n"));
     783            vbgdHeartbeatHostConfigure(pDevExt, false);
    611784        }
    612785        else
    613             LogRel(("VBoxGuestInitDevExt: Failed to configure host for heartbeat checking: rc=%Rrc\n", rc));
     786            LogRel(("VbgdCommonInitDevExt: Failed to configure host for heartbeat checking: rc=%Rrc\n", rc));
    614787    }
    615788    return rc;
    616789}
    617790
    618 
    619 /**
    620  * Helper to reinit the VBoxVMM communication after hibernation.
     791/** @} */
     792
     793
     794/**
     795 * Helper to reinit the VMMDev communication after hibernation.
    621796 *
    622797 * @returns VBox status code.
    623798 * @param   pDevExt         The device extension.
    624799 * @param   enmOSType       The OS type.
    625  */
    626 int VBoxGuestReinitDevExtAfterHibernation(PVBOXGUESTDEVEXT pDevExt, VBOXOSTYPE enmOSType)
     800 *
     801 * @todo Call this on all platforms, not just windows.
     802 */
     803int VbgdCommonReinitDevExtAfterHibernation(PVBOXGUESTDEVEXT pDevExt, VBOXOSTYPE enmOSType)
    627804{
    628805    int rc = VBoxGuestReportGuestInfo(enmOSType);
     
    631808        rc = VBoxGuestReportDriverStatus(true /* Driver is active */);
    632809        if (RT_FAILURE(rc))
    633             Log(("VBoxGuestReinitDevExtAfterHibernation: could not report guest driver status, rc=%Rrc\n", rc));
     810            Log(("VbgdCommonReinitDevExtAfterHibernation: could not report guest driver status, rc=%Rrc\n", rc));
    634811    }
    635812    else
    636         Log(("VBoxGuestReinitDevExtAfterHibernation: could not report guest information to host, rc=%Rrc\n", rc));
    637     LogFlow(("VBoxGuestReinitDevExtAfterHibernation: returned with rc=%Rrc\n", rc));
     813        Log(("VbgdCommonReinitDevExtAfterHibernation: could not report guest information to host, rc=%Rrc\n", rc));
     814    LogFlow(("VbgdCommonReinitDevExtAfterHibernation: returned with rc=%Rrc\n", rc));
    638815    return rc;
    639 }
    640 
    641 
    642 /**
    643  * Inflate/deflate the balloon by one chunk.
    644  *
    645  * Worker for VBoxGuestCommonIOCtl_ChangeMemoryBalloon - it takes the mutex.
    646  *
    647  * @returns VBox status code.
    648  * @param   pDevExt         The device extension.
    649  * @param   pSession        The session.
    650  * @param   u64ChunkAddr    The address of the chunk to add to / remove from the
    651  *                          balloon.
    652  * @param   fInflate        Inflate if true, deflate if false.
    653  */
    654 static int vboxGuestSetBalloonSizeFromUser(PVBOXGUESTDEVEXT pDevExt, PVBOXGUESTSESSION pSession,
    655                                            uint64_t u64ChunkAddr, bool fInflate)
    656 {
    657     VMMDevChangeMemBalloon *pReq;
    658     int rc = VINF_SUCCESS;
    659     uint32_t i;
    660     PRTR0MEMOBJ pMemObj = NULL;
    661 
    662     if (fInflate)
    663     {
    664         if (   pDevExt->MemBalloon.cChunks > pDevExt->MemBalloon.cMaxChunks - 1
    665             || pDevExt->MemBalloon.cMaxChunks == 0 /* If called without first querying. */)
    666         {
    667             LogRel(("vboxGuestSetBalloonSize: cannot inflate balloon, already have %u chunks (max=%u)\n",
    668                     pDevExt->MemBalloon.cChunks, pDevExt->MemBalloon.cMaxChunks));
    669             return VERR_INVALID_PARAMETER;
    670         }
    671 
    672         if (!pDevExt->MemBalloon.paMemObj)
    673         {
    674             pDevExt->MemBalloon.paMemObj = (PRTR0MEMOBJ)RTMemAlloc(sizeof(RTR0MEMOBJ) * pDevExt->MemBalloon.cMaxChunks);
    675             if (!pDevExt->MemBalloon.paMemObj)
    676             {
    677                 LogRel(("VBoxGuestSetBalloonSizeFromUser: no memory for paMemObj!\n"));
    678                 return VERR_NO_MEMORY;
    679             }
    680             for (i = 0; i < pDevExt->MemBalloon.cMaxChunks; i++)
    681                 pDevExt->MemBalloon.paMemObj[i] = NIL_RTR0MEMOBJ;
    682         }
    683     }
    684     else
    685     {
    686         if (pDevExt->MemBalloon.cChunks == 0)
    687         {
    688             AssertMsgFailed(("vboxGuestSetBalloonSize: cannot decrease balloon, already at size 0\n"));
    689             return VERR_INVALID_PARAMETER;
    690         }
    691     }
    692 
    693     /*
    694      * Enumerate all memory objects and check if the object is already registered.
    695      */
    696     for (i = 0; i < pDevExt->MemBalloon.cMaxChunks; i++)
    697     {
    698         if (   fInflate
    699             && !pMemObj
    700             && pDevExt->MemBalloon.paMemObj[i] == NIL_RTR0MEMOBJ)
    701             pMemObj = &pDevExt->MemBalloon.paMemObj[i]; /* found free object pointer */
    702         if (RTR0MemObjAddressR3(pDevExt->MemBalloon.paMemObj[i]) == u64ChunkAddr)
    703         {
    704             if (fInflate)
    705                 return VERR_ALREADY_EXISTS; /* don't provide the same memory twice */
    706             pMemObj = &pDevExt->MemBalloon.paMemObj[i];
    707             break;
    708         }
    709     }
    710     if (!pMemObj)
    711     {
    712         if (fInflate)
    713         {
    714             /* no free object pointer found -- should not happen */
    715             return VERR_NO_MEMORY;
    716         }
    717 
    718         /* cannot free this memory as it wasn't provided before */
    719         return VERR_NOT_FOUND;
    720     }
    721 
    722     /*
    723      * Try inflate / default the balloon as requested.
    724      */
    725     rc = VbglGRAlloc((VMMDevRequestHeader **)&pReq, cbChangeMemBalloonReq, VMMDevReq_ChangeMemBalloon);
    726     if (RT_FAILURE(rc))
    727         return rc;
    728 
    729     if (fInflate)
    730     {
    731         rc = RTR0MemObjLockUser(pMemObj, (RTR3PTR)u64ChunkAddr, VMMDEV_MEMORY_BALLOON_CHUNK_SIZE,
    732                                 RTMEM_PROT_READ | RTMEM_PROT_WRITE, NIL_RTR0PROCESS);
    733         if (RT_SUCCESS(rc))
    734         {
    735             rc = vboxGuestBalloonInflate(pMemObj, pReq);
    736             if (RT_SUCCESS(rc))
    737                 pDevExt->MemBalloon.cChunks++;
    738             else
    739             {
    740                 Log(("vboxGuestSetBalloonSize(inflate): failed, rc=%Rrc!\n", rc));
    741                 RTR0MemObjFree(*pMemObj, true);
    742                 *pMemObj = NIL_RTR0MEMOBJ;
    743             }
    744         }
    745     }
    746     else
    747     {
    748         rc = vboxGuestBalloonDeflate(pMemObj, pReq);
    749         if (RT_SUCCESS(rc))
    750             pDevExt->MemBalloon.cChunks--;
    751         else
    752             Log(("vboxGuestSetBalloonSize(deflate): failed, rc=%Rrc!\n", rc));
    753     }
    754 
    755     VbglGRFree(&pReq->header);
    756     return rc;
    757 }
    758 
    759 
    760 /**
    761  * Cleanup the memory balloon of a session.
    762  *
    763  * Will request the balloon mutex, so it must be valid and the caller must not
    764  * own it already.
    765  *
    766  * @param   pDevExt     The device extension.
    767  * @param   pDevExt     The session.  Can be NULL at unload.
    768  */
    769 static void vboxGuestCloseMemBalloon(PVBOXGUESTDEVEXT pDevExt, PVBOXGUESTSESSION pSession)
    770 {
    771     RTSemFastMutexRequest(pDevExt->MemBalloon.hMtx);
    772     if (    pDevExt->MemBalloon.pOwner == pSession
    773         ||  pSession == NULL /*unload*/)
    774     {
    775         if (pDevExt->MemBalloon.paMemObj)
    776         {
    777             VMMDevChangeMemBalloon *pReq;
    778             int rc = VbglGRAlloc((VMMDevRequestHeader **)&pReq, cbChangeMemBalloonReq, VMMDevReq_ChangeMemBalloon);
    779             if (RT_SUCCESS(rc))
    780             {
    781                 uint32_t i;
    782                 for (i = pDevExt->MemBalloon.cChunks; i-- > 0;)
    783                 {
    784                     rc = vboxGuestBalloonDeflate(&pDevExt->MemBalloon.paMemObj[i], pReq);
    785                     if (RT_FAILURE(rc))
    786                     {
    787                         LogRel(("vboxGuestCloseMemBalloon: Deflate failed with rc=%Rrc.  Will leak %u chunks.\n",
    788                                 rc, pDevExt->MemBalloon.cChunks));
    789                         break;
    790                     }
    791                     pDevExt->MemBalloon.paMemObj[i] = NIL_RTR0MEMOBJ;
    792                     pDevExt->MemBalloon.cChunks--;
    793                 }
    794                 VbglGRFree(&pReq->header);
    795             }
    796             else
    797                 LogRel(("vboxGuestCloseMemBalloon: Failed to allocate VMMDev request buffer (rc=%Rrc).  Will leak %u chunks.\n",
    798                         rc, pDevExt->MemBalloon.cChunks));
    799             RTMemFree(pDevExt->MemBalloon.paMemObj);
    800             pDevExt->MemBalloon.paMemObj = NULL;
    801         }
    802 
    803         pDevExt->MemBalloon.pOwner = NULL;
    804     }
    805     RTSemFastMutexRelease(pDevExt->MemBalloon.hMtx);
    806816}
    807817
     
    828838 *                          will ever be allowed to mask.
    829839 */
    830 int VBoxGuestInitDevExt(PVBOXGUESTDEVEXT pDevExt, uint16_t IOPortBase,
    831                         void *pvMMIOBase, uint32_t cbMMIO, VBOXOSTYPE enmOSType, uint32_t fFixedEvents)
     840int VbgdCommonInitDevExt(PVBOXGUESTDEVEXT pDevExt, uint16_t IOPortBase,
     841                         void *pvMMIOBase, uint32_t cbMMIO, VBOXOSTYPE enmOSType, uint32_t fFixedEvents)
    832842{
    833843    int rc, rc2;
     
    913923        {
    914924            pDevExt->pVMMDevMemory = pVMMDev;
    915             Log(("VBoxGuestInitDevExt: VMMDevMemory: mapping=%p size=%#RX32 (%#RX32) version=%#RX32\n",
     925            Log(("VbgdCommonInitDevExt: VMMDevMemory: mapping=%p size=%#RX32 (%#RX32) version=%#RX32\n",
    916926                 pVMMDev, pVMMDev->u32Size, cbMMIO, pVMMDev->u32Version));
    917927        }
    918928        else /* try live without it. */
    919             LogRel(("VBoxGuestInitDevExt: Bogus VMMDev memory; u32Version=%RX32 (expected %RX32) u32Size=%RX32 (expected <= %RX32)\n",
     929            LogRel(("VbgdCommonInitDevExt: Bogus VMMDev memory; u32Version=%RX32 (expected %RX32) u32Size=%RX32 (expected <= %RX32)\n",
    920930                    pVMMDev->u32Version, VMMDEV_MEMORY_VERSION, pVMMDev->u32Size, cbMMIO));
    921931    }
     
    929939    if (RT_FAILURE(rc))
    930940    {
    931         LogRel(("VBoxGuestInitDevExt: failed to create spinlock, rc=%Rrc!\n", rc));
     941        LogRel(("VbgdCommonInitDevExt: failed to create spinlock, rc=%Rrc!\n", rc));
    932942        if (pDevExt->EventSpinlock != NIL_RTSPINLOCK)
    933943            RTSpinlockDestroy(pDevExt->EventSpinlock);
     
    938948    if (RT_FAILURE(rc))
    939949    {
    940         LogRel(("VBoxGuestInitDevExt: failed to create mutex, rc=%Rrc!\n", rc));
     950        LogRel(("VbgdCommonInitDevExt: failed to create mutex, rc=%Rrc!\n", rc));
    941951        RTSpinlockDestroy(pDevExt->SessionSpinlock);
    942952        RTSpinlockDestroy(pDevExt->EventSpinlock);
     
    973983                         * Initialize stuff which may fail without requiring the driver init to fail.
    974984                         */
    975                         vboxGuestInitFixateGuestMappings(pDevExt);
     985                        vbgdInitFixateGuestMappings(pDevExt);
    976986                        vbgdHeartbeatInit(pDevExt);
    977987
     
    981991                        rc = VBoxGuestReportDriverStatus(true /* Driver is active */);
    982992                        if (RT_FAILURE(rc))
    983                             LogRel(("VBoxGuestInitDevExt: VBoxReportGuestDriverStatus failed, rc=%Rrc\n", rc));
    984 
    985                         LogFlowFunc(("VBoxGuestInitDevExt: returns success\n"));
     993                            LogRel(("VbgdCommonInitDevExt: VBoxReportGuestDriverStatus failed, rc=%Rrc\n", rc));
     994
     995                        LogFlowFunc(("VbgdCommonInitDevExt: returns success\n"));
    986996                        return VINF_SUCCESS;
    987997                    }
    988998                }
    989999
    990                 LogRel(("VBoxGuestInitDevExt: failed to set host flags, rc=%Rrc\n", rc));
     1000                LogRel(("VbgdCommonInitDevExt: failed to set host flags, rc=%Rrc\n", rc));
    9911001            }
    9921002            else
    993                 LogRel(("VBoxGuestInitDevExt: VBoxReportGuestInfo failed, rc=%Rrc\n", rc));
     1003                LogRel(("VbgdCommonInitDevExt: VBoxReportGuestInfo failed, rc=%Rrc\n", rc));
    9941004            VbglGRFree((VMMDevRequestHeader *)pDevExt->pIrqAckEvents);
    9951005        }
    9961006        else
    997             LogRel(("VBoxGuestInitDevExt: VBoxGRAlloc failed, rc=%Rrc\n", rc));
     1007            LogRel(("VbgdCommonInitDevExt: VBoxGRAlloc failed, rc=%Rrc\n", rc));
    9981008
    9991009        VbglTerminate();
    10001010    }
    10011011    else
    1002         LogRel(("VBoxGuestInitDevExt: VbglInit failed, rc=%Rrc\n", rc));
     1012        LogRel(("VbgdCommonInitDevExt: VbglInit failed, rc=%Rrc\n", rc));
    10031013
    10041014    rc2 = RTSemFastMutexDestroy(pDevExt->MemBalloon.hMtx); AssertRC(rc2);
     
    10181028 * @param   pList       The head of the chain.
    10191029 */
    1020 static void VBoxGuestDeleteWaitList(PRTLISTNODE pList)
     1030static void vbgdDeleteWaitList(PRTLISTNODE pList)
    10211031{
    10221032    while (!RTListIsEmpty(pList))
     
    10421052 * @param   pDevExt         The device extension.
    10431053 */
    1044 void VBoxGuestDeleteDevExt(PVBOXGUESTDEVEXT pDevExt)
     1054void VbgdCommonDeleteDevExt(PVBOXGUESTDEVEXT pDevExt)
    10451055{
    10461056    int rc2;
    1047     Log(("VBoxGuestDeleteDevExt:\n"));
     1057    Log(("VbgdCommonDeleteDevExt:\n"));
    10481058    Log(("VBoxGuest: The additions driver is terminating.\n"));
    10491059
     
    10551065    {
    10561066        RTTimerDestroy(pDevExt->pHeartbeatTimer);
    1057         VBoxGuestHeartbeatHostConfigure(pDevExt, false);
     1067        vbgdHeartbeatHostConfigure(pDevExt, false);
    10581068    }
    10591069
     
    10641074     * Clean up the bits that involves the host first.
    10651075     */
    1066     vboxGuestTermUnfixGuestMappings(pDevExt);
     1076    vbgdTermUnfixGuestMappings(pDevExt);
    10671077    if (!RTListIsEmpty(&pDevExt->SessionList))
    10681078    {
     
    10761086    vbgdResetMouseStatusOnHost(pDevExt);
    10771087
    1078     vboxGuestCloseMemBalloon(pDevExt, (PVBOXGUESTSESSION)NULL);
     1088    vbgdCloseMemBalloon(pDevExt, (PVBOXGUESTSESSION)NULL);
    10791089
    10801090    /*
     
    10851095    rc2 = RTSemFastMutexDestroy(pDevExt->MemBalloon.hMtx); AssertRC(rc2);
    10861096
    1087     VBoxGuestDeleteWaitList(&pDevExt->WaitList);
     1097    vbgdDeleteWaitList(&pDevExt->WaitList);
    10881098#ifdef VBOX_WITH_HGCM
    1089     VBoxGuestDeleteWaitList(&pDevExt->HGCMWaitList);
     1099    vbgdDeleteWaitList(&pDevExt->HGCMWaitList);
    10901100#endif
    10911101#ifdef VBOXGUEST_USE_DEFERRED_WAKE_UP
    1092     VBoxGuestDeleteWaitList(&pDevExt->WakeUpList);
     1102    vbgdDeleteWaitList(&pDevExt->WakeUpList);
    10931103#endif
    1094     VBoxGuestDeleteWaitList(&pDevExt->WokenUpList);
    1095     VBoxGuestDeleteWaitList(&pDevExt->FreeList);
     1104    vbgdDeleteWaitList(&pDevExt->WokenUpList);
     1105    vbgdDeleteWaitList(&pDevExt->FreeList);
    10961106
    10971107    VbglTerminate();
     
    11141124 *
    11151125 * The native code calls this when a ring-3 client opens the device.
    1116  * Use VBoxGuestCreateKernelSession when a ring-0 client connects.
     1126 * Use VbgdCommonCreateKernelSession when a ring-0 client connects.
    11171127 *
    11181128 * @returns VBox status code.
     
    11201130 * @param   ppSession       Where to store the session on success.
    11211131 */
    1122 int VBoxGuestCreateUserSession(PVBOXGUESTDEVEXT pDevExt, PVBOXGUESTSESSION *ppSession)
     1132int VbgdCommonCreateUserSession(PVBOXGUESTDEVEXT pDevExt, PVBOXGUESTSESSION *ppSession)
    11231133{
    11241134    PVBOXGUESTSESSION pSession = (PVBOXGUESTSESSION)RTMemAllocZ(sizeof(*pSession));
    11251135    if (RT_UNLIKELY(!pSession))
    11261136    {
    1127         LogRel(("VBoxGuestCreateUserSession: no memory!\n"));
     1137        LogRel(("VbgdCommonCreateUserSession: no memory!\n"));
    11281138        return VERR_NO_MEMORY;
    11291139    }
     
    11381148
    11391149    *ppSession = pSession;
    1140     LogFlow(("VBoxGuestCreateUserSession: pSession=%p proc=%RTproc (%d) r0proc=%p\n",
     1150    LogFlow(("VbgdCommonCreateUserSession: pSession=%p proc=%RTproc (%d) r0proc=%p\n",
    11411151             pSession, pSession->Process, (int)pSession->Process, (uintptr_t)pSession->R0Process)); /** @todo %RTr0proc */
    11421152    return VINF_SUCCESS;
     
    11481158 *
    11491159 * The native code calls this when a ring-0 client connects to the device.
    1150  * Use VBoxGuestCreateUserSession when a ring-3 client opens the device.
     1160 * Use VbgdCommonCreateUserSession when a ring-3 client opens the device.
    11511161 *
    11521162 * @returns VBox status code.
     
    11541164 * @param   ppSession       Where to store the session on success.
    11551165 */
    1156 int VBoxGuestCreateKernelSession(PVBOXGUESTDEVEXT pDevExt, PVBOXGUESTSESSION *ppSession)
     1166int VbgdCommonCreateKernelSession(PVBOXGUESTDEVEXT pDevExt, PVBOXGUESTSESSION *ppSession)
    11571167{
    11581168    PVBOXGUESTSESSION pSession = (PVBOXGUESTSESSION)RTMemAllocZ(sizeof(*pSession));
    11591169    if (RT_UNLIKELY(!pSession))
    11601170    {
    1161         LogRel(("VBoxGuestCreateKernelSession: no memory!\n"));
     1171        LogRel(("VbgdCommonCreateKernelSession: no memory!\n"));
    11621172        return VERR_NO_MEMORY;
    11631173    }
     
    11721182
    11731183    *ppSession = pSession;
    1174     LogFlow(("VBoxGuestCreateKernelSession: pSession=%p proc=%RTproc (%d) r0proc=%p\n",
     1184    LogFlow(("VbgdCommonCreateKernelSession: pSession=%p proc=%RTproc (%d) r0proc=%p\n",
    11751185             pSession, pSession->Process, (int)pSession->Process, (uintptr_t)pSession->R0Process)); /** @todo %RTr0proc */
    11761186    return VINF_SUCCESS;
     
    11841194 * @param   pSession        The session to close (and free).
    11851195 */
    1186 void VBoxGuestCloseSession(PVBOXGUESTDEVEXT pDevExt, PVBOXGUESTSESSION pSession)
     1196void VbgdCommonCloseSession(PVBOXGUESTDEVEXT pDevExt, PVBOXGUESTSESSION pSession)
    11871197{
    11881198#ifdef VBOX_WITH_HGCM
    11891199    unsigned i;
    11901200#endif
    1191     LogFlow(("VBoxGuestCloseSession: pSession=%p proc=%RTproc (%d) r0proc=%p\n",
     1201    LogFlow(("VbgdCommonCloseSession: pSession=%p proc=%RTproc (%d) r0proc=%p\n",
    11921202             pSession, pSession->Process, (int)pSession->Process, (uintptr_t)pSession->R0Process)); /** @todo %RTr0proc */
    11931203
     
    12021212    vbgdSetSessionMouseStatus(pDevExt, pSession, 0 /*fOrMask*/, UINT32_MAX /*fNotMask*/, true /*fSessionTermination*/);
    12031213
    1204     VBoxGuestCommonIOCtl_CancelAllWaitEvents(pDevExt, pSession);
     1214    vbgdIoCtl_CancelAllWaitEvents(pDevExt, pSession);
    12051215
    12061216#ifdef VBOX_WITH_HGCM
     
    12121222            Info.u32ClientID = pSession->aHGCMClientIds[i];
    12131223            pSession->aHGCMClientIds[i] = 0;
    1214             Log(("VBoxGuestCloseSession: disconnecting client id %#RX32\n", Info.u32ClientID));
    1215             VbglR0HGCMInternalDisconnect(&Info, VBoxGuestHGCMAsyncWaitCallback, pDevExt, RT_INDEFINITE_WAIT);
     1224            Log(("VbgdCommonCloseSession: disconnecting client id %#RX32\n", Info.u32ClientID));
     1225            VbglR0HGCMInternalDisconnect(&Info, vbgdHgcmAsyncWaitCallback, pDevExt, RT_INDEFINITE_WAIT);
    12161226        }
    12171227#endif
     
    12201230    pSession->Process = NIL_RTPROCESS;
    12211231    pSession->R0Process = NIL_RTR0PROCESS;
    1222     vboxGuestCloseMemBalloon(pDevExt, pSession);
     1232    vbgdCloseMemBalloon(pDevExt, pSession);
    12231233    RTMemFree(pSession);
    12241234}
     
    12321242 * @param   pSession        The session that's allocating this. Can be NULL.
    12331243 */
    1234 static PVBOXGUESTWAIT VBoxGuestWaitAlloc(PVBOXGUESTDEVEXT pDevExt, PVBOXGUESTSESSION pSession)
     1244static PVBOXGUESTWAIT vbgdWaitAlloc(PVBOXGUESTDEVEXT pDevExt, PVBOXGUESTSESSION pSession)
    12351245{
    12361246    /*
     
    12551265        if (!pWait)
    12561266        {
    1257             LogRelMax(32, ("VBoxGuestWaitAlloc: out-of-memory!\n"));
     1267            LogRelMax(32, ("vbgdWaitAlloc: out-of-memory!\n"));
    12581268            return NULL;
    12591269        }
     
    12621272        if (RT_FAILURE(rc))
    12631273        {
    1264             LogRelMax(32, ("VBoxGuestCommonIOCtl: RTSemEventMultiCreate failed with rc=%Rrc!\n", rc));
     1274            LogRelMax(32, ("VbgdCommonIoCtl: RTSemEventMultiCreate failed with rc=%Rrc!\n", rc));
    12651275            RTMemFree(pWait);
    12661276            return NULL;
     
    12981308 * @param   pWait           The wait-for-event entry to free.
    12991309 */
    1300 static void VBoxGuestWaitFreeLocked(PVBOXGUESTDEVEXT pDevExt, PVBOXGUESTWAIT pWait)
     1310static void vbgdWaitFreeLocked(PVBOXGUESTDEVEXT pDevExt, PVBOXGUESTWAIT pWait)
    13011311{
    13021312    pWait->fReqEvents = 0;
     
    13241334 * @param   pWait           The wait-for-event entry to free.
    13251335 */
    1326 static void VBoxGuestWaitFreeUnlocked(PVBOXGUESTDEVEXT pDevExt, PVBOXGUESTWAIT pWait)
     1336static void vbgdWaitFreeUnlocked(PVBOXGUESTDEVEXT pDevExt, PVBOXGUESTWAIT pWait)
    13271337{
    13281338    RTSpinlockAcquire(pDevExt->EventSpinlock);
    1329     VBoxGuestWaitFreeLocked(pDevExt, pWait);
     1339    vbgdWaitFreeLocked(pDevExt, pWait);
    13301340    RTSpinlockRelease(pDevExt->EventSpinlock);
    13311341}
     
    13411351 * @param   pDevExt         The device extension.
    13421352 */
    1343 void VBoxGuestWaitDoWakeUps(PVBOXGUESTDEVEXT pDevExt)
     1353void VbgdCommonWaitDoWakeUps(PVBOXGUESTDEVEXT pDevExt)
    13441354{
    13451355    if (!RTListIsEmpty(&pDevExt->WakeUpList))
     
    13681378            {
    13691379                pWait->fFreeMe = false;
    1370                 VBoxGuestWaitFreeLocked(pDevExt, pWait);
     1380                vbgdWaitFreeLocked(pDevExt, pWait);
    13711381            }
    13721382        }
     
    13751385}
    13761386#endif /* VBOXGUEST_USE_DEFERRED_WAKE_UP */
    1377 
    1378 
    1379 /**
    1380  * Modifies the guest capabilities.
    1381  *
    1382  * Should be called during driver init and termination.
    1383  *
    1384  * @returns VBox status code.
    1385  * @param   fOr             The Or mask (what to enable).
    1386  * @param   fNot            The Not mask (what to disable).
    1387  */
    1388 int VBoxGuestSetGuestCapabilities(uint32_t fOr, uint32_t fNot)
    1389 {
    1390     VMMDevReqGuestCapabilities2 *pReq;
    1391     int rc = VbglGRAlloc((VMMDevRequestHeader **)&pReq, sizeof(*pReq), VMMDevReq_SetGuestCapabilities);
    1392     if (RT_FAILURE(rc))
    1393     {
    1394         Log(("VBoxGuestSetGuestCapabilities: failed to allocate %u (%#x) bytes to cache the request. rc=%Rrc!!\n",
    1395              sizeof(*pReq), sizeof(*pReq), rc));
    1396         return rc;
    1397     }
    1398 
    1399     pReq->u32OrMask = fOr;
    1400     pReq->u32NotMask = fNot;
    1401 
    1402     rc = VbglGRPerform(&pReq->header);
    1403     if (RT_FAILURE(rc))
    1404         Log(("VBoxGuestSetGuestCapabilities: VbglGRPerform failed, rc=%Rrc!\n", rc));
    1405 
    1406     VbglGRFree(&pReq->header);
    1407     return rc;
    1408 }
    14091387
    14101388
     
    14191397 * @param   pSession    The session.
    14201398 */
    1421 int  VBoxGuestCommonIOCtlFast(unsigned iFunction, PVBOXGUESTDEVEXT pDevExt, PVBOXGUESTSESSION pSession)
    1422 {
    1423     LogFlow(("VBoxGuestCommonIOCtlFast: iFunction=%#x pDevExt=%p pSession=%p\n", iFunction, pDevExt, pSession));
     1399int  VbgdCommonIoCtlFast(unsigned iFunction, PVBOXGUESTDEVEXT pDevExt, PVBOXGUESTSESSION pSession)
     1400{
     1401    LogFlow(("VbgdCommonIoCtlFast: iFunction=%#x pDevExt=%p pSession=%p\n", iFunction, pDevExt, pSession));
    14241402
    14251403    NOREF(iFunction);
     
    14381416 * @param   pcbDataReturned (out) contains the number of bytes to return.
    14391417 */
    1440 static int VBoxGuestCommonIOCtl_GetVMMDevPort(PVBOXGUESTDEVEXT pDevExt, VBoxGuestPortInfo *pInfo, size_t *pcbDataReturned)
    1441 {
    1442     LogFlow(("VBoxGuestCommonIOCtl: GETVMMDEVPORT\n"));
     1418static int vbgdIoCtl_GetVMMDevPort(PVBOXGUESTDEVEXT pDevExt, VBoxGuestPortInfo *pInfo, size_t *pcbDataReturned)
     1419{
     1420    LogFlow(("VbgdCommonIoCtl: GETVMMDEVPORT\n"));
    14431421
    14441422    pInfo->portAddress = pDevExt->IOPortBase;
     
    14581436 * @param   pNotify         The new callback information.
    14591437 */
    1460 int VBoxGuestCommonIOCtl_SetMouseNotifyCallback(PVBOXGUESTDEVEXT pDevExt, VBoxGuestMouseSetNotifyCallback *pNotify)
    1461 {
    1462     LogFlow(("VBoxGuestCommonIOCtl: SET_MOUSE_NOTIFY_CALLBACK\n"));
     1438int vbgdIoCtl_SetMouseNotifyCallback(PVBOXGUESTDEVEXT pDevExt, VBoxGuestMouseSetNotifyCallback *pNotify)
     1439{
     1440    LogFlow(("VbgdCommonIoCtl: SET_MOUSE_NOTIFY_CALLBACK\n"));
    14631441
    14641442    RTSpinlockAcquire(pDevExt->EventSpinlock);
     
    14711449
    14721450/**
    1473  * Worker VBoxGuestCommonIOCtl_WaitEvent.
     1451 * Worker vbgdIoCtl_WaitEvent.
    14741452 *
    14751453 * The caller enters the spinlock, we leave it.
     
    14771455 * @returns VINF_SUCCESS if we've left the spinlock and can return immediately.
    14781456 */
    1479 DECLINLINE(int) WaitEventCheckCondition(PVBOXGUESTDEVEXT pDevExt, PVBOXGUESTSESSION pSession, VBoxGuestWaitEventInfo *pInfo,
    1480                                         int iEvent, const uint32_t fReqEvents)
     1457DECLINLINE(int) vbdgCheckWaitEventCondition(PVBOXGUESTDEVEXT pDevExt, PVBOXGUESTSESSION pSession,
     1458                                            VBoxGuestWaitEventInfo *pInfo, int iEvent, const uint32_t fReqEvents)
    14811459{
    14821460    uint32_t fMatches = pDevExt->f32PendingEvents & fReqEvents;
     
    14911469        pInfo->u32Result = VBOXGUEST_WAITEVENT_OK;
    14921470        if (fReqEvents & ~((uint32_t)1 << iEvent))
    1493             LogFlow(("VBoxGuestCommonIOCtl: WAITEVENT: returns %#x\n", pInfo->u32EventFlagsOut));
     1471            LogFlow(("VbgdCommonIoCtl: WAITEVENT: returns %#x\n", pInfo->u32EventFlagsOut));
    14941472        else
    1495             LogFlow(("VBoxGuestCommonIOCtl: WAITEVENT: returns %#x/%d\n", pInfo->u32EventFlagsOut, iEvent));
     1473            LogFlow(("VbgdCommonIoCtl: WAITEVENT: returns %#x/%d\n", pInfo->u32EventFlagsOut, iEvent));
    14961474        pSession->fPendingCancelWaitEvents = false;
    14971475        return VINF_SUCCESS;
     
    15031481
    15041482
    1505 static int VBoxGuestCommonIOCtl_WaitEvent(PVBOXGUESTDEVEXT pDevExt, PVBOXGUESTSESSION pSession,
    1506                                           VBoxGuestWaitEventInfo *pInfo,  size_t *pcbDataReturned, bool fInterruptible)
     1483static int vbgdIoCtl_WaitEvent(PVBOXGUESTDEVEXT pDevExt, PVBOXGUESTSESSION pSession,
     1484                               VBoxGuestWaitEventInfo *pInfo,  size_t *pcbDataReturned, bool fInterruptible)
    15071485{
    15081486    const uint32_t  fReqEvents = pInfo->u32EventMaskIn;
     
    15231501    if (RT_UNLIKELY(iEvent < 0))
    15241502    {
    1525         LogRel(("VBoxGuestCommonIOCtl: WAITEVENT: Invalid input mask %#x!!\n", fReqEvents));
     1503        LogRel(("VbgdCommonIoCtl: WAITEVENT: Invalid input mask %#x!!\n", fReqEvents));
    15261504        return VERR_INVALID_PARAMETER;
    15271505    }
     
    15311509     */
    15321510    RTSpinlockAcquire(pDevExt->EventSpinlock);
    1533     rc = WaitEventCheckCondition(pDevExt, pSession, pInfo, iEvent, fReqEvents);
     1511    rc = vbdgCheckWaitEventCondition(pDevExt, pSession, pInfo, iEvent, fReqEvents);
    15341512    if (rc == VINF_SUCCESS)
    15351513        return rc;
     
    15381516    {
    15391517        pInfo->u32Result = VBOXGUEST_WAITEVENT_TIMEOUT;
    1540         LogFlow(("VBoxGuestCommonIOCtl: WAITEVENT: returns VERR_TIMEOUT\n"));
     1518        LogFlow(("VbgdCommonIoCtl: WAITEVENT: returns VERR_TIMEOUT\n"));
    15411519        return VERR_TIMEOUT;
    15421520    }
    15431521
    1544     pWait = VBoxGuestWaitAlloc(pDevExt, pSession);
     1522    pWait = vbgdWaitAlloc(pDevExt, pSession);
    15451523    if (!pWait)
    15461524        return VERR_NO_MEMORY;
     
    15541532    RTSpinlockAcquire(pDevExt->EventSpinlock);
    15551533    RTListAppend(&pDevExt->WaitList, &pWait->ListNode);
    1556     rc = WaitEventCheckCondition(pDevExt, pSession, pInfo, iEvent, fReqEvents);
     1534    rc = vbdgCheckWaitEventCondition(pDevExt, pSession, pInfo, iEvent, fReqEvents);
    15571535    if (rc == VINF_SUCCESS)
    15581536    {
    1559         VBoxGuestWaitFreeUnlocked(pDevExt, pWait);
     1537        vbgdWaitFreeUnlocked(pDevExt, pWait);
    15601538        return rc;
    15611539    }
     
    15811559    RTSpinlockAcquire(pDevExt->EventSpinlock);
    15821560    fResEvents = pWait->fResEvents;
    1583     VBoxGuestWaitFreeLocked(pDevExt, pWait);
     1561    vbgdWaitFreeLocked(pDevExt, pWait);
    15841562    RTSpinlockRelease(pDevExt->EventSpinlock);
    15851563
     
    15931571        pInfo->u32Result = VBOXGUEST_WAITEVENT_OK;
    15941572        if (fReqEvents & ~((uint32_t)1 << iEvent))
    1595             LogFlow(("VBoxGuestCommonIOCtl: WAITEVENT: returns %#x\n", pInfo->u32EventFlagsOut));
     1573            LogFlow(("VbgdCommonIoCtl: WAITEVENT: returns %#x\n", pInfo->u32EventFlagsOut));
    15961574        else
    1597             LogFlow(("VBoxGuestCommonIOCtl: WAITEVENT: returns %#x/%d\n", pInfo->u32EventFlagsOut, iEvent));
     1575            LogFlow(("VbgdCommonIoCtl: WAITEVENT: returns %#x/%d\n", pInfo->u32EventFlagsOut, iEvent));
    15981576        rc = VINF_SUCCESS;
    15991577    }
     
    16031581        pInfo->u32Result = VBOXGUEST_WAITEVENT_INTERRUPTED;
    16041582        rc = VERR_INTERRUPTED;
    1605         LogFlow(("VBoxGuestCommonIOCtl: WAITEVENT: returns VERR_INTERRUPTED\n"));
     1583        LogFlow(("VbgdCommonIoCtl: WAITEVENT: returns VERR_INTERRUPTED\n"));
    16061584    }
    16071585    else if (rc == VERR_TIMEOUT)
    16081586    {
    16091587        pInfo->u32Result = VBOXGUEST_WAITEVENT_TIMEOUT;
    1610         LogFlow(("VBoxGuestCommonIOCtl: WAITEVENT: returns VERR_TIMEOUT (2)\n"));
     1588        LogFlow(("VbgdCommonIoCtl: WAITEVENT: returns VERR_TIMEOUT (2)\n"));
    16111589    }
    16121590    else
     
    16141592        if (RT_SUCCESS(rc))
    16151593        {
    1616             LogRelMax(32, ("VBoxGuestCommonIOCtl: WAITEVENT: returns %Rrc but no events!\n", rc));
     1594            LogRelMax(32, ("VbgdCommonIoCtl: WAITEVENT: returns %Rrc but no events!\n", rc));
    16171595            rc = VERR_INTERNAL_ERROR;
    16181596        }
    16191597        pInfo->u32Result = VBOXGUEST_WAITEVENT_ERROR;
    1620         LogFlow(("VBoxGuestCommonIOCtl: WAITEVENT: returns %Rrc\n", rc));
     1598        LogFlow(("VbgdCommonIoCtl: WAITEVENT: returns %Rrc\n", rc));
    16211599    }
    16221600
     
    16251603
    16261604
    1627 static int VBoxGuestCommonIOCtl_CancelAllWaitEvents(PVBOXGUESTDEVEXT pDevExt, PVBOXGUESTSESSION pSession)
     1605static int vbgdIoCtl_CancelAllWaitEvents(PVBOXGUESTDEVEXT pDevExt, PVBOXGUESTSESSION pSession)
    16281606{
    16291607    PVBOXGUESTWAIT          pWait;
     
    16361614    bool                    fCancelledOne = false;
    16371615
    1638     LogFlow(("VBoxGuestCommonIOCtl: CANCEL_ALL_WAITEVENTS\n"));
     1616    LogFlow(("VbgdCommonIoCtl: CANCEL_ALL_WAITEVENTS\n"));
    16391617
    16401618    /*
     
    16641642
    16651643#ifdef VBOXGUEST_USE_DEFERRED_WAKE_UP
    1666     VBoxGuestWaitDoWakeUps(pDevExt);
     1644    VbgdCommonWaitDoWakeUps(pDevExt);
    16671645#endif
    16681646
     
    16781656 * @param   pReqHdr             The request.
    16791657 */
    1680 static int VBoxGuestCheckIfVMMReqAllowed(PVBOXGUESTDEVEXT pDevExt, PVBOXGUESTSESSION pSession, VMMDevRequestType enmType,
    1681                                          VMMDevRequestHeader const *pReqHdr)
     1658static int vbgdCheckIfVmmReqIsAllowed(PVBOXGUESTDEVEXT pDevExt, PVBOXGUESTSESSION pSession, VMMDevRequestType enmType,
     1659                                      VMMDevRequestHeader const *pReqHdr)
    16821660{
    16831661    /*
     
    18231801}
    18241802
    1825 static int VBoxGuestCommonIOCtl_VMMRequest(PVBOXGUESTDEVEXT pDevExt, PVBOXGUESTSESSION pSession,
    1826                                            VMMDevRequestHeader *pReqHdr, size_t cbData, size_t *pcbDataReturned)
     1803static int vbgdIoCtl_VMMRequest(PVBOXGUESTDEVEXT pDevExt, PVBOXGUESTSESSION pSession,
     1804                                VMMDevRequestHeader *pReqHdr, size_t cbData, size_t *pcbDataReturned)
    18271805{
    18281806    int                     rc;
     
    18361814    const uint32_t          cbMinSize = (uint32_t)vmmdevGetRequestSize(enmType);
    18371815
    1838     LogFlow(("VBoxGuestCommonIOCtl: VMMREQUEST type %d\n", pReqHdr->requestType));
     1816    LogFlow(("VbgdCommonIoCtl: VMMREQUEST type %d\n", pReqHdr->requestType));
    18391817
    18401818    if (cbReq < cbMinSize)
    18411819    {
    1842         LogRel(("VBoxGuestCommonIOCtl: VMMREQUEST: invalid hdr size %#x, expected >= %#x; type=%#x!!\n",
     1820        LogRel(("VbgdCommonIoCtl: VMMREQUEST: invalid hdr size %#x, expected >= %#x; type=%#x!!\n",
    18431821                cbReq, cbMinSize, enmType));
    18441822        return VERR_INVALID_PARAMETER;
     
    18461824    if (cbReq > cbData)
    18471825    {
    1848         LogRel(("VBoxGuestCommonIOCtl: VMMREQUEST: invalid size %#x, expected >= %#x (hdr); type=%#x!!\n",
     1826        LogRel(("VbgdCommonIoCtl: VMMREQUEST: invalid size %#x, expected >= %#x (hdr); type=%#x!!\n",
    18491827                cbData, cbReq, enmType));
    18501828        return VERR_INVALID_PARAMETER;
     
    18531831    if (RT_FAILURE(rc))
    18541832    {
    1855         Log(("VBoxGuestCommonIOCtl: VMMREQUEST: invalid header: size %#x, expected >= %#x (hdr); type=%#x; rc=%Rrc!!\n",
     1833        Log(("VbgdCommonIoCtl: VMMREQUEST: invalid header: size %#x, expected >= %#x (hdr); type=%#x; rc=%Rrc!!\n",
    18561834             cbData, cbReq, enmType, rc));
    18571835        return rc;
    18581836    }
    18591837
    1860     rc = VBoxGuestCheckIfVMMReqAllowed(pDevExt, pSession, enmType, pReqHdr);
     1838    rc = vbgdCheckIfVmmReqIsAllowed(pDevExt, pSession, enmType, pReqHdr);
    18611839    if (RT_FAILURE(rc))
    18621840    {
    1863         Log(("VBoxGuestCommonIOCtl: VMMREQUEST: Operation not allowed! type=%#x rc=%Rrc\n", enmType, rc));
     1841        Log(("VbgdCommonIoCtl: VMMREQUEST: Operation not allowed! type=%#x rc=%Rrc\n", enmType, rc));
    18641842        return rc;
    18651843    }
     
    18751853    if (RT_FAILURE(rc))
    18761854    {
    1877         Log(("VBoxGuestCommonIOCtl: VMMREQUEST: failed to allocate %u (%#x) bytes to cache the request. rc=%Rrc!!\n",
     1855        Log(("VbgdCommonIoCtl: VMMREQUEST: failed to allocate %u (%#x) bytes to cache the request. rc=%Rrc!!\n",
    18781856             cbReq, cbReq, rc));
    18791857        return rc;
     
    18961874    }
    18971875    else if (RT_FAILURE(rc))
    1898         Log(("VBoxGuestCommonIOCtl: VMMREQUEST: VbglGRPerform - rc=%Rrc!\n", rc));
     1876        Log(("VbgdCommonIoCtl: VMMREQUEST: VbglGRPerform - rc=%Rrc!\n", rc));
    18991877    else
    19001878    {
    1901         Log(("VBoxGuestCommonIOCtl: VMMREQUEST: request execution failed; VMMDev rc=%Rrc!\n", pReqCopy->rc));
     1879        Log(("VbgdCommonIoCtl: VMMREQUEST: request execution failed; VMMDev rc=%Rrc!\n", pReqCopy->rc));
    19021880        rc = pReqCopy->rc;
    19031881    }
     
    19121890AssertCompile(RT_INDEFINITE_WAIT == (uint32_t)RT_INDEFINITE_WAIT); /* assumed by code below */
    19131891
    1914 /** Worker for VBoxGuestHGCMAsyncWaitCallback*. */
    1915 static int VBoxGuestHGCMAsyncWaitCallbackWorker(VMMDevHGCMRequestHeader volatile *pHdr, PVBOXGUESTDEVEXT pDevExt,
    1916                                                  bool fInterruptible, uint32_t cMillies)
     1892/** Worker for vbgdHgcmAsyncWaitCallback*. */
     1893static int vbgdHgcmAsyncWaitCallbackWorker(VMMDevHGCMRequestHeader volatile *pHdr, PVBOXGUESTDEVEXT pDevExt,
     1894                                           bool fInterruptible, uint32_t cMillies)
    19171895{
    19181896    int rc;
     
    19361914        RTSpinlockRelease(pDevExt->EventSpinlock);
    19371915
    1938         pWait = VBoxGuestWaitAlloc(pDevExt, NULL);
     1916        pWait = vbgdWaitAlloc(pDevExt, NULL);
    19391917        if (pWait)
    19401918            break;
     
    19551933    if ((pHdr->fu32Flags & VBOX_HGCM_REQ_DONE) != 0)
    19561934    {
    1957         VBoxGuestWaitFreeLocked(pDevExt, pWait);
     1935        vbgdWaitFreeLocked(pDevExt, pWait);
    19581936        RTSpinlockRelease(pDevExt->EventSpinlock);
    19591937        return VINF_SUCCESS;
     
    19751953        &&  (    !fInterruptible
    19761954             ||  rc != VERR_INTERRUPTED))
    1977         LogRel(("VBoxGuestHGCMAsyncWaitCallback: wait failed! %Rrc\n", rc));
    1978 
    1979     VBoxGuestWaitFreeUnlocked(pDevExt, pWait);
     1955        LogRel(("vbgdHgcmAsyncWaitCallback: wait failed! %Rrc\n", rc));
     1956
     1957    vbgdWaitFreeUnlocked(pDevExt, pWait);
    19801958    return rc;
    19811959}
     
    19851963 * This is a callback for dealing with async waits.
    19861964 *
    1987  * It operates in a manner similar to VBoxGuestCommonIOCtl_WaitEvent.
    1988  */
    1989 static DECLCALLBACK(int) VBoxGuestHGCMAsyncWaitCallback(VMMDevHGCMRequestHeader *pHdr, void *pvUser, uint32_t u32User)
     1965 * It operates in a manner similar to vbgdIoCtl_WaitEvent.
     1966 */
     1967static DECLCALLBACK(int) vbgdHgcmAsyncWaitCallback(VMMDevHGCMRequestHeader *pHdr, void *pvUser, uint32_t u32User)
    19901968{
    19911969    PVBOXGUESTDEVEXT pDevExt = (PVBOXGUESTDEVEXT)pvUser;
    1992     LogFlow(("VBoxGuestHGCMAsyncWaitCallback: requestType=%d\n", pHdr->header.requestType));
    1993     return VBoxGuestHGCMAsyncWaitCallbackWorker((VMMDevHGCMRequestHeader volatile *)pHdr,
    1994                                                 pDevExt,
    1995                                                 false /* fInterruptible */,
    1996                                                 u32User  /* cMillies */);
     1970    LogFlow(("vbgdHgcmAsyncWaitCallback: requestType=%d\n", pHdr->header.requestType));
     1971    return vbgdHgcmAsyncWaitCallbackWorker((VMMDevHGCMRequestHeader volatile *)pHdr, pDevExt,
     1972                                           false /* fInterruptible */, u32User  /* cMillies */);
    19971973}
    19981974
     
    20011977 * This is a callback for dealing with async waits with a timeout.
    20021978 *
    2003  * It operates in a manner similar to VBoxGuestCommonIOCtl_WaitEvent.
    2004  */
    2005 static DECLCALLBACK(int) VBoxGuestHGCMAsyncWaitCallbackInterruptible(VMMDevHGCMRequestHeader *pHdr,
    2006                                                                       void *pvUser, uint32_t u32User)
     1979 * It operates in a manner similar to vbgdIoCtl_WaitEvent.
     1980 */
     1981static DECLCALLBACK(int) vbgdHgcmAsyncWaitCallbackInterruptible(VMMDevHGCMRequestHeader *pHdr, void *pvUser, uint32_t u32User)
    20071982{
    20081983    PVBOXGUESTDEVEXT pDevExt = (PVBOXGUESTDEVEXT)pvUser;
    2009     LogFlow(("VBoxGuestHGCMAsyncWaitCallbackInterruptible: requestType=%d\n", pHdr->header.requestType));
    2010     return VBoxGuestHGCMAsyncWaitCallbackWorker((VMMDevHGCMRequestHeader volatile *)pHdr,
    2011                                                 pDevExt,
    2012                                                 true /* fInterruptible */,
    2013                                                 u32User /* cMillies */ );
    2014 }
    2015 
    2016 
    2017 static int VBoxGuestCommonIOCtl_HGCMConnect(PVBOXGUESTDEVEXT pDevExt, PVBOXGUESTSESSION pSession,
    2018                                             VBoxGuestHGCMConnectInfo *pInfo, size_t *pcbDataReturned)
     1984    LogFlow(("vbgdHgcmAsyncWaitCallbackInterruptible: requestType=%d\n", pHdr->header.requestType));
     1985    return vbgdHgcmAsyncWaitCallbackWorker((VMMDevHGCMRequestHeader volatile *)pHdr, pDevExt,
     1986                                           true /* fInterruptible */, u32User /* cMillies */);
     1987}
     1988
     1989
     1990static int vbgdIoCtl_HGCMConnect(PVBOXGUESTDEVEXT pDevExt, PVBOXGUESTSESSION pSession,
     1991                                 VBoxGuestHGCMConnectInfo *pInfo, size_t *pcbDataReturned)
    20191992{
    20201993    int rc;
     
    20251998     * to deal with cancelled requests.
    20261999     */
    2027     Log(("VBoxGuestCommonIOCtl: HGCM_CONNECT: %.128s\n",
     2000    Log(("VbgdCommonIoCtl: HGCM_CONNECT: %.128s\n",
    20282001         pInfo->Loc.type == VMMDevHGCMLoc_LocalHost || pInfo->Loc.type == VMMDevHGCMLoc_LocalHost_Existing
    20292002         ? pInfo->Loc.u.host.achName : "<not local host>"));
    20302003
    2031     rc = VbglR0HGCMInternalConnect(pInfo, VBoxGuestHGCMAsyncWaitCallback, pDevExt, RT_INDEFINITE_WAIT);
     2004    rc = VbglR0HGCMInternalConnect(pInfo, vbgdHgcmAsyncWaitCallback, pDevExt, RT_INDEFINITE_WAIT);
    20322005    if (RT_SUCCESS(rc))
    20332006    {
    2034         Log(("VBoxGuestCommonIOCtl: HGCM_CONNECT: u32Client=%RX32 result=%Rrc (rc=%Rrc)\n",
     2007        Log(("VbgdCommonIoCtl: HGCM_CONNECT: u32Client=%RX32 result=%Rrc (rc=%Rrc)\n",
    20352008             pInfo->u32ClientID, pInfo->result, rc));
    20362009        if (RT_SUCCESS(pInfo->result))
     
    20522025            {
    20532026                VBoxGuestHGCMDisconnectInfo Info;
    2054                 LogRelMax(32, ("VBoxGuestCommonIOCtl: HGCM_CONNECT: too many HGCMConnect calls for one session!\n"));
     2027                LogRelMax(32, ("VbgdCommonIoCtl: HGCM_CONNECT: too many HGCMConnect calls for one session!\n"));
    20552028                Info.result = 0;
    20562029                Info.u32ClientID = pInfo->u32ClientID;
    2057                 VbglR0HGCMInternalDisconnect(&Info, VBoxGuestHGCMAsyncWaitCallback, pDevExt, RT_INDEFINITE_WAIT);
     2030                VbglR0HGCMInternalDisconnect(&Info, vbgdHgcmAsyncWaitCallback, pDevExt, RT_INDEFINITE_WAIT);
    20582031                return VERR_TOO_MANY_OPEN_FILES;
    20592032            }
     
    20682041
    20692042
    2070 static int VBoxGuestCommonIOCtl_HGCMDisconnect(PVBOXGUESTDEVEXT pDevExt, PVBOXGUESTSESSION pSession, VBoxGuestHGCMDisconnectInfo *pInfo,
    2071                                               size_t *pcbDataReturned)
     2043static int vbgdIoCtl_HGCMDisconnect(PVBOXGUESTDEVEXT pDevExt, PVBOXGUESTSESSION pSession,
     2044                                    VBoxGuestHGCMDisconnectInfo *pInfo, size_t *pcbDataReturned)
    20722045{
    20732046    /*
     
    20872060    if (i >= RT_ELEMENTS(pSession->aHGCMClientIds))
    20882061    {
    2089         LogRelMax(32, ("VBoxGuestCommonIOCtl: HGCM_DISCONNECT: u32Client=%RX32\n", u32ClientId));
     2062        LogRelMax(32, ("VbgdCommonIoCtl: HGCM_DISCONNECT: u32Client=%RX32\n", u32ClientId));
    20902063        return VERR_INVALID_HANDLE;
    20912064    }
     
    20962069     * to deal with cancelled requests.
    20972070     */
    2098     Log(("VBoxGuestCommonIOCtl: HGCM_DISCONNECT: u32Client=%RX32\n", pInfo->u32ClientID));
    2099     rc = VbglR0HGCMInternalDisconnect(pInfo, VBoxGuestHGCMAsyncWaitCallback, pDevExt, RT_INDEFINITE_WAIT);
     2071    Log(("VbgdCommonIoCtl: HGCM_DISCONNECT: u32Client=%RX32\n", pInfo->u32ClientID));
     2072    rc = VbglR0HGCMInternalDisconnect(pInfo, vbgdHgcmAsyncWaitCallback, pDevExt, RT_INDEFINITE_WAIT);
    21002073    if (RT_SUCCESS(rc))
    21012074    {
    2102         LogFlow(("VBoxGuestCommonIOCtl: HGCM_DISCONNECT: result=%Rrc\n", pInfo->result));
     2075        LogFlow(("VbgdCommonIoCtl: HGCM_DISCONNECT: result=%Rrc\n", pInfo->result));
    21032076        if (pcbDataReturned)
    21042077            *pcbDataReturned = sizeof(*pInfo);
     
    21152088
    21162089
    2117 static int VBoxGuestCommonIOCtl_HGCMCall(PVBOXGUESTDEVEXT pDevExt,
    2118                                          PVBOXGUESTSESSION pSession,
    2119                                          VBoxGuestHGCMCallInfo *pInfo,
    2120                                          uint32_t cMillies, bool fInterruptible, bool f32bit, bool fUserData,
    2121                                          size_t cbExtra, size_t cbData, size_t *pcbDataReturned)
     2090static int vbgdIoCtl_HGCMCall(PVBOXGUESTDEVEXT pDevExt, PVBOXGUESTSESSION pSession, VBoxGuestHGCMCallInfo *pInfo,
     2091                              uint32_t cMillies, bool fInterruptible, bool f32bit, bool fUserData,
     2092                              size_t cbExtra, size_t cbData, size_t *pcbDataReturned)
    21222093{
    21232094    const uint32_t  u32ClientId = pInfo->u32ClientID;
     
    21322103    if (pInfo->cParms > 4096) /* (Just make sure it doesn't overflow the next check.) */
    21332104    {
    2134         LogRel(("VBoxGuestCommonIOCtl: HGCM_CALL: cParm=%RX32 is not sane\n", pInfo->cParms));
     2105        LogRel(("VbgdCommonIoCtl: HGCM_CALL: cParm=%RX32 is not sane\n", pInfo->cParms));
    21352106        return VERR_INVALID_PARAMETER;
    21362107    }
     
    21452116    if (cbData < cbActual)
    21462117    {
    2147         LogRel(("VBoxGuestCommonIOCtl: HGCM_CALL: cbData=%#zx (%zu) required size is %#zx (%zu)\n",
     2118        LogRel(("VbgdCommonIoCtl: HGCM_CALL: cbData=%#zx (%zu) required size is %#zx (%zu)\n",
    21482119               cbData, cbData, cbActual, cbActual));
    21492120        return VERR_INVALID_PARAMETER;
     
    21602131    if (RT_UNLIKELY(i >= RT_ELEMENTS(pSession->aHGCMClientIds)))
    21612132    {
    2162         LogRelMax(32, ("VBoxGuestCommonIOCtl: HGCM_CALL: Invalid handle. u32Client=%RX32\n", u32ClientId));
     2133        LogRelMax(32, ("VbgdCommonIoCtl: HGCM_CALL: Invalid handle. u32Client=%RX32\n", u32ClientId));
    21632134        return VERR_INVALID_HANDLE;
    21642135    }
     
    21702141     * be interruptible (should add a flag for this later I guess).
    21712142     */
    2172     LogFlow(("VBoxGuestCommonIOCtl: HGCM_CALL: u32Client=%RX32\n", pInfo->u32ClientID));
     2143    LogFlow(("VbgdCommonIoCtl: HGCM_CALL: u32Client=%RX32\n", pInfo->u32ClientID));
    21732144    fFlags = !fUserData && pSession->R0Process == NIL_RTR0PROCESS ? VBGLR0_HGCMCALL_F_KERNEL : VBGLR0_HGCMCALL_F_USER;
    21742145    uint32_t cbInfo = (uint32_t)(cbData - cbExtra);
     
    21772148    {
    21782149        if (fInterruptible)
    2179             rc = VbglR0HGCMInternalCall32(pInfo, cbInfo, fFlags, VBoxGuestHGCMAsyncWaitCallbackInterruptible, pDevExt, cMillies);
     2150            rc = VbglR0HGCMInternalCall32(pInfo, cbInfo, fFlags, vbgdHgcmAsyncWaitCallbackInterruptible, pDevExt, cMillies);
    21802151        else
    2181             rc = VbglR0HGCMInternalCall32(pInfo, cbInfo, fFlags, VBoxGuestHGCMAsyncWaitCallback, pDevExt, cMillies);
     2152            rc = VbglR0HGCMInternalCall32(pInfo, cbInfo, fFlags, vbgdHgcmAsyncWaitCallback, pDevExt, cMillies);
    21822153    }
    21832154    else
     
    21852156    {
    21862157        if (fInterruptible)
    2187             rc = VbglR0HGCMInternalCall(pInfo, cbInfo, fFlags, VBoxGuestHGCMAsyncWaitCallbackInterruptible, pDevExt, cMillies);
     2158            rc = VbglR0HGCMInternalCall(pInfo, cbInfo, fFlags, vbgdHgcmAsyncWaitCallbackInterruptible, pDevExt, cMillies);
    21882159        else
    2189             rc = VbglR0HGCMInternalCall(pInfo, cbInfo, fFlags, VBoxGuestHGCMAsyncWaitCallback, pDevExt, cMillies);
     2160            rc = VbglR0HGCMInternalCall(pInfo, cbInfo, fFlags, vbgdHgcmAsyncWaitCallback, pDevExt, cMillies);
    21902161    }
    21912162    if (RT_SUCCESS(rc))
    21922163    {
    2193         LogFlow(("VBoxGuestCommonIOCtl: HGCM_CALL: result=%Rrc\n", pInfo->result));
     2164        LogFlow(("VbgdCommonIoCtl: HGCM_CALL: result=%Rrc\n", pInfo->result));
    21942165        if (pcbDataReturned)
    21952166            *pcbDataReturned = cbActual;
     
    21992170        if (   rc != VERR_INTERRUPTED
    22002171            && rc != VERR_TIMEOUT)
    2201             LogRelMax(32, ("VBoxGuestCommonIOCtl: HGCM_CALL: %s Failed. rc=%Rrc.\n", f32bit ? "32" : "64", rc));
     2172            LogRelMax(32, ("VbgdCommonIoCtl: HGCM_CALL: %s Failed. rc=%Rrc.\n", f32bit ? "32" : "64", rc));
    22022173        else
    2203             Log(("VBoxGuestCommonIOCtl: HGCM_CALL: %s Failed. rc=%Rrc.\n", f32bit ? "32" : "64", rc));
     2174            Log(("VbgdCommonIoCtl: HGCM_CALL: %s Failed. rc=%Rrc.\n", f32bit ? "32" : "64", rc));
    22042175    }
    22052176    return rc;
     
    22232194 *                              be NULL.
    22242195 */
    2225 static int VBoxGuestCommonIOCtl_CheckMemoryBalloon(PVBOXGUESTDEVEXT pDevExt, PVBOXGUESTSESSION pSession,
    2226                                                    VBoxGuestCheckBalloonInfo *pInfo, size_t *pcbDataReturned)
     2196static int vbgdIoCtl_CheckMemoryBalloon(PVBOXGUESTDEVEXT pDevExt, PVBOXGUESTSESSION pSession,
     2197                                        VBoxGuestCheckBalloonInfo *pInfo, size_t *pcbDataReturned)
    22272198{
    22282199    VMMDevGetMemBalloonChangeRequest *pReq;
    22292200    int rc;
    22302201
    2231     LogFlow(("VBoxGuestCommonIOCtl: CHECK_MEMORY_BALLOON\n"));
     2202    LogFlow(("VbgdCommonIoCtl: CHECK_MEMORY_BALLOON\n"));
    22322203    rc = RTSemFastMutexRequest(pDevExt->MemBalloon.hMtx);
    22332204    AssertRCReturn(rc, rc);
     
    22352206    /*
    22362207     * The first user trying to query/change the balloon becomes the
    2237      * owner and owns it until the session is closed (vboxGuestCloseMemBalloon).
     2208     * owner and owns it until the session is closed (vbgdCloseMemBalloon).
    22382209     */
    22392210    if (   pDevExt->MemBalloon.pOwner != pSession
     
    22612232                pInfo->fHandleInR3    = false;
    22622233
    2263                 rc = vboxGuestSetBalloonSizeKernel(pDevExt, pReq->cBalloonChunks, &pInfo->fHandleInR3);
     2234                rc = vbgdSetBalloonSizeKernel(pDevExt, pReq->cBalloonChunks, &pInfo->fHandleInR3);
    22642235                /* Ignore various out of memory failures. */
    22652236                if (   rc == VERR_NO_MEMORY
     
    22722243            }
    22732244            else
    2274                 LogRel(("VBoxGuestCommonIOCtl: CHECK_MEMORY_BALLOON: VbglGRPerform failed. rc=%Rrc\n", rc));
     2245                LogRel(("VbgdCommonIoCtl: CHECK_MEMORY_BALLOON: VbglGRPerform failed. rc=%Rrc\n", rc));
    22752246            VbglGRFree(&pReq->header);
    22762247        }
     
    22802251
    22812252    RTSemFastMutexRelease(pDevExt->MemBalloon.hMtx);
    2282     LogFlow(("VBoxGuestCommonIOCtl: CHECK_MEMORY_BALLOON returns %Rrc\n", rc));
     2253    LogFlow(("VbgdCommonIoCtl: CHECK_MEMORY_BALLOON returns %Rrc\n", rc));
    22832254    return rc;
    22842255}
     
    22962267 *                              be NULL.
    22972268 */
    2298 static int VBoxGuestCommonIOCtl_ChangeMemoryBalloon(PVBOXGUESTDEVEXT pDevExt, PVBOXGUESTSESSION pSession,
    2299                                                     VBoxGuestChangeBalloonInfo *pInfo, size_t *pcbDataReturned)
     2269static int vbgdIoCtl_ChangeMemoryBalloon(PVBOXGUESTDEVEXT pDevExt, PVBOXGUESTSESSION pSession,
     2270                                         VBoxGuestChangeBalloonInfo *pInfo, size_t *pcbDataReturned)
    23002271{
    23012272    int rc;
    23022273
    2303     LogFlow(("VBoxGuestCommonIOCtl: CHANGE_BALLOON\n"));
     2274    LogFlow(("VbgdCommonIoCtl: CHANGE_BALLOON\n"));
    23042275    rc = RTSemFastMutexRequest(pDevExt->MemBalloon.hMtx);
    23052276    AssertRCReturn(rc, rc);
     
    23092280        /*
    23102281         * The first user trying to query/change the balloon becomes the
    2311          * owner and owns it until the session is closed (vboxGuestCloseMemBalloon).
     2282         * owner and owns it until the session is closed (vbgdCloseMemBalloon).
    23122283         */
    23132284        if (   pDevExt->MemBalloon.pOwner != pSession
     
    23172288        if (pDevExt->MemBalloon.pOwner == pSession)
    23182289        {
    2319             rc = vboxGuestSetBalloonSizeFromUser(pDevExt, pSession, pInfo->u64ChunkAddr, !!pInfo->fInflate);
     2290            rc = vbgdSetBalloonSizeFromUser(pDevExt, pSession, pInfo->u64ChunkAddr, !!pInfo->fInflate);
    23202291            if (pcbDataReturned)
    23212292                *pcbDataReturned = 0;
     
    23402311 * @param pInfo                 The output buffer.
    23412312 */
    2342 static int VBoxGuestCommonIOCtl_WriteCoreDump(PVBOXGUESTDEVEXT pDevExt, VBoxGuestWriteCoreDump *pInfo)
     2313static int vbgdIoCtl_WriteCoreDump(PVBOXGUESTDEVEXT pDevExt, VBoxGuestWriteCoreDump *pInfo)
    23432314{
    23442315    VMMDevReqWriteCoreDump *pReq = NULL;
    23452316    int rc;
    23462317
    2347     LogFlow(("VBoxGuestCommonIOCtl: WRITE_CORE_DUMP\n"));
     2318    LogFlow(("VbgdCommonIoCtl: WRITE_CORE_DUMP\n"));
    23482319    rc = VbglGRAlloc((VMMDevRequestHeader **)&pReq, sizeof(*pReq), VMMDevReq_WriteCoreDump);
    23492320    if (RT_FAILURE(rc))
    23502321    {
    2351         Log(("VBoxGuestCommonIOCtl: WRITE_CORE_DUMP: failed to allocate %u (%#x) bytes to cache the request. rc=%Rrc!!\n",
     2322        Log(("VbgdCommonIoCtl: WRITE_CORE_DUMP: failed to allocate %u (%#x) bytes to cache the request. rc=%Rrc!!\n",
    23522323             sizeof(*pReq), sizeof(*pReq), rc));
    23532324        return rc;
     
    23572328    rc = VbglGRPerform(&pReq->header);
    23582329    if (RT_FAILURE(rc))
    2359         Log(("VBoxGuestCommonIOCtl: WRITE_CORE_DUMP: VbglGRPerform failed, rc=%Rrc!\n", rc));
     2330        Log(("VbgdCommonIoCtl: WRITE_CORE_DUMP: VbglGRPerform failed, rc=%Rrc!\n", rc));
    23602331
    23612332    VbglGRFree(&pReq->header);
     
    23742345 * @param   pcbDataReturned     Where to store the amount of returned data. Can be NULL.
    23752346 */
    2376 static int VBoxGuestCommonIOCtl_Log(PVBOXGUESTDEVEXT pDevExt, const char *pch, size_t cbData, size_t *pcbDataReturned, bool fUserSession)
     2347static int vbgdIoCtl_Log(PVBOXGUESTDEVEXT pDevExt, const char *pch, size_t cbData, size_t *pcbDataReturned, bool fUserSession)
    23772348{
    23782349    NOREF(pch);
    23792350    NOREF(cbData);
    2380 RTAssertMsg2Weak("\nVBoxGuestCommonIOCtl_Log: cbData=%#x\n", cbData);
    23812351    if (pDevExt->fLoggingEnabled)
    23822352        RTLogBackdoorPrintf("%.*s", cbData, pch);
     
    26332603 * @param   pInfo               The request.
    26342604 */
    2635 static int VBoxGuestCommonIOCtl_CtlFilterMask(PVBOXGUESTDEVEXT pDevExt, PVBOXGUESTSESSION pSession,
    2636                                               VBoxGuestFilterMaskInfo *pInfo)
    2637 {
    2638     LogFlow(("VBoxGuestCommonIOCtl: CTL_FILTER_MASK or=%#x not=%#x\n", pInfo->u32OrMask, pInfo->u32NotMask));
     2605static int vbgdIoCtl_CtlFilterMask(PVBOXGUESTDEVEXT pDevExt, PVBOXGUESTSESSION pSession, VBoxGuestFilterMaskInfo *pInfo)
     2606{
     2607    LogFlow(("VbgdCommonIoCtl: CTL_FILTER_MASK or=%#x not=%#x\n", pInfo->u32OrMask, pInfo->u32NotMask));
    26392608
    26402609    if ((pInfo->u32OrMask | pInfo->u32NotMask) & ~VMMDEV_EVENT_VALID_EVENT_MASK)
    26412610    {
    2642         Log(("VBoxGuestCommonIOCtl: CTL_FILTER_MASK or=%#x not=%#x: Invalid masks!\n", pInfo->u32OrMask, pInfo->u32NotMask));
     2611        Log(("VbgdCommonIoCtl: CTL_FILTER_MASK or=%#x not=%#x: Invalid masks!\n", pInfo->u32OrMask, pInfo->u32NotMask));
    26432612        return VERR_INVALID_PARAMETER;
    26442613    }
     
    27862755 * @param   fFeatures           New bitmap of enabled features.
    27872756 */
    2788 static int vboxGuestCommonIOCtl_SetMouseStatus(PVBOXGUESTDEVEXT pDevExt, PVBOXGUESTSESSION pSession, uint32_t fFeatures)
     2757static int vbgdIoCtl_SetMouseStatus(PVBOXGUESTDEVEXT pDevExt, PVBOXGUESTSESSION pSession, uint32_t fFeatures)
    27892758{
    27902759    int rc;
    2791     LogFlow(("VBoxGuestCommonIOCtl: CTL_FILTER_MASK features=%#x\n", fFeatures));
     2760    LogFlow(("VbgdCommonIoCtl: CTL_FILTER_MASK features=%#x\n", fFeatures));
    27922761
    27932762    if (fFeatures & ~VMMDEV_MOUSE_GUEST_MASK)
     
    30733042
    30743043                    RTSpinlockRelease(pDevExt->EventSpinlock);
    3075                     LogRel(("vbgdAcquireSessionCapabilities: VBoxGuestSetGuestCapabilities failed: rc=%Rrc\n", rc));
     3044                    LogRel(("vbgdAcquireSessionCapabilities: vbgdUpdateCapabilitiesOnHostWithReqAndLock failed: rc=%Rrc\n", rc));
    30763045                    VbglGRFree(&pReq->header);
    30773046                    return rc;
     
    31153084
    31163085#ifdef VBOXGUEST_USE_DEFERRED_WAKE_UP
    3117         VBoxGuestWaitDoWakeUps(pDevExt);
     3086        VbgdCommonWaitDoWakeUps(pDevExt);
    31183087#endif
    31193088    }
     
    31323101 * @param   pAcquire            The request.
    31333102 */
    3134 static int VBoxGuestCommonIOCTL_GuestCapsAcquire(PVBOXGUESTDEVEXT pDevExt, PVBOXGUESTSESSION pSession,
    3135                                                  VBoxGuestCapsAquire *pAcquire)
     3103static int vbgdIoCtl_GuestCapsAcquire(PVBOXGUESTDEVEXT pDevExt, PVBOXGUESTSESSION pSession, VBoxGuestCapsAquire *pAcquire)
    31363104{
    31373105    int rc;
    3138     LogFlow(("VBoxGuestCommonIOCtl: GUEST_CAPS_ACQUIRE or=%#x not=%#x flags=%#x\n",
     3106    LogFlow(("VbgdCommonIoCtl: GUEST_CAPS_ACQUIRE or=%#x not=%#x flags=%#x\n",
    31393107             pAcquire->u32OrMask, pAcquire->u32NotMask, pAcquire->enmFlags));
    31403108
     
    31423110                                        false /*fSessionTermination*/);
    31433111    if (RT_FAILURE(rc))
    3144         LogRel(("VBoxGuestCommonIOCtl: GUEST_CAPS_ACQUIRE failed rc=%Rrc\n", rc));
     3112        LogRel(("VbgdCommonIoCtl: GUEST_CAPS_ACQUIRE failed rc=%Rrc\n", rc));
    31453113    pAcquire->rc = rc;
    31463114    return VINF_SUCCESS;
     
    32513219 * @param   pInfo               The request.
    32523220 */
    3253 static int VBoxGuestCommonIOCtl_SetCapabilities(PVBOXGUESTDEVEXT pDevExt, PVBOXGUESTSESSION pSession,
    3254                                                 VBoxGuestSetCapabilitiesInfo *pInfo)
     3221static int vbgdIoCtl_SetCapabilities(PVBOXGUESTDEVEXT pDevExt, PVBOXGUESTSESSION pSession, VBoxGuestSetCapabilitiesInfo *pInfo)
    32553222{
    32563223    int rc;
    3257     LogFlow(("VBoxGuestCommonIOCtl: SET_GUEST_CAPABILITIES or=%#x not=%#x\n", pInfo->u32OrMask, pInfo->u32NotMask));
     3224    LogFlow(("VbgdCommonIoCtl: SET_GUEST_CAPABILITIES or=%#x not=%#x\n", pInfo->u32OrMask, pInfo->u32NotMask));
    32583225
    32593226    if (!((pInfo->u32OrMask | pInfo->u32NotMask) & ~VMMDEV_GUEST_CAPABILITIES_MASK))
     
    32833250 * @param   pcbDataReturned     Where to store the amount of returned data. Can be NULL.
    32843251 */
    3285 int VBoxGuestCommonIOCtl(unsigned iFunction, PVBOXGUESTDEVEXT pDevExt, PVBOXGUESTSESSION pSession,
    3286                          void *pvData, size_t cbData, size_t *pcbDataReturned)
     3252int VbgdCommonIoCtl(unsigned iFunction, PVBOXGUESTDEVEXT pDevExt, PVBOXGUESTSESSION pSession,
     3253                    void *pvData, size_t cbData, size_t *pcbDataReturned)
    32873254{
    32883255    int rc;
    3289     LogFlow(("VBoxGuestCommonIOCtl: iFunction=%#x pDevExt=%p pSession=%p pvData=%p cbData=%zu\n",
     3256    LogFlow(("VbgdCommonIoCtl: iFunction=%#x pDevExt=%p pSession=%p pvData=%p cbData=%zu\n",
    32903257             iFunction, pDevExt, pSession, pvData, cbData));
    32913258
     
    33453312    {
    33463313        CHECKRET_MIN_SIZE("VMMREQUEST", sizeof(VMMDevRequestHeader));
    3347         rc = VBoxGuestCommonIOCtl_VMMRequest(pDevExt, pSession, (VMMDevRequestHeader *)pvData, cbData, pcbDataReturned);
     3314        rc = vbgdIoCtl_VMMRequest(pDevExt, pSession, (VMMDevRequestHeader *)pvData, cbData, pcbDataReturned);
    33483315    }
    33493316#ifdef VBOX_WITH_HGCM
     
    33553322        bool fInterruptible = pSession->R0Process != NIL_RTR0PROCESS;
    33563323        CHECKRET_MIN_SIZE("HGCM_CALL", sizeof(VBoxGuestHGCMCallInfo));
    3357         rc = VBoxGuestCommonIOCtl_HGCMCall(pDevExt, pSession, (VBoxGuestHGCMCallInfo *)pvData, RT_INDEFINITE_WAIT,
    3358                                            fInterruptible, false /*f32bit*/, false /* fUserData */,
    3359                                            0, cbData, pcbDataReturned);
     3324        rc = vbgdIoCtl_HGCMCall(pDevExt, pSession, (VBoxGuestHGCMCallInfo *)pvData, RT_INDEFINITE_WAIT,
     3325                                fInterruptible, false /*f32bit*/, false /* fUserData */,
     3326                                0, cbData, pcbDataReturned);
    33603327    }
    33613328    else if (VBOXGUEST_IOCTL_STRIP_SIZE(iFunction) == VBOXGUEST_IOCTL_STRIP_SIZE(VBOXGUEST_IOCTL_HGCM_CALL_TIMED(0)))
     
    33633330        VBoxGuestHGCMCallInfoTimed *pInfo = (VBoxGuestHGCMCallInfoTimed *)pvData;
    33643331        CHECKRET_MIN_SIZE("HGCM_CALL_TIMED", sizeof(VBoxGuestHGCMCallInfoTimed));
    3365         rc = VBoxGuestCommonIOCtl_HGCMCall(pDevExt, pSession, &pInfo->info, pInfo->u32Timeout,
    3366                                            !!pInfo->fInterruptible || pSession->R0Process != NIL_RTR0PROCESS,
    3367                                            false /*f32bit*/, false /* fUserData */,
    3368                                            RT_OFFSETOF(VBoxGuestHGCMCallInfoTimed, info), cbData, pcbDataReturned);
     3332        rc = vbgdIoCtl_HGCMCall(pDevExt, pSession, &pInfo->info, pInfo->u32Timeout,
     3333                                !!pInfo->fInterruptible || pSession->R0Process != NIL_RTR0PROCESS,
     3334                                false /*f32bit*/, false /* fUserData */,
     3335                                RT_OFFSETOF(VBoxGuestHGCMCallInfoTimed, info), cbData, pcbDataReturned);
    33693336    }
    33703337    else if (VBOXGUEST_IOCTL_STRIP_SIZE(iFunction) == VBOXGUEST_IOCTL_STRIP_SIZE(VBOXGUEST_IOCTL_HGCM_CALL_USERDATA(0)))
     
    33723339        bool fInterruptible = true;
    33733340        CHECKRET_MIN_SIZE("HGCM_CALL", sizeof(VBoxGuestHGCMCallInfo));
    3374         rc = VBoxGuestCommonIOCtl_HGCMCall(pDevExt, pSession, (VBoxGuestHGCMCallInfo *)pvData, RT_INDEFINITE_WAIT,
    3375                                            fInterruptible, false /*f32bit*/, true /* fUserData */,
    3376                                            0, cbData, pcbDataReturned);
     3341        rc = vbgdIoCtl_HGCMCall(pDevExt, pSession, (VBoxGuestHGCMCallInfo *)pvData, RT_INDEFINITE_WAIT,
     3342                                fInterruptible, false /*f32bit*/, true /* fUserData */,
     3343                                0, cbData, pcbDataReturned);
    33773344    }
    33783345# ifdef RT_ARCH_AMD64
     
    33813348        bool fInterruptible = pSession->R0Process != NIL_RTR0PROCESS;
    33823349        CHECKRET_MIN_SIZE("HGCM_CALL", sizeof(VBoxGuestHGCMCallInfo));
    3383         rc = VBoxGuestCommonIOCtl_HGCMCall(pDevExt, pSession, (VBoxGuestHGCMCallInfo *)pvData, RT_INDEFINITE_WAIT,
    3384                                            fInterruptible, true /*f32bit*/, false /* fUserData */,
    3385                                            0, cbData, pcbDataReturned);
     3350        rc = vbgdIoCtl_HGCMCall(pDevExt, pSession, (VBoxGuestHGCMCallInfo *)pvData, RT_INDEFINITE_WAIT,
     3351                                fInterruptible, true /*f32bit*/, false /* fUserData */,
     3352                                0, cbData, pcbDataReturned);
    33863353    }
    33873354    else if (VBOXGUEST_IOCTL_STRIP_SIZE(iFunction) == VBOXGUEST_IOCTL_STRIP_SIZE(VBOXGUEST_IOCTL_HGCM_CALL_TIMED_32(0)))
     
    33893356        CHECKRET_MIN_SIZE("HGCM_CALL_TIMED", sizeof(VBoxGuestHGCMCallInfoTimed));
    33903357        VBoxGuestHGCMCallInfoTimed *pInfo = (VBoxGuestHGCMCallInfoTimed *)pvData;
    3391         rc = VBoxGuestCommonIOCtl_HGCMCall(pDevExt, pSession, &pInfo->info, pInfo->u32Timeout,
    3392                                            !!pInfo->fInterruptible || pSession->R0Process != NIL_RTR0PROCESS,
    3393                                            true /*f32bit*/, false /* fUserData */,
    3394                                            RT_OFFSETOF(VBoxGuestHGCMCallInfoTimed, info), cbData, pcbDataReturned);
     3358        rc = vbgdIoCtl_HGCMCall(pDevExt, pSession, &pInfo->info, pInfo->u32Timeout,
     3359                                !!pInfo->fInterruptible || pSession->R0Process != NIL_RTR0PROCESS,
     3360                                true /*f32bit*/, false /* fUserData */,
     3361                                RT_OFFSETOF(VBoxGuestHGCMCallInfoTimed, info), cbData, pcbDataReturned);
    33953362    }
    33963363# endif
     
    33993366    {
    34003367        CHECKRET_MIN_SIZE("LOG", 1);
    3401         rc = VBoxGuestCommonIOCtl_Log(pDevExt, (char *)pvData, cbData, pcbDataReturned, pSession->fUserSession);
     3368        rc = vbgdIoCtl_Log(pDevExt, (char *)pvData, cbData, pcbDataReturned, pSession->fUserSession);
    34023369    }
    34033370    else
     
    34083375                CHECKRET_RING0("GETVMMDEVPORT");
    34093376                CHECKRET_MIN_SIZE("GETVMMDEVPORT", sizeof(VBoxGuestPortInfo));
    3410                 rc = VBoxGuestCommonIOCtl_GetVMMDevPort(pDevExt, (VBoxGuestPortInfo *)pvData, pcbDataReturned);
     3377                rc = vbgdIoCtl_GetVMMDevPort(pDevExt, (VBoxGuestPortInfo *)pvData, pcbDataReturned);
    34113378                break;
    34123379
     
    34153382                CHECKRET_RING0("SET_MOUSE_NOTIFY_CALLBACK");
    34163383                CHECKRET_SIZE("SET_MOUSE_NOTIFY_CALLBACK", sizeof(VBoxGuestMouseSetNotifyCallback));
    3417                 rc = VBoxGuestCommonIOCtl_SetMouseNotifyCallback(pDevExt, (VBoxGuestMouseSetNotifyCallback *)pvData);
     3384                rc = vbgdIoCtl_SetMouseNotifyCallback(pDevExt, (VBoxGuestMouseSetNotifyCallback *)pvData);
    34183385                break;
    34193386#endif
     
    34213388            case VBOXGUEST_IOCTL_WAITEVENT:
    34223389                CHECKRET_MIN_SIZE("WAITEVENT", sizeof(VBoxGuestWaitEventInfo));
    3423                 rc = VBoxGuestCommonIOCtl_WaitEvent(pDevExt, pSession, (VBoxGuestWaitEventInfo *)pvData,
     3390                rc = vbgdIoCtl_WaitEvent(pDevExt, pSession, (VBoxGuestWaitEventInfo *)pvData,
    34243391                                                    pcbDataReturned, pSession->R0Process != NIL_RTR0PROCESS);
    34253392                break;
     
    34283395                if (cbData != 0)
    34293396                    rc = VERR_INVALID_PARAMETER;
    3430                 rc = VBoxGuestCommonIOCtl_CancelAllWaitEvents(pDevExt, pSession);
     3397                rc = vbgdIoCtl_CancelAllWaitEvents(pDevExt, pSession);
    34313398                break;
    34323399
    34333400            case VBOXGUEST_IOCTL_CTL_FILTER_MASK:
    34343401                CHECKRET_MIN_SIZE("CTL_FILTER_MASK", sizeof(VBoxGuestFilterMaskInfo));
    3435                 rc = VBoxGuestCommonIOCtl_CtlFilterMask(pDevExt, pSession, (VBoxGuestFilterMaskInfo *)pvData);
     3402                rc = vbgdIoCtl_CtlFilterMask(pDevExt, pSession, (VBoxGuestFilterMaskInfo *)pvData);
    34363403                break;
    34373404
     
    34423409# endif
    34433410                CHECKRET_MIN_SIZE("HGCM_CONNECT", sizeof(VBoxGuestHGCMConnectInfo));
    3444                 rc = VBoxGuestCommonIOCtl_HGCMConnect(pDevExt, pSession, (VBoxGuestHGCMConnectInfo *)pvData, pcbDataReturned);
     3411                rc = vbgdIoCtl_HGCMConnect(pDevExt, pSession, (VBoxGuestHGCMConnectInfo *)pvData, pcbDataReturned);
    34453412                break;
    34463413
     
    34503417# endif
    34513418                CHECKRET_MIN_SIZE("HGCM_DISCONNECT", sizeof(VBoxGuestHGCMDisconnectInfo));
    3452                 rc = VBoxGuestCommonIOCtl_HGCMDisconnect(pDevExt, pSession, (VBoxGuestHGCMDisconnectInfo *)pvData,
    3453                                                          pcbDataReturned);
     3419                rc = vbgdIoCtl_HGCMDisconnect(pDevExt, pSession, (VBoxGuestHGCMDisconnectInfo *)pvData, pcbDataReturned);
    34543420                break;
    34553421#endif /* VBOX_WITH_HGCM */
     
    34573423            case VBOXGUEST_IOCTL_CHECK_BALLOON:
    34583424                CHECKRET_MIN_SIZE("CHECK_MEMORY_BALLOON", sizeof(VBoxGuestCheckBalloonInfo));
    3459                 rc = VBoxGuestCommonIOCtl_CheckMemoryBalloon(pDevExt, pSession, (VBoxGuestCheckBalloonInfo *)pvData,
    3460                                                              pcbDataReturned);
     3425                rc = vbgdIoCtl_CheckMemoryBalloon(pDevExt, pSession, (VBoxGuestCheckBalloonInfo *)pvData, pcbDataReturned);
    34613426                break;
    34623427
    34633428            case VBOXGUEST_IOCTL_CHANGE_BALLOON:
    34643429                CHECKRET_MIN_SIZE("CHANGE_MEMORY_BALLOON", sizeof(VBoxGuestChangeBalloonInfo));
    3465                 rc = VBoxGuestCommonIOCtl_ChangeMemoryBalloon(pDevExt, pSession, (VBoxGuestChangeBalloonInfo *)pvData,
    3466                                                               pcbDataReturned);
     3430                rc = vbgdIoCtl_ChangeMemoryBalloon(pDevExt, pSession, (VBoxGuestChangeBalloonInfo *)pvData, pcbDataReturned);
    34673431                break;
    34683432
    34693433            case VBOXGUEST_IOCTL_WRITE_CORE_DUMP:
    34703434                CHECKRET_MIN_SIZE("WRITE_CORE_DUMP", sizeof(VBoxGuestWriteCoreDump));
    3471                 rc = VBoxGuestCommonIOCtl_WriteCoreDump(pDevExt, (VBoxGuestWriteCoreDump *)pvData);
     3435                rc = vbgdIoCtl_WriteCoreDump(pDevExt, (VBoxGuestWriteCoreDump *)pvData);
    34723436                break;
    34733437
    34743438            case VBOXGUEST_IOCTL_SET_MOUSE_STATUS:
    34753439                CHECKRET_SIZE("SET_MOUSE_STATUS", sizeof(uint32_t));
    3476                 rc = vboxGuestCommonIOCtl_SetMouseStatus(pDevExt, pSession, *(uint32_t *)pvData);
     3440                rc = vbgdIoCtl_SetMouseStatus(pDevExt, pSession, *(uint32_t *)pvData);
    34773441                break;
    34783442
     
    34863450            case VBOXGUEST_IOCTL_GUEST_CAPS_ACQUIRE:
    34873451                CHECKRET_SIZE("GUEST_CAPS_ACQUIRE", sizeof(VBoxGuestCapsAquire));
    3488                 rc = VBoxGuestCommonIOCTL_GuestCapsAcquire(pDevExt, pSession, (VBoxGuestCapsAquire*)pvData);
     3452                rc = vbgdIoCtl_GuestCapsAcquire(pDevExt, pSession, (VBoxGuestCapsAquire *)pvData);
    34893453                *pcbDataReturned = sizeof(VBoxGuestCapsAquire);
    34903454                break;
     
    34923456            case VBOXGUEST_IOCTL_SET_GUEST_CAPABILITIES:
    34933457                CHECKRET_MIN_SIZE("SET_GUEST_CAPABILITIES", sizeof(VBoxGuestSetCapabilitiesInfo));
    3494                 rc = VBoxGuestCommonIOCtl_SetCapabilities(pDevExt, pSession, (VBoxGuestSetCapabilitiesInfo *)pvData);
     3458                rc = vbgdIoCtl_SetCapabilities(pDevExt, pSession, (VBoxGuestSetCapabilitiesInfo *)pvData);
    34953459                break;
    34963460
    34973461            default:
    34983462            {
    3499                 LogRel(("VBoxGuestCommonIOCtl: Unknown request iFunction=%#x stripped size=%#x\n",
     3463                LogRel(("VbgdCommonIoCtl: Unknown request iFunction=%#x stripped size=%#x\n",
    35003464                        iFunction, VBOXGUEST_IOCTL_STRIP_SIZE(iFunction)));
    35013465                rc = VERR_NOT_SUPPORTED;
     
    35053469    }
    35063470
    3507     LogFlow(("VBoxGuestCommonIOCtl: returns %Rrc *pcbDataReturned=%zu\n", rc, pcbDataReturned ? *pcbDataReturned : 0));
     3471    LogFlow(("VbgdCommonIoCtl: returns %Rrc *pcbDataReturned=%zu\n", rc, pcbDataReturned ? *pcbDataReturned : 0));
    35083472    return rc;
    35093473}
     
    35113475
    35123476/**
    3513  * Used by VBoxGuestCommonISR as well as the acquire guest capability code.
     3477 * Used by VbgdCommonISR as well as the acquire guest capability code.
    35143478 *
    35153479 * @returns VINF_SUCCESS on success. On failure, ORed together
     
    35663530 * @param   pDevExt     The VBoxGuest device extension.
    35673531 */
    3568 bool VBoxGuestCommonISR(PVBOXGUESTDEVEXT pDevExt)
    3569 {
    3570     bool                            fMousePositionChanged = false;
    3571     VMMDevEvents volatile          *pReq                  = pDevExt->pIrqAckEvents;
    3572     int                             rc                    = 0;
    3573     bool                            fOurIrq;
     3532bool VbgdCommonISR(PVBOXGUESTDEVEXT pDevExt)
     3533{
     3534    VMMDevEvents volatile  *pReq                  = pDevExt->pIrqAckEvents;
     3535    bool                    fMousePositionChanged = false;
     3536    int                     rc                    = 0;
     3537    bool                    fOurIrq;
    35743538
    35753539    /*
     
    36013565            PVBOXGUESTWAIT  pSafe;
    36023566
    3603             Log3(("VBoxGuestCommonISR: acknowledge events succeeded %#RX32\n", fEvents));
     3567            Log3(("VbgdCommonISR: acknowledge events succeeded %#RX32\n", fEvents));
    36043568
    36053569            /*
     
    36463610        }
    36473611        else /* something is serious wrong... */
    3648             Log(("VBoxGuestCommonISR: acknowledge events failed rc=%Rrc (events=%#x)!!\n",
     3612            Log(("VbgdCommonISR: acknowledge events failed rc=%Rrc (events=%#x)!!\n",
    36493613                 pReq->header.rc, pReq->events));
    36503614    }
    36513615    else
    3652         Log3(("VBoxGuestCommonISR: not ours\n"));
     3616        Log3(("VbgdCommonISR: not ours\n"));
    36533617
    36543618    RTSpinlockRelease(pDevExt->EventSpinlock);
     
    36603624     *       care of it.  Same on darwin, doing it in the work loop callback.
    36613625     */
    3662     VBoxGuestWaitDoWakeUps(pDevExt);
     3626    VbgdCommonWaitDoWakeUps(pDevExt);
    36633627#endif
    36643628
     
    36703634    {
    36713635        ASMAtomicIncU32(&pDevExt->u32MousePosChangedSeq);
    3672         VBoxGuestNativeISRMousePollEvent(pDevExt);
     3636        VbgdNativeISRMousePollEvent(pDevExt);
    36733637    }
    36743638
  • trunk/src/VBox/Additions/common/VBoxGuest/VBoxGuest2.cpp

    r41722 r54608  
    55
    66/*
    7  * Copyright (C) 2011-2012 Oracle Corporation
     7 * Copyright (C) 2011-2015 Oracle Corporation
    88 *
    99 * This file is part of VirtualBox Open Source Edition (OSE), as
  • trunk/src/VBox/Additions/common/VBoxGuest/VBoxGuest2.h

    r41722 r54608  
    55
    66/*
    7  * Copyright (C) 2010-2012 Oracle Corporation
     7 * Copyright (C) 2010-2015 Oracle Corporation
    88 *
    99 * This file is part of VirtualBox Open Source Edition (OSE), as
  • trunk/src/VBox/Additions/common/VBoxGuest/VBoxGuestA-os2.asm

    r48665 r54608  
    55
    66;
    7 ; Copyright (C) 2007-2013 Oracle Corporation
     7; Copyright (C) 2007-2015 Oracle Corporation
    88;
    99; This file is part of VirtualBox Open Source Edition (OSE), as
  • trunk/src/VBox/Additions/common/VBoxGuest/VBoxGuestIDC-unix.c.h

    r45372 r54608  
    77
    88/*
    9  * Copyright (C) 2006-2013 Oracle Corporation
     9 * Copyright (C) 2006-2015 Oracle Corporation
    1010 *
    1111 * This file is part of VirtualBox Open Source Edition (OSE), as
     
    6969#endif
    7070
    71     rc = VBoxGuestCreateKernelSession(&g_DevExt, &pSession);
     71    rc = VbgdCommonCreateKernelSession(&g_DevExt, &pSession);
    7272    if (RT_SUCCESS(rc))
    7373    {
     
    8989#endif
    9090
    91     LogRel(("VBoxGuestIDCOpen: VBoxGuestCreateKernelSession failed. rc=%d\n", rc));
     91    LogRel(("VBoxGuestIDCOpen: VbgdCommonCreateKernelSession failed. rc=%d\n", rc));
    9292    return NULL;
    9393}
     
    106106
    107107    AssertPtrReturn(pSession, VERR_INVALID_POINTER);
    108     VBoxGuestCloseSession(&g_DevExt, pSession);
     108    VbgdCommonCloseSession(&g_DevExt, pSession);
    109109
    110110#ifdef RT_OS_SOLARIS
     
    144144                    ("SC: %p != %p\n", pSession->pDevExt, &g_DevExt), VERR_INVALID_HANDLE);
    145145
    146     return VBoxGuestCommonIOCtl(iCmd, &g_DevExt, pSession, pvData, cbData, pcbDataReturned);
     146    return VbgdCommonIoCtl(iCmd, &g_DevExt, pSession, pvData, cbData, pcbDataReturned);
    147147}
    148148
  • trunk/src/VBox/Additions/common/VBoxGuest/VBoxGuestInternal.h

    r54606 r54608  
    55
    66/*
    7  * Copyright (C) 2010-2014 Oracle Corporation
     7 * Copyright (C) 2010-2015 Oracle Corporation
    88 *
    99 * This file is part of VirtualBox Open Source Edition (OSE), as
     
    6565    uint32_t volatile           fResEvents;
    6666#ifdef VBOXGUEST_USE_DEFERRED_WAKE_UP
    67     /** Set by VBoxGuestWaitDoWakeUps before leaving the spinlock to call
     67    /** Set by VbgdCommonWaitDoWakeUps before leaving the spinlock to call
    6868     *  RTSemEventMultiSignal. */
    6969    bool volatile               fPendingWakeUp;
    7070    /** Set by the requestor thread if it got the spinlock before the
    71      * signaller.  Deals with the race in VBoxGuestWaitDoWakeUps. */
     71     * signaller.  Deals with the race in VbgdCommonWaitDoWakeUps. */
    7272    bool volatile               fFreeMe;
    7373#endif
     
    314314RT_C_DECLS_BEGIN
    315315
    316 int  VBoxGuestInitDevExt(PVBOXGUESTDEVEXT pDevExt, uint16_t IOPortBase, void *pvMMIOBase, uint32_t cbMMIO, VBOXOSTYPE enmOSType, uint32_t fEvents);
    317 bool VBoxGuestCommonISR(PVBOXGUESTDEVEXT pDevExt);
    318 void VBoxGuestDeleteDevExt(PVBOXGUESTDEVEXT pDevExt);
    319 int  VBoxGuestReinitDevExtAfterHibernation(PVBOXGUESTDEVEXT pDevExt, VBOXOSTYPE enmOSType);
    320 int  VBoxGuestSetGuestCapabilities(uint32_t fOr, uint32_t fNot);
     316int  VbgdCommonInitDevExt(PVBOXGUESTDEVEXT pDevExt, uint16_t IOPortBase, void *pvMMIOBase, uint32_t cbMMIO,
     317                          VBOXOSTYPE enmOSType, uint32_t fEvents);
     318bool VbgdCommonISR(PVBOXGUESTDEVEXT pDevExt);
     319void VbgdCommonDeleteDevExt(PVBOXGUESTDEVEXT pDevExt);
     320int  VbgdCommonReinitDevExtAfterHibernation(PVBOXGUESTDEVEXT pDevExt, VBOXOSTYPE enmOSType);
    321321#ifdef VBOXGUEST_USE_DEFERRED_WAKE_UP
    322 void VBoxGuestWaitDoWakeUps(PVBOXGUESTDEVEXT pDevExt);
    323 #endif
    324 
    325 int  VBoxGuestCreateUserSession(PVBOXGUESTDEVEXT pDevExt, PVBOXGUESTSESSION *ppSession);
    326 int  VBoxGuestCreateKernelSession(PVBOXGUESTDEVEXT pDevExt, PVBOXGUESTSESSION *ppSession);
    327 void VBoxGuestCloseSession(PVBOXGUESTDEVEXT pDevExt, PVBOXGUESTSESSION pSession);
    328 
    329 int  VBoxGuestCommonIOCtlFast(unsigned iFunction, PVBOXGUESTDEVEXT pDevExt, PVBOXGUESTSESSION pSession);
    330 int  VBoxGuestCommonIOCtl(unsigned iFunction, PVBOXGUESTDEVEXT pDevExt, PVBOXGUESTSESSION pSession,
    331                           void *pvData, size_t cbData, size_t *pcbDataReturned);
    332 
    333 #if defined(RT_OS_SOLARIS) \
    334  || defined(RT_OS_FREEBSD) \
    335  || defined(RT_OS_LINUX)
    336 DECLVBGL(void *) VBoxGuestNativeServiceOpen(uint32_t *pu32Version);
    337 DECLVBGL(void)   VBoxGuestNativeServiceClose(void *pvOpaque);
    338 DECLVBGL(int)    VBoxGuestNativeServiceCall(void *pvOpaque, unsigned int iCmd, void *pvData, size_t cbSize, size_t *pcbReturn);
    339 #endif
     322void VbgdCommonWaitDoWakeUps(PVBOXGUESTDEVEXT pDevExt);
     323#endif
     324
     325int  VbgdCommonCreateUserSession(PVBOXGUESTDEVEXT pDevExt, PVBOXGUESTSESSION *ppSession);
     326int  VbgdCommonCreateKernelSession(PVBOXGUESTDEVEXT pDevExt, PVBOXGUESTSESSION *ppSession);
     327void VbgdCommonCloseSession(PVBOXGUESTDEVEXT pDevExt, PVBOXGUESTSESSION pSession);
     328
     329int  VbgdCommonIoCtlFast(unsigned iFunction, PVBOXGUESTDEVEXT pDevExt, PVBOXGUESTSESSION pSession);
     330int  VbgdCommonIoCtl(unsigned iFunction, PVBOXGUESTDEVEXT pDevExt, PVBOXGUESTSESSION pSession,
     331                     void *pvData, size_t cbData, size_t *pcbDataReturned);
    340332
    341333/**
     
    347339 * @param   pDevExt     The device extension.
    348340 */
    349 void VBoxGuestNativeISRMousePollEvent(PVBOXGUESTDEVEXT pDevExt);
     341void VbgdNativeISRMousePollEvent(PVBOXGUESTDEVEXT pDevExt);
    350342
    351343
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