1 Star 0 Fork 98

yu_boyun/grub2

forked from src-openEuler/grub2 
加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
该仓库未声明开源许可证文件(LICENSE),使用请关注具体项目描述及其代码上游依赖。
克隆/下载
0051-Add-grub_util_readlink.patch 2.61 KB
一键复制 编辑 原始数据 按行查看 历史
hanzj0122_admin 提交于 2020-07-29 20:47 . update to 2.04
From a2099170d2f7e9cca6a743c15b6cb649b88fd873 Mon Sep 17 00:00:00 2001
From: Peter Jones <[email protected]>
Date: Mon, 8 Jul 2019 21:46:52 +0200
Subject: [PATCH 051/220] Add grub_util_readlink()
Add grub_util_readlink(). This requires pulling in stat and readlink from
gnulib, which pulls in stat and related headers, but after that the
implementation is straightforward.
Signed-off-by: Peter Jones <[email protected]>
Reviewed-by: Adam Jackson <[email protected]>
---
grub-core/osdep/windows/hostdisk.c | 6 ++++++
include/grub/osdep/hostfile_aros.h | 6 ++++++
include/grub/osdep/hostfile_unix.h | 6 ++++++
include/grub/osdep/hostfile_windows.h | 2 ++
4 files changed, 20 insertions(+)
diff --git a/grub-core/osdep/windows/hostdisk.c b/grub-core/osdep/windows/hostdisk.c
index 3551007..87a106c 100644
--- a/grub-core/osdep/windows/hostdisk.c
+++ b/grub-core/osdep/windows/hostdisk.c
@@ -365,6 +365,12 @@ grub_util_mkdir (const char *dir)
free (windows_name);
}
+ssize_t
+grub_util_readlink (const char *name, char *buf, size_t bufsize)
+{
+ return readlink(name, buf, bufsize);
+}
+
int
grub_util_rename (const char *from, const char *to)
{
diff --git a/include/grub/osdep/hostfile_aros.h b/include/grub/osdep/hostfile_aros.h
index a059c0f..161fbb7 100644
--- a/include/grub/osdep/hostfile_aros.h
+++ b/include/grub/osdep/hostfile_aros.h
@@ -68,6 +68,12 @@ grub_util_rename (const char *from, const char *to)
return rename (from, to);
}
+static inline ssize_t
+grub_util_readlink (const char *name, char *buf, size_t bufsize)
+{
+ return readlink(name, buf, bufsize);
+}
+
#define grub_util_mkdir(a) mkdir ((a), 0755)
struct grub_util_fd
diff --git a/include/grub/osdep/hostfile_unix.h b/include/grub/osdep/hostfile_unix.h
index 9ffe46f..17cd3aa 100644
--- a/include/grub/osdep/hostfile_unix.h
+++ b/include/grub/osdep/hostfile_unix.h
@@ -71,6 +71,12 @@ grub_util_rename (const char *from, const char *to)
return rename (from, to);
}
+static inline ssize_t
+grub_util_readlink (const char *name, char *buf, size_t bufsize)
+{
+ return readlink(name, buf, bufsize);
+}
+
#define grub_util_mkdir(a) mkdir ((a), 0755)
#if defined (__NetBSD__)
diff --git a/include/grub/osdep/hostfile_windows.h b/include/grub/osdep/hostfile_windows.h
index bf6451b..8c92d05 100644
--- a/include/grub/osdep/hostfile_windows.h
+++ b/include/grub/osdep/hostfile_windows.h
@@ -41,6 +41,8 @@ typedef struct grub_util_fd_dir *grub_util_fd_dir_t;
int
grub_util_rename (const char *from, const char *to);
+ssize_t
+grub_util_readlink (const char *name, char *buf, size_t bufsize);
int
grub_util_unlink (const char *name);
void
--
1.8.3.1
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
1
https://gitee.com/yu_boyun/grub2.git
[email protected]:yu_boyun/grub2.git
yu_boyun
grub2
grub2
master

搜索帮助