Changeset 66058 in vbox
- Timestamp:
- Mar 13, 2017 11:53:11 AM (8 years ago)
- Location:
- trunk/src/VBox/Devices/Storage/VSCSI
- Files:
-
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Devices/Storage/VSCSI/VSCSIDevice.cpp
r65111 r66058 185 185 rcReq, pVScsiReq->cbXfer); 186 186 187 if (pVScsiReq->pvLun) 188 { 189 if (vscsiDeviceLunIsPresent(pVScsiDevice, pVScsiReq->iLun)) 190 { 191 PVSCSILUNINT pVScsiLun = pVScsiDevice->papVScsiLun[pVScsiReq->iLun]; 192 pVScsiLun->pVScsiLunDesc->pfnVScsiLunReqFree(pVScsiLun, pVScsiReq, pVScsiReq->pvLun); 193 } 194 else 195 AssertLogRelMsgFailed(("vscsiDeviceReqComplete: LUN %u for VSCSI request %#p is not present but there is LUN specific data allocated\n", 196 pVScsiReq->iLun, pVScsiReq)); 197 198 pVScsiReq->pvLun = NULL; 199 } 200 187 201 RTMemCacheFree(pVScsiDevice->hCacheReq, pVScsiReq); 188 202 } … … 396 410 pVScsiReq->pvVScsiReqUser = pvVScsiReqUser; 397 411 pVScsiReq->cbXfer = 0; 412 pVScsiReq->pvLun = NULL; 398 413 RTSgBufInit(&pVScsiReq->SgBuf, paSGList, cSGListEntries); 399 414 -
trunk/src/VBox/Devices/Storage/VSCSI/VSCSIInternal.h
r65111 r66058 121 121 /** Transfer size determined from the CDB. */ 122 122 size_t cbXfer; 123 /** Pointer to the opaque data which may be allocated by the LUN 124 * the request is for. */ 125 void *pvLun; 123 126 } VSCSIREQINT; 124 127 … … 265 268 266 269 /** 270 * Frees additional allocated resources for the given request if it was allocated before. 271 * 272 * @returns void. 273 * @param pVScsiLun The SCSI LUN instance. 274 * @param pVScsiReq The SCSI request. 275 * @param pvScsiReqLun The opaque data allocated previously. 276 */ 277 DECLR3CALLBACKMEMBER(void, pfnVScsiLunReqFree, (PVSCSILUNINT pVScsiLun, PVSCSIREQINT pVScsiReq, 278 void *pvScsiReqLun)); 279 280 /** 267 281 * Informs about a medium being inserted - optional. 268 282 * … … 424 438 425 439 /** 440 * Enqueue a new data transfer request - extended variant. 441 * 442 * @returns VBox status code. 443 * @param pVScsiLun The LUN instance which issued the request. 444 * @param pVScsiReq The virtual SCSI request associated with the transfer. 445 * @param enmTxDir Transfer direction. 446 * @param uOffset Start offset of the transfer. 447 * @param paSegs Pointer to the array holding the memory buffer segments. 448 * @param cSegs Number of segments in the array. 449 * @param cbTransfer Number of bytes to transfer. 450 */ 451 int vscsiIoReqTransferEnqueueEx(PVSCSILUNINT pVScsiLun, PVSCSIREQINT pVScsiReq, 452 VSCSIIOREQTXDIR enmTxDir, uint64_t uOffset, 453 PCRTSGSEG paSegs, unsigned cSegs, size_t cbTransfer); 454 455 /** 426 456 * Enqueue a new unmap request. 427 457 * -
trunk/src/VBox/Devices/Storage/VSCSI/VSCSIIoReq.cpp
r63994 r66058 92 92 93 93 94 int vscsiIoReqTransferEnqueueEx(PVSCSILUNINT pVScsiLun, PVSCSIREQINT pVScsiReq, 95 VSCSIIOREQTXDIR enmTxDir, uint64_t uOffset, 96 PCRTSGSEG paSegs, unsigned cSegs, size_t cbTransfer) 97 { 98 int rc = VINF_SUCCESS; 99 PVSCSIIOREQINT pVScsiIoReq = NULL; 100 101 LogFlowFunc(("pVScsiLun=%#p pVScsiReq=%#p enmTxDir=%u uOffset=%llu cbTransfer=%u\n", 102 pVScsiLun, pVScsiReq, enmTxDir, uOffset, cbTransfer)); 103 104 rc = vscsiLunReqAlloc(pVScsiLun, (uintptr_t)pVScsiReq, &pVScsiIoReq); 105 if (RT_SUCCESS(rc)) 106 { 107 pVScsiIoReq->pVScsiReq = pVScsiReq; 108 pVScsiIoReq->pVScsiLun = pVScsiLun; 109 pVScsiIoReq->enmTxDir = enmTxDir; 110 pVScsiIoReq->u.Io.uOffset = uOffset; 111 pVScsiIoReq->u.Io.cbTransfer = cbTransfer; 112 pVScsiIoReq->u.Io.paSeg = paSegs; 113 pVScsiIoReq->u.Io.cSeg = cSegs; 114 115 ASMAtomicIncU32(&pVScsiLun->IoReq.cReqOutstanding); 116 117 rc = vscsiLunReqTransferEnqueue(pVScsiLun, pVScsiIoReq); 118 if (RT_FAILURE(rc)) 119 { 120 ASMAtomicDecU32(&pVScsiLun->IoReq.cReqOutstanding); 121 vscsiLunReqFree(pVScsiLun, pVScsiIoReq); 122 } 123 } 124 125 return rc; 126 } 127 128 94 129 int vscsiIoReqUnmapEnqueue(PVSCSILUNINT pVScsiLun, PVSCSIREQINT pVScsiReq, 95 130 PRTRANGE paRanges, unsigned cRanges) -
trunk/src/VBox/Devices/Storage/VSCSI/VSCSILunMmc.cpp
r65648 r66058 1338 1338 /** pfnVScsiLunReqProcess */ 1339 1339 vscsiLunMmcReqProcess, 1340 /** pfnVScsiLunReqFree */ 1341 NULL, 1340 1342 /** pfnVScsiLunMediumInserted */ 1341 1343 vscsiLunMmcMediumInserted, -
trunk/src/VBox/Devices/Storage/VSCSI/VSCSILunSbc.cpp
r65648 r66058 616 616 /** pfnVScsiLunReqProcess */ 617 617 vscsiLunSbcReqProcess, 618 /** pfnVScsiLunReqFree */ 619 NULL, 618 620 /** pfnVScsiLunMediumInserted */ 619 621 NULL,
Note:
See TracChangeset
for help on using the changeset viewer.