grub2/0057-Fix-big-endian-mtime.patch
2013-05-02 16:54:52 -04:00

80 lines
2.2 KiB
Diff

From 32776fea2049a8b8198fdd59d49e18b4f8916d28 Mon Sep 17 00:00:00 2001
From: Vladimir 'phcoder' Serbinenko <phcoder@gmail.com>
Date: Sat, 8 Dec 2012 21:14:08 +0100
Subject: [PATCH 057/364] Fix big-endian mtime.
* grub-core/fs/ufs.c (grub_ufs_inode): Split improperly attached
together sec and usec.
(grub_ufs_dir): Use correct byteswapping for UFS time.
---
ChangeLog | 8 ++++++++
grub-core/fs/ufs.c | 19 +++++++++++++------
2 files changed, 21 insertions(+), 6 deletions(-)
diff --git a/ChangeLog b/ChangeLog
index d565547..9c6dde5 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,13 @@
2012-12-08 Vladimir Serbinenko <phcoder@gmail.com>
+ Fix big-endian mtime.
+
+ * grub-core/fs/ufs.c (grub_ufs_inode): Split improperly attached
+ together sec and usec.
+ (grub_ufs_dir): Use correct byteswapping for UFS time.
+
+2012-12-08 Vladimir Serbinenko <phcoder@gmail.com>
+
Support big-endian UFS1.
* Makefile.util.def (libgrubmods): Add ufs_be.c
diff --git a/grub-core/fs/ufs.c b/grub-core/fs/ufs.c
index 3f2dba1..c862336 100644
--- a/grub-core/fs/ufs.c
+++ b/grub-core/fs/ufs.c
@@ -151,9 +151,9 @@ struct grub_ufs_inode
grub_uint64_t mtime;
grub_uint64_t ctime;
grub_uint64_t create_time;
- grub_uint32_t atime_sec;
- grub_uint32_t mtime_sec;
- grub_uint32_t ctime_sec;
+ grub_uint32_t atime_usec;
+ grub_uint32_t mtime_usec;
+ grub_uint32_t ctime_usec;
grub_uint32_t create_time_sec;
grub_uint32_t gen;
grub_uint32_t kernel_flags;
@@ -181,9 +181,12 @@ struct grub_ufs_inode
grub_uint16_t uid;
grub_uint16_t gid;
grub_uint64_t size;
- grub_uint64_t atime;
- grub_uint64_t mtime;
- grub_uint64_t ctime;
+ grub_uint32_t atime;
+ grub_uint32_t atime_usec;
+ grub_uint32_t mtime;
+ grub_uint32_t mtime_usec;
+ grub_uint32_t ctime;
+ grub_uint32_t ctime_usec;
union
{
struct
@@ -684,7 +687,11 @@ grub_ufs_dir (grub_device_t device, const char *path,
info.dir = ((grub_ufs_to_cpu16 (inode.mode) & GRUB_UFS_ATTR_TYPE)
== GRUB_UFS_ATTR_DIR);
+#ifdef MODE_UFS2
info.mtime = grub_ufs_to_cpu64 (inode.mtime);
+#else
+ info.mtime = grub_ufs_to_cpu32 (inode.mtime);
+#endif
info.mtimeset = 1;
if (hook (filename, &info))
--
1.8.1.4