VirtualBox

Changeset 75871 in vbox for trunk/src/VBox/HostServices


Ignore:
Timestamp:
Dec 2, 2018 3:12:02 PM (6 years ago)
Author:
vboxsync
Message:

GuestControl: Cleanups. bugref:9313

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/HostServices/GuestControl/service.cpp

    r75870 r75871  
    6060*   Header Files                                                                                                                 *
    6161*********************************************************************************************************************************/
    62 #define USE_PVCLIENT
    6362#define LOG_GROUP LOG_GROUP_GUEST_CONTROL
    6463#include <VBox/HostServices/GuestControlSvc.h>
     
    9089
    9190/**
    92  * Structure for maintaining a pending (that is, a deferred and not yet completed)
    93  * client command.
    94  */
    95 typedef struct ClientConnection
     91 * Structure for maintaining a request.
     92 */
     93typedef struct ClientRequest
    9694{
    9795    /** The call handle */
     
    10199    /** The call parameters */
    102100    VBOXHGCMSVCPARM *mParms;
    103     /** The standard constructor. */
    104     ClientConnection(void)
    105         : mHandle(0), mNumParms(0), mParms(NULL) {}
    106 } ClientConnection;
     101    /** The default constructor. */
     102    ClientRequest(void)
     103        : mHandle(0), mNumParms(0), mParms(NULL)
     104    {}
     105} ClientRequest;
    107106
    108107/**
     
    395394    }
    396395
    397     int Assign(const ClientConnection *pConnection)
     396    int Assign(const ClientRequest *pConnection)
    398397    {
    399398        AssertPtrReturn(pConnection, VERR_INVALID_POINTER);
     
    435434    }
    436435
    437     int Peek(const ClientConnection *pConnection)
     436    int Peek(const ClientRequest *pConnection)
    438437    {
    439438        AssertPtrReturn(pConnection, VERR_INVALID_POINTER);
     
    461460} HostCommand;
    462461typedef std::list< HostCommand *> HostCmdList;
    463 typedef std::list< HostCommand *>::iterator HostCmdListIter;
    464 typedef std::list< HostCommand *>::const_iterator HostCmdListIterConst;
    465462
    466463/**
     
    478475} ClientContext;
    479476typedef std::map< uint32_t, ClientContext > ClientContextMap;
    480 typedef std::map< uint32_t, ClientContext >::iterator ClientContextMapIter;
    481 typedef std::map< uint32_t, ClientContext >::const_iterator ClientContextMapIterConst;
    482477
    483478/**
     
    486481typedef struct ClientState
    487482{
    488     PVBOXHGCMSVCHELPERS mSvcHelpers;
    489     /** The client's ID. */
    490     uint32_t mID;
     483    PVBOXHGCMSVCHELPERS     m_pSvcHelpers;
     484    /** The HGCM client ID. */
     485    uint32_t                m_idClient;
    491486    /** Host command list to process. */
    492487    HostCmdList mHostCmdList;
     
    495490     * This means the client waits for a new host command to reply and won't return
    496491     * from the waiting call until a new host command is available. */
    497     guestControl::eGuestFn mIsPending;
     492    guestControl::eGuestFn  m_enmIsPending;
    498493    /** The client's pending connection. */
    499     ClientConnection    mPendingCon;
     494    ClientRequest           m_PendingReq;
    500495    /** Set if we've got a pending wait cancel. */
    501     bool                m_fPendingCancel;
     496    bool                    m_fPendingCancel;
    502497    /** Set if master. */
    503     bool                m_fIsMaster;
     498    bool                    m_fIsMaster;
    504499    /** The session ID for this client, UINT32_MAX if not set or master. */
    505     uint32_t            m_idSession;
     500    uint32_t                m_idSession;
    506501
    507502
    508503    ClientState(void)
    509         : mSvcHelpers(NULL)
    510         , mID(0)
    511         , mIsPending((guestControl::eGuestFn)0)
     504        : m_pSvcHelpers(NULL)
     505        , m_idClient(0)
     506        , m_enmIsPending((guestControl::eGuestFn)0)
    512507        , m_fPendingCancel(false)
    513508        , m_fIsMaster(false)
     
    519514
    520515    ClientState(PVBOXHGCMSVCHELPERS pSvcHelpers, uint32_t idClient)
    521         : mSvcHelpers(pSvcHelpers)
    522         , mID(idClient)
    523         , mIsPending((guestControl::eGuestFn)0)
     516        : m_pSvcHelpers(pSvcHelpers)
     517        , m_idClient(idClient)
     518        , m_enmIsPending((guestControl::eGuestFn)0)
    524519        , m_fPendingCancel(false)
    525520        , m_fIsMaster(false)
     
    559554        int rc = VINF_NO_CHANGE;
    560555
    561         if (mIsPending != 0)
    562         {
    563             LogFlowFunc(("[Client %RU32] Waking up ...\n", mID));
     556        if (m_enmIsPending != 0)
     557        {
     558            LogFlowFunc(("[Client %RU32] Waking up ...\n", m_idClient));
    564559
    565560            rc = VINF_SUCCESS;
    566561
    567             HostCmdListIter ItFirstCmd = mHostCmdList.begin();
     562            HostCmdList::iterator ItFirstCmd = mHostCmdList.begin();
    568563            if (ItFirstCmd != mHostCmdList.end())
    569564            {
     
    572567
    573568                LogFlowThisFunc(("[Client %RU32] Current host command is %RU32 (CID=%RU32, cParms=%RU32, m_cRefs=%RU32)\n",
    574                                  mID, pFirstCmd->mMsgType, pFirstCmd->m_idContext, pFirstCmd->mParmCount, pFirstCmd->m_cRefs));
    575 
    576                 if (mIsPending == GUEST_MSG_PEEK_WAIT)
     569                                 m_idClient, pFirstCmd->mMsgType, pFirstCmd->m_idContext, pFirstCmd->mParmCount, pFirstCmd->m_cRefs));
     570
     571                if (m_enmIsPending == GUEST_MSG_PEEK_WAIT)
    577572                {
    578                     pFirstCmd->setPeekReturn(mPendingCon.mParms, mPendingCon.mNumParms);
    579                     rc = mSvcHelpers->pfnCallComplete(mPendingCon.mHandle, VINF_SUCCESS);
    580 
    581                     mPendingCon.mHandle   = NULL;
    582                     mPendingCon.mParms    = NULL;
    583                     mPendingCon.mNumParms = 0;
    584                     mIsPending            = (guestControl::eGuestFn)0;
     573                    pFirstCmd->setPeekReturn(m_PendingReq.mParms, m_PendingReq.mNumParms);
     574                    rc = m_pSvcHelpers->pfnCallComplete(m_PendingReq.mHandle, VINF_SUCCESS);
     575
     576                    m_PendingReq.mHandle   = NULL;
     577                    m_PendingReq.mParms    = NULL;
     578                    m_PendingReq.mNumParms = 0;
     579                    m_enmIsPending            = (guestControl::eGuestFn)0;
    585580                }
    586                 else if (mIsPending == GUEST_MSG_WAIT)
    587                     rc = OldRun(&mPendingCon, pFirstCmd);
     581                else if (m_enmIsPending == GUEST_MSG_WAIT)
     582                    rc = OldRun(&m_PendingReq, pFirstCmd);
    588583                else
    589                     AssertMsgFailed(("mIsPending=%d\n", mIsPending));
     584                    AssertMsgFailed(("m_enmIsPending=%d\n", m_enmIsPending));
    590585            }
    591586            else
    592                 AssertMsgFailed(("Waking up client ID=%RU32 with no host command in queue is a bad idea\n", mID));
     587                AssertMsgFailed(("Waking up client ID=%RU32 with no host command in queue is a bad idea\n", m_idClient));
    593588
    594589            return rc;
     
    606601    {
    607602        LogFlowFunc(("[Client %RU32] Cancelling waiting thread, isPending=%d, pendingNumParms=%RU32, m_idSession=%x\n",
    608                      mID, mIsPending, mPendingCon.mNumParms, m_idSession));
     603                     m_idClient, m_enmIsPending, m_PendingReq.mNumParms, m_idSession));
    609604
    610605        /*
     
    612607         */
    613608        int rcComplete;
    614         if (mIsPending == GUEST_MSG_PEEK_WAIT)
    615         {
    616             HGCMSvcSetU32(&mPendingCon.mParms[0], HOST_CANCEL_PENDING_WAITS);
     609        if (m_enmIsPending == GUEST_MSG_PEEK_WAIT)
     610        {
     611            HGCMSvcSetU32(&m_PendingReq.mParms[0], HOST_CANCEL_PENDING_WAITS);
    617612            rcComplete = VINF_TRY_AGAIN;
    618613        }
     
    622617         * aren't two parameters, fail the call.
    623618         */
    624         else if (mIsPending != 0)
    625         {
    626             Assert(mIsPending == GUEST_MSG_WAIT);
    627             if (mPendingCon.mNumParms > 0)
    628                 HGCMSvcSetU32(&mPendingCon.mParms[0], HOST_CANCEL_PENDING_WAITS);
    629             if (mPendingCon.mNumParms > 1)
    630                 HGCMSvcSetU32(&mPendingCon.mParms[1], 0);
    631             rcComplete = mPendingCon.mNumParms == 2 ? VINF_SUCCESS : VERR_TRY_AGAIN;
     619        else if (m_enmIsPending != 0)
     620        {
     621            Assert(m_enmIsPending == GUEST_MSG_WAIT);
     622            if (m_PendingReq.mNumParms > 0)
     623                HGCMSvcSetU32(&m_PendingReq.mParms[0], HOST_CANCEL_PENDING_WAITS);
     624            if (m_PendingReq.mNumParms > 1)
     625                HGCMSvcSetU32(&m_PendingReq.mParms[1], 0);
     626            rcComplete = m_PendingReq.mNumParms == 2 ? VINF_SUCCESS : VERR_TRY_AGAIN;
    632627        }
    633628        /*
     
    640635        }
    641636
    642         mSvcHelpers->pfnCallComplete(mPendingCon.mHandle, rcComplete);
    643 
    644         mPendingCon.mHandle   = NULL;
    645         mPendingCon.mParms    = NULL;
    646         mPendingCon.mNumParms = 0;
    647         mIsPending            = (guestControl::eGuestFn)0;
     637        m_pSvcHelpers->pfnCallComplete(m_PendingReq.mHandle, rcComplete);
     638
     639        m_PendingReq.mHandle   = NULL;
     640        m_PendingReq.mParms    = NULL;
     641        m_PendingReq.mNumParms = 0;
     642        m_enmIsPending            = (guestControl::eGuestFn)0;
    648643        m_fPendingCancel      = false;
    649644        return VINF_SUCCESS;
     
    698693     * @note Only used by GUEST_MSG_WAIT scenarios.
    699694     */
    700     int OldRun(ClientConnection const *pConnection, HostCommand *pHostCmd)
     695    int OldRun(ClientRequest const *pConnection, HostCommand *pHostCmd)
    701696    {
    702697        AssertPtrReturn(pConnection, VERR_INVALID_POINTER);
     
    705700
    706701        LogFlowFunc(("[Client %RU32] pConnection=%p, mHostCmdRc=%Rrc, mHostCmdTries=%RU32, mPeekCount=%RU32\n",
    707                       mID, pConnection, mHostCmdRc, mHostCmdTries, mPeekCount));
     702                      m_idClient, pConnection, mHostCmdRc, mHostCmdTries, mPeekCount));
    708703
    709704        int rc = mHostCmdRc = OldSendReply(pConnection, pHostCmd);
    710705
    711         LogFlowThisFunc(("[Client %RU32] Processing command %RU32 ended with rc=%Rrc\n", mID, pHostCmd->mMsgType, mHostCmdRc));
     706        LogFlowThisFunc(("[Client %RU32] Processing command %RU32 ended with rc=%Rrc\n", m_idClient, pHostCmd->mMsgType, mHostCmdRc));
    712707
    713708        bool fRemove = false;
     
    745740
    746741        LogFlowThisFunc(("[Client %RU32] Tried command %RU32 for %RU32 times, (last result=%Rrc, fRemove=%RTbool)\n",
    747                          mID, pHostCmd->mMsgType, mHostCmdTries, rc, fRemove));
     742                         m_idClient, pHostCmd->mMsgType, mHostCmdTries, rc, fRemove));
    748743
    749744        if (fRemove)
     
    753748        }
    754749
    755         LogFlowFunc(("[Client %RU32] Returned with rc=%Rrc\n", mID, rc));
     750        LogFlowFunc(("[Client %RU32] Returned with rc=%Rrc\n", m_idClient, rc));
    756751        return rc;
    757752    }
     
    760755     * @note Only used by GUEST_MSG_WAIT scenarios.
    761756     */
    762     int OldRunCurrent(const ClientConnection *pConnection)
     757    int OldRunCurrent(const ClientRequest *pConnection)
    763758    {
    764759        AssertPtrReturn(pConnection, VERR_INVALID_POINTER);
     
    772767            {
    773768                /* Go to sleep. */
    774                 ASSERT_GUEST_RETURN(mIsPending == 0, VERR_WRONG_ORDER);
    775                 mPendingCon = *pConnection;
    776                 mIsPending  = GUEST_MSG_WAIT;
    777                 LogFlowFunc(("[Client %RU32] Is now in pending mode\n", mID));
     769                ASSERT_GUEST_RETURN(m_enmIsPending == 0, VERR_WRONG_ORDER);
     770                m_PendingReq = *pConnection;
     771                m_enmIsPending  = GUEST_MSG_WAIT;
     772                LogFlowFunc(("[Client %RU32] Is now in pending mode\n", m_idClient));
    778773                return VINF_HGCM_ASYNC_EXECUTE;
    779774            }
     
    791786         * Return first host command.
    792787         */
    793         HostCmdListIter curCmd = mHostCmdList.begin();
     788        HostCmdList::iterator curCmd = mHostCmdList.begin();
    794789        Assert(curCmd != mHostCmdList.end());
    795790        HostCommand *pHostCmd = *curCmd;
     
    803798     * @note Only used for GUEST_MSG_WAIT.
    804799     */
    805     int OldSendReply(ClientConnection const *pConnection,
     800    int OldSendReply(ClientRequest const *pConnection,
    806801                     HostCommand            *pHostCmd)
    807802    {
     
    815810        /* If the client is in pending mode, always send back
    816811         * the peek result first. */
    817         if (mIsPending)
    818         {
    819             Assert(mIsPending == GUEST_MSG_WAIT);
     812        if (m_enmIsPending)
     813        {
     814            Assert(m_enmIsPending == GUEST_MSG_WAIT);
    820815            rc = pHostCmd->Peek(pConnection);
    821816            mPeekCount++;
     
    847842
    848843        /* Reset pending status. */
    849         mIsPending = (guestControl::eGuestFn)0;
     844        m_enmIsPending = (guestControl::eGuestFn)0;
    850845
    851846        /* In any case the client did something, so complete
    852847         * the pending call with the result we just got. */
    853         AssertPtr(mSvcHelpers);
    854         int rc2 = mSvcHelpers->pfnCallComplete(pConnection->mHandle, rc);
     848        AssertPtr(m_pSvcHelpers);
     849        int rc2 = m_pSvcHelpers->pfnCallComplete(pConnection->mHandle, rc);
    855850
    856851        /* Rollback in case the guest cancelled the call. */
     
    862857
    863858        LogFlowThisFunc(("[Client %RU32] Command %RU32 ended with %Rrc (mPeekCount=%RU32, pConnection=%p)\n",
    864                          mID, pHostCmd->mMsgType, rc, mPeekCount, pConnection));
     859                         m_idClient, pHostCmd->mMsgType, rc, mPeekCount, pConnection));
    865860        return rc;
    866861    }
     
    868863    /** @} */
    869864} ClientState;
    870 #ifdef USE_PVCLIENT
    871865typedef std::map< uint32_t, ClientState *> ClientStateMap;
    872866typedef std::map< uint32_t, ClientState *>::iterator ClientStateMapIter;
    873867typedef std::map< uint32_t, ClientState *>::const_iterator ClientStateMapIterConst;
    874 #else
    875 typedef std::map< uint32_t, ClientState > ClientStateMap;
    876 typedef std::map< uint32_t, ClientState >::iterator ClientStateMapIter;
    877 typedef std::map< uint32_t, ClientState >::const_iterator ClientStateMapIterConst;
    878 #endif
    879868
    880869/**
     
    1009998     */
    1010999    ClientState *pClient;
    1011 #ifdef USE_PVCLIENT
    10121000    try
    10131001    {
     
    10271015        return VERR_NO_MEMORY;
    10281016    }
    1029 #else
    1030     try
    1031     {
    1032         pThis->mClientStateMap[idClient] = ClientState(pThis->mpHelpers, idClient);
    1033         pClient = &pThis->mClientStateMap[idClient];
    1034     }
    1035     catch (std::bad_alloc &)
    1036     {
    1037         return VERR_NO_MEMORY;
    1038     }
    1039 #endif
    10401017
    10411018    /*
     
    10731050    SELF *pThis = reinterpret_cast<SELF *>(pvService);
    10741051    AssertPtrReturn(pThis, VERR_INVALID_POINTER);
    1075 #ifdef USE_PVCLIENT
    10761052    ClientState *pClient = reinterpret_cast<ClientState *>(pvClient);
    10771053    AssertPtrReturn(pClient, VERR_INVALID_POINTER);
    1078 #else
    1079     RT_NOREF(pvClient);
    1080 #endif
    10811054    LogFlowFunc(("[Client %RU32] Disconnected (%zu clients total)\n", idClient, pThis->mClientStateMap.size()));
    1082 
    1083 #ifndef USE_PVCLIENT
    1084     ClientStateMapIter ItClientState = pThis->mClientStateMap.find(idClient);
    1085     AssertMsgReturn(ItClientState != pThis->mClientStateMap.end(),
    1086                     ("Client ID=%RU32 not found in client list when it should be there\n", idClient),
    1087                     VINF_SUCCESS);
    1088     ClientState *pClient = &ItClientState->second;
    1089 #endif
    10901055
    10911056    /*
     
    11131078     * Delete the client state.
    11141079     */
    1115 #ifdef USE_PVCLIENT
    11161080    pThis->mClientStateMap.erase(idClient);
    11171081    pClient->~ClientState();
    1118 #else
    1119     pThis->mClientStateMap.erase(ItClientState);
    1120 #endif
    11211082    pClient = NULL;
    11221083
     
    11651126
    11661127    /* Use the current (inbound) connection. */
    1167     ClientConnection thisCon;
     1128    ClientRequest thisCon;
    11681129    thisCon.mHandle   = hCall;
    11691130    thisCon.mNumParms = cParms;
     
    12051166     * Do the work.
    12061167     */
    1207     ASSERT_GUEST_MSG_RETURN(m_idMasterClient == pClient->mID || m_idMasterClient == UINT32_MAX,
    1208                             ("Already have master session %RU32, refusing %RU32.\n", m_idMasterClient, pClient->mID),
     1168    ASSERT_GUEST_MSG_RETURN(m_idMasterClient == pClient->m_idClient || m_idMasterClient == UINT32_MAX,
     1169                            ("Already have master session %RU32, refusing %RU32.\n", m_idMasterClient, pClient->m_idClient),
    12091170                            VERR_RESOURCE_BUSY);
    12101171    int rc = mpHelpers->pfnCallComplete(hCall, VINF_SUCCESS);
    12111172    if (RT_SUCCESS(rc))
    12121173    {
    1213         m_idMasterClient = pClient->mID;
     1174        m_idMasterClient = pClient->m_idClient;
    12141175        m_fLegacyMode    = false;
    12151176        pClient->m_fIsMaster = true;
    1216         Log(("[Client %RU32] is master.\n", pClient->mID));
     1177        Log(("[Client %RU32] is master.\n", pClient->m_idClient));
    12171178    }
    12181179    else
     
    12701231            paParms[0].u.uint32 = idRestore;
    12711232            LogFlowFunc(("[Client %RU32] GUEST_MSG_PEEK_XXXX -> VERR_VM_RESTORED (%#RX64 -> %#RX64)\n",
    1272                          pClient->mID, idRestoreCheck, idRestore));
     1233                         pClient->m_idClient, idRestoreCheck, idRestore));
    12731234            return VERR_VM_RESTORED;
    12741235        }
     
    12791240     * Return information about the first command if one is pending in the list.
    12801241     */
    1281     HostCmdListIter itFirstCmd = pClient->mHostCmdList.begin();
     1242    HostCmdList::iterator itFirstCmd = pClient->mHostCmdList.begin();
    12821243    if (itFirstCmd != pClient->mHostCmdList.end())
    12831244    {
     
    12851246        pFirstCmd->setPeekReturn(paParms, cParms);
    12861247        LogFlowFunc(("[Client %RU32] GUEST_MSG_PEEK_XXXX -> VINF_SUCCESS (idMsg=%u (%s), cParms=%u)\n",
    1287                      pClient->mID, pFirstCmd->mMsgType, GstCtrlHostFnName((eHostFn)pFirstCmd->mMsgType), pFirstCmd->mParmCount));
     1248                     pClient->m_idClient, pFirstCmd->mMsgType, GstCtrlHostFnName((eHostFn)pFirstCmd->mMsgType), pFirstCmd->mParmCount));
    12881249        return VINF_SUCCESS;
    12891250    }
     
    12941255    if (!fWait)
    12951256    {
    1296         LogFlowFunc(("[Client %RU32] GUEST_MSG_PEEK_NOWAIT -> VERR_TRY_AGAIN\n", pClient->mID));
     1257        LogFlowFunc(("[Client %RU32] GUEST_MSG_PEEK_NOWAIT -> VERR_TRY_AGAIN\n", pClient->m_idClient));
    12971258        return VERR_TRY_AGAIN;
    12981259    }
     
    13011262     * Wait for the host to queue a message for this client.
    13021263     */
    1303     ASSERT_GUEST_MSG_RETURN(pClient->mIsPending == 0, ("Already pending! (idClient=%RU32)\n", pClient->mID), VERR_RESOURCE_BUSY);
    1304     pClient->mPendingCon.mHandle    = hCall;
    1305     pClient->mPendingCon.mNumParms  = cParms;
    1306     pClient->mPendingCon.mParms     = paParms;
    1307     pClient->mIsPending             = GUEST_MSG_PEEK_WAIT;
    1308     LogFlowFunc(("[Client %RU32] Is now in pending mode\n", pClient->mID));
     1264    ASSERT_GUEST_MSG_RETURN(pClient->m_enmIsPending == 0, ("Already pending! (idClient=%RU32)\n", pClient->m_idClient),
     1265                            VERR_RESOURCE_BUSY);
     1266    pClient->m_PendingReq.mHandle    = hCall;
     1267    pClient->m_PendingReq.mNumParms  = cParms;
     1268    pClient->m_PendingReq.mParms     = paParms;
     1269    pClient->m_enmIsPending             = GUEST_MSG_PEEK_WAIT;
     1270    LogFlowFunc(("[Client %RU32] Is now in pending mode...\n", pClient->m_idClient));
    13091271    return VINF_HGCM_ASYNC_EXECUTE;
    13101272}
     
    13431305     * Return information aobut the first command if one is pending in the list.
    13441306     */
    1345     HostCmdListIter itFirstCmd = pClient->mHostCmdList.begin();
     1307    HostCmdList::iterator itFirstCmd = pClient->mHostCmdList.begin();
    13461308    if (itFirstCmd != pClient->mHostCmdList.end())
    13471309    {
     
    14241386    paParms[0].u.uint32 = 0;
    14251387    paParms[1].u.uint32 = 0;
    1426     LogFlowFunc(("[Client %RU32] GUEST_MSG_GET -> VERR_TRY_AGAIN\n", pClient->mID));
     1388    LogFlowFunc(("[Client %RU32] GUEST_MSG_GET -> VERR_TRY_AGAIN\n", pClient->m_idClient));
    14271389    return VERR_TRY_AGAIN;
    14281390}
     
    14491411     * Execute.
    14501412     */
    1451     if (pClient->mIsPending != 0)
     1413    if (pClient->m_enmIsPending != 0)
    14521414    {
    14531415        pClient->CancelWaiting();
     
    16431605    ASSERT_GUEST_RETURN(pClient->m_fIsMaster, VERR_ACCESS_DENIED);
    16441606    ASSERT_GUEST_RETURN(!m_fLegacyMode, VERR_ACCESS_DENIED);
    1645     Assert(m_idMasterClient == pClient->mID);
     1607    Assert(m_idMasterClient == pClient->m_idClient);
    16461608
    16471609    /* Now that we know it's the master, we can check for session ID duplicates. */
     
    17061668    ASSERT_GUEST_RETURN(pClient->m_fIsMaster, VERR_ACCESS_DENIED);
    17071669    ASSERT_GUEST_RETURN(!m_fLegacyMode, VERR_ACCESS_DENIED);
    1708     Assert(m_idMasterClient == pClient->mID);
     1670    Assert(m_idMasterClient == pClient->m_idClient);
    17091671
    17101672    /*
     
    17771739    ASSERT_GUEST_RETURN(!pClient->m_fIsMaster, VERR_ACCESS_DENIED);
    17781740    ASSERT_GUEST_RETURN(!m_fLegacyMode, VERR_ACCESS_DENIED);
    1779     Assert(m_idMasterClient != pClient->mID);
     1741    Assert(m_idMasterClient != pClient->m_idClient);
    17801742    ASSERT_GUEST_RETURN(pClient->m_idSession == UINT32_MAX, VERR_RESOURCE_BUSY);
    17811743
     
    18021764                    RTMemFree(pCur);
    18031765                    m_cPreparedSessions -= 1;
    1804                     Log(("[Client %RU32] accepted session id %u.\n", pClient->mID, idSession));
     1766                    Log(("[Client %RU32] accepted session id %u.\n", pClient->m_idClient, idSession));
    18051767                }
    18061768                else
     
    18081770                return VINF_HGCM_ASYNC_EXECUTE; /* The caller must not complete it. */
    18091771            }
    1810             LogFunc(("Key mismatch for %u!\n", pClient->mID));
     1772            LogFunc(("Key mismatch for %u!\n", pClient->m_idClient));
    18111773            return VERR_MISMATCH;
    18121774        }
    18131775    }
    18141776
    1815     LogFunc(("No client prepared for %u!\n", pClient->mID));
     1777    LogFunc(("No client prepared for %u!\n", pClient->m_idClient));
    18161778    return VERR_NOT_FOUND;
    18171779}
     
    18491811    int rc = hostProcessCommand(HOST_SESSION_CLOSE, RT_ELEMENTS(aParms), aParms);
    18501812
    1851     LogFlowFunc(("Closing guest context ID=%RU32 (from client ID=%RU32) returned with rc=%Rrc\n", idContext, pClient->mID, rc));
     1813    LogFlowFunc(("Closing guest context ID=%RU32 (from client ID=%RU32) returned with rc=%Rrc\n", idContext, pClient->m_idClient, rc));
    18521814    return rc;
    18531815}
     
    19041866
    19051867        for (ClientStateMapIter It = mClientStateMap.begin(); It != mClientStateMap.end(); ++It)
    1906 #ifdef USE_PVCLIENT
    19071868            ASSERT_GUEST_LOGREL_MSG_RETURN(It->second->m_idSession != idSession,
    19081869                                           ("idSession=%u uValue=%#x idClient=%u; conflicting with client %u\n",
    1909                                             idSession, uValue, pClient->mID, It->second->mID),
     1870                                            idSession, uValue, pClient->m_idClient, It->second->m_idClient),
    19101871                                           VERR_DUPLICATE);
    1911 #else
    1912             ASSERT_GUEST_LOGREL_MSG_RETURN(It->second.m_idSession != idSession,
    1913                                            ("idSession=%u uValue=%#x idClient=%u; conflicting with client %u\n",
    1914                                             idSession, uValue, pClient->mID, It->second.mID),
    1915                                            VERR_DUPLICATE);
    1916 #endif
    19171872        /* Commit it. */
    19181873        pClient->m_idSession = idSession;
     
    19461901        pClient->OldDitchFirstHostCmd();
    19471902
    1948     LogFlowFunc(("[Client %RU32] Skipped current message - leagcy function\n", pClient->mID));
     1903    LogFlowFunc(("[Client %RU32] Skipped current message - leagcy function\n", pClient->m_idClient));
    19491904    return VINF_SUCCESS;
    19501905}
     
    19801935                                    || idFunction == GUEST_SESSION_NOTIFY)),
    19811936                            ("idSession=%u (CID=%#x) m_idSession=%u idClient=%u idFunction=%u (%s)\n", idSession, idContext,
    1982                              pClient->m_idSession, pClient->mID, idFunction, GstCtrlGuestFnName((eGuestFn)idFunction)),
     1937                             pClient->m_idSession, pClient->m_idClient, idFunction, GstCtrlGuestFnName((eGuestFn)idFunction)),
    19831938                            VERR_ACCESS_DENIED);
    19841939
     
    20111966    SELF *pThis = reinterpret_cast<SELF *>(pvService);
    20121967    AssertReturnVoidStmt(pThis, pThis->mpHelpers->pfnCallComplete(hCall, VERR_INTERNAL_ERROR_5));
    2013 #ifdef USE_PVCLIENT
    20141968    ClientState *pClient = reinterpret_cast<ClientState *>(pvClient);
    20151969    AssertReturnVoidStmt(pClient, pThis->mpHelpers->pfnCallComplete(hCall, VERR_INVALID_CLIENT_ID));
    2016     Assert(pClient->mID == idClient);
    2017 #else
    2018     ClientStateMapIter ItClientState = pThis->mClientStateMap.find(idClient);
    2019     AssertReturnVoidStmt(ItClientState != pThis->mClientStateMap.end(),
    2020                          pThis->mpHelpers->pfnCallComplete(hCall, VERR_INVALID_CLIENT_ID));
    2021     ClientState *pClient = &ItClientState->second;
    2022     RT_NOREF(pvClient);
    2023 #endif
     1970    Assert(pClient->m_idClient == idClient);
    20241971
    20251972    /*
     
    20882035
    20892036        /*
    2090          * The remaining commands are here for compatibility with older
    2091          * guest additions:
     2037         * The remaining commands are here for compatibility with older guest additions:
    20922038         */
    20932039        case GUEST_MSG_WAIT:
     
    21132059
    21142060        /*
    2115          * Anything else shall return fail with invalid function.
    2116          *
     2061         * Anything else shall return invalid function.
    21172062         * Note! We used to return VINF_SUCCESS for these.  See bugref:9313
    21182063         *       and Guest::i_notifyCtrlDispatcher().
     
    22212166            for (ClientStateMapIter It = mClientStateMap.begin(); It != mClientStateMap.end(); ++It)
    22222167            {
    2223 #ifdef USE_PVCLIENT
    22242168                ClientState *pClient = It->second;
    2225 #else
    2226                 ClientState *pClient = &It->second;
    2227 #endif
    22282169                if (pClient->m_idSession == idSession)
    22292170                {
     
    22322173                    {
    22332174                        int rc2 = pClient->Wakeup();
    2234                         LogFlowFunc(("Woke up client ID=%RU32 -> rc=%Rrc\n", pClient->mID, rc2));
     2175                        LogFlowFunc(("Woke up client ID=%RU32 -> rc=%Rrc\n", pClient->m_idClient, rc2));
    22352176                        RT_NOREF(rc2);
    22362177                    }
     
    22472188            if (It != mClientStateMap.end())
    22482189            {
    2249 #ifdef USE_PVCLIENT
    22502190                ClientState *pClient = It->second;
    2251 #else
    2252                 ClientState *pClient = &It->second;
    2253 #endif
    22542191                int rc2 = pClient->EnqueueCommand(pHostCmd);
    22552192                if (RT_SUCCESS(rc2))
    22562193                {
    22572194                    rc2 = pClient->Wakeup();
    2258                     LogFlowFunc(("Woke up client ID=%RU32 (master) -> rc=%Rrc\n", pClient->mID, rc2));
     2195                    LogFlowFunc(("Woke up client ID=%RU32 (master) -> rc=%Rrc\n", pClient->m_idClient, rc2));
    22592196                }
    22602197                else
     
    23402277        ClientStateMapIter It = pThis->mClientStateMap.find(idClient);
    23412278        if (It != pThis->mClientStateMap.end())
    2342 #ifdef USE_PVCLIENT
    23432279            It->second->m_fIsMaster = fIsMaster;
    2344 #else
    2345             It->second.m_fIsMaster = fIsMaster;
    2346 #endif
    23472280        else
    23482281            AssertFailed();
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