ScsiPortGetLogicalUnit

PVOID
    ScsiPortGetLogicalUnit(

        IN PVOID  HwDeviceExtension,
        IN UCHAR  PathId,
        IN UCHAR  TargetId,
        IN UCHAR  Lun
        );

ScsiPortGetLogicalUnit returns a pointer to the miniport’s per-LU storage area for a given peripheral.

Parameters

HwDeviceExtension
Points to the miniport driver’s per-HBA storage area.
PathId
Identifies the SCSI bus.
TargetId
Identifies the target controller or device on the bus.
Lun
Identifies the logical unit number of the target device, for which the miniport wants access to its per-LU storage area.

Return Value

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

Comments

ScsiPortGetLogicalUnit is irrelevant if the miniport’s DriverEntry routine specified zero for the LuExtensionSize in the HW_INITIALIZATION_DATA when it called ScsiPortInitialize. Otherwise, the OS-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 calls ScsiPortGetLogicalUnit when the driver is maintaining information about the state of or current operation for any particular peripheral.

The OS-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.

See Also

DriverEntry, HW_INITIALIZATION_DATA, ScsiPortInitialize, ScsiPortMoveMemory