File: probe-fusionio.patch

package info (click to toggle)
grub2 2.12-9
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie, trixie-proposed-updates, trixie-updates
  • size: 70,780 kB
  • sloc: ansic: 424,740; asm: 16,228; sh: 9,525; cpp: 2,095; makefile: 1,590; python: 1,468; sed: 431; lex: 393; yacc: 268; awk: 85; lisp: 54; perl: 31
file content (75 lines) | stat: -rw-r--r-- 1,863 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
From: Colin Watson <cjwatson@ubuntu.com>
Date: Mon, 13 Jan 2014 12:13:31 +0000
Subject: Probe FusionIO devices

Bug-Ubuntu: https://bugs.launchpad.net/bugs/1237519
Forwarded: no
Last-Update: 2016-09-18

Patch-Name: probe-fusionio.patch
---
 grub-core/osdep/linux/getroot.c | 13 +++++++++++++
 util/deviceiter.c               | 19 +++++++++++++++++++
 2 files changed, 32 insertions(+)

diff --git a/grub-core/osdep/linux/getroot.c b/grub-core/osdep/linux/getroot.c
index 7dd775d..b4e279f 100644
--- a/grub-core/osdep/linux/getroot.c
+++ b/grub-core/osdep/linux/getroot.c
@@ -960,6 +960,19 @@ grub_util_part_to_disk (const char *os_dev, struct stat *st,
 	  *pp = '\0';
 	  return path;
 	}
+
+      /* If this is a FusionIO disk.  */
+      if ((strncmp ("fio", p, 3) == 0) && p[3] >= 'a' && p[3] <= 'z')
+	{
+	  char *pp = p + 3;
+	  while (*pp >= 'a' && *pp <= 'z')
+	    pp++;
+	  if (*pp)
+	    *is_part = 1;
+	  /* /dev/fio[a-z]+[0-9]* */
+	  *pp = '\0';
+	  return path;
+	}
     }
 
   return path;
diff --git a/util/deviceiter.c b/util/deviceiter.c
index b5b9ac6..3a8f277 100644
--- a/util/deviceiter.c
+++ b/util/deviceiter.c
@@ -384,6 +384,12 @@ get_nvme_disk_name (char *name, int controller, int namespace)
 {
   sprintf (name, "/dev/nvme%dn%d", controller, namespace);
 }
+
+static void
+get_fio_disk_name (char *name, int unit)
+{
+  sprintf (name, "/dev/fio%c", unit + 'a');
+}
 #endif
 
 static struct seen_device
@@ -929,6 +935,19 @@ grub_util_iterate_devices (int (*hook) (const char *, int, void *), void *hook_d
       }
   }
 
+  /* FusionIO.  */
+  for (i = 0; i < 26; i++)
+    {
+      char name[16];
+
+      get_fio_disk_name (name, i);
+      if (check_device_readable_unique (name))
+	{
+	  if (hook (name, 0, hook_data))
+	    goto out;
+	}
+    }
+
 # ifdef HAVE_DEVICE_MAPPER
 #  define dmraid_check(cond, ...) \
   if (! (cond)) \