2018-07-12 14:56:34 +00:00
|
|
|
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
2014-09-03 17:10:57 +00:00
|
|
|
From: Peter Jones <pjones@redhat.com>
|
2019-08-15 06:01:31 +00:00
|
|
|
Date: Mon, 8 Jul 2019 21:46:52 +0200
|
2018-07-10 18:39:10 +00:00
|
|
|
Subject: [PATCH] Add grub_util_readlink()
|
2014-09-03 17:10:57 +00:00
|
|
|
|
|
|
|
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 <pjones@redhat.com>
|
|
|
|
Reviewed-by: Adam Jackson <ajax@redhat.com>
|
|
|
|
---
|
2019-08-15 06:01:31 +00:00
|
|
|
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(+)
|
2014-09-03 17:10:57 +00:00
|
|
|
|
2018-02-27 18:56:41 +00:00
|
|
|
diff --git a/grub-core/osdep/windows/hostdisk.c b/grub-core/osdep/windows/hostdisk.c
|
2019-08-15 06:01:31 +00:00
|
|
|
index 355100789a7..87a106c9b82 100644
|
2018-02-27 18:56:41 +00:00
|
|
|
--- a/grub-core/osdep/windows/hostdisk.c
|
|
|
|
+++ b/grub-core/osdep/windows/hostdisk.c
|
2019-08-15 06:01:31 +00:00
|
|
|
@@ -365,6 +365,12 @@ grub_util_mkdir (const char *dir)
|
2018-02-27 18:56:41 +00:00
|
|
|
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)
|
|
|
|
{
|
2014-09-03 17:10:57 +00:00
|
|
|
diff --git a/include/grub/osdep/hostfile_aros.h b/include/grub/osdep/hostfile_aros.h
|
2018-02-27 18:56:41 +00:00
|
|
|
index a059c0fa40a..161fbb7bdfd 100644
|
2014-09-03 17:10:57 +00:00
|
|
|
--- 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
|
2018-02-27 18:56:41 +00:00
|
|
|
index 9ffe46fa3ca..17cd3aa8b30 100644
|
2014-09-03 17:10:57 +00:00
|
|
|
--- 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
|
2018-02-27 18:56:41 +00:00
|
|
|
index bf6451b6db4..8c92d0591bb 100644
|
2014-09-03 17:10:57 +00:00
|
|
|
--- 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
|