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

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