Blame SOURCES/xfsprogs-5.10.0-libxfs-create-a-real-struct-timespec64.patch

f49185
From ec24f6fa05f695af02b4e0fca5bc27cb1cab49b7 Mon Sep 17 00:00:00 2001
f49185
From: "Darrick J. Wong" <darrick.wong@oracle.com>
f49185
Date: Tue, 10 Nov 2020 12:05:32 -0500
f49185
Subject: [PATCH] libxfs: create a real struct timespec64
f49185
f49185
Create a real struct timespec64 that supports 64-bit seconds counts.
f49185
The C library struct timespec doesn't support this on 32-bit
f49185
architectures and we cannot lose the upper bits in the incore inode.
f49185
f49185
Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
f49185
Reviewed-by: Amir Goldstein <amir73il@gmail.com>
f49185
Reviewed-by: Christoph Hellwig <hch@lst.de>
f49185
Signed-off-by: Eric Sandeen <sandeen@sandeen.net>
f49185
---
f49185
f49185
diff --git a/include/libxfs.h b/include/libxfs.h
f49185
index 731561c..2bdef70 100644
f49185
--- a/include/libxfs.h
f49185
+++ b/include/libxfs.h
f49185
@@ -36,8 +36,6 @@ extern uint32_t crc32c_le(uint32_t crc, unsigned char const *p, size_t len);
f49185
 
f49185
 #include "xfs_cksum.h"
f49185
 
f49185
-#define timespec64 timespec
f49185
-
f49185
 /*
f49185
  * This mirrors the kernel include for xfs_buf.h - it's implicitly included in
f49185
  * every files via a similar include in the kernel xfs_linux.h.
f49185
diff --git a/include/xfs_inode.h b/include/xfs_inode.h
f49185
index e03d1cb..ddd48be 100644
f49185
--- a/include/xfs_inode.h
f49185
+++ b/include/xfs_inode.h
f49185
@@ -32,15 +32,15 @@ struct xfs_dir_ops;
f49185
  * metadata.
f49185
  */
f49185
 struct inode {
f49185
-	mode_t		i_mode;
f49185
-	uint32_t	i_nlink;
f49185
-	xfs_dev_t	i_rdev;		/* This actually holds xfs_dev_t */
f49185
-	unsigned long	i_state;	/* Not actually used in userspace */
f49185
-	uint32_t	i_generation;
f49185
-	uint64_t	i_version;
f49185
-	struct timespec	i_atime;
f49185
-	struct timespec	i_mtime;
f49185
-	struct timespec	i_ctime;
f49185
+	mode_t			i_mode;
f49185
+	uint32_t		i_nlink;
f49185
+	xfs_dev_t		i_rdev;	 /* This actually holds xfs_dev_t */
f49185
+	unsigned long		i_state; /* Not actually used in userspace */
f49185
+	uint32_t		i_generation;
f49185
+	uint64_t		i_version;
f49185
+	struct timespec64	i_atime;
f49185
+	struct timespec64	i_mtime;
f49185
+	struct timespec64	i_ctime;
f49185
 };
f49185
 
f49185
 typedef struct xfs_inode {
f49185
diff --git a/libxfs/libxfs_priv.h b/libxfs/libxfs_priv.h
f49185
index 8232f89..b45d07e 100644
f49185
--- a/libxfs/libxfs_priv.h
f49185
+++ b/libxfs/libxfs_priv.h
f49185
@@ -62,8 +62,6 @@ extern kmem_zone_t *xfs_buf_zone;
f49185
 extern kmem_zone_t *xfs_inode_zone;
f49185
 extern kmem_zone_t *xfs_trans_zone;
f49185
 
f49185
-#define timespec64 timespec
f49185
-
f49185
 /* CRC stuff, buffer API dependent on it */
f49185
 #define crc32c(c,p,l)	crc32c_le((c),(unsigned char const *)(p),(l))
f49185
 
f49185
diff --git a/libxfs/xfs_fs.h b/libxfs/xfs_fs.h
f49185
index c8a3b12..fbc9031 100644
f49185
--- a/libxfs/xfs_fs.h
f49185
+++ b/libxfs/xfs_fs.h
f49185
@@ -686,6 +686,14 @@ struct xfs_extent_data {
f49185
 #define XFS_IOC_CLONE_RANGE	 _IOW (0x94, 13, struct xfs_clone_args)
f49185
 #define XFS_IOC_FILE_EXTENT_SAME _IOWR(0x94, 54, struct xfs_extent_data)
f49185
 
f49185
+/* 64-bit seconds counter that works independently of the C library time_t. */
f49185
+typedef long long int time64_t;
f49185
+
f49185
+struct timespec64 {
f49185
+	time64_t	tv_sec;			/* seconds */
f49185
+	long		tv_nsec;		/* nanoseconds */
f49185
+};
f49185
+
f49185
 #ifndef HAVE_BBMACROS
f49185
 /*
f49185
  * Block I/O parameterization.	A basic block (BB) is the lowest size of