Author: cgutman
Date: Thu Nov 24 00:07:15 2011
New Revision: 54484
URL:
http://svn.reactos.org/svn/reactos?rev=54484&view=rev
Log:
[SCSIPORT]
- Implement ScsiPortGetLogicalUnit
Modified:
trunk/reactos/drivers/storage/scsiport/scsiport.c
Modified: trunk/reactos/drivers/storage/scsiport/scsiport.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/drivers/storage/scsiport/s…
==============================================================================
--- trunk/reactos/drivers/storage/scsiport/scsiport.c [iso-8859-1] (original)
+++ trunk/reactos/drivers/storage/scsiport/scsiport.c [iso-8859-1] Thu Nov 24 00:07:15
2011
@@ -580,37 +580,35 @@
IN UCHAR TargetId,
IN UCHAR Lun)
{
- UNIMPLEMENTED;
-#if 0
- PSCSI_PORT_DEVICE_EXTENSION DeviceExtension;
- PSCSI_PORT_LUN_EXTENSION LunExtension;
- PLIST_ENTRY Entry;
-
- DPRINT("ScsiPortGetLogicalUnit() called\n");
-
- DeviceExtension = CONTAINING_RECORD(HwDeviceExtension,
- SCSI_PORT_DEVICE_EXTENSION,
- MiniPortDeviceExtension);
- if (IsListEmpty(&DeviceExtension->LunExtensionListHead))
- return NULL;
-
- Entry = DeviceExtension->LunExtensionListHead.Flink;
- while (Entry != &DeviceExtension->LunExtensionListHead)
- {
- LunExtension = CONTAINING_RECORD(Entry,
- SCSI_PORT_LUN_EXTENSION,
- List);
- if (LunExtension->PathId == PathId &&
- LunExtension->TargetId == TargetId &&
- LunExtension->Lun == Lun)
- {
- return (PVOID)&LunExtension->MiniportLunExtension;
- }
-
- Entry = Entry->Flink;
- }
-#endif
- return NULL;
+ PSCSI_PORT_DEVICE_EXTENSION DeviceExtension;
+ PSCSI_PORT_LUN_EXTENSION LunExtension;
+
+ DPRINT("ScsiPortGetLogicalUnit() called\n");
+
+ DeviceExtension = CONTAINING_RECORD(HwDeviceExtension,
+ SCSI_PORT_DEVICE_EXTENSION,
+ MiniPortDeviceExtension);
+
+ /* Check the extension size */
+ if (!DeviceExtension->LunExtensionSize)
+ {
+ /* They didn't want one */
+ return NULL;
+ }
+
+ LunExtension = SpiGetLunExtension(DeviceExtension,
+ PathId,
+ TargetId,
+ Lun);
+ /* Check that the logical unit exists */
+ if (!LunExtension)
+ {
+ /* Nope, return NULL */
+ return NULL;
+ }
+
+ /* Return the logical unit miniport extension */
+ return (LunExtension + 1);
}