Change off64_t into uint64_t
authorBart Van Assche <bvanassche@acm.org>
Sun, 5 Jan 2020 19:10:30 +0000 (11:10 -0800)
committerBart Van Assche <bvanassche@acm.org>
Mon, 6 Jan 2020 19:10:37 +0000 (11:10 -0800)
off64_t is Linux specific while uint64_t is defined by a C standard. This
change makes fio easier to port.

Signed-off-by: Bart Van Assche <bvanassche@acm.org>
helpers.c
helpers.h
io_u.c
os/os-dragonfly.h
os/os-freebsd.h
os/os-mac.h
os/os-netbsd.h
os/os-openbsd.h
os/windows/posix.h

index a0ee37044e8abdc418ac9f19fcca06509858485a..ab9d706da87935870ce3784b4d4fedafc2f2db48 100644 (file)
--- a/helpers.c
+++ b/helpers.c
@@ -18,7 +18,8 @@ int posix_fallocate(int fd, off_t offset, off_t len)
 #endif
 
 #ifndef CONFIG_SYNC_FILE_RANGE
-int sync_file_range(int fd, off64_t offset, off64_t nbytes, unsigned int flags)
+int sync_file_range(int fd, uint64_t offset, uint64_t nbytes,
+                   unsigned int flags)
 {
        errno = ENOSYS;
        return -1;
index a0b328581f79f3110f15328b7f97d30265e16110..4ec0f0525612cdcc1435d242870bba35af140ecf 100644 (file)
--- a/helpers.h
+++ b/helpers.h
@@ -7,8 +7,10 @@
 
 extern int fallocate(int fd, int mode, off_t offset, off_t len);
 extern int posix_fallocate(int fd, off_t offset, off_t len);
-extern int sync_file_range(int fd, off64_t offset, off64_t nbytes,
+#ifndef CONFIG_SYNC_FILE_RANGE
+extern int sync_file_range(int fd, uint64_t offset, uint64_t nbytes,
                                        unsigned int flags);
+#endif
 extern int posix_fadvise(int fd, off_t offset, off_t len, int advice);
 
 #endif /* FIO_HELPERS_H_ */
diff --git a/io_u.c b/io_u.c
index 4a0c725a7ec5b609c902f807699ebff987d9a81b..03f5c21f37c10523362ed2c73af8f57fe1ca691e 100644 (file)
--- a/io_u.c
+++ b/io_u.c
@@ -2182,7 +2182,7 @@ void io_u_fill_buffer(struct thread_data *td, struct io_u *io_u,
 static int do_sync_file_range(const struct thread_data *td,
                              struct fio_file *f)
 {
-       off64_t offset, nbytes;
+       uint64_t offset, nbytes;
 
        offset = f->first_write;
        nbytes = f->last_write - f->first_write;
index 3c460ae2f33105574769450cba7fe817362c66a6..44bfcd5d064001722567d8c2011665b612a13d4b 100644 (file)
@@ -47,7 +47,6 @@
 /* This is supposed to equal (sizeof(cpumask_t)*8) */
 #define FIO_MAX_CPUS   SMP_MAXCPU
 
-typedef off_t off64_t;
 typedef cpumask_t os_cpu_mask_t;
 
 /*
index 789da178afa1671bd788be57964c4368ef46ee23..b3addf981f98d1d0ac872bde57ae0363f6e8af4c 100644 (file)
@@ -30,8 +30,6 @@
 #define fio_swap32(x)  bswap32(x)
 #define fio_swap64(x)  bswap64(x)
 
-typedef off_t off64_t;
-
 typedef cpuset_t os_cpu_mask_t;
 
 #define fio_cpu_clear(mask, cpu)        (void) CPU_CLR((cpu), (mask))
index 0d97f6b984c60196cbc66a11737a612bc815e1e9..2852ac678857cd2ed7225f9d5d73f1d0d54ca2f7 100644 (file)
@@ -33,8 +33,6 @@
  */
 #define FIO_MAX_JOBS           128
 
-typedef off_t off64_t;
-
 #ifndef CONFIG_CLOCKID_T
 typedef unsigned int clockid_t;
 #endif
index 88fb3ef1c1a8710cdb118d9b5f5fdd21e04eddfa..abc1d3cb70120b25244ff80e8833e1023f6f602a 100644 (file)
@@ -35,8 +35,6 @@
 #define fio_swap32(x)  bswap32(x)
 #define fio_swap64(x)  bswap64(x)
 
-typedef off_t off64_t;
-
 static inline int blockdev_size(struct fio_file *f, unsigned long long *bytes)
 {
        struct disklabel dl;
index 43a649d447bcaeaa3d72f6cdd4dcd58194bd4393..085a6f2b7f397272a3ed0c3fcb20ccdfaea7c6f0 100644 (file)
@@ -35,8 +35,6 @@
 #define fio_swap32(x)  bswap32(x)
 #define fio_swap64(x)  bswap64(x)
 
-typedef off_t off64_t;
-
 static inline int blockdev_size(struct fio_file *f, unsigned long long *bytes)
 {
        struct disklabel dl;
index 85640a21d55c6422d8f2dd764319d3771b380989..02a9075be23cdbe65b088919e0fd40c196d75009 100644 (file)
@@ -1,7 +1,6 @@
 #ifndef FIO_WINDOWS_POSIX_H
 #define FIO_WINDOWS_POSIX_H
 
-typedef off_t off64_t;
 typedef int clockid_t;
 
 extern int clock_gettime(clockid_t clock_id, struct timespec *tp);