Changeset 35967 in vbox for trunk/src/VBox
- Timestamp:
- Feb 15, 2011 9:37:16 AM (14 years ago)
- Location:
- trunk/src/VBox
- Files:
-
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Frontends/VBoxManage/VBoxManageInfo.cpp
r35907 r35967 2069 2069 } 2070 2070 2071 if (details == VMINFO_FULL) 2072 { 2073 rc = guest->COMGETTER(AdditionsVersion)(guestString.asOutParam()); 2074 if ( SUCCEEDED(rc) 2075 && !guestString.isEmpty()) 2071 rc = guest->COMGETTER(AdditionsVersion)(guestString.asOutParam()); 2072 if ( SUCCEEDED(rc) 2073 && !guestString.isEmpty()) 2074 { 2075 if (details == VMINFO_MACHINEREADABLE) 2076 RTPrintf("GuestAdditionsVersion=\"%lS\"\n", guestString.raw()); 2077 else 2078 RTPrintf("Additions version: %lS\n\n", guestString.raw()); 2079 } 2080 2081 if (details != VMINFO_MACHINEREADABLE) 2082 RTPrintf("\nGuest Facilities:\n\n"); 2083 2084 /* Print information about known Guest Additions facilities: */ 2085 SafeIfaceArray <IAdditionsFacility> collFac; 2086 CHECK_ERROR_RET(guest, COMGETTER(Facilities)(ComSafeArrayAsOutParam(collFac)), rc); 2087 LONG64 lLastUpdatedMS; 2088 char szLastUpdated[32]; 2089 AdditionsFacilityStatus_T curStatus; 2090 for (size_t index = 0; index < collFac.size(); ++index) 2091 { 2092 ComPtr<IAdditionsFacility> fac = collFac[index]; 2093 if (fac) 2076 2094 { 2077 if (details == VMINFO_MACHINEREADABLE) 2078 RTPrintf("GuestAdditionsVersion=\"%lS\"\n", guestString.raw()); 2079 else 2080 RTPrintf("Additions version: %lS\n\n", guestString.raw()); 2095 CHECK_ERROR_RET(fac, COMGETTER(Name)(guestString.asOutParam()), rc); 2096 if (!guestString.isEmpty()) 2097 { 2098 CHECK_ERROR_RET(fac, COMGETTER(Status)(&curStatus), rc); 2099 CHECK_ERROR_RET(fac, COMGETTER(LastUpdated)(&lLastUpdatedMS), rc); 2100 if (details == VMINFO_MACHINEREADABLE) 2101 RTPrintf("GuestAdditionsFacility_%lS=%u,%lld\n", 2102 guestString.raw(), curStatus, lLastUpdatedMS); 2103 else 2104 { 2105 makeTimeStr(szLastUpdated, sizeof(szLastUpdated), lLastUpdatedMS); 2106 RTPrintf("Facility \"%lS\": %s (last update: %s)\n", 2107 guestString.raw(), facilityStateToName(curStatus, false /* No short naming */), szLastUpdated); 2108 } 2109 } 2110 else 2111 AssertMsgFailed(("Facility with undefined name retrieved!\n")); 2081 2112 } 2082 2083 if (details != VMINFO_MACHINEREADABLE) 2084 RTPrintf("\nGuest Components:\n\n"); 2085 2086 /* Print information about important Guest Additions parts: */ 2087 /** @todo Add a makeFacilityStatusStr() to translate facility states into a human readable string! */ 2088 AdditionsFacilityStatus_T faStatus; 2089 LONG64 lLastUpdatedMS = 0; 2090 char szLastUpdated[32]; 2091 rc = guest->GetFacilityStatus(AdditionsFacilityType_VBoxGuestDriver, &lLastUpdatedMS, &faStatus); 2092 if (SUCCEEDED(rc)) 2093 { 2094 makeTimeStr(szLastUpdated, sizeof(szLastUpdated), lLastUpdatedMS); 2095 if (details == VMINFO_MACHINEREADABLE) 2096 RTPrintf("GuestAdditionsFacilityStatusGuestDriver=%u,%ld\n", 2097 faStatus, lLastUpdatedMS); 2098 else 2099 RTPrintf("Guest driver: %u (last update: %s)\n", 2100 facilityStateToName(faStatus, false /* No short naming */), szLastUpdated); 2101 } 2102 2103 rc = guest->GetFacilityStatus(AdditionsFacilityType_VBoxService, &lLastUpdatedMS, &faStatus); 2104 if (SUCCEEDED(rc)) 2105 { 2106 makeTimeStr(szLastUpdated, sizeof(szLastUpdated), lLastUpdatedMS); 2107 if (details == VMINFO_MACHINEREADABLE) 2108 RTPrintf("GuestAdditionsFacilityStatusVBoxService=%u,%ld\n", 2109 faStatus, lLastUpdatedMS); 2110 else 2111 RTPrintf("VBoxService: %s (last update: %s)\n", 2112 facilityStateToName(faStatus, false /* No short naming */), szLastUpdated); 2113 } 2114 2115 rc = guest->GetFacilityStatus(AdditionsFacilityType_VBoxTrayClient, &lLastUpdatedMS, &faStatus); 2116 if (SUCCEEDED(rc)) 2117 { 2118 makeTimeStr(szLastUpdated, sizeof(szLastUpdated), lLastUpdatedMS); 2119 if (details == VMINFO_MACHINEREADABLE) 2120 RTPrintf("GuestAdditionsFacilityStatusVBoxTrayClient=%u,%ld\n", 2121 facilityStateToName(faStatus, false /* No short naming */), lLastUpdatedMS); 2122 else 2123 RTPrintf("VBoxTray / VBoxClient: %u (last update: %s)\n", 2124 faStatus, szLastUpdated); 2125 } 2126 } 2113 else 2114 AssertMsgFailed(("Invalid facility returned!\n")); 2115 } 2116 if (!collFac.size() && details != VMINFO_MACHINEREADABLE) 2117 RTPrintf("No active facilities.\n"); 2127 2118 } 2128 2119 } -
trunk/src/VBox/Main/Makefile.kmk
r35685 r35967 637 637 src-all/VirtualBoxErrorInfoImpl.cpp \ 638 638 $(if $(VBOX_WITH_EXTPACK),src-all/ExtPackManagerImpl.cpp src-all/ExtPackUtil.cpp,) \ 639 src-client/AdditionsFacilityImpl.cpp \ 639 640 src-client/AudioSnifferInterface.cpp \ 640 641 src-client/BusAssignmentManager.cpp \ -
trunk/src/VBox/Main/idl/VirtualBox.xidl
r35942 r35967 7910 7910 7911 7911 <enum 7912 name="AdditionsFacilityClass" 7913 uuid="9cff7275-9a5b-4dcd-b164-523e001a5a9e" 7914 > 7915 <desc> 7916 Guest Additions facility classes. 7917 </desc> 7918 7919 <const name="None" value="0"> 7920 <desc>No/invalid class.</desc> 7921 </const> 7922 <const name="Driver" value="10"> 7923 <desc>Driver.</desc> 7924 </const> 7925 <const name="Service" value="30"> 7926 <desc>System service.</desc> 7927 </const> 7928 <const name="Program" value="50"> 7929 <desc>Program.</desc> 7930 </const> 7931 <const name="Feature" value="100"> 7932 <desc>Feature.</desc> 7933 </const> 7934 <const name="ThirdParty" value="999"> 7935 <desc>Third party.</desc> 7936 </const> 7937 </enum> 7938 7939 <enum 7912 7940 name="AdditionsFacilityStatus" 7913 7941 uuid="ce06f9e1-394e-4fe9-9368-5a88c567dbde" … … 7945 7973 </const> 7946 7974 </enum> 7975 7976 <interface 7977 name="IAdditionsFacility" extends="$unknown" 7978 uuid="5b681761-e865-4bdd-9d6e-135aa8f26e66" 7979 wsmap="struct" 7980 > 7981 <desc> 7982 Structure representing a Guest Additions facility. 7983 </desc> 7984 7985 <attribute name="class" type="AdditionsFacilityClass" readonly="yes"> 7986 <desc>Additions facility class.</desc> 7987 </attribute> 7988 7989 <attribute name="lastUpdated" type="long long" readonly="yes"> 7990 <desc>Timestamp of last updated status.</desc> 7991 </attribute> 7992 7993 <attribute name="name" type="wstring" readonly="yes"> 7994 <desc>Additions facility name.</desc> 7995 </attribute> 7996 7997 <attribute name="status" type="AdditionsFacilityStatus" readonly="yes"> 7998 <desc>Additions facility status.</desc> 7999 </attribute> 8000 8001 <attribute name="type" type="AdditionsFacilityType" readonly="yes"> 8002 <desc>Additions facility type.</desc> 8003 </attribute> 8004 </interface> 7947 8005 7948 8006 <enum … … 8110 8168 separated by dots + revision number) installed on the guest or empty 8111 8169 when the Additions are not installed. 8170 </desc> 8171 </attribute> 8172 8173 <attribute name="facilities" type="IAdditionsFacility" readonly="yes" safearray="yes"> 8174 <desc> 8175 Array of current known facilities. Only returns facilities where a status is known, 8176 e.g. facilities with an unknown status will not be returned. 8112 8177 </desc> 8113 8178 </attribute> -
trunk/src/VBox/Main/include/GuestImpl.h
r35907 r35967 23 23 #include <VBox/ostypes.h> 24 24 25 #include "AdditionsFacilityImpl.h" 25 26 #ifdef VBOX_WITH_GUEST_CONTROL 26 27 # include <VBox/HostServices/GuestControlSvc.h> … … 76 77 STDMETHOD(COMGETTER(AdditionsRunLevel)) (AdditionsRunLevelType_T *aRunLevel); 77 78 STDMETHOD(COMGETTER(AdditionsVersion)) (BSTR *aAdditionsVersion); 79 STDMETHOD(COMGETTER(Facilities)) (ComSafeArrayOut(IAdditionsFacility*, aFacilities)); 78 80 STDMETHOD(COMGETTER(MemoryBalloonSize)) (ULONG *aMemoryBalloonSize); 79 81 STDMETHOD(COMSETTER(MemoryBalloonSize)) (ULONG aMemoryBalloonSize); … … 110 112 void setAdditionsInfo2(Bstr aAdditionsVersion, Bstr aVersionName, Bstr aRevision); 111 113 bool facilityIsActive(VBoxGuestFacilityType enmFacility); 112 void updateFacility(VBoxGuestFacilityType enmFacility, VBoxGuestFacilityStatus enmStatus);114 HRESULT facilityUpdate(VBoxGuestFacilityType enmFacility, VBoxGuestFacilityStatus enmStatus); 113 115 void setAdditionsStatus(VBoxGuestFacilityType enmFacility, VBoxGuestFacilityStatus enmStatus, ULONG aFlags); 114 116 void setSupportedFeatures(uint32_t aCaps); … … 180 182 # endif 181 183 182 struct FacilityData 183 { 184 RTTIMESPEC tsLastUpdated; 185 AdditionsFacilityStatus_T curStatus; 186 }; 187 typedef std::map< AdditionsFacilityType_T, FacilityData > FacilityMap; 188 typedef std::map< AdditionsFacilityType_T, FacilityData >::iterator FacilityMapIter; 184 typedef std::map< AdditionsFacilityType_T, ComObjPtr<AdditionsFacility> > FacilityMap; 185 typedef std::map< AdditionsFacilityType_T, ComObjPtr<AdditionsFacility> >::iterator FacilityMapIter; 186 typedef std::map< AdditionsFacilityType_T, ComObjPtr<AdditionsFacility> >::const_iterator FacilityMapIterConst; 189 187 190 188 struct Data -
trunk/src/VBox/Main/src-client/GuestImpl.cpp
r35907 r35967 237 237 } 238 238 239 STDMETHODIMP Guest::COMGETTER(Facilities)(ComSafeArrayOut(IAdditionsFacility*, aFacilities)) 240 { 241 CheckComArgOutPointerValid(aFacilities); 242 243 AutoCaller autoCaller(this); 244 if (FAILED(autoCaller.rc())) return autoCaller.rc(); 245 246 AutoReadLock alock(this COMMA_LOCKVAL_SRC_POS); 247 248 SafeIfaceArray<IAdditionsFacility> fac(mData.mFacilityMap); 249 fac.detachTo(ComSafeArrayOutArg(aFacilities)); 250 251 return S_OK; 252 } 253 239 254 BOOL Guest::isPageFusionEnabled() 240 255 { … … 247 262 } 248 263 249 STDMETHODIMP Guest::COMGETTER(MemoryBalloonSize) 264 STDMETHODIMP Guest::COMGETTER(MemoryBalloonSize)(ULONG *aMemoryBalloonSize) 250 265 { 251 266 CheckComArgOutPointerValid(aMemoryBalloonSize); … … 261 276 } 262 277 263 STDMETHODIMP Guest::COMSETTER(MemoryBalloonSize) 278 STDMETHODIMP Guest::COMSETTER(MemoryBalloonSize)(ULONG aMemoryBalloonSize) 264 279 { 265 280 AutoCaller autoCaller(this); … … 427 442 /* Not checking for aTimestamp is intentional; it's optional. */ 428 443 429 FacilityMapIter it = mData.mFacilityMap.find(aType);444 FacilityMapIterConst it = mData.mFacilityMap.find(aType); 430 445 if (it != mData.mFacilityMap.end()) 431 446 { 432 *aStatus = it->second.curStatus; 447 AdditionsFacility *pFacility = it->second; 448 ComAssert(pFacility); 449 *aStatus = pFacility->getStatus(); 433 450 if (aTimestamp) 434 *aTimestamp = RTTimeSpecGetMilli(&it->second.tsLastUpdated);451 *aTimestamp = pFacility->getLastUpdated(); 435 452 } 436 453 else … … 560 577 * and use the setSupportedFeatures function instead. 561 578 */ 562 updateFacility(VBoxGuestFacilityType_Graphics, facilityIsActive(VBoxGuestFacilityType_VBoxGuestDriver) ?579 facilityUpdate(VBoxGuestFacilityType_Graphics, facilityIsActive(VBoxGuestFacilityType_VBoxGuestDriver) ? 563 580 VBoxGuestFacilityStatus_Active : VBoxGuestFacilityStatus_Inactive); 564 581 … … 597 614 bool Guest::facilityIsActive(VBoxGuestFacilityType enmFacility) 598 615 { 599 return mData.mFacilityMap[(AdditionsFacilityType_T)enmFacility].curStatus == AdditionsFacilityStatus_Active;600 }601 602 void Guest::updateFacility(VBoxGuestFacilityType enmFacility, VBoxGuestFacilityStatus enmStatus)603 {604 616 Assert(enmFacility < UINT32_MAX); 605 FacilityData *pData = &mData.mFacilityMap[(AdditionsFacilityType_T)enmFacility]; 606 AssertPtr(pData); 607 608 RTTimeNow(&pData->tsLastUpdated); 609 pData->curStatus = (AdditionsFacilityStatus_T)enmStatus; 610 611 LogFlowFunc(("Setting guest facility %u = %u (%u)\n", 612 enmFacility, pData->curStatus, pData->tsLastUpdated)); 617 FacilityMapIterConst it = mData.mFacilityMap.find((AdditionsFacilityType_T)enmFacility); 618 if (it != mData.mFacilityMap.end()) 619 { 620 AdditionsFacility *pFac = it->second; 621 return (pFac->getStatus() == AdditionsFacilityStatus_Active); 622 } 623 return false; 624 } 625 626 HRESULT Guest::facilityUpdate(VBoxGuestFacilityType enmFacility, VBoxGuestFacilityStatus enmStatus) 627 { 628 ComAssertRet(enmFacility < UINT32_MAX, E_INVALIDARG); 629 630 HRESULT rc; 631 RTTIMESPEC tsNow; 632 RTTimeNow(&tsNow); 633 634 FacilityMapIter it = mData.mFacilityMap.find((AdditionsFacilityType_T)enmFacility); 635 if (it != mData.mFacilityMap.end()) 636 { 637 AdditionsFacility *pFac = it->second; 638 rc = pFac->update((AdditionsFacilityStatus_T)enmStatus, tsNow); 639 } 640 else 641 { 642 ComObjPtr<AdditionsFacility> pFacility; 643 pFacility.createObject(); 644 ComAssert(!pFacility.isNull()); 645 rc = pFacility->init(this, 646 (AdditionsFacilityType_T)enmFacility, 647 (AdditionsFacilityStatus_T)enmStatus); 648 if (SUCCEEDED(rc)) 649 mData.mFacilityMap.insert(std::make_pair((AdditionsFacilityType_T)enmFacility, pFacility)); 650 } 651 652 LogFlowFunc(("Returned with rc=%Rrc\n")); 653 return rc; 613 654 } 614 655 … … 666 707 while (it != mData.mFacilityMap.end()) 667 708 { 668 updateFacility((VBoxGuestFacilityType)it->first, enmStatus);709 facilityUpdate((VBoxGuestFacilityType)it->first, enmStatus); 669 710 it++; 670 711 } 671 712 } 672 713 else /* Update one facility only. */ 673 updateFacility(enmFacility, enmStatus);714 facilityUpdate(enmFacility, enmStatus); 674 715 } 675 716 } … … 687 728 AutoWriteLock alock(this COMMA_LOCKVAL_SRC_POS); 688 729 689 updateFacility(VBoxGuestFacilityType_Seamless, aCaps & VMMDEV_GUEST_SUPPORTS_SEAMLESS ?730 facilityUpdate(VBoxGuestFacilityType_Seamless, aCaps & VMMDEV_GUEST_SUPPORTS_SEAMLESS ? 690 731 VBoxGuestFacilityStatus_Active : VBoxGuestFacilityStatus_Inactive); 691 732 /** @todo Add VMMDEV_GUEST_SUPPORTS_GUEST_HOST_WINDOW_MAPPING */ 692 updateFacility(VBoxGuestFacilityType_Graphics, aCaps & VMMDEV_GUEST_SUPPORTS_GRAPHICS ?733 facilityUpdate(VBoxGuestFacilityType_Graphics, aCaps & VMMDEV_GUEST_SUPPORTS_GRAPHICS ? 693 734 VBoxGuestFacilityStatus_Active : VBoxGuestFacilityStatus_Inactive); 694 735 }
Note:
See TracChangeset
for help on using the changeset viewer.