PathId, TargetId and Lun of SCSI_REQUEST_BLOCK?

Hi all,
Now I receive a SRB command, I want to find out the partition letter from the fields PathId, TargetId and Lun of SCSI_REQUEST_BLOCK.
Is this possible? How?

I think it would be possible to determine this from the SRB if it is a read
or a write, but the sector number will be required since a single device can
have multiple partitions.

wrote in message news:xxxxx@ntdev…
> Hi all,
> Now I receive a SRB command, I want to find out the partition letter from
> the fields PathId, TargetId and Lun of SCSI_REQUEST_BLOCK.
> Is this possible? How?
>

Why?

-----Original Message-----
From: xxxxx@lists.osr.com [mailto:xxxxx@lists.osr.com] On Behalf Of xxxxx@sina.com
Sent: Tuesday, March 17, 2009 10:13 PM
To: Windows System Software Devs Interest List
Subject: [ntdev] PathId, TargetId and Lun of SCSI_REQUEST_BLOCK?

Hi all,
Now I receive a SRB command, I want to find out the partition letter from the fields PathId, TargetId and Lun of SCSI_REQUEST_BLOCK.
Is this possible? How?


NTDEV is sponsored by OSR

For our schedule of WDF, WDM, debugging and other seminars visit:
http://www.osr.com/seminars

To unsubscribe, visit the List Server section of OSR Online at http://www.osronline.com/page.cfm?name=ListServer

Maybe, one can judge the device who receives the SRB command. and then one will find out the partition letter.
But I just want to find partition letterfrom SRB itself.
While debugging, I always find that PathId, TargetId and Lun are all zeros.

According to DDK/WDK document, I think PathId represents the bus number, and TargetId
represents the hard disk, and Lun represents the partition number.
So does Microsoft ignore PathId, TargetId and Lun of SCSI_REQUEST_BLOCK?

According to which docs? Here is what the WDK says:

PathId
Indicates the SCSI port or bus for the request. This value is zero-based.

TargetId
Indicates the target controller or device on the bus.

Lun
Indicates the logical unit number of the device.

Path is indeed the ‘bus’ number, which can mean almost anything
depending on what one is actually connected to. TargetId is at least
theoretically a single physical device, but LUN, or Logical Unit
Number, is an addressable entity within a physical device. LUNs and
‘partitions’ are simply not related at all.

You can determine which windows volume a read or write SRB is intended
for by building a mapping from Path/Target/Lun + LBA to associated
Physical Disk device in windows and the volume disk extents on that
disk for each volume in the system. That would be a lot of work, and
would require help from applications or drivers high enough in the
storage stack to provide the mapping information to a driver low
enough in the storage stack to intercept SRBs.

All of which begs the question: ‘what are you trying to do?’

Mark Roddy

On Wed, Mar 18, 2009 at 3:07 AM, wrote:
> According to DDK/WDK document, ?I think PathId represents the bus number, and TargetId
> represents the hard disk, and Lun represents the partition number.
> So does Microsoft ignore PathId, TargetId and Lun of SCSI_REQUEST_BLOCK?
>
> —
> NTDEV is sponsored by OSR
>
> For our schedule of WDF, WDM, debugging and other seminars visit:
> http://www.osr.com/seminars
>
> To unsubscribe, visit the List Server section of OSR Online at http://www.osronline.com/page.cfm?name=ListServer
>

Yes. They were used pre-Win2k but now that each LUN has its own physical device object they’re irrelevant above the miniport level. The port driver uses the PDO to provide appropriate bus-address information for the miniport now.

-p

-----Original Message-----
From: xxxxx@lists.osr.com [mailto:xxxxx@lists.osr.com] On Behalf Of xxxxx@sina.com
Sent: Wednesday, March 18, 2009 12:08 AM
To: Windows System Software Devs Interest List
Subject: RE:[ntdev] PathId, TargetId and Lun of SCSI_REQUEST_BLOCK?

According to DDK/WDK document, I think PathId represents the bus number, and TargetId
represents the hard disk, and Lun represents the partition number.
So does Microsoft ignore PathId, TargetId and Lun of SCSI_REQUEST_BLOCK?


NTDEV is sponsored by OSR

For our schedule of WDF, WDM, debugging and other seminars visit:
http://www.osr.com/seminars

To unsubscribe, visit the List Server section of OSR Online at http://www.osronline.com/page.cfm?name=ListServer

In fact, I want to monitor hard disk’s SRB commands at low level. Maybe this is hard.
From my debugging, such as HarddiskVolume1 will not be attached above any other device. So as you said, I will have to change my mind.

I am sure that in most cases Microsoft just cares about the LBA address in Cdb. And in some cases, TargetId is used to identify the physical disk.

Why the miniport should know anything on partition letters? looks like misdesign.


Maxim S. Shatskih
Windows DDK MVP
xxxxx@storagecraft.com
http://www.storagecraft.com

wrote in message news:xxxxx@ntdev…
> Hi all,
> Now I receive a SRB command, I want to find out the partition letter from the fields PathId, TargetId and Lun of SCSI_REQUEST_BLOCK.
> Is this possible? How?
>

> In fact, I want to monitor hard disk’s SRB commands at low level. Maybe this is hard.

So what? and why do you need the partition letter on such a low level? it does not exist on such low a level.

From my debugging, such as HarddiskVolume1 will not be attached above any other device.

You cannot see SRBs at HarddiskVolume1 level.


Maxim S. Shatskih
Windows DDK MVP
xxxxx@storagecraft.com
http://www.storagecraft.com

>I am sure that in most cases Microsoft just cares about the LBA address in Cdb. And in some

TargetId is used to identify the physical disk.

There is no even 1-to-1 relation between Bus/Target/LUN SCSI address and the \.\PhysicalDisk%d disk device.

The thing is that Bus/Target/LUN can be the same for the disk hanging off another controller devnode.


Maxim S. Shatskih
Windows DDK MVP
xxxxx@storagecraft.com
http://www.storagecraft.com