Skip to content

Commit

Permalink
Change off64_t into uint64_t
Browse files Browse the repository at this point in the history
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 <[email protected]>
  • Loading branch information
bvanassche committed Jan 6, 2020
1 parent 585ef66 commit 7e2a317
Show file tree
Hide file tree
Showing 9 changed files with 6 additions and 13 deletions.
3 changes: 2 additions & 1 deletion helpers.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
4 changes: 3 additions & 1 deletion helpers.h
Original file line number Diff line number Diff line change
Expand Up @@ -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_ */
2 changes: 1 addition & 1 deletion io_u.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
1 change: 0 additions & 1 deletion os/os-dragonfly.h
Original file line number Diff line number Diff line change
Expand Up @@ -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;

/*
Expand Down
2 changes: 0 additions & 2 deletions os/os-freebsd.h
Original file line number Diff line number Diff line change
Expand Up @@ -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))
Expand Down
2 changes: 0 additions & 2 deletions os/os-mac.h
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,6 @@
*/
#define FIO_MAX_JOBS 128

typedef off_t off64_t;

#ifndef CONFIG_CLOCKID_T
typedef unsigned int clockid_t;
#endif
Expand Down
2 changes: 0 additions & 2 deletions os/os-netbsd.h
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
2 changes: 0 additions & 2 deletions os/os-openbsd.h
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
1 change: 0 additions & 1 deletion os/windows/posix.h
Original file line number Diff line number Diff line change
@@ -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);
Expand Down

0 comments on commit 7e2a317

Please sign in to comment.