LBA48 in Linux SCSI ATA Passthrough

Posted by Ben Englert on Stack Overflow See other posts from Stack Overflow or by Ben Englert
Published on 2010-06-15T03:28:20Z Indexed on 2010/06/15 3:32 UTC
Read the original article Hit count: 245

Filed under:
|
|

I am writing a custom disk monitoring/diagnostics app which, among other things, needs to do stuff to SATA disks behind a SAS PCI card under Linux. So far I am following this guide as well as the example code in sg_utils to pass ATA taskfiles through the SCSI layer. Seems to be working okay.

However, in both cases, the CDB data structure (pointed to by the cmdp member of the sg_io argument to the ioctl) has only one unsigned char worth of space for the number of sectors. If you look at the ata_taskfile structure in linux\ata.h you'll see that it has an "nsect" and a "hob_nsect" field - high order bits for the sector count, to support LBA48.

It turns out that in my application I need LBA48 support. So, anyone know how to set up an sg_io_hdr structure with an LBA48 sector count?

© Stack Overflow or respective owner

Related posts about linux

Related posts about scsi