Changeset 45061 in vbox for trunk/src/VBox/Devices/Storage
- Timestamp:
- Mar 18, 2013 2:09:03 PM (12 years ago)
- Location:
- trunk/src/VBox/Devices/Storage
- Files:
-
- 7 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Devices/Storage/DrvHostBase.cpp
r44528 r45061 1878 1878 pThis->enmType = enmType; 1879 1879 //pThis->cErrors = 0; 1880 pThis->fAttachFailError = true; /* It's an error until we've read the config. */ 1880 1881 1881 1882 pThis->pfnGetMediaSize = drvHostBaseGetMediaSize; -
trunk/src/VBox/Devices/Storage/DrvHostDVD.cpp
r40282 r45061 759 759 760 760 /* 761 * Validate configuration.762 */763 if (!CFGMR3AreValuesValid(pCfg, "Path\0Interval\0Locked\0BIOSVisible\0AttachFailError\0Passthrough\0"))764 return VERR_PDM_DRVINS_UNKNOWN_CFG_VALUES;765 766 767 /*768 761 * Init instance data. 769 762 */ … … 772 765 { 773 766 /* 774 * Override stuff.767 * Validate configuration. 775 768 */ 769 if (CFGMR3AreValuesValid(pCfg, "Path\0Interval\0Locked\0BIOSVisible\0AttachFailError\0Passthrough\0")) 770 { 771 /* 772 * Override stuff. 773 */ 776 774 #ifdef RT_OS_LINUX 777 pThis->pbDoubleBuffer = (uint8_t *)RTMemAlloc(SCSI_MAX_BUFFER_SIZE);778 if (!pThis->pbDoubleBuffer)779 return VERR_NO_MEMORY;775 pThis->pbDoubleBuffer = (uint8_t *)RTMemAlloc(SCSI_MAX_BUFFER_SIZE); 776 if (!pThis->pbDoubleBuffer) 777 return VERR_NO_MEMORY; 780 778 #endif 781 779 782 780 #ifndef RT_OS_L4 /* Passthrough is not supported on L4 yet */ 783 bool fPassthrough; 784 rc = CFGMR3QueryBool(pCfg, "Passthrough", &fPassthrough); 785 if (RT_SUCCESS(rc) && fPassthrough) 781 bool fPassthrough; 782 rc = CFGMR3QueryBool(pCfg, "Passthrough", &fPassthrough); 783 if (RT_SUCCESS(rc) && fPassthrough) 784 { 785 pThis->IBlock.pfnSendCmd = drvHostDvdSendCmd; 786 /* Passthrough requires opening the device in R/W mode. */ 787 pThis->fReadOnlyConfig = false; 788 # ifdef VBOX_WITH_SUID_WRAPPER /* Solaris setuid for Passthrough mode. */ 789 rc = solarisCheckUserAuth(); 790 if (RT_FAILURE(rc)) 791 { 792 Log(("DVD: solarisCheckUserAuth failed. Permission denied!\n")); 793 return rc; 794 } 795 # endif /* VBOX_WITH_SUID_WRAPPER */ 796 } 797 #endif /* !RT_OS_L4 */ 798 799 pThis->IMount.pfnUnmount = drvHostDvdUnmount; 800 pThis->pfnDoLock = drvHostDvdDoLock; 801 #ifdef USE_MEDIA_POLLING 802 if (!fPassthrough) 803 pThis->pfnPoll = drvHostDvdPoll; 804 else 805 pThis->pfnPoll = NULL; 806 #endif 807 #ifdef RT_OS_LINUX 808 pThis->pfnGetMediaSize = drvHostDvdGetMediaSize; 809 #endif 810 811 /* 812 * 2nd init part. 813 */ 814 rc = DRVHostBaseInitFinish(pThis); 815 } 816 else 786 817 { 787 pThis->IBlock.pfnSendCmd = drvHostDvdSendCmd; 788 /* Passthrough requires opening the device in R/W mode. */ 789 pThis->fReadOnlyConfig = false; 790 # ifdef VBOX_WITH_SUID_WRAPPER /* Solaris setuid for Passthrough mode. */ 791 rc = solarisCheckUserAuth(); 792 if (RT_FAILURE(rc)) 793 { 794 Log(("DVD: solarisCheckUserAuth failed. Permission denied!\n")); 795 return rc; 796 } 797 # endif /* VBOX_WITH_SUID_WRAPPER */ 818 pThis->fAttachFailError = true; 819 rc = VERR_PDM_DRVINS_UNKNOWN_CFG_VALUES; 798 820 } 799 #endif /* !RT_OS_L4 */800 801 pThis->IMount.pfnUnmount = drvHostDvdUnmount;802 pThis->pfnDoLock = drvHostDvdDoLock;803 #ifdef USE_MEDIA_POLLING804 if (!fPassthrough)805 pThis->pfnPoll = drvHostDvdPoll;806 else807 pThis->pfnPoll = NULL;808 #endif809 #ifdef RT_OS_LINUX810 pThis->pfnGetMediaSize = drvHostDvdGetMediaSize;811 #endif812 813 /*814 * 2nd init part.815 */816 rc = DRVHostBaseInitFinish(pThis);817 821 } 818 822 if (RT_FAILURE(rc)) -
trunk/src/VBox/Devices/Storage/DrvHostFloppy.cpp
r44528 r45061 185 185 186 186 /* 187 * Validate configuration.188 */189 if (!CFGMR3AreValuesValid(pCfg, "Path\0ReadOnly\0Interval\0Locked\0BIOSVisible\0"))190 return VERR_PDM_DRVINS_UNKNOWN_CFG_VALUES;191 192 /*193 187 * Init instance data. 194 188 */ … … 197 191 { 198 192 /* 199 * Override stuff.193 * Validate configuration. 200 194 */ 195 if (CFGMR3AreValuesValid(pCfg, "Path\0ReadOnly\0Interval\0Locked\0BIOSVisible\0")) 196 { 197 /* 198 * Override stuff. 199 */ 201 200 #ifdef RT_OS_WINDOWS 202 pThis->Base.pfnGetMediaSize = drvHostFloppyGetMediaSize;201 pThis->Base.pfnGetMediaSize = drvHostFloppyGetMediaSize; 203 202 #endif 204 203 #ifdef RT_OS_LINUX 205 pThis->Base.pfnPoll = drvHostFloppyPoll;206 pThis->Base.pfnGetMediaSize = drvHostFloppyGetMediaSize;204 pThis->Base.pfnPoll = drvHostFloppyPoll; 205 pThis->Base.pfnGetMediaSize = drvHostFloppyGetMediaSize; 207 206 #endif 208 207 209 /* 210 * 2nd init part. 211 */ 212 rc = DRVHostBaseInitFinish(&pThis->Base); 208 /* 209 * 2nd init part. 210 */ 211 rc = DRVHostBaseInitFinish(&pThis->Base); 212 } 213 else 214 { 215 pThis->fAttachFailError = true; 216 rc = VERR_PDM_DRVINS_UNKNOWN_CFG_VALUES; 217 } 213 218 } 214 219 if (RT_FAILURE(rc)) -
trunk/src/VBox/Devices/Storage/DrvMediaISO.cpp
r44528 r45061 197 197 PDMDRV_CHECK_VERSIONS_RETURN_VOID(pDrvIns); 198 198 199 RTFileClose(pThis->hFile); 200 pThis->hFile = NIL_RTFILE; 199 if (pThis->hFile != NIL_RTFILE) 200 { 201 RTFileClose(pThis->hFile); 202 pThis->hFile = NIL_RTFILE; 203 } 201 204 202 205 if (pThis->pszFilename) -
trunk/src/VBox/Devices/Storage/DrvRawImage.cpp
r44528 r45061 235 235 PDMDRV_CHECK_VERSIONS_RETURN_VOID(pDrvIns); 236 236 237 RTFileClose(pThis->hFile); 238 pThis->hFile = NIL_RTFILE; 237 if (pThis->hFile != NIL_RTFILE) 238 { 239 RTFileClose(pThis->hFile); 240 pThis->hFile = NIL_RTFILE; 241 } 239 242 240 243 if (pThis->pszFilename) -
trunk/src/VBox/Devices/Storage/DrvSCSI.cpp
r44889 r45061 847 847 848 848 /* Free the VSCSI device and LUN handle. */ 849 VSCSILUN hVScsiLun; 850 int rc = VSCSIDeviceLunDetach(pThis->hVScsiDevice, 0, &hVScsiLun); 851 AssertRC(rc); 852 853 Assert(hVScsiLun == pThis->hVScsiLun); 854 rc = VSCSILunDestroy(hVScsiLun); 855 AssertRC(rc); 856 rc = VSCSIDeviceDestroy(pThis->hVScsiDevice); 857 AssertRC(rc); 849 if (pThis->hVScsiDevice) 850 { 851 VSCSILUN hVScsiLun; 852 int rc = VSCSIDeviceLunDetach(pThis->hVScsiDevice, 0, &hVScsiLun); 853 AssertRC(rc); 854 855 Assert(hVScsiLun == pThis->hVScsiLun); 856 rc = VSCSILunDestroy(hVScsiLun); 857 AssertRC(rc); 858 rc = VSCSIDeviceDestroy(pThis->hVScsiDevice); 859 AssertRC(rc); 860 861 pThis->hVScsiDevice = NULL; 862 pThis->hVScsiLun = NULL; 863 } 858 864 } 859 865 … … 868 874 PDRVSCSI pThis = PDMINS_2_DATA(pDrvIns, PDRVSCSI); 869 875 LogFlowFunc(("pDrvIns=%#p pCfg=%#p\n", pDrvIns, pCfg)); 870 LogRelFunc(("pDrvIns=%#p pCfg=%#p\n", pDrvIns, pCfg));871 876 PDMDRV_CHECK_VERSIONS_RETURN(pDrvIns); 872 877 -
trunk/src/VBox/Devices/Storage/DrvVD.cpp
r44358 r45061 2069 2069 static DECLCALLBACK(void) drvvdDestruct(PPDMDRVINS pDrvIns) 2070 2070 { 2071 PDMDRV_CHECK_VERSIONS_RETURN_VOID(pDrvIns); 2071 2072 PVBOXDISK pThis = PDMINS_2_DATA(pDrvIns, PVBOXDISK); 2072 2073 LogFlowFunc(("\n")); 2073 PDMDRV_CHECK_VERSIONS_RETURN_VOID(pDrvIns);2074 2074 2075 2075 RTSEMFASTMUTEX mutex; … … 2088 2088 } 2089 2089 2090 if ( VALID_PTR(pThis->pBlkCache))2090 if (RT_VALID_PTR(pThis->pBlkCache)) 2091 2091 { 2092 2092 PDMR3BlkCacheRelease(pThis->pBlkCache); … … 2094 2094 } 2095 2095 2096 if ( VALID_PTR(pThis->pDisk))2096 if (RT_VALID_PTR(pThis->pDisk)) 2097 2097 { 2098 2098 VDDestroy(pThis->pDisk); … … 2108 2108 } 2109 2109 if (pThis->pbData) 2110 { 2110 2111 RTMemFree(pThis->pbData); 2112 pThis->pbData = NULL; 2113 } 2111 2114 if (pThis->pszBwGroup) 2112 2115 { … … 2121 2124 * @copydoc FNPDMDRVCONSTRUCT 2122 2125 */ 2123 static DECLCALLBACK(int) drvvdConstruct(PPDMDRVINS pDrvIns, 2124 PCFGMNODE pCfg, 2125 uint32_t fFlags) 2126 static DECLCALLBACK(int) drvvdConstruct(PPDMDRVINS pDrvIns, PCFGMNODE pCfg, uint32_t fFlags) 2126 2127 { 2127 2128 LogFlowFunc(("\n")); 2129 PDMDRV_CHECK_VERSIONS_RETURN(pDrvIns); 2128 2130 PVBOXDISK pThis = PDMINS_2_DATA(pDrvIns, PVBOXDISK); 2129 2131 int rc = VINF_SUCCESS; … … 2135 2137 bool fMaybeReadOnly; /**< True if the media may or may not be read-only. */ 2136 2138 bool fHonorZeroWrites; /**< True if zero blocks should be written. */ 2137 PDMDRV_CHECK_VERSIONS_RETURN(pDrvIns);2138 2139 2139 2140 /* … … 2148 2149 pThis->fMergePending = false; 2149 2150 pThis->MergeCompleteMutex = NIL_RTSEMFASTMUTEX; 2151 pThis->MergeLock = NIL_RTSEMRW; 2150 2152 pThis->uMergeSource = VD_LAST_IMAGE; 2151 2153 pThis->uMergeTarget = VD_LAST_IMAGE; … … 2739 2741 /* Open the cache image if set. */ 2740 2742 if ( RT_SUCCESS(rc) 2741 && VALID_PTR(pszCachePath))2743 && RT_VALID_PTR(pszCachePath)) 2742 2744 { 2743 2745 /* Insert the custom I/O interface only if we're told to use new IO. … … 2772 2774 } 2773 2775 2774 if ( VALID_PTR(pszCachePath))2776 if (RT_VALID_PTR(pszCachePath)) 2775 2777 MMR3HeapFree(pszCachePath); 2776 if ( VALID_PTR(pszCacheFormat))2778 if (RT_VALID_PTR(pszCacheFormat)) 2777 2779 MMR3HeapFree(pszCacheFormat); 2778 2780 … … 2866 2868 if (RT_FAILURE(rc)) 2867 2869 { 2868 if ( VALID_PTR(pszName))2870 if (RT_VALID_PTR(pszName)) 2869 2871 MMR3HeapFree(pszName); 2870 if ( VALID_PTR(pszFormat))2872 if (RT_VALID_PTR(pszFormat)) 2871 2873 MMR3HeapFree(pszFormat); 2872 2874 /* drvvdDestruct does the rest. */
Note:
See TracChangeset
for help on using the changeset viewer.