All of lore.kernel.org
 help / color / mirror / Atom feed
From: Jeff Garzik <jgarzik@pobox.com>
To: Bartlomiej Zolnierkiewicz <B.Zolnierkiewicz@elka.pw.edu.pl>,
	"linux-ide@vger.kernel.org" <linux-ide@vger.kernel.org>,
	Tobias Lorenz <tobias.lorenz@gmx.net>
Subject: get-identity ioctl in libata?
Date: Mon, 07 Mar 2005 23:46:28 -0500	[thread overview]
Message-ID: <422D2E24.3060208@pobox.com> (raw)

[-- Attachment #1: Type: text/plain, Size: 217 bytes --]

Bart,

Did you say that there was some problem with the patch to add 
HDIO_GET_IDENTITY support to libata (attached)?

I forget what the issues were, and this has been sitting in 
libata-dev-2.6 for a while.

	Jeff



[-- Attachment #2: patch --]
[-- Type: text/plain, Size: 1146 bytes --]

diff -Nru a/drivers/scsi/libata-scsi.c b/drivers/scsi/libata-scsi.c
--- a/drivers/scsi/libata-scsi.c	2005-03-07 23:44:42 -05:00
+++ b/drivers/scsi/libata-scsi.c	2005-03-07 23:44:42 -05:00
@@ -72,6 +72,17 @@
 	struct 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)
@@ -94,6 +105,17 @@
 		val = (unsigned long) arg;
 		if (val != 0)
 			return -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:

             reply	other threads:[~2005-03-08  4:46 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2005-03-08  4:46 Jeff Garzik [this message]
2005-03-08  8:14 ` get-identity ioctl in libata? Bartlomiej Zolnierkiewicz

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=422D2E24.3060208@pobox.com \
    --to=jgarzik@pobox.com \
    --cc=B.Zolnierkiewicz@elka.pw.edu.pl \
    --cc=linux-ide@vger.kernel.org \
    --cc=tobias.lorenz@gmx.net \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.