linux-hotplug.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Chris Paulson-Ellis <chris@edesix.com>
To: linux-hotplug@vger.kernel.org
Subject: Re: /dev/disk/by-id incomplete and unhelpful for SATA drives
Date: Fri, 23 Dec 2005 00:12:18 +0000	[thread overview]
Message-ID: <43AB40E2.1050009@edesix.com> (raw)
In-Reply-To: <doc5jl$acv$1@sea.gmane.org>

Bill Nottingham wrote:
> Chris Paulson-Ellis (chris@edesix.com) said: 
> 
>>KERNEL="sd*[!0-9]", ENV{ID_SERIAL}="*_Linux_ATA-SCSI_simulator", 
>>IMPORT="/sbin/scsi_id -g -x -s %p -d %N -p 0x80"
>>
>>I'm not sure which fix is better. Perhaps the scsi_id.config fix, as the 
>>udev rule could contradict an entry in scsi_id.config, confusing the 
>>user. Then again, the rule is only run if neccessary and I prefer to 
>>have only one place to look (the udev rules) to see what is happening.
> 
> 
> Why not just fix the kernel when it's filling in the page 83
> data to pull the serial from page 80 instead of putting *that* there?
> 
> Bill

Indeed. Here's the patch. Now I have 3 ways to fix this. Any more anyone?

--- drivers/scsi/libata-scsi.c.orig     2005-12-22 23:23:55.000000000 +0000
+++ drivers/scsi/libata-scsi.c  2005-12-22 23:56:14.000000000 +0000
@@ -1532,16 +1532,13 @@
         return 0;
  }

-static const char *inq_83_str = "Linux ATA-SCSI simulator";
-
  /**
   *     ata_scsiop_inq_83 - Simulate INQUIRY EVPD page 83, device identity
   *     @args: device IDENTIFY data / SCSI command of interest.
   *     @rbuf: Response buffer, to which simulated SCSI cmd output is sent.
   *     @buflen: Response buffer length.
   *
- *     Returns device identification.  Currently hardcoded to
- *     return "Linux ATA-SCSI simulator".
+ *     Returns ATA device serial number (as for page 80).
   *
   *     LOCKING:
   *     spin_lock_irqsave(host_set lock)
@@ -1551,13 +1548,14 @@
                               unsigned int buflen)
  {
         rbuf[1] = 0x83;                 /* this page code */
-       rbuf[3] = 4 + strlen(inq_83_str);       /* page len */
+       rbuf[3] = 4 + ATA_SERNO_LEN;    /* page len */

         /* our one and only identification descriptor (vendor-specific) */
-       if (buflen > (strlen(inq_83_str) + 4 + 4 - 1)) {
+       if (buflen > (ATA_SERNO_LEN + 4 + 4 - 1)) {
                 rbuf[4 + 0] = 2;        /* code set: ASCII */
-               rbuf[4 + 3] = strlen(inq_83_str);
-               memcpy(rbuf + 4 + 4, inq_83_str, strlen(inq_83_str));
+               rbuf[4 + 3] = ATA_SERNO_LEN;
+               ata_dev_id_string(args->id, (unsigned char *) rbuf + 4 + 4,
+                                 ATA_ID_SERNO_OFS, ATA_SERNO_LEN);
         }

         return 0;


-------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc. Do you grep through log files
for problems?  Stop!  Download the new AJAX search engine that makes
searching your log files as easy as surfing the  web.  DOWNLOAD SPLUNK!
http://ads.osdn.com/?ad_idv37&alloc_id\x16865&op=click
_______________________________________________
Linux-hotplug-devel mailing list  http://linux-hotplug.sourceforge.net
Linux-hotplug-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/linux-hotplug-devel

  parent reply	other threads:[~2005-12-23  0:12 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2005-12-21 18:05 /dev/disk/by-id incomplete and unhelpful for SATA drives Chris Paulson-Ellis
2005-12-21 18:55 ` Kay Sievers
2005-12-21 21:57 ` Chris Paulson-Ellis
2005-12-22  4:35 ` Kay Sievers
2005-12-22 11:24 ` Chris Paulson-Ellis
2005-12-22 18:35 ` Bill Nottingham
2005-12-22 21:08 ` David Liontooth
2005-12-22 22:48 ` Chris Paulson-Ellis
2005-12-23  0:12 ` Chris Paulson-Ellis [this message]
2006-01-06  1:36   ` patman
2006-01-06  2:57     ` Douglas Gilbert
2006-01-06 12:39       ` [PATCH] " Douglas Gilbert
2006-01-06 13:34         ` Chris Paulson-Ellis
2006-01-06 18:58           ` Patrick Mansfield
2006-01-06 19:46         ` Patrick Mansfield
2006-01-06 23:44           ` Douglas Gilbert
2006-03-06 20:08         ` Jeff Garzik
2006-03-07 17:05           ` Douglas Gilbert

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=43AB40E2.1050009@edesix.com \
    --to=chris@edesix.com \
    --cc=linux-hotplug@vger.kernel.org \
    /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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).