Bug#261447: grub does not detect CCISS devices

Horms Horms <horms@debian.org>, 261447@bugs.debian.org
Mon, 26 Jul 2004 11:47:07 +0900


This is a multi-part MIME message sent by reportbug.

--===============1512714000==
Content-Type: text/plain; charset="us-ascii"
MIME-Version: 1.0
Content-Transfer-Encoding: 7bit
Content-Disposition: inline

Package: grub
Version: 0.95+cvs20040624-4
Severity: important
Tags: patch

Grub does not seem to be able to detect CCISS raid devices.
The attached patch resolves this problem. I have sumbitted it
upstream.

-- System Information:
Debian Release: testing/unstable
  APT prefers unstable
  APT policy: (500, 'unstable')
Architecture: i386 (i686)
Kernel: Linux 2.4.26-1-686
Locale: LANG=C, LC_CTYPE=ja_JP.eucJP

Versions of packages grub depends on:
ii  libc6                       2.3.2.ds1-13 GNU C Library: Shared libraries an
ii  libncurses5                 5.4-4        Shared libraries for terminal hand

-- no debconf information

--===============1512714000==
Content-Type: text/x-c; charset="us-ascii"
MIME-Version: 1.0
Content-Transfer-Encoding: 7bit
Content-Disposition: attachment; filename="grub-cvs.200407260-cciss.patch"

? util/grub-set-default
Index: lib/device.c
===================================================================
RCS file: /cvsroot/grub/grub/lib/device.c,v
retrieving revision 1.24
diff -u -r1.24 device.c
--- grub/lib/device.c	23 May 2004 16:45:35 -0000	1.24
+++ grub/lib/device.c	26 Jul 2004 00:57:20 -0000
@@ -403,6 +403,12 @@
 }
 
 static void
+get_cciss_disk_name (char *name, int controller, int drive)
+{
+  sprintf (name, "/dev/cciss/c%dd%d", controller, drive);
+}
+
+static void
 get_ataraid_disk_name (char *name, int unit)
 {
   sprintf (name, "/dev/ataraid/d%c", unit + '0');
@@ -798,6 +804,40 @@
 	  }
       }
   }
+
+  /* This is for CCISS, its like the DAC960  - we have
+     /dev/cciss/<controller>d<logical drive>p<partition> 
+
+     It currently supports up to 3 controllers, 10 logical volumes
+     and 10 partitions
+
+     Code gratuitously copied from DAC960 above.
+     Horms <horms@verge.net.au> 23rd July 2004
+  */
+  {
+    int controller, drive;
+    
+    for (controller = 0; controller < 2; controller++)
+      {
+	for (drive = 0; drive < 9; drive++)
+	  {
+	    char name[24];
+	    
+	    get_cciss_disk_name (name, controller, drive);
+	    if (check_device (name))
+	      {
+		(*map)[num_hd + 0x80] = strdup (name);
+		assert ((*map)[num_hd + 0x80]);
+		
+		/* If the device map file is opened, write the map.  */
+		if (fp)
+		  fprintf (fp, "(hd%d)\t%s\n", num_hd, name);
+		
+		num_hd++;
+	      }
+	  }
+      }
+  }
 #endif /* __linux__ */
   
   /* OK, close the device map file if opened.  */

--===============1512714000==--