|
|
a85e8e |
From 5e1b45be24a3614eb8ce083e06c71a1f651b5ae7 Mon Sep 17 00:00:00 2001
|
|
|
a85e8e |
From: Peter Jones <pjones@redhat.com>
|
|
|
a85e8e |
Date: Tue, 18 Feb 2014 11:34:00 -0500
|
|
|
a85e8e |
Subject: [PATCH 134/260] Fix convert function to support NVMe devices
|
|
|
a85e8e |
|
|
|
a85e8e |
This is adapted from the patch at
|
|
|
a85e8e |
https://bugzilla.redhat.com/show_bug.cgi?id=1019660 , which is against
|
|
|
a85e8e |
the now very old version of convert_system_partition_to_system_disk().
|
|
|
a85e8e |
|
|
|
a85e8e |
As such, it certainly not the right thing for upstream, but should
|
|
|
a85e8e |
function for now.
|
|
|
a85e8e |
|
|
|
a85e8e |
Resolves: rhbz#1019660
|
|
|
a85e8e |
|
|
|
a85e8e |
Signed-off-by: Peter Jones <grub2-owner@fedoraproject.org>
|
|
|
a85e8e |
---
|
|
|
a85e8e |
util/getroot.c | 19 +++++++++++++++++++
|
|
|
a85e8e |
1 file changed, 19 insertions(+)
|
|
|
a85e8e |
|
|
|
a85e8e |
diff --git a/util/getroot.c b/util/getroot.c
|
|
|
a85e8e |
index 3958105d8..e70061099 100644
|
|
|
a85e8e |
--- a/util/getroot.c
|
|
|
a85e8e |
+++ b/util/getroot.c
|
|
|
a85e8e |
@@ -152,6 +152,7 @@ convert_system_partition_to_system_disk (const char *os_dev, int *is_part)
|
|
|
a85e8e |
{
|
|
|
a85e8e |
#if GRUB_UTIL_FD_STAT_IS_FUNCTIONAL
|
|
|
a85e8e |
struct stat st;
|
|
|
a85e8e |
+ char *path = xmalloc(PATH_MAX);
|
|
|
a85e8e |
|
|
|
a85e8e |
if (stat (os_dev, &st) < 0)
|
|
|
a85e8e |
{
|
|
|
a85e8e |
@@ -164,6 +165,24 @@ convert_system_partition_to_system_disk (const char *os_dev, int *is_part)
|
|
|
a85e8e |
|
|
|
a85e8e |
*is_part = 0;
|
|
|
a85e8e |
|
|
|
a85e8e |
+ if (realpath(os_dev, path))
|
|
|
a85e8e |
+ {
|
|
|
a85e8e |
+ if ((strncmp ("/dev/nvme", path, 9) == 0))
|
|
|
a85e8e |
+ {
|
|
|
a85e8e |
+ char *p = path + 5;
|
|
|
a85e8e |
+ p = strchr(p, 'p');
|
|
|
a85e8e |
+ if (p)
|
|
|
a85e8e |
+ {
|
|
|
a85e8e |
+ *is_part = 1;
|
|
|
a85e8e |
+ *p = '\0';
|
|
|
a85e8e |
+ }
|
|
|
a85e8e |
+ return path;
|
|
|
a85e8e |
+ }
|
|
|
a85e8e |
+ }
|
|
|
a85e8e |
+
|
|
|
a85e8e |
+ grub_free (path);
|
|
|
a85e8e |
+ *is_part = 0;
|
|
|
a85e8e |
+
|
|
|
a85e8e |
if (grub_util_device_is_mapped_stat (&st))
|
|
|
a85e8e |
return grub_util_devmapper_part_to_disk (&st, is_part, os_dev);
|
|
|
a85e8e |
|
|
|
a85e8e |
--
|
|
|
a85e8e |
2.13.0
|
|
|
a85e8e |
|