Isn't sd_major() broken ?

From: Badari Pulavarty (pbadari@us.ibm.com)
Date: Thu Apr 10 2003 - 13:01:44 EST


Hi,

I am little confused about the correctness of sd_major() in drivers/scsi/sd.c.

static int sd_major(int major_idx)
{
        switch (major_idx) {
        case 0:
                return SCSI_DISK0_MAJOR;
        case 1 ... 7:
                return SCSI_DISK1_MAJOR + major_idx - 1;
        case 8 ... 15:
                return SCSI_DISK8_MAJOR + major_idx;
        default:
                BUG();
                return 0; /* shut up gcc */
        }
}

So, if major_idx = 8, It returns 143.
But according to major.h, scsi has 128-135 reserved
majors. But it is registering 136 - 143 as its majors.

#define SCSI_DISK8_MAJOR 128
#define SCSI_DISK9_MAJOR 129
#define SCSI_DISK10_MAJOR 130
#define SCSI_DISK11_MAJOR 131
#define SCSI_DISK12_MAJOR 132
#define SCSI_DISK13_MAJOR 133
#define SCSI_DISK14_MAJOR 134
#define SCSI_DISK15_MAJOR 135

Isn't sd_major() broken ? Here is the patch to fix it.

Thanks,
Badari

# cat /proc/devices
...
Block devices:
  2 fd
  3 ide0
  8 sd
 11 sr
 65 sd
 66 sd
 67 sd
 68 sd
 69 sd
 70 sd
 71 sd
136 sd
137 sd
138 sd
139 sd
140 sd
141 sd
142 sd
143 sd



-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/



This archive was generated by hypermail 2b29 : Tue Apr 15 2003 - 22:00:21 EST