2018-04-03 17:41:24 +00:00
|
|
|
From 39976a692a9350b1293f209953426830ddde2ad6 Mon Sep 17 00:00:00 2001
|
2014-07-02 15:49:28 +00:00
|
|
|
From: Peter Jones <pjones@redhat.com>
|
|
|
|
Date: Tue, 18 Feb 2014 11:34:00 -0500
|
2018-04-03 17:41:24 +00:00
|
|
|
Subject: [PATCH 114/216] Fix convert function to support NVMe devices
|
2014-07-02 15:49:28 +00:00
|
|
|
|
|
|
|
This is adapted from the patch at
|
|
|
|
https://bugzilla.redhat.com/show_bug.cgi?id=1019660 , which is against
|
|
|
|
the now very old version of convert_system_partition_to_system_disk().
|
|
|
|
|
|
|
|
As such, it certainly not the right thing for upstream, but should
|
|
|
|
function for now.
|
|
|
|
|
|
|
|
Resolves: rhbz#1019660
|
|
|
|
|
|
|
|
Signed-off-by: Peter Jones <grub2-owner@fedoraproject.org>
|
|
|
|
---
|
|
|
|
util/getroot.c | 19 +++++++++++++++++++
|
|
|
|
1 file changed, 19 insertions(+)
|
|
|
|
|
|
|
|
diff --git a/util/getroot.c b/util/getroot.c
|
2018-02-27 18:56:41 +00:00
|
|
|
index 847406fbab0..fa3460d6cd8 100644
|
2014-07-02 15:49:28 +00:00
|
|
|
--- a/util/getroot.c
|
|
|
|
+++ b/util/getroot.c
|
2015-07-22 13:44:51 +00:00
|
|
|
@@ -153,6 +153,7 @@ convert_system_partition_to_system_disk (const char *os_dev, int *is_part)
|
2014-07-02 15:49:28 +00:00
|
|
|
{
|
|
|
|
#if GRUB_UTIL_FD_STAT_IS_FUNCTIONAL
|
|
|
|
struct stat st;
|
|
|
|
+ char *path = xmalloc(PATH_MAX);
|
|
|
|
|
|
|
|
if (stat (os_dev, &st) < 0)
|
|
|
|
{
|
2015-07-22 13:44:51 +00:00
|
|
|
@@ -165,6 +166,24 @@ convert_system_partition_to_system_disk (const char *os_dev, int *is_part)
|
2014-07-02 15:49:28 +00:00
|
|
|
|
|
|
|
*is_part = 0;
|
|
|
|
|
|
|
|
+ if (realpath(os_dev, path))
|
|
|
|
+ {
|
|
|
|
+ if ((strncmp ("/dev/nvme", path, 9) == 0))
|
|
|
|
+ {
|
|
|
|
+ char *p = path + 5;
|
|
|
|
+ p = strchr(p, 'p');
|
|
|
|
+ if (p)
|
|
|
|
+ {
|
|
|
|
+ *is_part = 1;
|
|
|
|
+ *p = '\0';
|
|
|
|
+ }
|
|
|
|
+ return path;
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ grub_free (path);
|
|
|
|
+ *is_part = 0;
|
|
|
|
+
|
|
|
|
if (grub_util_device_is_mapped_stat (&st))
|
|
|
|
return grub_util_devmapper_part_to_disk (&st, is_part, os_dev);
|
|
|
|
|
|
|
|
--
|
2018-02-27 18:56:41 +00:00
|
|
|
2.15.0
|
2014-07-02 15:49:28 +00:00
|
|
|
|