This is the mail archive of the cygwin mailing list for the Cygwin project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

RE: Mapping of \device\harddisk12 and beyond


Really appreaciate the recommendation that Dave Korn suggested.  We went
ahead and modified the cygwin1.dll for version 1.5.19-4, which is the
one we have installed for testing.  In the event of checking out our
change we found a bug in the current SCSI device handling of major
number 65, i.e. any devices mapping from /dev/sdq thru dev/sdz.  There
was a missing case in dtable.cc file inhibiting access to /dev/sdq thru
/dev/sdz.  We have checked the latest source in the cvs repository and
noticed that the case is still missing.  We are posting the fix here
just in case others are interested:

--- cygwin-1.5.19-4/winsup/cygwin/dtable.cc     2006-01-16
11:14:35.000000000 -0600
+++ src/winsup/cygwin/dtable.cc 2006-11-02 18:13:13.154011100 -0600
@@ -378,6 +378,7 @@
     case DEV_FLOPPY_MAJOR:
     case DEV_CDROM_MAJOR:
     case DEV_SD_MAJOR:
+    case DEV_SD1_MAJOR:
       fh = cnew (fhandler_dev_floppy) ();
       break;
     case DEV_TAPE_MAJOR:

In addition, if anyone is interested in patching for more SCSI device
mapping up to 64, here are the changes we did.  We were testing iSCSI
volumes up to 32, including the host direct attached, a total of 33.
Hence, we mapped all of the major block device 65, which leaves us one
short.  So, we decided to define 2 more major block device, 66 & 67 to
give us a total of 64 devices for any possible future support.  These
major numbers are consistent with what Linux uses according to
http://www.kernel.org/pub/linux/docs/device-list/devices.txt.  Following
is the patch we did.  We would appreciate it if the Cygwin developers
would consider extending the support to future Cygwin releases as we
like testing with Cygwin as it's distributed. Again, thank you so much
Dave for your recommendation.

--- cygwin-1.5.19-4/winsup/cygwin/devices.in    2005-09-19
09:38:27.000000000 -0500
+++ src/winsup/cygwin/devices.in        2006-11-02 16:02:43.434520000
-0600
@@ -85,7 +85,11 @@
 "/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-l}s", BRACK(FH_SDB{uc $1}), "\\Device\\Harddisk{52 +
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-l}s%(1-15)d", BRACK(FH_SDB{uc $1} | {$2}),
"\\Device\\Harddisk{52 + 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 +150,24 @@
 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;
+    }
+  // NOTE: This will cause multiple /dev/sdbl entries in
+  //       /proc/partitions if there are more than 64 devices
+  else                          // /dev/sdaw -to- /dev/sdbl
+    {
+      base = DEV_SD3_MAJOR;
+      drive -= 48;
+    }
   parse (base, part + (drive * 16));
 }

--- cygwin-1.5.19-4/winsup/cygwin/devices.h     2006-01-16
11:14:35.000000000 -0600
+++ src/winsup/cygwin/devices.h 2006-11-01 19:39:55.398128100 -0600
@@ -65,8 +65,12 @@
 
   DEV_SD_MAJOR = 8,
   DEV_SD1_MAJOR = 65,
+  DEV_SD2_MAJOR = 66,
+  DEV_SD3_MAJOR = 67,
   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_SDA     = FHDEV (DEV_SD_MAJOR, 0),
   FH_SDB     = FHDEV (DEV_SD_MAJOR, 16),
   FH_SDC     = FHDEV (DEV_SD_MAJOR, 32),
@@ -93,6 +97,44 @@
   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_MEM     = FHDEV (1, 1),
   FH_KMEM    = FHDEV (1, 2),   /* not implemented yet */

--- cygwin-1.5.19-4/winsup/cygwin/dtable.cc     2006-01-16
11:14:35.000000000 -0600
+++ src/winsup/cygwin/dtable.cc 2006-11-02 14:05:27.905787600 -0600
@@ -378,6 +378,9 @@
     case DEV_FLOPPY_MAJOR:
     case DEV_CDROM_MAJOR:
     case DEV_SD_MAJOR:
+    case DEV_SD1_MAJOR:
+    case DEV_SD2_MAJOR:
+    case DEV_SD3_MAJOR:
       fh = cnew (fhandler_dev_floppy) ();
       break;
     case DEV_TAPE_MAJOR:

--
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple
Problem reports:       http://cygwin.com/problems.html
Documentation:         http://cygwin.com/docs.html
FAQ:                   http://cygwin.com/faq/


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]