Changeset 98091 in vbox for trunk/src/VBox/Main
- Timestamp:
- Jan 16, 2023 10:18:24 AM (2 years ago)
- Location:
- trunk/src/VBox/Main
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Main/include/ConsoleImpl.h
r98088 r98091 809 809 struct LEDSET; 810 810 typedef struct LEDSET *PLEDSET; 811 PPDMLED *i_getLedSet(uint32_t iLedSet);811 PPDMLED volatile *i_getLedSet(uint32_t iLedSet); 812 812 uint32_t i_allocateDriverLeds(uint32_t cLeds, uint32_t fTypes, DeviceType_T **ppSubTypes); 813 813 void i_attachStatusDriver(PCFGMNODE pCtlInst, DeviceType_T enmType); … … 1069 1069 * @{ */ 1070 1070 /** Read/write lock separating LED allocations (write) from queries (read). */ 1071 RWLockHandle mLedLock;1071 RWLockHandle mLedLock; 1072 1072 /** Number of LED sets in use in maLedSets. */ 1073 uint32_t mcLedSets;1073 uint32_t mcLedSets; 1074 1074 /** LED sets. */ 1075 1075 struct LEDSET 1076 1076 { 1077 PPDMLED *papLeds; 1078 uint32_t cLeds; 1079 uint32_t fTypes; /**< Bitmask of possible DeviceType_T values (e.g. RT_BIT_32(DeviceType_Network)). */ 1080 DeviceType_T *paSubTypes; /**< Optionally, device types for each individual LED. Runs parallel to papLeds. */ 1081 } maLedSets[32]; 1077 /** Bitmask of possible DeviceType_T values (e.g. RT_BIT_32(DeviceType_Network)). */ 1078 uint32_t fTypes; 1079 /** Number of LEDs. */ 1080 uint32_t cLeds; 1081 /** Array of PDMLED pointers. The pointers in the array can be changed at any 1082 * time by Console::i_drvStatus_UnitChanged(). */ 1083 PPDMLED volatile *papLeds; 1084 /** Optionally, device types for each individual LED. Runs parallel to papLeds. */ 1085 DeviceType_T *paSubTypes; 1086 } maLedSets[32]; 1082 1087 /** @} */ 1083 1088 -
trunk/src/VBox/Main/src-client/ConsoleImpl.cpp
r98088 r98091 883 883 for (size_t idxSet = 0; idxSet < mcLedSets; idxSet++) 884 884 { 885 RTMemFree( maLedSets[idxSet].papLeds);885 RTMemFree((void *)maLedSets[idxSet].papLeds); 886 886 maLedSets[idxSet].papLeds = NULL; 887 887 maLedSets[idxSet].paSubTypes = NULL; … … 2862 2862 if (pLS->fTypes & fWanted) 2863 2863 { 2864 uint32_t const cLeds = pLS->cLeds;2865 PPDMLED const* const papSrcLeds = pLS->papLeds;2864 uint32_t const cLeds = pLS->cLeds; 2865 PPDMLED volatile * const papSrcLeds = pLS->papLeds; 2866 2866 2867 2867 /* Multi-type drivers (e.g. SCSI) have a subtype array which must be matched. */ … … 11515 11515 * @param iLedSet Index of LED set to fetch 11516 11516 */ 11517 PPDMLED *11517 PPDMLED volatile * 11518 11518 Console::i_getLedSet(uint32_t iLedSet) 11519 11519 { … … 11681 11681 PPDMILEDPORTS pLedPorts; 11682 11682 /** Pointer to the array of LED pointers. */ 11683 PPDMLED 11683 PPDMLED volatile *papLeds; 11684 11684 /** The unit number corresponding to the first entry in the LED array. */ 11685 11685 uint32_t iFirstLUN; … … 11697 11697 /** Pointer to the Console object, for driver triggered activities. */ 11698 11698 Console *pConsole; 11699 } DRVMAINSTATUS, *PDRVMAINSTATUS; 11699 } DRVMAINSTATUS; 11700 /** Pointer the instance data for a Main status driver. */ 11701 typedef DRVMAINSTATUS *PDRVMAINSTATUS; 11700 11702 11701 11703 … … 11714 11716 if (iLUN >= pThis->iFirstLUN && iLUN <= pThis->iLastLUN) 11715 11717 { 11718 /* 11719 * Query the pointer to the PDMLED field inside the target device 11720 * structure (owned by the virtual hardware device). 11721 */ 11716 11722 PPDMLED pLed; 11717 11723 int rc = pThis->pLedPorts->pfnQueryStatusLed(pThis->pLedPorts, iLUN, &pLed); 11718 /*11719 * pLed now points directly to the per-unit struct PDMLED field11720 * inside the target device struct owned by the hardware driver.11721 */11722 11724 if (RT_FAILURE(rc)) 11723 11725 pLed = NULL; 11724 ASMAtomicWritePtr(&pThis->papLeds[iLUN - pThis->iFirstLUN], pLed); 11726 11725 11727 /* 11728 * Update the corresponding papLeds[] entry. 11729 * 11726 11730 * papLeds[] points to the struct PDMLED of each of this driver's 11727 11731 * units. The entries are initialized here, called out of a loop … … 11733 11737 * src/VBox/Frontends/VirtualBox/src/runtime/UIIndicatorsPool.cpp 11734 11738 */ 11739 /** @todo acquire Console::mLedLock here in exclusive mode? */ 11740 ASMAtomicWritePtr(&pThis->papLeds[iLUN - pThis->iFirstLUN], pLed); 11735 11741 Log(("drvStatus_UnitChanged: iLUN=%d pLed=%p\n", iLUN, pLed)); 11736 11742 } -
trunk/src/VBox/Main/src-client/ConsoleImpl2.cpp
r98088 r98091 676 676 /* Preallocate the arrays we need, bunching them together. */ 677 677 AssertCompile((unsigned)DeviceType_Null == 0); 678 PPDMLED *papLeds = (PPDMLED *)RTMemAllocZ((sizeof(PPDMLED) + (ppaSubTypes ? sizeof(**ppaSubTypes) : 0)) * cLeds); 678 PPDMLED volatile *papLeds = (PPDMLED volatile *)RTMemAllocZ( (sizeof(PPDMLED) + (ppaSubTypes ? sizeof(**ppaSubTypes) : 0)) 679 * cLeds); 679 680 AssertStmt(papLeds, throw E_OUTOFMEMORY); 680 681 … … 701 702 } 702 703 703 RTMemFree( papLeds);704 RTMemFree((void *)papLeds); 704 705 AssertFailed(); 705 706 throw ConfigError("AllocateDriverPapLeds", VERR_OUT_OF_RANGE, "Too many LED sets"); … … 707 708 708 709 710 /** 711 * @throws ConfigError and std::bad_alloc. 712 */ 709 713 void Console::i_attachStatusDriver(PCFGMNODE pCtlInst, uint32_t fTypes, uint32_t cLeds, DeviceType_T **ppaSubTypes, 710 714 Console::MediumAttachmentMap *pmapMediumAttachments, … … 731 735 732 736 737 /** 738 * @throws ConfigError and std::bad_alloc. 739 */ 733 740 void Console::i_attachStatusDriver(PCFGMNODE pCtlInst, DeviceType_T enmType) 734 741 { … … 4880 4887 LONG lPort; 4881 4888 hrc = pMediumAtt->COMGETTER(Port)(&lPort); H(); 4882 DeviceType_T lType;4883 hrc = pMediumAtt->COMGETTER(Type)(& lType);H();4889 DeviceType_T enmType; 4890 hrc = pMediumAtt->COMGETTER(Type)(&enmType); H(); 4884 4891 BOOL fNonRotational; 4885 4892 hrc = pMediumAtt->COMGETTER(NonRotational)(&fNonRotational); H(); … … 4887 4894 hrc = pMediumAtt->COMGETTER(Discard)(&fDiscard); H(); 4888 4895 4889 if ( lType == DeviceType_DVD)4896 if (enmType == DeviceType_DVD) 4890 4897 fInsertDiskIntegrityDrv = false; 4891 4898 … … 4948 4955 4949 4956 vrc = i_removeMediumDriverFromVm(pCtlInst, pcszDevice, uInstance, uLUN, enmBus, fAttachDetach, 4950 fHotplug, fForceUnmount, pUVM, pVMM, lType, &pLunL0);4957 fHotplug, fForceUnmount, pUVM, pVMM, enmType, &pLunL0); 4951 4958 if (RT_FAILURE(vrc)) 4952 4959 return vrc; … … 4965 4972 * taking an online snapshot! 4966 4973 */ 4967 if ( lType == DeviceType_HardDisk4974 if ( enmType == DeviceType_HardDisk 4968 4975 && ( aMachineState == MachineState_Starting 4969 4976 || aMachineState == MachineState_Restoring)) … … 4979 4986 BOOL fHostDrive; 4980 4987 hrc = ptrMedium->COMGETTER(HostDrive)(&fHostDrive); H(); 4981 if ( ( lType == DeviceType_DVD4982 || lType == DeviceType_Floppy)4988 if ( ( enmType == DeviceType_DVD 4989 || enmType == DeviceType_Floppy) 4983 4990 && !fHostDrive) 4984 4991 { … … 4992 4999 (void)RTFsQueryType(strFile.c_str(), &enmFsTypeFile); 4993 5000 LogRel(("File system of '%s' (%s) is %s\n", 4994 strFile.c_str(), lType == DeviceType_DVD ? "DVD" : "Floppy", RTFsTypeName(enmFsTypeFile)));5001 strFile.c_str(), enmType == DeviceType_DVD ? "DVD" : "Floppy", RTFsTypeName(enmFsTypeFile))); 4995 5002 } 4996 5003 … … 5016 5023 if ( (fHotplug || !fAttachDetach) 5017 5024 && ( (enmBus == StorageBus_SCSI || enmBus == StorageBus_SAS || enmBus == StorageBus_USB || enmBus == StorageBus_VirtioSCSI) 5018 || (enmBus == StorageBus_SATA && lType == DeviceType_DVD && !fPassthrough)))5025 || (enmBus == StorageBus_SATA && enmType == DeviceType_DVD && !fPassthrough))) 5019 5026 { 5020 5027 InsertConfigString(pLunL0, "Driver", "SCSI"); … … 5024 5031 vrc = i_configMedium(pLunL0, 5025 5032 !!fPassthrough, 5026 lType,5033 enmType, 5027 5034 fUseHostIOCache, 5028 5035 fBuiltinIOCache, … … 5060 5067 else if ( !fHotplug 5061 5068 && ( (enmBus == StorageBus_SAS || enmBus == StorageBus_SCSI || enmBus == StorageBus_VirtioSCSI) 5062 || (enmBus == StorageBus_SATA && lType == DeviceType_DVD)))5069 || (enmBus == StorageBus_SATA && enmType == DeviceType_DVD))) 5063 5070 vrc = pVMM->pfnPDMR3DriverAttach(pUVM, pcszDevice, uInstance, uLUN, 5064 5071 fHotplug ? 0 : PDM_TACH_FLAGS_NOT_HOT_PLUG, NULL /*ppBase*/); … … 5090 5097 5091 5098 if (paLedDevType) 5092 paLedDevType[uLUN] = lType;5099 paLedDevType[uLUN] = enmType; 5093 5100 5094 5101 /* Dump the changed LUN if possible, dump the complete device otherwise */
Note:
See TracChangeset
for help on using the changeset viewer.