From e77a16ca025055a7a6d27179a2aeec3b934b1e03 Mon Sep 17 00:00:00 2001 From: Vladimir 'phcoder' Serbinenko Date: Sat, 8 Dec 2012 21:14:08 +0100 Subject: [PATCH] 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 d56554745..9c6dde54d 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,11 @@ +2012-12-08 Vladimir Serbinenko + + 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 Support big-endian UFS1. diff --git a/grub-core/fs/ufs.c b/grub-core/fs/ufs.c index 3f2dba1d9..c86233674 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))