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

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