1 Star 0 Fork 16

jackzhao166/grub2

forked from OpenCloudOS Stream/grub2 
加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
该仓库未声明开源许可证文件(LICENSE),使用请关注具体项目描述及其代码上游依赖。
克隆/下载
0026-Fix-grub2-mkconfig-warning-when-disk-is-LVM-PV.patch 1.35 KB
一键复制 编辑 原始数据 按行查看 历史
nilusyi 提交于 2024-04-07 16:45 . update patches
From a9836b9de95ae05f5d057746dea0d052d8fabaa4 Mon Sep 17 00:00:00 2001
From: Michael Chang <mchang@suse.com>
Date: Mon, 1 Apr 2024 15:41:03 +0800
Subject: [PATCH 026/272] Fix grub2-mkconfig warning when disk is LVM PV
When a disk device was found in grub_util_biosdisk_get_grub_dev, its grub
hostdisk device name just returned. Since the disk could also be used as PV
disk, use grub_util_get_ldm to kick scanning of on disk metadata and adding it
to VG array.
---
util/getroot.c | 20 ++++++++++++++++++++
1 file changed, 20 insertions(+)
diff --git a/util/getroot.c b/util/getroot.c
index 75a7d5f21..e42e945ff 100644
--- a/util/getroot.c
+++ b/util/getroot.c
@@ -272,8 +272,28 @@ grub_util_biosdisk_get_grub_dev (const char *os_dev)
grub_util_info ("%s is a parent of %s", sys_disk, os_dev);
if (!is_part)
{
+#if defined(__APPLE__)
free (sys_disk);
return make_device_name (drive);
+#else
+ char *name, *ldm_name;
+ grub_disk_t disk;
+
+ free (sys_disk);
+ name = make_device_name (drive);
+ disk = grub_disk_open (name);
+ if (!disk)
+ return name;
+ ldm_name = grub_util_get_ldm (disk, 0);
+ if (ldm_name)
+ {
+ grub_disk_close (disk);
+ grub_free (name);
+ return ldm_name;
+ }
+ grub_disk_close (disk);
+ return name;
+#endif
}
free (sys_disk);
--
2.41.0
Loading...
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
1
https://gitee.com/jackzhao166/grub2.git
git@gitee.com:jackzhao166/grub2.git
jackzhao166
grub2
grub2
master

搜索帮助