libata: shelved ioctl-get-identity patch
PATCH 1/1 libata: shelved ioctl-get-identity patch
I am removing the attached patch from libata-dev.git, as it does not justify the maintenance burden at the present time. The reasons it sat in libata-dev rather than go upstream are discussed at the top of the patch.
If anyone feels strongly about this ioctl, take it upon yourself to research the patch fully, address the concerns, and present an updated solution.
The patch will be archived forever at
http://www.kernel.org/pub/linux/kernel/people/jgarzik/libata/archive/2.6.12-rc5-git8-ioctl-get-identity.patch.bz2
For inclusion,
a) should determine if need for ioctl justifies maintenance
b) should address Bart Z's concerns:
* it is not complete HDIO_GET_IDENTIFY implementation (applications may assume otherwise)
* you may need to add byte-swapping of the fields in the future (currently it is fine)
* same info is available via pass-thru inteface
drivers/scsi/libata-scsi.c | 22 ++++++++++++++++++++++ 1 files changed, 22 insertions(+)
commit fcf604172829176bc618663e8387c8943ff88b66
tree b10326c351daf26f34ce43b6a37369b30bb434c2
parent 89fb1c9e5e5345ea5531d6378912a5896923e914
parent 8be3de3fd8469154a2b3e18a4712032dac5b4a53
author <[email protected]> Sat, 04 Jun 2005 08:02:29 -0400 committer Jeff Garzik <[email protected]> Sat, 04 Jun 2005 08:02:29 -0400
Automatic merge of /spare/repo/linux-2.6/.git branch HEAD
--------------------------
commit 89fb1c9e5e5345ea5531d6378912a5896923e914
tree 48fd7c6d1f9bba8936fc3e1208465c854c77834c
parent 88d7bd8cb9eb8d64bf7997600b0d64f7834047c5
author Tobias Lorenz <[email protected]> Thu, 12 May 2005 23:10:33 -0400 committer Jeff Garzik <[email protected]> Thu, 12 May 2005 23:10:33 -0400
[PATCH] libata-scsi: get-identity ioctl support
This patch adds support for transfering drive informations via the hd_driveid structure to the hdparm utility. At the moment, only cylinders, sectors, heads, model and firmware version are transfered.
--------------------------
drivers/scsi/libata-scsi.c +22 -0
@@ -72,6 +72,17 @@ int ata_scsi_ioctl(struct scsi_device *sstruct ata_port *ap;struct ata_device *dev;int val = -EINVAL , rc = -EINVAL ; +struct hd_driveid drv_id = { + .cyls =0 , + .sectors =0 , + .heads =0 , + .fw_rev ="" , + .model ="" , + .cur_cyls =0 , + .cur_heads =0 , + .cur_sectors =0 , + }; +int geom[3 ]; ap = (struct ata_port *) &scsidev->host->hostdata[0 ];if (!ap)
@@ -96,6 +107,17 @@ int ata_scsi_ioctl(struct scsi_device *sreturn -EINVAL ;return 0 ; +case HDIO_GET_IDENTITY : +ata_std_bios_param (scsidev,NULL , dev->n_sectors, geom); + drv_id.cur_heads = drv_id.heads = geom[0 ]; + drv_id.cur_sectors = drv_id.sectors = geom[1 ]; + drv_id.cur_cyls = drv_id.cyls = geom[2 ]; +strncpy ((char *) &drv_id.model, scsidev->model,sizeof (drv_id.model)); +strncpy ((char *) &drv_id.fw_rev, scsidev->rev,sizeof (drv_id.fw_rev)); +if (copy_to_user ((char *) arg, (char *) &drv_id,sizeof (drv_id))) +return (-EFAULT ); +return 0 ; +default : rc = -ENOTTY ;break ;
Quoted 4 lines · Jeff Garzik
I am removing the attached patch from libata-dev.git, as it does not justify the maintenance burden at the present time. The reasons it sat in libata-dev rather than go upstream are discussed at the top of the patch.
If anyone feels strongly about this ioctl, take it upon yourself to research the patch fully, address the concerns, and present an updated solution.
That interface is so obsolete it really doesn't matter much now. Most people seem to use the more modern "hdparm -I" instead of this ("hdparm -i") one.
For now, "hdparm -I" works just fine using HDIO_DRIVE_CMD, but if somebody could show me how to use ATA PASSTHRU, then I'll port it over to that.
Cheers
Quoted 3 lines · Mark Lord
For now, "hdparm -I" works just fine using
HDIO_DRIVE_CMD, but if somebody could show me how to use ATA PASSTHRU, then I'll port it over to that.
Use the SG_IO ioctl to send ATA passthru CDBs. Passthru CDBs are defined in the T10 "SAT" specification.
blktool should have example code ;-)
Jeff