On Tue, May 06, 2008 at 02:32:38PM -0700, Roland Dreier wrote:
> [ARGH!! sent to the wrong bug, sorry!!]

It's okay ;-)

> (The "Duplicated entry" error seems to be an unrelated buglet caused by
> grub-probe not discarding the previous map[] contents when regenerating
> device.map)

Ugh.  That deserves a new bug I think.  Could you file it as a reminder?

> I guess a change to get_os_disk() like the below is needed too?
> update-grub seems to work with your patch plus this change.

Ok, here's a complete patch.  Can you confirm this one is good?

-- 
Robert Millan

<GPLv2> I know my rights; I want my phone call!
<DRM> What use is a phone call… if you are unable to speak?
(as seen on /.)
diff -x configure -x config.h.in -x CVS -x '*~' -x '*.mk' -urp ../grub2/util/biosdisk.c ./util/biosdisk.c
--- ../grub2/util/biosdisk.c	2008-04-07 18:45:01.000000000 +0200
+++ ./util/biosdisk.c	2008-05-07 16:27:47.000000000 +0200
@@ -233,7 +233,7 @@ linux_find_partition (char *dev, unsigne
       p = real_dev + 8;
       format = "%d";
     }
-  else if (strncmp (real_dev + 5, "rd/c", 4) == 0)
+  else if (strncmp (real_dev + 5, "rd/c", 4) == 0)	/* dac960 */
     {
       p = strchr (real_dev + 9, 'd');
       if (! p)
@@ -245,6 +245,18 @@ linux_find_partition (char *dev, unsigne
 
       format = "p%d";
     }
+  else if (strncmp (real_dev + 5, "cciss/c", sizeof("cciss/c")-1) == 0)
+    {
+      p = strchr (real_dev + 5 + sizeof("cciss/c")-1, 'd');
+      if (! p)
+	return 0;
+
+      p++;
+      while (*p && isdigit (*p))
+	p++;
+
+      format = "p%d";
+    }
   else
     return 0;
 
@@ -645,6 +657,17 @@ get_os_disk (const char *os_dev)
 	  return path;
 	}
       
+      /* If this is a CCISS disk.  */
+      if (strncmp ("cciss/c", p, sizeof ("cciss/c") - 1) == 0)
+	{
+	  /* /dev/cciss/c[0-9]+d[0-9]+(p[0-9]+)? */
+	  p = strchr (p, 'p');
+	  if (p)
+	    *p = '\0';
+
+	  return path;
+	}
+      
       /* If this is an IDE disk or a SCSI disk.  */
       if ((strncmp ("hd", p, 2) == 0
 	   || strncmp ("sd", p, 2) == 0)
diff -x configure -x config.h.in -x CVS -x '*~' -x '*.mk' -urp ../grub2/util/grub-mkdevicemap.c ./util/grub-mkdevicemap.c
--- ../grub2/util/grub-mkdevicemap.c	2008-05-06 12:10:08.000000000 +0200
+++ ./util/grub-mkdevicemap.c	2008-05-07 16:26:34.000000000 +0200
@@ -283,6 +283,12 @@ get_i2o_disk_name (char *name, char unit
 {
   sprintf (name, "/dev/i2o/hd%c", unit);
 }
+
+static void
+get_cciss_disk_name (char *name, int controller, int drive)
+{
+  sprintf (name, "/dev/cciss/c%dd%d", controller, drive);
+}
 #endif
 
 /* Check if DEVICE can be read. If an error occurs, return zero,
@@ -504,6 +510,30 @@ make_device_map (const char *device_map,
       }
   }
     
+  /* This is for CCISS - we have
+     /dev/cciss/c<controller>d<logical drive>p<partition>.  */
+  {
+    int controller, drive;
+    
+    for (controller = 0; controller < 3; controller++)
+      {
+	for (drive = 0; drive < 10; drive++)
+	  {
+	    char name[24];
+	    
+	    get_cciss_disk_name (name, controller, drive);
+	    if (check_device (name))
+	      {
+		char *p;
+		p = grub_util_get_disk_name (num_hd, name);
+		fprintf (fp, "(%s)\t%s\n", p, name);
+		free (p);
+		num_hd++;
+	      }
+	  }
+      }
+  }
+    
   /* This is for I2O - we have /dev/i2o/hd<logical drive><partition> */
   {
     char unit;

Reply via email to