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