From ec24f6fa05f695af02b4e0fca5bc27cb1cab49b7 Mon Sep 17 00:00:00 2001 From: "Darrick J. Wong" Date: Tue, 10 Nov 2020 12:05:32 -0500 Subject: [PATCH] libxfs: create a real struct timespec64 Create a real struct timespec64 that supports 64-bit seconds counts. The C library struct timespec doesn't support this on 32-bit architectures and we cannot lose the upper bits in the incore inode. Signed-off-by: Darrick J. Wong Reviewed-by: Amir Goldstein Reviewed-by: Christoph Hellwig Signed-off-by: Eric Sandeen --- include/libxfs.h | 1 - include/xfs_fs_compat.h | 8 ++++++++ include/xfs_inode.h | 22 +++++++++++----------- libxfs/libxfs_priv.h | 2 -- 4 files changed, 19 insertions(+), 14 deletions(-) diff --git a/include/libxfs.h b/include/libxfs.h index b9370139b..2667d3b77 100644 --- a/include/libxfs.h +++ b/include/libxfs.h @@ -41,7 +41,6 @@ struct iomap; #define __round_mask(x, y) ((__typeof__(x))((y)-1)) #define round_up(x, y) ((((x)-1) | __round_mask(x, y))+1) #define unlikely(x) (x) -#define timespec64 timespec /* * This mirrors the kernel include for xfs_buf.h - it's implicitly included in diff --git a/include/xfs_fs_compat.h b/include/xfs_fs_compat.h index 154a802d9..d0ffc9775 100644 --- a/include/xfs_fs_compat.h +++ b/include/xfs_fs_compat.h @@ -85,4 +85,12 @@ struct xfs_extent_data { #define XFS_IOC_CLONE_RANGE _IOW (0x94, 13, struct xfs_clone_args) #define XFS_IOC_FILE_EXTENT_SAME _IOWR(0x94, 54, struct xfs_extent_data) +/* 64-bit seconds counter that works independently of the C library time_t. */ +typedef long long int time64_t; + +struct timespec64 { + time64_t tv_sec; /* seconds */ + long tv_nsec; /* nanoseconds */ +}; + #endif /* __XFS_FS_COMPAT_H__ */ diff --git a/include/xfs_inode.h b/include/xfs_inode.h index 588d8c725..12676cb30 100644 --- a/include/xfs_inode.h +++ b/include/xfs_inode.h @@ -31,17 +31,17 @@ struct xfs_inode_log_item; * metadata. */ struct inode { - mode_t i_mode; - uint32_t i_uid; - uint32_t i_gid; - uint32_t i_nlink; - xfs_dev_t i_rdev; /* This actually holds xfs_dev_t */ - unsigned long i_state; /* Not actually used in userspace */ - uint32_t i_generation; - uint64_t i_version; - struct timespec i_atime; - struct timespec i_mtime; - struct timespec i_ctime; + mode_t i_mode; + uint32_t i_uid; + uint32_t i_gid; + uint32_t i_nlink; + xfs_dev_t i_rdev; /* This actually holds xfs_dev_t */ + unsigned long i_state; /* Not actually used in userspace */ + uint32_t i_generation; + uint64_t i_version; + struct timespec64 i_atime; + struct timespec64 i_mtime; + struct timespec64 i_ctime; }; static inline uint32_t i_uid_read(struct inode *inode) diff --git a/libxfs/libxfs_priv.h b/libxfs/libxfs_priv.h index bd724c32c..e92269f0b 100644 --- a/libxfs/libxfs_priv.h +++ b/libxfs/libxfs_priv.h @@ -64,8 +64,6 @@ extern kmem_zone_t *xfs_buf_zone; extern kmem_zone_t *xfs_inode_zone; extern kmem_zone_t *xfs_trans_zone; -#define timespec64 timespec - /* fake up iomap, (not) used in xfs_bmap.[ch] */ #define IOMAP_F_SHARED 0x04 #define xfs_bmbt_to_iomap(a, b, c, d) ((void) 0) -- 2.47.2