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

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