[PATCH] [libata] quick fix for vendor and model names

From: Justin Cormack
Date: Tue Apr 06 2004 - 12:55:48 EST


ok, so transport attributes arent happening for libata. Howabout this
little patch to fix up the vendor and model names in the common case
when they are 3 chars + 16 chars (like almost all hard drives) so the
model names arent truncated in this case. Otherwise leaves things as
they are.

Justin


diff -urN linux-2.6.5-orig/drivers/scsi/libata-scsi.c linux-2.6.5/drivers/scsi/libata-scsi.c
--- linux-2.6.5-orig/drivers/scsi/libata-scsi.c 2004-04-04 03:36:57.000000000 +0000
+++ linux-2.6.5/drivers/scsi/libata-scsi.c 2004-04-06 17:10:57.000000000 +0000
@@ -464,11 +464,17 @@
memcpy(rbuf, hdr, sizeof(hdr));

if (buflen > 36) {
- memcpy(&rbuf[8], args->dev->vendor, 8);
- memcpy(&rbuf[16], args->dev->product, 16);
+ /* hack for common ata vendor/product strings */
+ if (args->dev->product[3] == ' ') {
+ memcpy(&rbuf[8], args->dev->product, 4);
+ memset(&rbuf[12], ' ', 4);
+ memcpy(&rbuf[16], &args->dev->product[4], 16);
+ } else {
+ memcpy(&rbuf[8], args->dev->vendor, 8);
+ memcpy(&rbuf[16], args->dev->product, 16);
+ }
memcpy(&rbuf[32], DRV_VERSION, 4);
}
-
if (buflen > 63) {
const u8 versions[] = {
0x60, /* SAM-3 (no version claimed) */