~ubuntu-branches/ubuntu/maverick/grub/maverick-updates

« back to all changes in this revision

Viewing changes to debian/patches/grub-xvd_drives.diff

  • Committer: Package Import Robot
  • Author(s): Colin Watson
  • Date: 2011-09-23 22:36:41 UTC
  • Revision ID: package-import@ubuntu.com-20110923223641-78imsw8llmbde34m
Tags: 0.97-29ubuntu60.10.10.1
* Backport from Debian 0.97-39 (LP: #720558):
  - Support for Xen style xvd[a-z] devices.  Thanks Ian Campbell.
    (Closes: #456776)
* Don't use UUIDs for expressing xvd* devices as GRUB drives, as PV-GRUB
  can't handle it.

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
--- a/lib/device.c
 
2
+++ b/lib/device.c
 
3
@@ -395,6 +395,16 @@
 
4
 #endif
 
5
 }
 
6
 
 
7
+static void
 
8
+get_xvd_disk_name (char *name, int unit)
 
9
+{
 
10
+#ifdef __linux__
 
11
+  sprintf (name, "/dev/xvd%c", unit + 'a');
 
12
+#else
 
13
+# warning "Xen XVD drives cannot be guessed in your operating system."
 
14
+  *name = 0;
 
15
+#endif
 
16
+}
 
17
 #ifdef __linux__
 
18
 static void
 
19
 get_dac960_disk_name (char *name, int controller, int drive)
 
20
@@ -770,7 +780,28 @@
 
21
          num_hd++;
 
22
        }
 
23
     }
 
24
-  
 
25
+
 
26
+#ifdef __linux__
 
27
+  /* Xen Virtual Disks. */
 
28
+  for (i = 0; i < 16; i++)
 
29
+    {
 
30
+      char name[16];
 
31
+
 
32
+      get_xvd_disk_name (name, i);
 
33
+      if (check_device (name))
 
34
+        {
 
35
+          (*map)[num_hd + 0x80] = strdup (name);
 
36
+          assert ((*map)[num_hd + 0x80]);
 
37
+
 
38
+          /* If the device map file is opened, write the map.  */
 
39
+          if (fp)
 
40
+            fprintf (fp, "(hd%d)\t%s\n", num_hd, name);
 
41
+
 
42
+          num_hd++;
 
43
+        }
 
44
+    }
 
45
+#endif
 
46
+
 
47
 #ifdef __linux__
 
48
   /* This is for DAC960 - we have
 
49
      /dev/rd/c<controller>d<logical drive>p<partition>.