Changeset 75871 in vbox for trunk/src/VBox/HostServices
- Timestamp:
- Dec 2, 2018 3:12:02 PM (6 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/HostServices/GuestControl/service.cpp
r75870 r75871 60 60 * Header Files * 61 61 *********************************************************************************************************************************/ 62 #define USE_PVCLIENT63 62 #define LOG_GROUP LOG_GROUP_GUEST_CONTROL 64 63 #include <VBox/HostServices/GuestControlSvc.h> … … 90 89 91 90 /** 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 */ 93 typedef struct ClientRequest 96 94 { 97 95 /** The call handle */ … … 101 99 /** The call parameters */ 102 100 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; 107 106 108 107 /** … … 395 394 } 396 395 397 int Assign(const Client Connection*pConnection)396 int Assign(const ClientRequest *pConnection) 398 397 { 399 398 AssertPtrReturn(pConnection, VERR_INVALID_POINTER); … … 435 434 } 436 435 437 int Peek(const Client Connection*pConnection)436 int Peek(const ClientRequest *pConnection) 438 437 { 439 438 AssertPtrReturn(pConnection, VERR_INVALID_POINTER); … … 461 460 } HostCommand; 462 461 typedef std::list< HostCommand *> HostCmdList; 463 typedef std::list< HostCommand *>::iterator HostCmdListIter;464 typedef std::list< HostCommand *>::const_iterator HostCmdListIterConst;465 462 466 463 /** … … 478 475 } ClientContext; 479 476 typedef 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;482 477 483 478 /** … … 486 481 typedef struct ClientState 487 482 { 488 PVBOXHGCMSVCHELPERS mSvcHelpers;489 /** The client'sID. */490 uint32_t mID;483 PVBOXHGCMSVCHELPERS m_pSvcHelpers; 484 /** The HGCM client ID. */ 485 uint32_t m_idClient; 491 486 /** Host command list to process. */ 492 487 HostCmdList mHostCmdList; … … 495 490 * This means the client waits for a new host command to reply and won't return 496 491 * from the waiting call until a new host command is available. */ 497 guestControl::eGuestFn mIsPending;492 guestControl::eGuestFn m_enmIsPending; 498 493 /** The client's pending connection. */ 499 Client Connection mPendingCon;494 ClientRequest m_PendingReq; 500 495 /** Set if we've got a pending wait cancel. */ 501 bool m_fPendingCancel;496 bool m_fPendingCancel; 502 497 /** Set if master. */ 503 bool m_fIsMaster;498 bool m_fIsMaster; 504 499 /** The session ID for this client, UINT32_MAX if not set or master. */ 505 uint32_t m_idSession;500 uint32_t m_idSession; 506 501 507 502 508 503 ClientState(void) 509 : m SvcHelpers(NULL)510 , m ID(0)511 , m IsPending((guestControl::eGuestFn)0)504 : m_pSvcHelpers(NULL) 505 , m_idClient(0) 506 , m_enmIsPending((guestControl::eGuestFn)0) 512 507 , m_fPendingCancel(false) 513 508 , m_fIsMaster(false) … … 519 514 520 515 ClientState(PVBOXHGCMSVCHELPERS pSvcHelpers, uint32_t idClient) 521 : m SvcHelpers(pSvcHelpers)522 , m ID(idClient)523 , m IsPending((guestControl::eGuestFn)0)516 : m_pSvcHelpers(pSvcHelpers) 517 , m_idClient(idClient) 518 , m_enmIsPending((guestControl::eGuestFn)0) 524 519 , m_fPendingCancel(false) 525 520 , m_fIsMaster(false) … … 559 554 int rc = VINF_NO_CHANGE; 560 555 561 if (m IsPending != 0)562 { 563 LogFlowFunc(("[Client %RU32] Waking up ...\n", m ID));556 if (m_enmIsPending != 0) 557 { 558 LogFlowFunc(("[Client %RU32] Waking up ...\n", m_idClient)); 564 559 565 560 rc = VINF_SUCCESS; 566 561 567 HostCmdList Iter ItFirstCmd = mHostCmdList.begin();562 HostCmdList::iterator ItFirstCmd = mHostCmdList.begin(); 568 563 if (ItFirstCmd != mHostCmdList.end()) 569 564 { … … 572 567 573 568 LogFlowThisFunc(("[Client %RU32] Current host command is %RU32 (CID=%RU32, cParms=%RU32, m_cRefs=%RU32)\n", 574 m ID, pFirstCmd->mMsgType, pFirstCmd->m_idContext, pFirstCmd->mParmCount, pFirstCmd->m_cRefs));575 576 if (m IsPending == 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) 577 572 { 578 pFirstCmd->setPeekReturn(m PendingCon.mParms, mPendingCon.mNumParms);579 rc = m SvcHelpers->pfnCallComplete(mPendingCon.mHandle, VINF_SUCCESS);580 581 m PendingCon.mHandle = NULL;582 m PendingCon.mParms = NULL;583 m PendingCon.mNumParms = 0;584 m IsPending = (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; 585 580 } 586 else if (m IsPending == GUEST_MSG_WAIT)587 rc = OldRun(&m PendingCon, pFirstCmd);581 else if (m_enmIsPending == GUEST_MSG_WAIT) 582 rc = OldRun(&m_PendingReq, pFirstCmd); 588 583 else 589 AssertMsgFailed(("m IsPending=%d\n",mIsPending));584 AssertMsgFailed(("m_enmIsPending=%d\n", m_enmIsPending)); 590 585 } 591 586 else 592 AssertMsgFailed(("Waking up client ID=%RU32 with no host command in queue is a bad idea\n", m ID));587 AssertMsgFailed(("Waking up client ID=%RU32 with no host command in queue is a bad idea\n", m_idClient)); 593 588 594 589 return rc; … … 606 601 { 607 602 LogFlowFunc(("[Client %RU32] Cancelling waiting thread, isPending=%d, pendingNumParms=%RU32, m_idSession=%x\n", 608 m ID, mIsPending, mPendingCon.mNumParms, m_idSession));603 m_idClient, m_enmIsPending, m_PendingReq.mNumParms, m_idSession)); 609 604 610 605 /* … … 612 607 */ 613 608 int rcComplete; 614 if (m IsPending == GUEST_MSG_PEEK_WAIT)615 { 616 HGCMSvcSetU32(&m PendingCon.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); 617 612 rcComplete = VINF_TRY_AGAIN; 618 613 } … … 622 617 * aren't two parameters, fail the call. 623 618 */ 624 else if (m IsPending != 0)625 { 626 Assert(m IsPending == GUEST_MSG_WAIT);627 if (m PendingCon.mNumParms > 0)628 HGCMSvcSetU32(&m PendingCon.mParms[0], HOST_CANCEL_PENDING_WAITS);629 if (m PendingCon.mNumParms > 1)630 HGCMSvcSetU32(&m PendingCon.mParms[1], 0);631 rcComplete = m PendingCon.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; 632 627 } 633 628 /* … … 640 635 } 641 636 642 m SvcHelpers->pfnCallComplete(mPendingCon.mHandle, rcComplete);643 644 m PendingCon.mHandle = NULL;645 m PendingCon.mParms = NULL;646 m PendingCon.mNumParms = 0;647 m IsPending = (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; 648 643 m_fPendingCancel = false; 649 644 return VINF_SUCCESS; … … 698 693 * @note Only used by GUEST_MSG_WAIT scenarios. 699 694 */ 700 int OldRun(Client Connectionconst *pConnection, HostCommand *pHostCmd)695 int OldRun(ClientRequest const *pConnection, HostCommand *pHostCmd) 701 696 { 702 697 AssertPtrReturn(pConnection, VERR_INVALID_POINTER); … … 705 700 706 701 LogFlowFunc(("[Client %RU32] pConnection=%p, mHostCmdRc=%Rrc, mHostCmdTries=%RU32, mPeekCount=%RU32\n", 707 m ID, pConnection, mHostCmdRc, mHostCmdTries, mPeekCount));702 m_idClient, pConnection, mHostCmdRc, mHostCmdTries, mPeekCount)); 708 703 709 704 int rc = mHostCmdRc = OldSendReply(pConnection, pHostCmd); 710 705 711 LogFlowThisFunc(("[Client %RU32] Processing command %RU32 ended with rc=%Rrc\n", m ID, pHostCmd->mMsgType, mHostCmdRc));706 LogFlowThisFunc(("[Client %RU32] Processing command %RU32 ended with rc=%Rrc\n", m_idClient, pHostCmd->mMsgType, mHostCmdRc)); 712 707 713 708 bool fRemove = false; … … 745 740 746 741 LogFlowThisFunc(("[Client %RU32] Tried command %RU32 for %RU32 times, (last result=%Rrc, fRemove=%RTbool)\n", 747 m ID, pHostCmd->mMsgType, mHostCmdTries, rc, fRemove));742 m_idClient, pHostCmd->mMsgType, mHostCmdTries, rc, fRemove)); 748 743 749 744 if (fRemove) … … 753 748 } 754 749 755 LogFlowFunc(("[Client %RU32] Returned with rc=%Rrc\n", m ID, rc));750 LogFlowFunc(("[Client %RU32] Returned with rc=%Rrc\n", m_idClient, rc)); 756 751 return rc; 757 752 } … … 760 755 * @note Only used by GUEST_MSG_WAIT scenarios. 761 756 */ 762 int OldRunCurrent(const Client Connection*pConnection)757 int OldRunCurrent(const ClientRequest *pConnection) 763 758 { 764 759 AssertPtrReturn(pConnection, VERR_INVALID_POINTER); … … 772 767 { 773 768 /* Go to sleep. */ 774 ASSERT_GUEST_RETURN(m IsPending == 0, VERR_WRONG_ORDER);775 m PendingCon= *pConnection;776 m IsPending = GUEST_MSG_WAIT;777 LogFlowFunc(("[Client %RU32] Is now in pending mode\n", m ID));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)); 778 773 return VINF_HGCM_ASYNC_EXECUTE; 779 774 } … … 791 786 * Return first host command. 792 787 */ 793 HostCmdList Iter curCmd = mHostCmdList.begin();788 HostCmdList::iterator curCmd = mHostCmdList.begin(); 794 789 Assert(curCmd != mHostCmdList.end()); 795 790 HostCommand *pHostCmd = *curCmd; … … 803 798 * @note Only used for GUEST_MSG_WAIT. 804 799 */ 805 int OldSendReply(Client Connectionconst *pConnection,800 int OldSendReply(ClientRequest const *pConnection, 806 801 HostCommand *pHostCmd) 807 802 { … … 815 810 /* If the client is in pending mode, always send back 816 811 * the peek result first. */ 817 if (m IsPending)818 { 819 Assert(m IsPending == GUEST_MSG_WAIT);812 if (m_enmIsPending) 813 { 814 Assert(m_enmIsPending == GUEST_MSG_WAIT); 820 815 rc = pHostCmd->Peek(pConnection); 821 816 mPeekCount++; … … 847 842 848 843 /* Reset pending status. */ 849 m IsPending = (guestControl::eGuestFn)0;844 m_enmIsPending = (guestControl::eGuestFn)0; 850 845 851 846 /* In any case the client did something, so complete 852 847 * the pending call with the result we just got. */ 853 AssertPtr(m SvcHelpers);854 int rc2 = m SvcHelpers->pfnCallComplete(pConnection->mHandle, rc);848 AssertPtr(m_pSvcHelpers); 849 int rc2 = m_pSvcHelpers->pfnCallComplete(pConnection->mHandle, rc); 855 850 856 851 /* Rollback in case the guest cancelled the call. */ … … 862 857 863 858 LogFlowThisFunc(("[Client %RU32] Command %RU32 ended with %Rrc (mPeekCount=%RU32, pConnection=%p)\n", 864 m ID, pHostCmd->mMsgType, rc, mPeekCount, pConnection));859 m_idClient, pHostCmd->mMsgType, rc, mPeekCount, pConnection)); 865 860 return rc; 866 861 } … … 868 863 /** @} */ 869 864 } ClientState; 870 #ifdef USE_PVCLIENT871 865 typedef std::map< uint32_t, ClientState *> ClientStateMap; 872 866 typedef std::map< uint32_t, ClientState *>::iterator ClientStateMapIter; 873 867 typedef std::map< uint32_t, ClientState *>::const_iterator ClientStateMapIterConst; 874 #else875 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 #endif879 868 880 869 /** … … 1009 998 */ 1010 999 ClientState *pClient; 1011 #ifdef USE_PVCLIENT1012 1000 try 1013 1001 { … … 1027 1015 return VERR_NO_MEMORY; 1028 1016 } 1029 #else1030 try1031 {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 #endif1040 1017 1041 1018 /* … … 1073 1050 SELF *pThis = reinterpret_cast<SELF *>(pvService); 1074 1051 AssertPtrReturn(pThis, VERR_INVALID_POINTER); 1075 #ifdef USE_PVCLIENT1076 1052 ClientState *pClient = reinterpret_cast<ClientState *>(pvClient); 1077 1053 AssertPtrReturn(pClient, VERR_INVALID_POINTER); 1078 #else1079 RT_NOREF(pvClient);1080 #endif1081 1054 LogFlowFunc(("[Client %RU32] Disconnected (%zu clients total)\n", idClient, pThis->mClientStateMap.size())); 1082 1083 #ifndef USE_PVCLIENT1084 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 #endif1090 1055 1091 1056 /* … … 1113 1078 * Delete the client state. 1114 1079 */ 1115 #ifdef USE_PVCLIENT1116 1080 pThis->mClientStateMap.erase(idClient); 1117 1081 pClient->~ClientState(); 1118 #else1119 pThis->mClientStateMap.erase(ItClientState);1120 #endif1121 1082 pClient = NULL; 1122 1083 … … 1165 1126 1166 1127 /* Use the current (inbound) connection. */ 1167 Client ConnectionthisCon;1128 ClientRequest thisCon; 1168 1129 thisCon.mHandle = hCall; 1169 1130 thisCon.mNumParms = cParms; … … 1205 1166 * Do the work. 1206 1167 */ 1207 ASSERT_GUEST_MSG_RETURN(m_idMasterClient == pClient->m ID|| m_idMasterClient == UINT32_MAX,1208 ("Already have master session %RU32, refusing %RU32.\n", m_idMasterClient, pClient->m ID),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), 1209 1170 VERR_RESOURCE_BUSY); 1210 1171 int rc = mpHelpers->pfnCallComplete(hCall, VINF_SUCCESS); 1211 1172 if (RT_SUCCESS(rc)) 1212 1173 { 1213 m_idMasterClient = pClient->m ID;1174 m_idMasterClient = pClient->m_idClient; 1214 1175 m_fLegacyMode = false; 1215 1176 pClient->m_fIsMaster = true; 1216 Log(("[Client %RU32] is master.\n", pClient->m ID));1177 Log(("[Client %RU32] is master.\n", pClient->m_idClient)); 1217 1178 } 1218 1179 else … … 1270 1231 paParms[0].u.uint32 = idRestore; 1271 1232 LogFlowFunc(("[Client %RU32] GUEST_MSG_PEEK_XXXX -> VERR_VM_RESTORED (%#RX64 -> %#RX64)\n", 1272 pClient->m ID, idRestoreCheck, idRestore));1233 pClient->m_idClient, idRestoreCheck, idRestore)); 1273 1234 return VERR_VM_RESTORED; 1274 1235 } … … 1279 1240 * Return information about the first command if one is pending in the list. 1280 1241 */ 1281 HostCmdList Iter itFirstCmd = pClient->mHostCmdList.begin();1242 HostCmdList::iterator itFirstCmd = pClient->mHostCmdList.begin(); 1282 1243 if (itFirstCmd != pClient->mHostCmdList.end()) 1283 1244 { … … 1285 1246 pFirstCmd->setPeekReturn(paParms, cParms); 1286 1247 LogFlowFunc(("[Client %RU32] GUEST_MSG_PEEK_XXXX -> VINF_SUCCESS (idMsg=%u (%s), cParms=%u)\n", 1287 pClient->m ID, pFirstCmd->mMsgType, GstCtrlHostFnName((eHostFn)pFirstCmd->mMsgType), pFirstCmd->mParmCount));1248 pClient->m_idClient, pFirstCmd->mMsgType, GstCtrlHostFnName((eHostFn)pFirstCmd->mMsgType), pFirstCmd->mParmCount)); 1288 1249 return VINF_SUCCESS; 1289 1250 } … … 1294 1255 if (!fWait) 1295 1256 { 1296 LogFlowFunc(("[Client %RU32] GUEST_MSG_PEEK_NOWAIT -> VERR_TRY_AGAIN\n", pClient->m ID));1257 LogFlowFunc(("[Client %RU32] GUEST_MSG_PEEK_NOWAIT -> VERR_TRY_AGAIN\n", pClient->m_idClient)); 1297 1258 return VERR_TRY_AGAIN; 1298 1259 } … … 1301 1262 * Wait for the host to queue a message for this client. 1302 1263 */ 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)); 1309 1271 return VINF_HGCM_ASYNC_EXECUTE; 1310 1272 } … … 1343 1305 * Return information aobut the first command if one is pending in the list. 1344 1306 */ 1345 HostCmdList Iter itFirstCmd = pClient->mHostCmdList.begin();1307 HostCmdList::iterator itFirstCmd = pClient->mHostCmdList.begin(); 1346 1308 if (itFirstCmd != pClient->mHostCmdList.end()) 1347 1309 { … … 1424 1386 paParms[0].u.uint32 = 0; 1425 1387 paParms[1].u.uint32 = 0; 1426 LogFlowFunc(("[Client %RU32] GUEST_MSG_GET -> VERR_TRY_AGAIN\n", pClient->m ID));1388 LogFlowFunc(("[Client %RU32] GUEST_MSG_GET -> VERR_TRY_AGAIN\n", pClient->m_idClient)); 1427 1389 return VERR_TRY_AGAIN; 1428 1390 } … … 1449 1411 * Execute. 1450 1412 */ 1451 if (pClient->m IsPending != 0)1413 if (pClient->m_enmIsPending != 0) 1452 1414 { 1453 1415 pClient->CancelWaiting(); … … 1643 1605 ASSERT_GUEST_RETURN(pClient->m_fIsMaster, VERR_ACCESS_DENIED); 1644 1606 ASSERT_GUEST_RETURN(!m_fLegacyMode, VERR_ACCESS_DENIED); 1645 Assert(m_idMasterClient == pClient->m ID);1607 Assert(m_idMasterClient == pClient->m_idClient); 1646 1608 1647 1609 /* Now that we know it's the master, we can check for session ID duplicates. */ … … 1706 1668 ASSERT_GUEST_RETURN(pClient->m_fIsMaster, VERR_ACCESS_DENIED); 1707 1669 ASSERT_GUEST_RETURN(!m_fLegacyMode, VERR_ACCESS_DENIED); 1708 Assert(m_idMasterClient == pClient->m ID);1670 Assert(m_idMasterClient == pClient->m_idClient); 1709 1671 1710 1672 /* … … 1777 1739 ASSERT_GUEST_RETURN(!pClient->m_fIsMaster, VERR_ACCESS_DENIED); 1778 1740 ASSERT_GUEST_RETURN(!m_fLegacyMode, VERR_ACCESS_DENIED); 1779 Assert(m_idMasterClient != pClient->m ID);1741 Assert(m_idMasterClient != pClient->m_idClient); 1780 1742 ASSERT_GUEST_RETURN(pClient->m_idSession == UINT32_MAX, VERR_RESOURCE_BUSY); 1781 1743 … … 1802 1764 RTMemFree(pCur); 1803 1765 m_cPreparedSessions -= 1; 1804 Log(("[Client %RU32] accepted session id %u.\n", pClient->m ID, idSession));1766 Log(("[Client %RU32] accepted session id %u.\n", pClient->m_idClient, idSession)); 1805 1767 } 1806 1768 else … … 1808 1770 return VINF_HGCM_ASYNC_EXECUTE; /* The caller must not complete it. */ 1809 1771 } 1810 LogFunc(("Key mismatch for %u!\n", pClient->m ID));1772 LogFunc(("Key mismatch for %u!\n", pClient->m_idClient)); 1811 1773 return VERR_MISMATCH; 1812 1774 } 1813 1775 } 1814 1776 1815 LogFunc(("No client prepared for %u!\n", pClient->m ID));1777 LogFunc(("No client prepared for %u!\n", pClient->m_idClient)); 1816 1778 return VERR_NOT_FOUND; 1817 1779 } … … 1849 1811 int rc = hostProcessCommand(HOST_SESSION_CLOSE, RT_ELEMENTS(aParms), aParms); 1850 1812 1851 LogFlowFunc(("Closing guest context ID=%RU32 (from client ID=%RU32) returned with rc=%Rrc\n", idContext, pClient->m ID, rc));1813 LogFlowFunc(("Closing guest context ID=%RU32 (from client ID=%RU32) returned with rc=%Rrc\n", idContext, pClient->m_idClient, rc)); 1852 1814 return rc; 1853 1815 } … … 1904 1866 1905 1867 for (ClientStateMapIter It = mClientStateMap.begin(); It != mClientStateMap.end(); ++It) 1906 #ifdef USE_PVCLIENT1907 1868 ASSERT_GUEST_LOGREL_MSG_RETURN(It->second->m_idSession != idSession, 1908 1869 ("idSession=%u uValue=%#x idClient=%u; conflicting with client %u\n", 1909 idSession, uValue, pClient->m ID, It->second->mID),1870 idSession, uValue, pClient->m_idClient, It->second->m_idClient), 1910 1871 VERR_DUPLICATE); 1911 #else1912 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 #endif1917 1872 /* Commit it. */ 1918 1873 pClient->m_idSession = idSession; … … 1946 1901 pClient->OldDitchFirstHostCmd(); 1947 1902 1948 LogFlowFunc(("[Client %RU32] Skipped current message - leagcy function\n", pClient->m ID));1903 LogFlowFunc(("[Client %RU32] Skipped current message - leagcy function\n", pClient->m_idClient)); 1949 1904 return VINF_SUCCESS; 1950 1905 } … … 1980 1935 || idFunction == GUEST_SESSION_NOTIFY)), 1981 1936 ("idSession=%u (CID=%#x) m_idSession=%u idClient=%u idFunction=%u (%s)\n", idSession, idContext, 1982 pClient->m_idSession, pClient->m ID, idFunction, GstCtrlGuestFnName((eGuestFn)idFunction)),1937 pClient->m_idSession, pClient->m_idClient, idFunction, GstCtrlGuestFnName((eGuestFn)idFunction)), 1983 1938 VERR_ACCESS_DENIED); 1984 1939 … … 2011 1966 SELF *pThis = reinterpret_cast<SELF *>(pvService); 2012 1967 AssertReturnVoidStmt(pThis, pThis->mpHelpers->pfnCallComplete(hCall, VERR_INTERNAL_ERROR_5)); 2013 #ifdef USE_PVCLIENT2014 1968 ClientState *pClient = reinterpret_cast<ClientState *>(pvClient); 2015 1969 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); 2024 1971 2025 1972 /* … … 2088 2035 2089 2036 /* 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: 2092 2038 */ 2093 2039 case GUEST_MSG_WAIT: … … 2113 2059 2114 2060 /* 2115 * Anything else shall return fail with invalid function. 2116 * 2061 * Anything else shall return invalid function. 2117 2062 * Note! We used to return VINF_SUCCESS for these. See bugref:9313 2118 2063 * and Guest::i_notifyCtrlDispatcher(). … … 2221 2166 for (ClientStateMapIter It = mClientStateMap.begin(); It != mClientStateMap.end(); ++It) 2222 2167 { 2223 #ifdef USE_PVCLIENT2224 2168 ClientState *pClient = It->second; 2225 #else2226 ClientState *pClient = &It->second;2227 #endif2228 2169 if (pClient->m_idSession == idSession) 2229 2170 { … … 2232 2173 { 2233 2174 int rc2 = pClient->Wakeup(); 2234 LogFlowFunc(("Woke up client ID=%RU32 -> rc=%Rrc\n", pClient->m ID, rc2));2175 LogFlowFunc(("Woke up client ID=%RU32 -> rc=%Rrc\n", pClient->m_idClient, rc2)); 2235 2176 RT_NOREF(rc2); 2236 2177 } … … 2247 2188 if (It != mClientStateMap.end()) 2248 2189 { 2249 #ifdef USE_PVCLIENT2250 2190 ClientState *pClient = It->second; 2251 #else2252 ClientState *pClient = &It->second;2253 #endif2254 2191 int rc2 = pClient->EnqueueCommand(pHostCmd); 2255 2192 if (RT_SUCCESS(rc2)) 2256 2193 { 2257 2194 rc2 = pClient->Wakeup(); 2258 LogFlowFunc(("Woke up client ID=%RU32 (master) -> rc=%Rrc\n", pClient->m ID, rc2));2195 LogFlowFunc(("Woke up client ID=%RU32 (master) -> rc=%Rrc\n", pClient->m_idClient, rc2)); 2259 2196 } 2260 2197 else … … 2340 2277 ClientStateMapIter It = pThis->mClientStateMap.find(idClient); 2341 2278 if (It != pThis->mClientStateMap.end()) 2342 #ifdef USE_PVCLIENT2343 2279 It->second->m_fIsMaster = fIsMaster; 2344 #else2345 It->second.m_fIsMaster = fIsMaster;2346 #endif2347 2280 else 2348 2281 AssertFailed();
Note:
See TracChangeset
for help on using the changeset viewer.