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

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