Changeset 65078 in vbox
- Timestamp:
- Jan 3, 2017 1:24:58 PM (8 years ago)
- Location:
- trunk
- Files:
-
- 8 edited
-
include/VBox/scsi.h (modified) (1 diff)
-
src/VBox/Devices/Storage/DrvHostBase-darwin.cpp (modified) (2 diffs)
-
src/VBox/Devices/Storage/DrvHostBase-freebsd.cpp (modified) (3 diffs)
-
src/VBox/Devices/Storage/DrvHostBase-linux.cpp (modified) (5 diffs)
-
src/VBox/Devices/Storage/DrvHostBase-solaris.cpp (modified) (2 diffs)
-
src/VBox/Devices/Storage/DrvHostBase-win.cpp (modified) (2 diffs)
-
src/VBox/Devices/Storage/DrvHostBase.h (modified) (1 diff)
-
src/VBox/Devices/Storage/DrvHostDVD.cpp (modified) (3 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/include/VBox/scsi.h
r65069 r65078 29 29 #include <iprt/assert.h> 30 30 31 /** 32 * @todo: Remove when the splitting code was removed from DevATA. 33 * The limit doesn't belong here but is specific for each host platform. 34 */ 31 35 #ifdef RT_OS_FREEBSD 32 36 /* The cam subsystem doesn't allow more */ -
trunk/src/VBox/Devices/Storage/DrvHostBase-darwin.cpp
r64316 r65078 26 26 #include <mach/mach_error.h> 27 27 #include <VBox/scsi.h> 28 29 /** Maximum buffer size we support, check whether darwin has some real upper limit. */ 30 #define DARWIN_SCSI_MAX_BUFFER_SIZE (100 * _1K) 28 31 29 32 /** … … 322 325 323 326 327 DECLHIDDEN(size_t) drvHostBaseScsiCmdGetBufLimitOs(PDRVHOSTBASE pThis) 328 { 329 RT_NOREF(pThis); 330 331 return DARWIN_SCSI_MAX_BUFFER_SIZE; 332 } 333 334 324 335 DECLHIDDEN(int) drvHostBaseGetMediaSizeOs(PDRVHOSTBASE pThis, uint64_t *pcb) 325 336 { -
trunk/src/VBox/Devices/Storage/DrvHostBase-freebsd.cpp
r64316 r65078 27 27 #include <iprt/log.h> 28 28 29 /** Maximum buffer size supported by the CAM subsystem. */ 30 #define FBSD_SCSI_MAX_BUFFER_SIZE (64 * _1K) 31 29 32 /** 30 33 * Host backend specific data. … … 149 152 150 153 154 DECLHIDDEN(size_t) drvHostBaseScsiCmdGetBufLimitOs(PDRVHOSTBASE pThis) 155 { 156 RT_NOREF(pThis); 157 158 return FBSD_SCSI_MAX_BUFFER_SIZE; 159 } 160 161 151 162 DECLHIDDEN(int) drvHostBaseGetMediaSizeOs(PDRVHOSTBASE pThis, uint64_t *pcb) 152 163 { … … 194 205 const uint32_t LBA = off / pThis->Os.cbBlock; 195 206 AssertReturn(!(off % pThis->Os.cbBlock), VERR_INVALID_PARAMETER); 196 uint32_t cbRead32 = cbRead > SCSI_MAX_BUFFER_SIZE197 ? SCSI_MAX_BUFFER_SIZE207 uint32_t cbRead32 = cbRead > FBSD_SCSI_MAX_BUFFER_SIZE 208 ? FBSD_SCSI_MAX_BUFFER_SIZE 198 209 : (uint32_t)cbRead; 199 210 const uint32_t cBlocks = cbRead32 / pThis->Os.cbBlock; -
trunk/src/VBox/Devices/Storage/DrvHostBase-linux.cpp
r64316 r65078 39 39 #include <VBox/scsi.h> 40 40 41 /** Maximum buffer size supported by the kernel interface. */ 42 #define LNX_SCSI_MAX_BUFFER_SIZE (100 * _1K) 43 41 44 /** 42 45 * Host backend specific data. … … 75 78 if(RT_UNLIKELY(!pThis->Os.pbDoubleBuffer)) 76 79 { 77 pThis->Os.pbDoubleBuffer = (uint8_t *)RTMemAlloc( SCSI_MAX_BUFFER_SIZE);80 pThis->Os.pbDoubleBuffer = (uint8_t *)RTMemAlloc(LNX_SCSI_MAX_BUFFER_SIZE); 78 81 if (!pThis->Os.pbDoubleBuffer) 79 82 return VERR_NO_MEMORY; … … 92 95 case PDMMEDIATXDIR_FROM_DEVICE: 93 96 Assert(*pcbBuf != 0); 94 Assert(*pcbBuf <= SCSI_MAX_BUFFER_SIZE);97 Assert(*pcbBuf <= LNX_SCSI_MAX_BUFFER_SIZE); 95 98 /* Make sure that the buffer is clear for commands reading 96 99 * data. The actually received data may be shorter than what … … 105 108 case PDMMEDIATXDIR_TO_DEVICE: 106 109 Assert(*pcbBuf != 0); 107 Assert(*pcbBuf <= SCSI_MAX_BUFFER_SIZE);110 Assert(*pcbBuf <= LNX_SCSI_MAX_BUFFER_SIZE); 108 111 memcpy(pThis->Os.pbDoubleBuffer, pvBuf, *pcbBuf); 109 112 direction = CGC_DATA_WRITE; … … 154 157 } 155 158 159 160 DECLHIDDEN(size_t) drvHostBaseScsiCmdGetBufLimitOs(PDRVHOSTBASE pThis) 161 { 162 RT_NOREF(pThis); 163 164 return LNX_SCSI_MAX_BUFFER_SIZE; 165 } 166 167 156 168 DECLHIDDEN(int) drvHostBaseGetMediaSizeOs(PDRVHOSTBASE pThis, uint64_t *pcb) 157 169 { -
trunk/src/VBox/Devices/Storage/DrvHostBase-solaris.cpp
r64317 r65078 33 33 34 34 #include <iprt/file.h> 35 36 /** Maximum buffer size we support, check whether darwin has some real upper limit. */ 37 #define SOL_SCSI_MAX_BUFFER_SIZE (100 * _1K) 35 38 36 39 /** … … 203 206 } 204 207 208 209 DECLHIDDEN(size_t) drvHostBaseScsiCmdGetBufLimitOs(PDRVHOSTBASE pThis) 210 { 211 RT_NOREF(pThis); 212 213 return SOL_SCSI_MAX_BUFFER_SIZE; 214 } 215 216 205 217 DECLHIDDEN(int) drvHostBaseGetMediaSizeOs(PDRVHOSTBASE pThis, uint64_t *pcb) 206 218 { -
trunk/src/VBox/Devices/Storage/DrvHostBase-win.cpp
r64318 r65078 80 80 #include <iprt/file.h> 81 81 #include <VBox/scsi.h> 82 83 /** Maximum buffer size we support, check whether darwin has some real upper limit. */ 84 #define SOL_SCSI_MAX_BUFFER_SIZE (100 * _1K) 82 85 83 86 /** … … 305 308 return rc; 306 309 } 310 311 312 DECLHIDDEN(size_t) drvHostBaseScsiCmdGetBufLimitOs(PDRVHOSTBASE pThis) 313 { 314 RT_NOREF(pThis); 315 316 return WIN_SCSI_MAX_BUFFER_SIZE; 317 } 318 307 319 308 320 DECLHIDDEN(int) drvHostBaseGetMediaSizeOs(PDRVHOSTBASE pThis, uint64_t *pcb) -
trunk/src/VBox/Devices/Storage/DrvHostBase.h
r64839 r65078 167 167 DECLHIDDEN(int) drvHostBaseScsiCmdOs(PDRVHOSTBASE pThis, const uint8_t *pbCmd, size_t cbCmd, PDMMEDIATXDIR enmTxDir, 168 168 void *pvBuf, uint32_t *pcbBuf, uint8_t *pbSense, size_t cbSense, uint32_t cTimeoutMillies); 169 DECLHIDDEN(size_t) drvHostBaseScsiCmdGetBufLimitOs(PDRVHOSTBASE pThis); 169 170 DECLHIDDEN(int) drvHostBaseGetMediaSizeOs(PDRVHOSTBASE pThis, uint64_t *pcb); 170 171 DECLHIDDEN(int) drvHostBaseReadOs(PDRVHOSTBASE pThis, uint64_t off, void *pvBuf, size_t cbRead); -
trunk/src/VBox/Devices/Storage/DrvHostDVD.cpp
r65061 r65078 555 555 size_t cbXfer = 0; 556 556 size_t cbSector = 0; 557 size_t cbScsiCmdBufLimit = drvHostBaseScsiCmdGetBufLimitOs(&pThis->Core); 557 558 bool fPassthrough = drvHostDvdParseCdb(pThis, pReq, pbCdb, cbCdb, cbBuf, 558 559 &enmXferDir, &cbXfer, &cbSector, pu8ScsiSts); … … 568 569 rc = drvHostBaseBufferRetain(&pThis->Core, pReq, cbXfer, enmXferDir == PDMMEDIATXDIR_TO_DEVICE, &pvBuf); 569 570 570 if (cbXfer > SCSI_MAX_BUFFER_SIZE)571 if (cbXfer > cbScsiCmdBufLimit) 571 572 { 572 573 /* Linux accepts commands with up to 100KB of data, but expects … … 610 611 for (uint32_t i = cSectors; i > 0; i -= cReqSectors) 611 612 { 612 if (i * cbSector > SCSI_MAX_BUFFER_SIZE)613 cReqSectors = SCSI_MAX_BUFFER_SIZE/ (uint32_t)cbSector;613 if (i * cbSector > cbScsiCmdBufLimit) 614 cReqSectors = cbScsiCmdBufLimit / (uint32_t)cbSector; 614 615 else 615 616 cReqSectors = i;
Note:
See TracChangeset
for help on using the changeset viewer.

