[PATCH 1/4] Remove off64_t from linux.h

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



The off64_t type is usually only conditionally exposed under the
feature test macro _LARGEFILE64_SOURCE (also defined by _GNU_SOURCE).
To make the public xfs headers more standalone therefore off64_t should
be avoided.

Enable transparent large file support via configure so that the
standard off_t is the same as off64_t. Make compilation of linux
programs using libxfs but without large file support fail. Now off64_t
can safely be replaced by off_t in linux.h.

Signed-off-by: Felix Janda <felix.janda@xxxxxxxxx>
---
 configure.ac    | 2 ++
 include/linux.h | 7 ++++++-
 2 files changed, 8 insertions(+), 1 deletion(-)

diff --git a/configure.ac b/configure.ac
index a4a6cfa..2ea3e50 100644
--- a/configure.ac
+++ b/configure.ac
@@ -107,6 +107,8 @@ AC_PACKAGE_UTILITIES(xfsprogs)
 AC_MULTILIB($enable_lib64)
 AC_RT($enable_librt)
 
+AC_SYS_LARGEFILE
+
 AC_PACKAGE_NEED_UUID_H
 AC_PACKAGE_NEED_UUIDCOMPARE
 
diff --git a/include/linux.h b/include/linux.h
index cc0f70c..b94de81 100644
--- a/include/linux.h
+++ b/include/linux.h
@@ -142,7 +142,12 @@ platform_discard_blocks(int fd, uint64_t start, uint64_t len)
 #define EFSCORRUPTED	EUCLEAN	/* Filesystem is corrupted */
 #define EFSBADCRC	EBADMSG	/* Bad CRC detected */
 
-typedef off64_t		xfs_off_t;
+/* Make compilation fail when off_t has 32 bits */
+struct __xfs_assert_64bit_off_t {
+	int assert_64bit_off_t[sizeof(off_t)-8];
+};
+
+typedef off_t		xfs_off_t;
 typedef __uint64_t	xfs_ino_t;
 typedef __uint32_t	xfs_dev_t;
 typedef __int64_t	xfs_daddr_t;
-- 
2.7.3

_______________________________________________
xfs mailing list
xfs@xxxxxxxxxxx
http://oss.sgi.com/mailman/listinfo/xfs



[Index of Archives]     [Linux XFS Devel]     [Linux Filesystem Development]     [Filesystem Testing]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux