diff options
author | Manuel Bentele | 2020-09-11 11:48:48 +0200 |
---|---|---|
committer | Manuel Bentele | 2020-09-16 07:37:56 +0200 |
commit | a4215c3632c13218bb389d1f066549ab783028e3 (patch) | |
tree | 0468836ef5303f6eb94b876189ccaa60a7a2b453 /kernel/tests/include/lapi/sync_file_range.h | |
parent | Updated README with documentation of general information and build options (diff) | |
download | xloop-a4215c3632c13218bb389d1f066549ab783028e3.tar.gz xloop-a4215c3632c13218bb389d1f066549ab783028e3.tar.xz xloop-a4215c3632c13218bb389d1f066549ab783028e3.zip |
Added testcases from the Linux testing project (LTP)
Diffstat (limited to 'kernel/tests/include/lapi/sync_file_range.h')
-rw-r--r-- | kernel/tests/include/lapi/sync_file_range.h | 58 |
1 files changed, 58 insertions, 0 deletions
diff --git a/kernel/tests/include/lapi/sync_file_range.h b/kernel/tests/include/lapi/sync_file_range.h new file mode 100644 index 0000000..86bfe5d --- /dev/null +++ b/kernel/tests/include/lapi/sync_file_range.h @@ -0,0 +1,58 @@ +// SPDX-License-Identifier: GPL-2.0-or-later +/* + * Copyright (c) International Business Machines Corp., 2008 + */ + +#ifndef SYNC_FILE_RANGE_H +#define SYNC_FILE_RANGE_H + +#include <sys/types.h> +#include "config.h" +#include "lapi/syscalls.h" +#include "lapi/abisize.h" + +#if !defined(HAVE_SYNC_FILE_RANGE) + +#ifdef TST_TEST_H__ +# define TST_SYSCALL tst_syscall +#else +# define TST_SYSCALL ltp_syscall +#endif + +/***************************************************************************** + * Wraper function to call sync_file_range system call + ******************************************************************************/ +static inline long sync_file_range(int fd, off64_t offset, off64_t nbytes, + unsigned int flags) +{ +#if (defined(__arm__) || defined(__powerpc__) || defined(__powerpc64__)) +# ifdef TST_ABI32 +# if __BYTE_ORDER == __BIG_ENDIAN + return TST_SYSCALL(__NR_sync_file_range2, fd, flags, + (int)(offset >> 32), (int)offset, (int)(nbytes >> 32), + (int)nbytes); +# elif __BYTE_ORDER == __LITTLE_ENDIAN + return TST_SYSCALL(__NR_sync_file_range2, fd, flags, (int)offset, + (int)(offset >> 32), nbytes, (int)(nbytes >> 32)); +# endif +# else + return TST_SYSCALL(__NR_sync_file_range2, fd, flags, offset, nbytes); +# endif +#elif (defined(__s390__) || defined(__s390x__)) && defined(TST_ABI32) + return TST_SYSCALL(__NR_sync_file_range, fd, (int)(offset >> 32), + (int)offset, (int)(nbytes >> 32), (int)nbytes, flags); +#elif defined(__mips__) && defined(TST_ABI32) +# if __BYTE_ORDER == __BIG_ENDIAN + return TST_SYSCALL(__NR_sync_file_range, fd, 0, (int)(offset >> 32), + (int)offset, (int)(nbytes >> 32), (int)nbytes, flags); +# elif __BYTE_ORDER == __LITTLE_ENDIAN + return TST_SYSCALL(__NR_sync_file_range, fd, 0, (int)offset, + (int)(offset >> 32), (int)nbytes, (int)(nbytes >> 32), flags); +# endif +#else + return TST_SYSCALL(__NR_sync_file_range, fd, offset, nbytes, flags); +#endif +} +#endif + +#endif /* SYNC_FILE_RANGE_H */ |