File grub2-getroot-support-NVMe-device-names.patch of Package grub2.2117

From 9706066791b994a55fb2d3d532a86aa1fde2a457 Mon Sep 17 00:00:00 2001
From: Vladimir Serbinenko <phcoder@gmail.com>
Date: Thu, 3 Apr 2014 21:31:12 +0200
Subject: [PATCH] * grub-core/osdep/linux/getroot.c (grub_util_part_to_disk): Support NVMe device names.
References: bnc#873132

---

Index: grub-2.02~beta2/grub-core/osdep/linux/getroot.c
===================================================================
--- grub-2.02~beta2.orig/grub-core/osdep/linux/getroot.c
+++ grub-2.02~beta2/grub-core/osdep/linux/getroot.c
@@ -883,6 +883,23 @@ grub_util_part_to_disk (const char *os_d
 	  *pp = '\0';
 	  return path;
 	}
+
+      /* If this is a NVMe device */
+      if ((strncmp ("nvme", p, 4) == 0) && p[4] >= '0' && p[4] <= '9')
+	{
+	  char *pp = p + 4;
+	  while (*pp >= '0' && *pp <= '9')
+	    pp++;
+	  if (*pp == 'n')
+	    pp++;
+	  while (*pp >= '0' && *pp <= '9')
+	    pp++;
+	  if (*pp == 'p')
+	    *is_part = 1;
+	  /* /dev/nvme[0-9]+n[0-9]+p[0-9]* */
+	  *pp = '\0';
+	  return path;
+	}
     }
 
   return path;