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