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

23d2ea
From 07122fa30773a0668180fd187989477421235afa Mon Sep 17 00:00:00 2001
39700a
From: Vladimir Serbinenko <phcoder@gmail.com>
39700a
Date: Thu, 3 Apr 2014 21:31:12 +0200
27a4da
Subject: [PATCH 072/260] * 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
27a4da
index accffade8..4a484092a 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
27a4da
index 19581d329..7007193d9 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
-- 
27a4da
2.13.0
39700a