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