[PATCH] sd_devname broken

Andreas Schwab (schwab@issan.informatik.uni-dortmund.de)
06 Feb 1998 11:25:59 +0100


There is some confusion about what the function sd_devname in sd.c expects
as the disknum parameter. Some callers pass the minor number, some pass
the disk number (which is the same as the minor number divided by 16).
Since sd_devname does not deal with partitions the latter is more usefull.
If you have more than one SCSI disk you will see the bug during probing
and partition check, where all disks are identified as sda.

--- linux-2.1.85/drivers/scsi/sd.c.~1~ Wed Jan 14 21:40:28 1998
+++ linux-2.1.85/drivers/scsi/sd.c Thu Jan 29 10:16:01 1998
@@ -91,7 +91,7 @@
{
if( disknum <= 26 )
{
- sprintf(buffer, "sd%c", 'a' + (disknum >> 4));
+ sprintf(buffer, "sd%c", 'a' + disknum);
}
else
{
@@ -101,8 +101,8 @@
* For larger numbers of disks, we need to go to a new
* naming scheme.
*/
- min1 = (disknum >> 4) / 26;
- min2 = (disknum >> 4) % 26;
+ min1 = disknum / 26;
+ min2 = disknum % 26;
sprintf(buffer, "sd%c%c", 'a' + min1, 'a' + min2);
}
}
@@ -677,7 +677,7 @@
goto repeat;
}

- sd_devname(devm, nbuff);
+ sd_devname(devm >> 4, nbuff);
SCSI_LOG_HLQUEUE(2,printk("%s : real dev = /dev/%d, block = %d\n",
nbuff, dev, block));

-- 
Andreas Schwab                                      "And now for something
schwab@issan.informatik.uni-dortmund.de              completely different"
schwab@gnu.org
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.rutgers.edu