File grub-0.97-bz814014-Scan-for-virtio-disks.patch of Package grub

From c51925a16a5b12caf27e6d46b256cbeb51d233fe Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?V=C3=A1clav=20Pavl=C3=ADn?= <vpavlin@redhat.com>
Date: Tue, 9 Oct 2012 09:57:10 +0200
Subject: [PATCH 1/3] bz#814014 Scan for virtio disks

---
 lib/device.c | 25 +++++++++++++++++++++++++
 1 file changed, 25 insertions(+)

diff --git a/lib/device.c b/lib/device.c
index 45e4001..ab5b943 100644
--- a/lib/device.c
+++ b/lib/device.c
@@ -568,6 +568,12 @@ get_i2o_disk_name (char *name, int unit)
 {
   sprintf (name, "/dev/i2o/hd%c", unit + 'a');
 }
+
+static void
+get_vd_disk_name (char *name, int unit)
+{
+  sprintf (name, "/dev/vd%c", unit + 'a');
+}
 #endif
 
 /* Check if DEVICE can be read. If an error occurs, return zero,
@@ -908,6 +914,25 @@ init_device_map (char ***map, const char *map_file, int floppy_disks)
           num_hd++;
         }
     }
+
+  /* KVM vd* disks.  */
+  for (i = 0; i < 16; i++)
+    {
+      char name[16];
+
+      get_vd_disk_name (name, i);
+      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__ */
 
   /* The rest is SCSI disks.  */
-- 
1.7.11.4

openSUSE Build Service is sponsored by