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

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