VirtualBox

Changeset 80396 in vbox for trunk/src/VBox/Main


Ignore:
Timestamp:
Aug 23, 2019 1:27:22 PM (6 years ago)
Author:
vboxsync
svn:sync-xref-src-repo-rev:
132865
Message:

Devices/DevVGA, Main: Get rid of obsolete code enclosed by VBOX_WITH_CRHGSMI, bugref:9529

Location:
trunk/src/VBox/Main
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Main/Makefile.kmk

    r80370 r80396  
    853853        $(if $(VBOX_WITH_USB),VBOX_WITH_USB,) \
    854854        $(if $(VBOX_WITH_VRDEAUTH_IN_VBOXSVC),VBOX_WITH_VRDEAUTH_IN_VBOXSVC,)
    855 ifdef VBOX_WITH_CRHGSMI
    856  VBoxC_DEFS += VBOX_WITH_CRHGSMI
    857 endif
    858855ifdef VBOX_WITH_NETSHAPER
    859856 VBoxC_DEFS += VBOX_WITH_NETSHAPER
  • trunk/src/VBox/Main/include/HGCM.h

    r76562 r80396  
    5050int HGCMBroadcastEvent(HGCMNOTIFYEVENT enmEvent);
    5151
    52 #ifdef VBOX_WITH_CRHGSMI
    53 int HGCMHostSvcHandleCreate(const char *pszServiceName, HGCMCVSHANDLE * phSvc);
    54 int HGCMHostSvcHandleDestroy(HGCMCVSHANDLE hSvc);
    55 int HGCMHostFastCallAsync(HGCMCVSHANDLE hSvc, uint32_t function, PVBOXHGCMSVCPARM pParm,
    56                           PHGCMHOSTFASTCALLCB pfnCompletion, void *pvCompletion);
    57 #endif
    58 
    5952int HGCMHostSaveState(PSSMHANDLE pSSM);
    6053int HGCMHostLoadState(PSSMHANDLE pSSM, uint32_t uVersion);
  • trunk/src/VBox/Main/include/VMMDev.h

    r76562 r80396  
    6363    int hgcmLoadService (const char *pszServiceLibrary, const char *pszServiceName);
    6464    int hgcmHostCall (const char *pszServiceName, uint32_t u32Function, uint32_t cParms, PVBOXHGCMSVCPARM paParms);
    65 # ifdef VBOX_WITH_CRHGSMI
    66     int hgcmHostSvcHandleCreate (const char *pszServiceName, HGCMCVSHANDLE * phSvc);
    67     int hgcmHostSvcHandleDestroy (HGCMCVSHANDLE hSvc);
    68     int hgcmHostFastCallAsync (HGCMCVSHANDLE hSvc, uint32_t function, PVBOXHGCMSVCPARM pParm, PHGCMHOSTFASTCALLCB pfnCompletion, void *pvCompletion);
    69 # endif
    7065    void hgcmShutdown(bool fUvmIsInvalid = false);
    7166
  • trunk/src/VBox/Main/src-client/HGCM.cpp

    r78910 r80396  
    110110
    111111        uint32_t *m_paClientIds;
    112 
    113 #ifdef VBOX_WITH_CRHGSMI
    114         uint32_t m_cHandleAcquires;
    115 #endif
    116112
    117113        HGCMSVCEXTHANDLE m_hExtension;
     
    180176        void Notify(HGCMNOTIFYEVENT enmEvent);
    181177
    182 #ifdef VBOX_WITH_CRHGSMI
    183         int HandleAcquired();
    184         int HandleReleased();
    185         int HostFastCallAsync(uint32_t u32Function, VBOXHGCMSVCPARM *pParm, PHGCMHOSTFASTCALLCB pfnCompletion,
    186                               void *pvCompletion);
    187 #endif
    188 
    189178        uint32_t SizeOfClient(void) { return m_fntable.cbClient; };
    190179
     
    280269    m_cClientsAllocated (0),
    281270    m_paClientIds (NULL),
    282 #ifdef VBOX_WITH_CRHGSMI
    283     m_cHandleAcquires (0),
    284 #endif
    285271    m_hExtension (NULL),
    286272    m_pUVM       (NULL),
     
    418404#define SVC_MSG_NOTIFY          (11) /**< pfnNotify */
    419405#define SVC_MSG_GUESTCANCELLED  (12) /**< pfnCancelled */
    420 #ifdef VBOX_WITH_CRHGSMI
    421 # define SVC_MSG_HOSTFASTCALLASYNC (21) /* pfnHostCall */
    422 #endif
    423406
    424407class HGCMMsgSvcLoad: public HGCMMsgCore
     
    553536};
    554537
    555 #ifdef VBOX_WITH_CRHGSMI
    556 class HGCMMsgHostFastCallAsyncSvc: public HGCMMsgCore
    557 {
    558     public:
    559         /* function number */
    560         uint32_t u32Function;
    561         /* parameter */
    562         VBOXHGCMSVCPARM Param;
    563         /* completion info */
    564         PHGCMHOSTFASTCALLCB pfnCompletion;
    565         void *pvCompletion;
    566 };
    567 #endif
    568 
    569538static HGCMMsgCore *hgcmMessageAllocSvc(uint32_t u32MsgId)
    570539{
    571540    switch (u32MsgId)
    572541    {
    573 #ifdef VBOX_WITH_CRHGSMI
    574         case SVC_MSG_HOSTFASTCALLASYNC: return new HGCMMsgHostFastCallAsyncSvc();
    575 #endif
    576542        case SVC_MSG_LOAD:        return new HGCMMsgSvcLoad();
    577543        case SVC_MSG_UNLOAD:      return new HGCMMsgSvcUnload();
     
    622588        switch (u32MsgId)
    623589        {
    624 #ifdef VBOX_WITH_CRHGSMI
    625             case SVC_MSG_HOSTFASTCALLASYNC:
    626             {
    627                 HGCMMsgHostFastCallAsyncSvc *pMsg = (HGCMMsgHostFastCallAsyncSvc *)pMsgCore;
    628 
    629                 LogFlowFunc(("SVC_MSG_HOSTFASTCALLASYNC u32Function = %d, pParm = %p\n", pMsg->u32Function, &pMsg->Param));
    630 
    631                 rc = pSvc->m_fntable.pfnHostCall(pSvc->m_fntable.pvService, pMsg->u32Function, 1, &pMsg->Param);
    632             } break;
    633 #endif
    634590            case SVC_MSG_LOAD:
    635591            {
     
    14281384        }
    14291385
    1430 #ifdef VBOX_WITH_CRHGSMI
    1431         /** @todo could this actually happen that the service is destroyed on ReleaseService? */
    1432         HGCMService *pNextSvc = pSvc->m_pSvcNext;
    1433         while (pSvc->m_cHandleAcquires)
    1434         {
    1435             pSvc->HandleReleased();
    1436             pSvc->ReleaseService();
    1437         }
    1438         pSvc = pNextSvc;
    1439 #else
    14401386        pSvc = pSvc->m_pSvcNext;
    1441 #endif
    14421387    }
    14431388
     
    19411886}
    19421887
    1943 #ifdef VBOX_WITH_CRHGSMI
    1944 
    1945 static DECLCALLBACK(int) hgcmMsgFastCallCompletionCallback(int32_t result, HGCMMsgCore *pMsgCore)
    1946 {
    1947     /* Call the VMMDev port interface to issue IRQ notification. */
    1948     LogFlow(("MAIN::hgcmMsgFastCallCompletionCallback: message %p\n", pMsgCore));
    1949 
    1950     HGCMMsgHostFastCallAsyncSvc *pMsg = (HGCMMsgHostFastCallAsyncSvc *)pMsgCore;
    1951     if (pMsg->pfnCompletion)
    1952         pMsg->pfnCompletion(result, pMsg->u32Function, &pMsg->Param, pMsg->pvCompletion);
    1953     return VINF_SUCCESS;
    1954 }
    1955 
    1956 int HGCMService::HandleAcquired()
    1957 {
    1958     ++m_cHandleAcquires;
    1959     return VINF_SUCCESS;
    1960 }
    1961 
    1962 int HGCMService::HandleReleased()
    1963 {
    1964     Assert(m_cHandleAcquires);
    1965     if (m_cHandleAcquires)
    1966     {
    1967         --m_cHandleAcquires;
    1968         return VINF_SUCCESS;
    1969     }
    1970     return VERR_INVALID_STATE;
    1971 }
    1972 
    1973 int HGCMService::HostFastCallAsync(uint32_t u32Function, VBOXHGCMSVCPARM *pParm, PHGCMHOSTFASTCALLCB pfnCompletion,
    1974                                    void *pvCompletion)
    1975 {
    1976     LogFlowFunc(("%s u32Function = %d, pParm = %p\n",
    1977                  m_pszSvcName, u32Function, pParm));
    1978 
    1979     HGCMMsgCore *pCoreMsg;
    1980     int rc = hgcmMsgAlloc(m_pThread, &pCoreMsg, SVC_MSG_HOSTFASTCALLASYNC, hgcmMessageAllocSvc);
    1981 
    1982     if (RT_SUCCESS(rc))
    1983     {
    1984         HGCMMsgHostFastCallAsyncSvc *pMsg = (HGCMMsgHostFastCallAsyncSvc *)pCoreMsg;
    1985 
    1986         pMsg->u32Function      = u32Function;
    1987         pMsg->Param = *pParm;
    1988         pMsg->pfnCompletion = pfnCompletion;
    1989         pMsg->pvCompletion = pvCompletion;
    1990 
    1991         rc = hgcmMsgPost(pMsg, hgcmMsgFastCallCompletionCallback);
    1992     }
    1993 
    1994     LogFlowFunc(("rc = %Rrc\n", rc));
    1995     return rc;
    1996 }
    1997 
    1998 #endif /* VBOX_WITH_CRHGSMI */
    1999 
    20001888/*
    20011889 * Main HGCM thread that manages services.
     
    20141902#define HGCM_MSG_UNREGEXT   (19)  /**< Unregister a service extension. */
    20151903#define HGCM_MSG_BRD_NOTIFY (20)  /**< Broadcast notification event (VM state change). */
    2016 #ifdef VBOX_WITH_CRHGSMI
    2017 # define HGCM_MSG_SVCAQUIRE  (30) /**< Acquire a service handle (for fast host calls) */
    2018 # define HGCM_MSG_SVCRELEASE (31) /**< Release a service */
    2019 #endif
    20201904
    20211905class HGCMMsgMainConnect: public HGCMMsgHeader
     
    21101994        HGCMNOTIFYEVENT enmEvent;
    21111995};
    2112 
    2113 #ifdef VBOX_WITH_CRHGSMI
    2114 class HGCMMsgMainSvcAcquire: public HGCMMsgCore
    2115 {
    2116     public:
    2117         /* Which service to call. */
    2118         const char *pszServiceName;
    2119         /* Returned service. */
    2120         HGCMService *pService;
    2121 };
    2122 
    2123 class HGCMMsgMainSvcRelease: public HGCMMsgCore
    2124 {
    2125     public:
    2126         /* Svc . */
    2127         HGCMService *pService;
    2128 };
    2129 #endif
    21301996
    21311997
     
    21452011        case HGCM_MSG_UNREGEXT:   return new HGCMMsgMainUnregisterExtension();
    21462012        case HGCM_MSG_BRD_NOTIFY: return new HGCMMsgMainBroadcastNotify();
    2147 #ifdef VBOX_WITH_CRHGSMI
    2148         case HGCM_MSG_SVCAQUIRE:  return new HGCMMsgMainSvcAcquire();
    2149         case HGCM_MSG_SVCRELEASE: return new HGCMMsgMainSvcRelease();
    2150 #endif
    21512013
    21522014        default:
     
    22692131                HGCMService::BroadcastNotify(pMsg->enmEvent);
    22702132            } break;
    2271 
    2272 #ifdef VBOX_WITH_CRHGSMI
    2273             case HGCM_MSG_SVCAQUIRE:
    2274             {
    2275                 HGCMMsgMainSvcAcquire *pMsg = (HGCMMsgMainSvcAcquire *)pMsgCore;
    2276 
    2277                 LogFlowFunc(("HGCM_MSG_SVCAQUIRE pszServiceName %s\n", pMsg->pszServiceName));
    2278 
    2279                 /* Resolve the service name to the pointer to service instance. */
    2280                 HGCMService *pService;
    2281                 rc = HGCMService::ResolveService(&pService, pMsg->pszServiceName);
    2282                 if (RT_SUCCESS(rc))
    2283                 {
    2284                     rc = pService->HandleAcquired();
    2285                     if (RT_SUCCESS(rc))
    2286                     {
    2287                         pMsg->pService = pService;
    2288                     }
    2289                     else
    2290                     {
    2291                         pService->ReleaseService();
    2292                     }
    2293                 }
    2294             } break;
    2295 
    2296             case HGCM_MSG_SVCRELEASE:
    2297             {
    2298                 HGCMMsgMainSvcRelease *pMsg = (HGCMMsgMainSvcRelease *)pMsgCore;
    2299 
    2300                 LogFlowFunc(("HGCM_MSG_SVCARELEASE pService %p\n", pMsg->pService));
    2301 
    2302                 /* Resolve the service name to the pointer to service instance. */
    2303 
    2304                 rc = pMsg->pService->HandleReleased();
    2305                 if (RT_SUCCESS(rc))
    2306                 {
    2307                     pMsg->pService->ReleaseService();
    2308                 }
    2309             } break;
    2310 #endif
    23112133
    23122134            case HGCM_MSG_RESET:
     
    28242646
    28252647
    2826 #ifdef VBOX_WITH_CRHGSMI
    2827 int HGCMHostSvcHandleCreate(const char *pszServiceName, HGCMCVSHANDLE * phSvc)
    2828 {
    2829     LogFlowFunc(("name = %s\n", pszServiceName));
    2830 
    2831     if (!pszServiceName)
    2832     {
    2833         return VERR_INVALID_PARAMETER;
    2834     }
    2835 
    2836     if (!phSvc)
    2837     {
    2838         return VERR_INVALID_PARAMETER;
    2839     }
    2840 
    2841     /* Host calls go to main HGCM thread that resolves the service name to the
    2842      * service instance pointer and then, using the service pointer, forwards
    2843      * the message to the service thread.
    2844      * So it is slow but host calls are intended mostly for configuration and
    2845      * other non-time-critical functions.
    2846      */
    2847     HGCMMsgCore *pCoreMsg;
    2848     int rc = hgcmMsgAlloc(g_pHgcmThread, &pCoreMsg, HGCM_MSG_SVCAQUIRE, hgcmMainMessageAlloc);
    2849 
    2850     if (RT_SUCCESS(rc))
    2851     {
    2852         HGCMMsgMainSvcAcquire *pMsg = (HGCMMsgMainSvcAcquire *)pCoreMsg;
    2853 
    2854         pMsg->pszServiceName = (char *)pszServiceName;
    2855         pMsg->pService = NULL;
    2856 
    2857         pMsg->Reference();
    2858 
    2859         rc = hgcmMsgSend(pMsg);
    2860         if (RT_SUCCESS(rc))
    2861         {
    2862             /* for simplicity just use a svc ptr as handle for now */
    2863             *phSvc = (HGCMCVSHANDLE)pMsg->pService;
    2864         }
    2865         pMsg->Dereference();
    2866     }
    2867 
    2868     LogFlowFunc(("rc = %Rrc\n", rc));
    2869     return rc;
    2870 }
    2871 
    2872 int HGCMHostSvcHandleDestroy(HGCMCVSHANDLE hSvc)
    2873 {
    2874     LogFlowFunc(("hSvc = %p\n", hSvc));
    2875 
    2876     if (!hSvc)
    2877     {
    2878         return VERR_INVALID_PARAMETER;
    2879     }
    2880 
    2881     /* Host calls go to main HGCM thread that resolves the service name to the
    2882      * service instance pointer and then, using the service pointer, forwards
    2883      * the message to the service thread.
    2884      * So it is slow but host calls are intended mostly for configuration and
    2885      * other non-time-critical functions.
    2886      */
    2887     HGCMMsgCore *pCoreMsg;
    2888     int rc = hgcmMsgAlloc(g_pHgcmThread, &pCoreMsg, HGCM_MSG_SVCRELEASE, hgcmMainMessageAlloc);
    2889 
    2890     if (RT_SUCCESS(rc))
    2891     {
    2892         HGCMMsgMainSvcRelease *pMsg = (HGCMMsgMainSvcRelease *)pCoreMsg;
    2893 
    2894         pMsg->pService = (HGCMService *)hSvc;
    2895 
    2896         rc = hgcmMsgSend(pMsg);
    2897     }
    2898 
    2899     LogFlowFunc(("rc = %Rrc\n", rc));
    2900     return rc;
    2901 }
    2902 
    2903 int HGCMHostFastCallAsync(HGCMCVSHANDLE hSvc, uint32_t function, VBOXHGCMSVCPARM *pParm, PHGCMHOSTFASTCALLCB pfnCompletion,
    2904                           void *pvCompletion)
    2905 {
    2906     LogFlowFunc(("hSvc = %p, u32Function = %d, pParm = %p\n",
    2907             hSvc, function, pParm));
    2908 
    2909     if (!hSvc)
    2910     {
    2911         return VERR_INVALID_PARAMETER;
    2912     }
    2913 
    2914     HGCMService *pService = (HGCMService *)hSvc;
    2915     int rc = pService->HostFastCallAsync(function, pParm, pfnCompletion, pvCompletion);
    2916 
    2917     LogFlowFunc(("rc = %Rrc\n", rc));
    2918     return rc;
    2919 }
    2920 #endif
    2921 
    29222648int HGCMHostReset(bool fForShutdown)
    29232649{
  • trunk/src/VBox/Main/src-client/VMMDevInterface.cpp

    r79263 r80396  
    754754        HGCMHostShutdown(fUvmIsInvalid);
    755755}
    756 
    757 # ifdef VBOX_WITH_CRHGSMI
    758 int VMMDev::hgcmHostSvcHandleCreate(const char *pszServiceName, HGCMCVSHANDLE * phSvc)
    759 {
    760     if (!hgcmIsActive())
    761         return VERR_INVALID_STATE;
    762     return HGCMHostSvcHandleCreate(pszServiceName, phSvc);
    763 }
    764 
    765 int VMMDev::hgcmHostSvcHandleDestroy(HGCMCVSHANDLE hSvc)
    766 {
    767     if (!hgcmIsActive())
    768         return VERR_INVALID_STATE;
    769     return HGCMHostSvcHandleDestroy(hSvc);
    770 }
    771 
    772 int VMMDev::hgcmHostFastCallAsync(HGCMCVSHANDLE hSvc, uint32_t function, PVBOXHGCMSVCPARM pParm,
    773                                   PHGCMHOSTFASTCALLCB pfnCompletion, void *pvCompletion)
    774 {
    775     if (!hgcmIsActive())
    776         return VERR_INVALID_STATE;
    777     return HGCMHostFastCallAsync(hSvc, function, pParm, pfnCompletion, pvCompletion);
    778 }
    779 # endif
    780756
    781757#endif /* HGCM */
Note: See TracChangeset for help on using the changeset viewer.

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