- Timestamp:
- Oct 6, 2016 3:19:48 PM (8 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Main/src-client/ConsoleImpl2.cpp
r64166 r64169 4058 4058 } 4059 4059 4060 /* For USB detach every driver below the SCSI transport driver. */ 4060 /* 4061 * Don't detach the SCSI driver when unmounting the current medium 4062 * (we are not ripping out the device but only eject the medium). 4063 */ 4064 char *pszDriverDetach = NULL; 4065 if ( !fHotplug 4066 && ( (enmBus == StorageBus_SATA && enmDevType == DeviceType_DVD) 4067 || enmBus == StorageBus_SAS 4068 || enmBus == StorageBus_SCSI 4069 || enmBus == StorageBus_USB)) 4070 { 4071 /* Get the current attached driver we have to detach. */ 4072 PCFGMNODE pDrvLun = CFGMR3GetChildF(pCtlInst, "LUN#%u/AttachedDriver/", uLUN); 4073 if (pDrvLun) 4074 { 4075 char szDriver[128]; 4076 RT_ZERO(szDriver); 4077 rc = CFGMR3QueryString(pDrvLun, "Driver", &szDriver[0], sizeof(szDriver)); 4078 if (RT_SUCCESS(rc)) 4079 pszDriverDetach = RTStrDup(&szDriver[0]); 4080 4081 pLunL0 = pDrvLun; 4082 } 4083 } 4084 4061 4085 if (enmBus == StorageBus_USB) 4062 rc = PDMR3UsbDriverDetach(pUVM, pcszDevice, uInstance, uLUN, "SCSI", 0, 4086 rc = PDMR3UsbDriverDetach(pUVM, pcszDevice, uInstance, uLUN, 4087 pszDriverDetach, 0 /* iOccurence */, 4063 4088 fHotplug ? 0 : PDM_TACH_FLAGS_NOT_HOT_PLUG); 4064 4089 else 4065 {4066 /*4067 * Don't detach the SCSI driver when unmounting the current medium4068 * (we are not ripping out the device but only eject the medium).4069 */4070 char *pszDriverDetach = NULL;4071 if ( !fHotplug4072 && ( (enmBus == StorageBus_SATA && enmDevType == DeviceType_DVD)4073 || enmBus == StorageBus_SAS4074 || enmBus == StorageBus_SCSI))4075 {4076 /* Get the current attached driver we have to detach. */4077 PCFGMNODE pDrvLun = CFGMR3GetChildF(pCtlInst, "LUN#%u/AttachedDriver/", uLUN);4078 if (pDrvLun)4079 {4080 char szDriver[128];4081 RT_ZERO(szDriver);4082 rc = CFGMR3QueryString(pDrvLun, "Driver", &szDriver[0], sizeof(szDriver));4083 if (RT_SUCCESS(rc))4084 pszDriverDetach = RTStrDup(&szDriver[0]);4085 4086 pLunL0 = pDrvLun;4087 }4088 }4089 4090 4090 rc = PDMR3DriverDetach(pUVM, pcszDevice, uInstance, uLUN, 4091 4091 pszDriverDetach, 0 /* iOccurence */, 4092 4092 fHotplug ? 0 : PDM_TACH_FLAGS_NOT_HOT_PLUG); 4093 if (pszDriverDetach) 4094 {4095 RTStrFree(pszDriverDetach);4096 /* Remove the complete node and create new for the new config. */4097 CFGMR3RemoveNode(pLunL0);4098 pLunL0 = CFGMR3GetChildF(pCtlInst, "LUN#%u", uLUN);4099 if (pLunL0)4100 {4101 try4102 {4103 InsertConfigNode(pLunL0, "AttachedDriver", &pLunL0);4104 }4105 catch (ConfigError &x)4106 {4107 // InsertConfig threw something:4108 return x.m_vrc;4109 }4093 4094 if (pszDriverDetach) 4095 { 4096 RTStrFree(pszDriverDetach); 4097 /* Remove the complete node and create new for the new config. */ 4098 CFGMR3RemoveNode(pLunL0); 4099 pLunL0 = CFGMR3GetChildF(pCtlInst, "LUN#%u", uLUN); 4100 if (pLunL0) 4101 { 4102 try 4103 { 4104 InsertConfigNode(pLunL0, "AttachedDriver", &pLunL0); 4105 } 4106 catch (ConfigError &x) 4107 { 4108 // InsertConfig threw something: 4109 return x.m_vrc; 4110 4110 } 4111 4111 }
Note:
See TracChangeset
for help on using the changeset viewer.