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

Justin Cormack
2004-04-06T17:54:19Z

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

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

[-- Attachment #2: libata-hackpatch --]
[-- Type: text/x-patch, Size: 934 bytes --]

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) */