Changeset 43517 in vbox for trunk/src/VBox
- Timestamp:
- Oct 2, 2012 4:34:27 PM (12 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Devices/Storage/DrvSCSI.cpp
r40282 r43517 71 71 /** The optional block async port interface. */ 72 72 PDMIBLOCKASYNCPORT IPortAsync; 73 #if 0 /* these interfaces aren't implemented */74 73 /** The mount notify interface. */ 75 74 PDMIMOUNTNOTIFY IMountNotify; 76 #endif77 75 /** Fallback status LED state for this drive. 78 76 * This is used in case the device doesn't has a LED interface. */ … … 115 113 /** Converts a pointer to DRVSCSI::IPortAsync to a PDRVSCSI. */ 116 114 #define PDMIBLOCKASYNCPORT_2_DRVSCSI(pInterface) ( (PDRVSCSI)((uintptr_t)pInterface - RT_OFFSETOF(DRVSCSI, IPortAsync)) ) 115 /** Converts a pointer to DRVSCSI::IMountNotify to PDRVSCSI. */ 116 #define PDMIMOUNTNOTIFY_2_DRVSCSI(pInterface) ( (PDRVSCSI)((uintptr_t)pInterface - RT_OFFSETOF(DRVSCSI, IMountNotify)) ) 117 117 /** Converts a pointer to DRVSCSI::IPort to a PDRVSCSI. */ 118 118 #define PDMIBLOCKPORT_2_DRVSCSI(pInterface) ( (PDRVSCSI)((uintptr_t)pInterface - RT_OFFSETOF(DRVSCSI, IPort)) ) … … 636 636 PDRVSCSI pThis = PDMINS_2_DATA(pDrvIns, PDRVSCSI); 637 637 638 PDMIBASE_RETURN_INTERFACE(pszIID, PDMIMOUNT, pThis->pDrvMount); 638 639 PDMIBASE_RETURN_INTERFACE(pszIID, PDMIBASE, &pDrvIns->IBase); 639 640 PDMIBASE_RETURN_INTERFACE(pszIID, PDMISCSICONNECTOR, &pThis->ISCSIConnector); 640 641 PDMIBASE_RETURN_INTERFACE(pszIID, PDMIBLOCKPORT, &pThis->IPort); 642 PDMIBASE_RETURN_INTERFACE(pszIID, PDMIMOUNTNOTIFY, &pThis->IMountNotify); 641 643 PDMIBASE_RETURN_INTERFACE(pszIID, PDMIBLOCKASYNCPORT, &pThis->IPortAsync); 642 644 return NULL; … … 650 652 return pThis->pDevScsiPort->pfnQueryDeviceLocation(pThis->pDevScsiPort, ppcszController, 651 653 piInstance, piLUN); 654 } 655 656 /** 657 * Called when media is mounted. 658 * 659 * @param pInterface Pointer to the interface structure containing the called function pointer. 660 */ 661 static DECLCALLBACK(void) drvscsiMountNotify(PPDMIMOUNTNOTIFY pInterface) 662 { 663 PDRVSCSI pThis = PDMIMOUNTNOTIFY_2_DRVSCSI(pInterface); 664 LogFlowFunc(("mounting LUN#%p\n", pThis->hVScsiLun)); 665 666 /* Ignore the call if we're called while being attached. */ 667 if (!pThis->pDrvBlock) 668 return; 669 670 //@todo: Notify of media change? Update media size? 671 } 672 673 /** 674 * Called when media is unmounted 675 * 676 * @param pInterface Pointer to the interface structure containing the called function pointer. 677 */ 678 static DECLCALLBACK(void) drvscsiUnmountNotify(PPDMIMOUNTNOTIFY pInterface) 679 { 680 PDRVSCSI pThis = PDMIMOUNTNOTIFY_2_DRVSCSI(pInterface); 681 LogFlowFunc(("unmounting LUN#%p\n", pThis->hVScsiLun)); 682 683 //@todo: Notify of media change? Report that no media is present? 652 684 } 653 685 … … 832 864 pDrvIns->IBase.pfnQueryInterface = drvscsiQueryInterface; 833 865 866 pThis->IMountNotify.pfnMountNotify = drvscsiMountNotify; 867 pThis->IMountNotify.pfnUnmountNotify = drvscsiUnmountNotify; 834 868 pThis->IPort.pfnQueryDeviceLocation = drvscsiQueryDeviceLocation; 835 869 pThis->IPortAsync.pfnTransferCompleteNotify = drvscsiTransferCompleteNotify; … … 897 931 898 932 PDMBLOCKTYPE enmType = pThis->pDrvBlock->pfnGetType(pThis->pDrvBlock); 899 if (enmType != PDMBLOCKTYPE_HARD_DISK) 933 VSCSILUNTYPE enmLunType; 934 switch (enmType) 935 { 936 case PDMBLOCKTYPE_HARD_DISK: 937 enmLunType = VSCSILUNTYPE_SBC; 938 break; 939 case PDMBLOCKTYPE_CDROM: 940 case PDMBLOCKTYPE_DVD: 941 enmLunType = VSCSILUNTYPE_MMC; 942 break; 943 default: 900 944 return PDMDrvHlpVMSetError(pDrvIns, VERR_PDM_UNSUPPORTED_BLOCK_TYPE, RT_SRC_POS, 901 N_("Only hard disks a re currently supported as SCSI devices (enmType=%d)"),945 N_("Only hard disks and CD/DVD-ROMs are currently supported as SCSI devices (enmType=%d)"), 902 946 enmType); 947 } 948 if ( ( enmType == PDMBLOCKTYPE_DVD 949 || enmType == PDMBLOCKTYPE_CDROM) 950 && !pThis->pDrvMount) 951 { 952 AssertMsgFailed(("Internal error: cdrom without a mountable interface\n")); 953 return VERR_INTERNAL_ERROR; 954 } 903 955 904 956 /* Create VSCSI device and LUN. */ … … 909 961 rc = VSCSIDeviceCreate(&pThis->hVScsiDevice, drvscsiVScsiReqCompleted, pThis); 910 962 AssertMsgReturn(RT_SUCCESS(rc), ("Failed to create VSCSI device rc=%Rrc\n"), rc); 911 rc = VSCSILunCreate(&pThis->hVScsiLun, VSCSILUNTYPE_SBC, &pThis->VScsiIoCallbacks,963 rc = VSCSILunCreate(&pThis->hVScsiLun, enmLunType, &pThis->VScsiIoCallbacks, 912 964 pThis); 913 965 AssertMsgReturn(RT_SUCCESS(rc), ("Failed to create VSCSI LUN rc=%Rrc\n"), rc);
Note:
See TracChangeset
for help on using the changeset viewer.