ScsiPortGetLogicalUnit function (srb.h)

The ScsiPortGetLogicalUnit routine returns a pointer to the miniport driver's per-LU storage area for a given peripheral.

Note  The SCSI port driver and SCSI miniport driver models may be altered or unavailable in the future. Instead, we recommend using the Storport driver and Storport miniport driver models.
 

Syntax

SCSIPORT_API PVOID ScsiPortGetLogicalUnit(
  [in] PVOID HwDeviceExtension,
  [in] UCHAR PathId,
  [in] UCHAR TargetId,
  [in] UCHAR Lun
);

Parameters

[in] HwDeviceExtension

Pointer to the hardware device extension. This is a per-HBA storage area that the port driver allocates and initializes on behalf of the miniport driver. Miniport drivers usually store HBA-specific information in this extension, such as the state of the HBA and the HBA's mapped access ranges. This area is available to the miniport driver in the DeviceExtension->HwDeviceExtension member of the HBA's device object immediately after the miniport driver calls ScsiPortInitialize. The port driver frees this memory when it removes the device.

[in] PathId

Identifies the SCSI bus.

[in] TargetId

Identifies the target controller or device on the bus.

[in] Lun

Identifies the logical unit number of the target device.

Return value

ScsiPortGetLogicalUnit returns a pointer to the miniport driver's storage area for the requested logical unit. If the operating system-specific port driver considers this logical unit to be nonexistent, it returns NULL.

Remarks

ScsiPortGetLogicalUnit is irrelevant if the miniport driver's DriverEntry routine specified zero for the LuExtensionSize in the HW_INITIALIZATION_DATA when it called ScsiPortInitialize. Otherwise, the operating system-specific port driver allocates and initializes with zeros a set of LU extensions of the specified size for the miniport driver to use.

Per-LU storage can be used to store data relevant to a particular peripheral, such as saved data pointers. To access this area, the miniport driver calls ScsiPortGetLogicalUnit when the driver is maintaining information about the state of or current operation for any particular peripheral.

The operating system-specific port driver can consider a logical unit to be nonexistent if there is no active request for that logical unit and the device has never been successfully selected.

Requirements

Requirement Value
Target Platform Desktop
Header srb.h (include Miniport.h, Scsi.h)
Library Scsiport.lib

See also

DriverEntry of SCSI Miniport Driver

HW_INITIALIZATION_DATA (SCSI)

ScsiPortInitialize

ScsiPortMoveMemory