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

55 lines
1.5 KiB
Diff

From c3d9e64a61d17e57ef941a6a46e5a148c51c8519 Mon Sep 17 00:00:00 2001
From: Vladimir Serbinenko <phcoder@gmail.com>
Date: Thu, 3 Apr 2014 21:31:12 +0200
Subject: [PATCH 072/140] * grub-core/osdep/linux/getroot.c
(grub_util_part_to_disk): Support NVMe device names.
---
ChangeLog | 5 +++++
grub-core/osdep/linux/getroot.c | 17 +++++++++++++++++
2 files changed, 22 insertions(+)
diff --git a/ChangeLog b/ChangeLog
index accffad..4a48409 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+2014-04-03 Vladimir Serbinenko <phcoder@gmail.com>
+
+ * grub-core/osdep/linux/getroot.c (grub_util_part_to_disk): Support NVMe
+ device names.
+
2014-03-31 Thomas Falcon <tlfalcon@linux.vnet.ibm.com>
btrfs: fix get_root key comparison failures due to endianness
diff --git a/grub-core/osdep/linux/getroot.c b/grub-core/osdep/linux/getroot.c
index 19581d3..7007193 100644
--- a/grub-core/osdep/linux/getroot.c
+++ b/grub-core/osdep/linux/getroot.c
@@ -896,6 +896,23 @@ grub_util_part_to_disk (const char *os_dev, struct stat *st,
*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;
--
1.9.3