]> git.ipfire.org Git - thirdparty/xfsprogs-dev.git/commitdiff
libxfs: create a real struct timespec64
authorDarrick J. Wong <darrick.wong@oracle.com>
Tue, 10 Nov 2020 17:05:32 +0000 (12:05 -0500)
committerEric Sandeen <sandeen@sandeen.net>
Tue, 10 Nov 2020 17:05:32 +0000 (12:05 -0500)
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 <darrick.wong@oracle.com>
Reviewed-by: Amir Goldstein <amir73il@gmail.com>
Reviewed-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Eric Sandeen <sandeen@sandeen.net>
include/libxfs.h
include/xfs_fs_compat.h
include/xfs_inode.h
libxfs/libxfs_priv.h

index b9370139becc40590d0e582bf7f9b58bbea9daac..2667d3b77084c53faab54179818a6a2dba5c8a30 100644 (file)
@@ -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
index 154a802d9aed0aa41831ea9d867a7478b863aac5..d0ffc9775875b0ed5dd9abe097e0344f3e193b62 100644 (file)
@@ -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__ */
index 588d8c7258f4b4ee4c5d451402a397ca5be0c861..12676cb30bf22c6b1cb6298dcd03ea055e73576f 100644 (file)
@@ -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)
index bd724c32c2632fb18404864a120d4937400766bc..e92269f0bdae1495c4abe00455e34bd62d7202cb 100644 (file)
@@ -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)