Patch to mapping up to 128 SCSI Disk Devices

Loh, Joe joel@pivot3.com
Mon Nov 13 22:42:00 GMT 2006


This is a modified patch for up to 128 SCSI Disk Devices as discussed in
http://cygwin.com/ml/cygwin/2006-11/msg00060.html.

As suggested by Eric Blake, we have snail mailed the copyright
assignment to Rose Naftaly.

ChangeLog for winsup/cygwin:

2006-11-13  Joe Loh  <joel at pivot3 dot com>

        * devices.h: Add additional SCSI disk block device numbers per
        http://www.kernel.org/pub/linux/docs/device-list/devices.txt 
        up to 128 devices.
        (DEV_SD{2..7}_MAJOR): Define.
        (FH_SD{2..7}): Define.
        (FH_SDA{A..Z}): Define.
        (FH_SDB{A..Z}): Define.
        (FH_SDC{A..Z}): Define.
        (FH_SDD{A..X}): Define.
        * devices.in: Add additional SCSI disk block device numbers per
        http://www.kernel.org/pub/linux/docs/device-list/devices.txt 
        up to 128 devices.
        (/dev/sda{a..z}): Define.
        (/dev/sdb{a..z}): Define.
        (/dev/sdc{a..z}): Define.
        (/dev/sdd{a..x}): Define.
        (device::parsedisk): Add additonal else-if cases for decoding
base 
        and drive indices.
        * dtable.cc (build_fh_pc): Add additional DEV_SD{2..7}_MAJOR
cases.



Index: devices.h
===================================================================
RCS file: /cvs/src/src/winsup/cygwin/devices.h,v
retrieving revision 1.22
diff -u -r1.22 devices.h
--- devices.h   2 Dec 2005 00:37:21 -0000       1.22
+++ devices.h   13 Nov 2006 22:30:44 -0000
@@ -65,8 +65,20 @@
 
   DEV_SD_MAJOR = 8,
   DEV_SD1_MAJOR = 65,
+  DEV_SD2_MAJOR = 66,
+  DEV_SD3_MAJOR = 67,
+  DEV_SD4_MAJOR = 68,
+  DEV_SD5_MAJOR = 69,
+  DEV_SD6_MAJOR = 70,
+  DEV_SD7_MAJOR = 71,
   FH_SD      = FHDEV (DEV_SD_MAJOR, 0),
   FH_SD1     = FHDEV (DEV_SD1_MAJOR, 0),
+  FH_SD2     = FHDEV (DEV_SD2_MAJOR, 0),
+  FH_SD3     = FHDEV (DEV_SD3_MAJOR, 0),
+  FH_SD4     = FHDEV (DEV_SD4_MAJOR, 0),
+  FH_SD5     = FHDEV (DEV_SD5_MAJOR, 0),
+  FH_SD6     = FHDEV (DEV_SD6_MAJOR, 0),
+  FH_SD7     = FHDEV (DEV_SD7_MAJOR, 0),
   FH_SDA     = FHDEV (DEV_SD_MAJOR, 0),
   FH_SDB     = FHDEV (DEV_SD_MAJOR, 16),
   FH_SDC     = FHDEV (DEV_SD_MAJOR, 32),
@@ -93,6 +105,108 @@
   FH_SDX     = FHDEV (DEV_SD1_MAJOR, 112),
   FH_SDY     = FHDEV (DEV_SD1_MAJOR, 128),
   FH_SDZ     = FHDEV (DEV_SD1_MAJOR, 144),
+  FH_SDAA    = FHDEV (DEV_SD1_MAJOR, 160),
+  FH_SDAB    = FHDEV (DEV_SD1_MAJOR, 176),
+  FH_SDAC    = FHDEV (DEV_SD1_MAJOR, 192),
+  FH_SDAD    = FHDEV (DEV_SD1_MAJOR, 208),
+  FH_SDAE    = FHDEV (DEV_SD1_MAJOR, 224),
+  FH_SDAF    = FHDEV (DEV_SD1_MAJOR, 240),
+  FH_SDAG    = FHDEV (DEV_SD2_MAJOR, 0),
+  FH_SDAH    = FHDEV (DEV_SD2_MAJOR, 16),
+  FH_SDAI    = FHDEV (DEV_SD2_MAJOR, 32),
+  FH_SDAJ    = FHDEV (DEV_SD2_MAJOR, 48),
+  FH_SDAK    = FHDEV (DEV_SD2_MAJOR, 64),
+  FH_SDAL    = FHDEV (DEV_SD2_MAJOR, 80),
+  FH_SDAM    = FHDEV (DEV_SD2_MAJOR, 96),
+  FH_SDAN    = FHDEV (DEV_SD2_MAJOR, 112),
+  FH_SDAO    = FHDEV (DEV_SD2_MAJOR, 128),
+  FH_SDAP    = FHDEV (DEV_SD2_MAJOR, 144),
+  FH_SDAQ    = FHDEV (DEV_SD2_MAJOR, 160),
+  FH_SDAR    = FHDEV (DEV_SD2_MAJOR, 176),
+  FH_SDAS    = FHDEV (DEV_SD2_MAJOR, 192),
+  FH_SDAT    = FHDEV (DEV_SD2_MAJOR, 208),
+  FH_SDAU    = FHDEV (DEV_SD2_MAJOR, 224),
+  FH_SDAV    = FHDEV (DEV_SD2_MAJOR, 240),
+  FH_SDAW    = FHDEV (DEV_SD3_MAJOR, 0),
+  FH_SDAX    = FHDEV (DEV_SD3_MAJOR, 16),
+  FH_SDAY    = FHDEV (DEV_SD3_MAJOR, 32),
+  FH_SDAZ    = FHDEV (DEV_SD3_MAJOR, 48),
+  FH_SDBA    = FHDEV (DEV_SD3_MAJOR, 64),
+  FH_SDBB    = FHDEV (DEV_SD3_MAJOR, 80),
+  FH_SDBC    = FHDEV (DEV_SD3_MAJOR, 96),
+  FH_SDBD    = FHDEV (DEV_SD3_MAJOR, 112),
+  FH_SDBE    = FHDEV (DEV_SD3_MAJOR, 128),
+  FH_SDBF    = FHDEV (DEV_SD3_MAJOR, 144),
+  FH_SDBG    = FHDEV (DEV_SD3_MAJOR, 160),
+  FH_SDBH    = FHDEV (DEV_SD3_MAJOR, 176),
+  FH_SDBI    = FHDEV (DEV_SD3_MAJOR, 192),
+  FH_SDBJ    = FHDEV (DEV_SD3_MAJOR, 208),
+  FH_SDBK    = FHDEV (DEV_SD3_MAJOR, 224),
+  FH_SDBL    = FHDEV (DEV_SD3_MAJOR, 240),
+  FH_SDBM    = FHDEV (DEV_SD4_MAJOR, 0),
+  FH_SDBN    = FHDEV (DEV_SD4_MAJOR, 16),
+  FH_SDBO    = FHDEV (DEV_SD4_MAJOR, 32),
+  FH_SDBP    = FHDEV (DEV_SD4_MAJOR, 48),
+  FH_SDBQ    = FHDEV (DEV_SD4_MAJOR, 64),
+  FH_SDBR    = FHDEV (DEV_SD4_MAJOR, 80),
+  FH_SDBS    = FHDEV (DEV_SD4_MAJOR, 96),
+  FH_SDBT    = FHDEV (DEV_SD4_MAJOR, 112),
+  FH_SDBU    = FHDEV (DEV_SD4_MAJOR, 128),
+  FH_SDBV    = FHDEV (DEV_SD4_MAJOR, 144),
+  FH_SDBW    = FHDEV (DEV_SD4_MAJOR, 160),
+  FH_SDBX    = FHDEV (DEV_SD4_MAJOR, 176),
+  FH_SDBY    = FHDEV (DEV_SD4_MAJOR, 192),
+  FH_SDBZ    = FHDEV (DEV_SD4_MAJOR, 208),
+  FH_SDCA    = FHDEV (DEV_SD4_MAJOR, 224),
+  FH_SDCB    = FHDEV (DEV_SD4_MAJOR, 240),
+  FH_SDCC    = FHDEV (DEV_SD5_MAJOR, 0),
+  FH_SDCD    = FHDEV (DEV_SD5_MAJOR, 16),
+  FH_SDCE    = FHDEV (DEV_SD5_MAJOR, 32),
+  FH_SDCF    = FHDEV (DEV_SD5_MAJOR, 48),
+  FH_SDCG    = FHDEV (DEV_SD5_MAJOR, 64),
+  FH_SDCH    = FHDEV (DEV_SD5_MAJOR, 80),
+  FH_SDCI    = FHDEV (DEV_SD5_MAJOR, 96),
+  FH_SDCJ    = FHDEV (DEV_SD5_MAJOR, 112),
+  FH_SDCK    = FHDEV (DEV_SD5_MAJOR, 128),
+  FH_SDCL    = FHDEV (DEV_SD5_MAJOR, 144),
+  FH_SDCM    = FHDEV (DEV_SD5_MAJOR, 160),
+  FH_SDCN    = FHDEV (DEV_SD5_MAJOR, 176),
+  FH_SDCO    = FHDEV (DEV_SD5_MAJOR, 192),
+  FH_SDCP    = FHDEV (DEV_SD5_MAJOR, 208),
+  FH_SDCQ    = FHDEV (DEV_SD5_MAJOR, 224),
+  FH_SDCR    = FHDEV (DEV_SD5_MAJOR, 240),
+  FH_SDCS    = FHDEV (DEV_SD6_MAJOR, 0),
+  FH_SDCT    = FHDEV (DEV_SD6_MAJOR, 16),
+  FH_SDCU    = FHDEV (DEV_SD6_MAJOR, 32),
+  FH_SDCV    = FHDEV (DEV_SD6_MAJOR, 48),
+  FH_SDCW    = FHDEV (DEV_SD6_MAJOR, 64),
+  FH_SDCX    = FHDEV (DEV_SD6_MAJOR, 80),
+  FH_SDCY    = FHDEV (DEV_SD6_MAJOR, 96),
+  FH_SDCZ    = FHDEV (DEV_SD6_MAJOR, 112),
+  FH_SDDA    = FHDEV (DEV_SD6_MAJOR, 128),
+  FH_SDDB    = FHDEV (DEV_SD6_MAJOR, 144),
+  FH_SDDC    = FHDEV (DEV_SD6_MAJOR, 160),
+  FH_SDDD    = FHDEV (DEV_SD6_MAJOR, 176),
+  FH_SDDE    = FHDEV (DEV_SD6_MAJOR, 192),
+  FH_SDDF    = FHDEV (DEV_SD6_MAJOR, 208),
+  FH_SDDG    = FHDEV (DEV_SD6_MAJOR, 224),
+  FH_SDDH    = FHDEV (DEV_SD6_MAJOR, 240),
+  FH_SDDI    = FHDEV (DEV_SD7_MAJOR, 0),
+  FH_SDDJ    = FHDEV (DEV_SD7_MAJOR, 16),
+  FH_SDDK    = FHDEV (DEV_SD7_MAJOR, 32),
+  FH_SDDL    = FHDEV (DEV_SD7_MAJOR, 48),
+  FH_SDDM    = FHDEV (DEV_SD7_MAJOR, 64),
+  FH_SDDN    = FHDEV (DEV_SD7_MAJOR, 80),
+  FH_SDDO    = FHDEV (DEV_SD7_MAJOR, 96),
+  FH_SDDP    = FHDEV (DEV_SD7_MAJOR, 112),
+  FH_SDDQ    = FHDEV (DEV_SD7_MAJOR, 128),
+  FH_SDDR    = FHDEV (DEV_SD7_MAJOR, 144),
+  FH_SDDS    = FHDEV (DEV_SD7_MAJOR, 160),
+  FH_SDDT    = FHDEV (DEV_SD7_MAJOR, 176),
+  FH_SDDU    = FHDEV (DEV_SD7_MAJOR, 192),
+  FH_SDDV    = FHDEV (DEV_SD7_MAJOR, 208),
+  FH_SDDW    = FHDEV (DEV_SD7_MAJOR, 224),
+  FH_SDDX    = FHDEV (DEV_SD7_MAJOR, 240),
 
   FH_MEM     = FHDEV (1, 1),
   FH_KMEM    = FHDEV (1, 2),   /* not implemented yet */


Index: devices.in
===================================================================
RCS file: /cvs/src/src/winsup/cygwin/devices.in,v
retrieving revision 1.14
diff -u -r1.14 devices.in
--- devices.in  9 Oct 2006 08:27:23 -0000       1.14
+++ devices.in  13 Nov 2006 22:30:44 -0000
@@ -85,7 +85,15 @@
 "/dev/scd%(0-15)d", BRACK(FHDEV(DEV_CDROM_MAJOR, {$1})),
"\\Device\\CdRom{$1}"
 "/dev/sr%(0-15)d", BRACK(FHDEV(DEV_CDROM_MAJOR, {$1})),
"\\Device\\CdRom{$1}"
 "/dev/sd%{a-z}s", BRACK(FH_SD{uc $1}), "\\Device\\Harddisk{ord($1) -
ord('a')}\\Partition0"
+"/dev/sda%{a-z}s", BRACK(FH_SDA{uc $1}), "\\Device\\Harddisk{26 +
ord($1) - ord('a')}\\Partition0"
+"/dev/sdb%{a-z}s", BRACK(FH_SDB{uc $1}), "\\Device\\Harddisk{52 +
ord($1) - ord('a')}\\Partition0"
+"/dev/sdc%{a-z}s", BRACK(FH_SDC{uc $1}), "\\Device\\Harddisk{78 +
ord($1) - ord('a')}\\Partition0"
+"/dev/sdd%{a-x}s", BRACK(FH_SDD{uc $1}), "\\Device\\Harddisk{104 +
ord($1) - ord('a')}\\Partition0"
 "/dev/sd%{a-z}s%(1-15)d", BRACK(FH_SD{uc $1} | {$2}),
"\\Device\\Harddisk{ord($1) - ord('a')}\\Partition{$2 % 16}"
+"/dev/sda%{a-z}s%(1-15)d", BRACK(FH_SDA{uc $1} | {$2}),
"\\Device\\Harddisk{26 + ord($1) - ord('a')}\\Partition{$2 % 16}"
+"/dev/sdb%{a-z}s%(1-15)d", BRACK(FH_SDB{uc $1} | {$2}),
"\\Device\\Harddisk{52 + ord($1) - ord('a')}\\Partition{$2 % 16}"
+"/dev/sdc%{a-z}s%(1-15)d", BRACK(FH_SDC{uc $1} | {$2}),
"\\Device\\Harddisk{78 + ord($1) - ord('a')}\\Partition{$2 % 16}"
+"/dev/sdd%{a-x}s%(1-15)d", BRACK(FH_SDD{uc $1} | {$2}),
"\\Device\\Harddisk{104 + ord($1) - ord('a')}\\Partition{$2 % 16}"
 "/dev/kmsg", BRACK(FH_KMSG), "\\\\.\\mailslot\\cygwin\\dev\\kmsg"
 "/dev", BRACK(FH_DEV), "/dev"
 %other {return NULL;}
@@ -146,12 +154,44 @@
 device::parsedisk (int drive, int part)
 {
   int base;
-  if (drive < ('q' - 'a'))
+  if (drive < ('q' - 'a'))      // /dev/sda -to- /dev/sdp
     base = DEV_SD_MAJOR;
-  else
+  else if (drive < 32)          // /dev/sdq -to- /dev/sdaf
     {
       base = DEV_SD1_MAJOR;
       drive -= 'q' - 'a';
     }
+  else if (drive < 48)          // /dev/sdag -to- /dev/sdav
+    {
+      base = DEV_SD2_MAJOR;
+      drive -= 32;
+    }
     {
       base = DEV_SD1_MAJOR;
       drive -= 'q' - 'a';
     }
+  else if (drive < 48)          // /dev/sdag -to- /dev/sdav
+    {
+      base = DEV_SD2_MAJOR;
+      drive -= 32;
+    }
+  else if (drive < 64)          // /dev/sdaw -to- /dev/sdbl
+    {
+      base = DEV_SD3_MAJOR;
+      drive -= 48;
+    }
+  else if (drive < 80)          // /dev/sdbm -to- /dev/sdcb
+    {
+      base = DEV_SD4_MAJOR;
+      drive -= 64;
+    }
+  else if (drive < 96)          // /dev/sdcc -to- /dev/sdcr
+    {
+      base = DEV_SD5_MAJOR;
+      drive -= 80;
+    }
+  else if (drive < 112)          // /dev/sdcs -to- /dev/sddh
+    {
+      base = DEV_SD6_MAJOR;
+      drive -= 96;
+    }
+  // NOTE: This will cause multiple /dev/sddx entries in
+  //       /proc/partitions if there are more than 128 devices
+  else                           // /dev/sddi -to- /dev/sddx
+    {
+      base = DEV_SD7_MAJOR;
+      drive -= 112;
+    }
   parse (base, part + (drive * 16));
 }


Index: dtable.cc
===================================================================
RCS file: /cvs/src/src/winsup/cygwin/dtable.cc,v
retrieving revision 1.170
diff -u -r1.170 dtable.cc
--- dtable.cc   6 Nov 2006 13:46:24 -0000       1.170
+++ dtable.cc   13 Nov 2006 22:30:45 -0000
@@ -384,6 +384,12 @@
     case DEV_CDROM_MAJOR:
     case DEV_SD_MAJOR:
     case DEV_SD1_MAJOR:
+    case DEV_SD2_MAJOR:
+    case DEV_SD3_MAJOR:
+    case DEV_SD4_MAJOR:
+    case DEV_SD5_MAJOR:
+    case DEV_SD6_MAJOR:
+    case DEV_SD7_MAJOR:
       fh = cnew (fhandler_dev_floppy) ();
       break;
     case DEV_TAPE_MAJOR:



More information about the Cygwin-patches mailing list