Changeset 15815 in vbox for trunk/src/VBox
- Timestamp:
- Jan 5, 2009 7:42:23 PM (16 years ago)
- Location:
- trunk/src/VBox/Devices/Storage
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Devices/Storage/DevATA.cpp
r15711 r15815 1789 1789 1790 1790 if (pProf) { STAM_PROFILE_ADV_START(pProf, b); } 1791 if (cbTransfer > 100 * _1K)1791 if (cbTransfer > SCSI_MAX_BUFFER_SIZE) 1792 1792 { 1793 1793 /* Linux accepts commands with up to 100KB of data, but expects … … 1836 1836 for (uint32_t i = cSectors; i > 0; i -= cReqSectors) 1837 1837 { 1838 if (i * s->cbATAPISector > 100 * _1K)1839 cReqSectors = (100 * _1K)/ s->cbATAPISector;1838 if (i * s->cbATAPISector > SCSI_MAX_BUFFER_SIZE) 1839 cReqSectors = SCSI_MAX_BUFFER_SIZE / s->cbATAPISector; 1840 1840 else 1841 1841 cReqSectors = i; -
trunk/src/VBox/Devices/Storage/DrvHostBase.h
r8155 r15815 131 131 #endif 132 132 133 #ifdef RT_OS_LINUX 134 /** Double buffer required for ioctl with the Linux kernel as long as we use 135 * remap_pfn_range() instead of vm_insert_page(). */ 136 void *pbDoubleBuffer; 137 #endif 138 133 139 134 140 /** -
trunk/src/VBox/Devices/Storage/DrvHostDVD.cpp
r15776 r15815 56 56 # include <errno.h> 57 57 # include <limits.h> 58 # include <iprt/mem.h> 58 59 # define USE_MEDIA_POLLING 59 60 … … 430 431 case PDMBLOCKTXDIR_FROM_DEVICE: 431 432 Assert(*pcbBuf != 0); 433 Assert(*pcbBuf <= SCSI_MAX_BUFFER_SIZE); 432 434 /* Make sure that the buffer is clear for commands reading 433 435 * data. The actually received data may be shorter than what … … 437 439 * security problems inside the guest OS, if users can issue 438 440 * commands to the CDROM device. */ 439 memset(p vBuf, '\0', *pcbBuf);441 memset(pThis->pbDoubleBuffer, '\0', *pcbBuf); 440 442 direction = CGC_DATA_READ; 441 443 break; 442 444 case PDMBLOCKTXDIR_TO_DEVICE: 443 445 Assert(*pcbBuf != 0); 446 Assert(*pcbBuf <= SCSI_MAX_BUFFER_SIZE); 447 memcpy(pThis->pbDoubleBuffer, pvBuf, *pcbBuf); 444 448 direction = CGC_DATA_WRITE; 445 449 break; … … 450 454 memset(&cgc, '\0', sizeof(cgc)); 451 455 memcpy(cgc.cmd, pbCmd, CDROM_PACKET_SIZE); 452 cgc.buffer = (unsigned char *)p vBuf;456 cgc.buffer = (unsigned char *)pThis->pbDoubleBuffer; 453 457 cgc.buflen = *pcbBuf; 454 458 cgc.stat = 0; … … 472 476 Log2(("%s: error status %d, rc=%Rrc\n", __FUNCTION__, cgc.stat, rc)); 473 477 } 478 } 479 switch (enmTxDir) 480 { 481 case PDMBLOCKTXDIR_FROM_DEVICE: 482 memcpy(pvBuf, pThis->pbDoubleBuffer, *pcbBuf); 483 break; 484 default: 485 ; 474 486 } 475 487 Log2(("%s: after ioctl: cgc.buflen=%d txlen=%d\n", __FUNCTION__, cgc.buflen, *pcbBuf)); … … 722 734 * Override stuff. 723 735 */ 736 #ifdef RT_OS_LINUX 737 pThis->pbDoubleBuffer = RTMemAlloc(SCSI_MAX_BUFFER_SIZE); 738 if (!pThis->pbDoubleBuffer) 739 return VERR_NO_MEMORY; 740 #endif 724 741 725 742 #ifndef RT_OS_L4 /* Passthrough is not supported on L4 yet */ … … 776 793 } 777 794 795 /** @copydoc FNPDMDRVDESTRUCT */ 796 DECLCALLBACK(void) drvHostDvdDestruct(PPDMDRVINS pDrvIns) 797 { 798 #ifdef RT_OS_LINUX 799 PDRVHOSTBASE pThis = PDMINS_2_DATA(pDrvIns, PDRVHOSTBASE); 800 801 if (pThis->pbDoubleBuffer) 802 { 803 RTMemFree(pThis->pbDoubleBuffer); 804 pThis->pbDoubleBuffer = NULL; 805 } 806 #endif 807 return DRVHostBaseDestruct(pDrvIns); 808 } 778 809 779 810 /** … … 799 830 drvHostDvdConstruct, 800 831 /* pfnDestruct */ 801 DRVHostBaseDestruct,832 drvHostDvdDestruct, 802 833 /* pfnIOCtl */ 803 834 NULL,
Note:
See TracChangeset
for help on using the changeset viewer.