Changeset 98123 in vbox for trunk/src/VBox/Main/src-client
- Timestamp:
- Jan 19, 2023 12:04:47 AM (2 years ago)
- svn:sync-xref-src-repo-rev:
- 155292
- Location:
- trunk/src/VBox/Main/src-client
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Main/src-client/ConsoleImpl.cpp
r98103 r98123 4128 4128 bool fSilent) 4129 4129 { 4130 Log FlowFunc(("pThis=%p uInstance=%u pszDevice=%p:{%s} enmBus=%u, pMediumAtt=%p\n",4130 LogRelFlowFunc(("pThis=%p uInstance=%u pszDevice=%p:{%s} enmBus=%u, pMediumAtt=%p\n", 4131 4131 pThis, uInstance, pcszDevice, pcszDevice, enmBus, pMediumAtt)); 4132 4132 … … 4143 4143 4144 4144 /* Determine the base path for the device instance. */ 4145 PCFGMNODE pCtlInst; 4146 pCtlInst = pVMM->pfnCFGMR3GetChildF(pVMM->pfnCFGMR3GetRootU(pUVM), "Devices/%s/%u/", pcszDevice, uInstance); 4145 PCFGMNODE pCtlInst = pVMM->pfnCFGMR3GetChildF(pVMM->pfnCFGMR3GetRootU(pUVM), "Devices/%s/%u/", pcszDevice, uInstance); 4147 4146 AssertReturn(pCtlInst || enmBus == StorageBus_USB, VERR_INTERNAL_ERROR); 4148 4147 … … 4150 4149 4151 4150 HRESULT hrc; 4152 int rc = VINF_SUCCESS; 4153 int rcRet = VINF_SUCCESS; 4151 int vrc = VINF_SUCCESS; 4152 LONG lDev; 4153 hrc = pMediumAtt->COMGETTER(Device)(&lDev); H(); 4154 LONG lPort; 4155 hrc = pMediumAtt->COMGETTER(Port)(&lPort); H(); 4156 DeviceType_T lType; 4157 hrc = pMediumAtt->COMGETTER(Type)(&lType); H(); 4154 4158 unsigned uLUN; 4155 LONG lDev; 4156 LONG lPort; 4157 DeviceType_T lType; 4159 hrc = Console::i_storageBusPortDeviceToLun(enmBus, lPort, lDev, uLUN); H(); 4160 4161 #undef H 4162 4158 4163 PCFGMNODE pLunL0 = NULL; 4159 4160 hrc = pMediumAtt->COMGETTER(Device)(&lDev); H();4161 hrc = pMediumAtt->COMGETTER(Port)(&lPort); H();4162 hrc = pMediumAtt->COMGETTER(Type)(&lType); H();4163 hrc = Console::i_storageBusPortDeviceToLun(enmBus, lPort, lDev, uLUN); H();4164 4165 #undef H4166 4167 4164 if (enmBus != StorageBus_USB) 4168 4165 { … … 4172 4169 { 4173 4170 uint32_t fFlags = 0; 4174 4175 4171 if (fSilent) 4176 4172 fFlags |= PDM_TACH_FLAGS_NOT_HOT_PLUG; 4177 4173 4178 rc = pVMM->pfnPDMR3DeviceDetach(pUVM, pcszDevice, uInstance, uLUN, fFlags);4179 if ( rc == VERR_PDM_NO_DRIVER_ATTACHED_TO_LUN)4180 rc = VINF_SUCCESS;4181 Assert RCReturn(rc,rc);4174 vrc = pVMM->pfnPDMR3DeviceDetach(pUVM, pcszDevice, uInstance, uLUN, fFlags); 4175 if (vrc == VERR_PDM_NO_DRIVER_ATTACHED_TO_LUN) 4176 vrc = VINF_SUCCESS; 4177 AssertLogRelRCReturn(vrc, vrc); 4182 4178 pVMM->pfnCFGMR3RemoveNode(pLunL0); 4183 4179 4184 4180 Utf8StrFmt devicePath("%s/%u/LUN#%u", pcszDevice, uInstance, uLUN); 4185 4181 pThis->mapMediumAttachments.erase(devicePath); 4186 4187 4182 } 4188 4183 else 4189 Assert FailedReturn(VERR_INTERNAL_ERROR);4184 AssertLogRelFailedReturn(VERR_INTERNAL_ERROR); 4190 4185 4191 4186 pVMM->pfnCFGMR3Dump(pCtlInst); … … 4197 4192 USBStorageDeviceList::iterator it; 4198 4193 for (it = pThis->mUSBStorageDevices.begin(); it != pThis->mUSBStorageDevices.end(); ++it) 4199 {4200 4194 if (it->iPort == lPort) 4201 4195 break; 4202 } 4203 4204 AssertReturn(it != pThis->mUSBStorageDevices.end(), VERR_INTERNAL_ERROR); 4205 rc = pVMM->pfnPDMR3UsbDetachDevice(pUVM, &it->mUuid); 4206 AssertRCReturn(rc, rc); 4196 AssertLogRelReturn(it != pThis->mUSBStorageDevices.end(), VERR_INTERNAL_ERROR); 4197 4198 vrc = pVMM->pfnPDMR3UsbDetachDevice(pUVM, &it->mUuid); 4199 AssertLogRelRCReturn(vrc, vrc); 4207 4200 pThis->mUSBStorageDevices.erase(it); 4208 4201 } 4209 4202 #endif 4210 4203 4211 LogFlowFunc(("Returning %Rrc\n", rcRet));4212 return rcRet;4204 LogFlowFunc(("Returning VINF_SUCCESS\n")); 4205 return VINF_SUCCESS; 4213 4206 } 4214 4207 -
trunk/src/VBox/Main/src-client/ConsoleImpl2.cpp
r98103 r98123 4943 4943 pCtlInst = pVMM->pfnCFGMR3GetChildF(pVMM->pfnCFGMR3GetRootU(pUVM), "USB/%s/", pcszDevice); 4944 4944 else 4945 pCtlInst = pVMM->pfnCFGMR3CreateTree(pUVM); 4945 pCtlInst = pVMM->pfnCFGMR3CreateTree(pUVM); /** @todo r=bird: Leaked in error paths! */ 4946 4946 } 4947 4947 AssertReturn(pCtlInst, VERR_INTERNAL_ERROR); … … 4965 4965 uInstance = lPort; /* Overwrite uInstance with the correct one. */ 4966 4966 4967 /** @todo No LED after hotplugging. */ 4967 4968 if (!fHotplug && !fAttachDetach) 4968 4969 { 4969 4970 USBStorageDevice UsbMsd; 4970 4971 4971 UsbMsd.iPort = uInstance; 4972 4972 vrc = RTUuidCreate(&UsbMsd.mUuid); … … 4977 4977 mUSBStorageDevices.push_back(UsbMsd); 4978 4978 4979 /** @todo No LED after hotplugging. */ 4979 /** @todo This LED set is not freed if the device is unplugged. We could 4980 * keep the LED set index in the UsbMsd structure and clean it up in 4981 * i_detachStorageDevice. */ 4980 4982 /* Attach the status driver */ 4981 4983 i_attachStatusDriver(pCtlInst, RT_BIT_32(DeviceType_HardDisk), … … 5052 5054 */ 5053 5055 if ( (fHotplug || !fAttachDetach) 5054 && ( (enmBus == StorageBus_SCSI || enmBus == StorageBus_SAS || enmBus == StorageBus_USB || enmBus == StorageBus_VirtioSCSI) 5056 && ( enmBus == StorageBus_SCSI 5057 || enmBus == StorageBus_SAS 5058 || enmBus == StorageBus_USB 5059 || enmBus == StorageBus_VirtioSCSI 5055 5060 || (enmBus == StorageBus_SATA && enmType == DeviceType_DVD && !fPassthrough))) 5056 5061 {
Note:
See TracChangeset
for help on using the changeset viewer.