]> git.ipfire.org Git - thirdparty/grub.git/commitdiff
2008-05-09 Robert Millan <rmh@aybabtu.com>
authorrobertmh <robertmh@localhost>
Fri, 9 May 2008 12:13:03 +0000 (12:13 +0000)
committerrobertmh <robertmh@localhost>
Fri, 9 May 2008 12:13:03 +0000 (12:13 +0000)
        * util/biosdisk.c (linux_find_partition, get_os_disk): Handle Virtio
        devices.
        * util/grub-mkdevicemap.c (get_virtio_disk_name)
        (make_device_map): Likewise.
        Reported by Aurelien Jarno <aurel32@debian.org>

ChangeLog
util/biosdisk.c
util/grub-mkdevicemap.c

index 6a8e341c87698abd468cf8cf725994dab215ee55..eb26bb11dbbb5ed520cd16a6b450a35c6acb9899 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,11 @@
+2008-05-09  Robert Millan  <rmh@aybabtu.com>
+
+       * util/biosdisk.c (linux_find_partition, get_os_disk): Handle Virtio
+       devices.
+       * util/grub-mkdevicemap.c (get_virtio_disk_name)
+       (make_device_map): Likewise.
+       Reported by Aurelien Jarno <aurel32@debian.org>
+
 2008-05-07  Ian Campbell  <ijc@hellion.org.uk>
 
        * util/biosdisk.c (get_os_disk): Recognise xvd type disks.
index c4ee7c14a335a0e84726941704914626429fd8fb..fcf01a4976459ad003efd26f7849512a4b1889d3 100644 (file)
@@ -227,6 +227,7 @@ linux_find_partition (char *dev, unsigned long sector)
       format = "part%d";
     }
   else if ((strncmp (real_dev + 5, "hd", 2) == 0
+           || strncmp (real_dev + 5, "vd", 2) == 0
            || strncmp (real_dev + 5, "sd", 2) == 0)
           && real_dev[7] >= 'a' && real_dev[7] <= 'z')
     {
@@ -668,12 +669,13 @@ get_os_disk (const char *os_dev)
          return path;
        }
       
-      /* If this is an IDE disk or a SCSI disk.  */
+      /* If this is an IDE, SCSI or Virtio disk.  */
       if ((strncmp ("hd", p, 2) == 0
+          || strncmp ("vd", p, 2) == 0
           || strncmp ("sd", p, 2) == 0)
          && p[2] >= 'a' && p[2] <= 'z')
        {
-         /* /dev/[hs]d[a-z][0-9]* */
+         /* /dev/[hsv]d[a-z][0-9]* */
          p[3] = '\0';
          return path;
        }
index 19d6747bfb8e68e48814d2d30f908b46e8725a08..d24d844163ae47171b9198416c1069d3a567a043 100644 (file)
@@ -266,6 +266,12 @@ get_scsi_disk_name (char *name, int unit)
 }
 
 #ifdef __linux__
+static void
+get_virtio_disk_name (char *name, int unit)
+{
+  sprintf (name, "/dev/vd%c", unit + 'a');
+}
+
 static void
 get_dac960_disk_name (char *name, int controller, int drive)
 {
@@ -455,6 +461,22 @@ make_device_map (const char *device_map, int floppy_disks)
     }
   
 #ifdef __linux__
+  /* Virtio disks.  */
+  for (i = 0; i < 20; i++)
+    {
+      char name[16];
+      
+      get_virtio_disk_name (name, i);
+      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++;
+       }
+    }
+  
   /* ATARAID disks.  */
   for (i = 0; i < 8; i++)
     {