Blame SOURCES/0072-grub-core-osdep-linux-getroot.c-grub_util_part_to_di.patch

a85e8e
From 07122fa30773a0668180fd187989477421235afa Mon Sep 17 00:00:00 2001
a85e8e
From: Vladimir Serbinenko <phcoder@gmail.com>
a85e8e
Date: Thu, 3 Apr 2014 21:31:12 +0200
a85e8e
Subject: [PATCH 072/260] * grub-core/osdep/linux/getroot.c
a85e8e
 (grub_util_part_to_disk): Support NVMe device names.
a85e8e
a85e8e
---
a85e8e
 ChangeLog                       |  5 +++++
a85e8e
 grub-core/osdep/linux/getroot.c | 17 +++++++++++++++++
a85e8e
 2 files changed, 22 insertions(+)
a85e8e
a85e8e
diff --git a/ChangeLog b/ChangeLog
a85e8e
index accffade8..4a484092a 100644
a85e8e
--- a/ChangeLog
a85e8e
+++ b/ChangeLog
a85e8e
@@ -1,3 +1,8 @@
a85e8e
+2014-04-03  Vladimir Serbinenko  <phcoder@gmail.com>
a85e8e
+
a85e8e
+	* grub-core/osdep/linux/getroot.c (grub_util_part_to_disk): Support NVMe
a85e8e
+	device names.
a85e8e
+
a85e8e
 2014-03-31  Thomas Falcon <tlfalcon@linux.vnet.ibm.com>
a85e8e
 
a85e8e
 	btrfs: fix get_root key comparison failures due to endianness
a85e8e
diff --git a/grub-core/osdep/linux/getroot.c b/grub-core/osdep/linux/getroot.c
a85e8e
index 19581d329..7007193d9 100644
a85e8e
--- a/grub-core/osdep/linux/getroot.c
a85e8e
+++ b/grub-core/osdep/linux/getroot.c
a85e8e
@@ -896,6 +896,23 @@ grub_util_part_to_disk (const char *os_dev, struct stat *st,
a85e8e
 	  *pp = '\0';
a85e8e
 	  return path;
a85e8e
 	}
a85e8e
+
a85e8e
+      /* If this is a NVMe device */
a85e8e
+      if ((strncmp ("nvme", p, 4) == 0) && p[4] >= '0' && p[4] <= '9')
a85e8e
+	{
a85e8e
+	  char *pp = p + 4;
a85e8e
+	  while (*pp >= '0' && *pp <= '9')
a85e8e
+	    pp++;
a85e8e
+	  if (*pp == 'n')
a85e8e
+	    pp++;
a85e8e
+	  while (*pp >= '0' && *pp <= '9')
a85e8e
+	    pp++;
a85e8e
+	  if (*pp == 'p')
a85e8e
+	    *is_part = 1;
a85e8e
+	  /* /dev/nvme[0-9]+n[0-9]+p[0-9]* */
a85e8e
+	  *pp = '\0';
a85e8e
+	  return path;
a85e8e
+	}
a85e8e
     }
a85e8e
 
a85e8e
   return path;
a85e8e
-- 
a85e8e
2.13.0
a85e8e