3030#include <stdarg.h>
3131#include <stdlib.h>
3232
33- #ifdef __linux__
34- #include <linux/fs.h> // FICLONE
33+ #ifdef HAVE_FICLONERANGE
34+ #include <linux/fs.h> // FICLONERANGE
3535#include <sys/ioctl.h> // ioctl()
36- #elif defined(__FreeBSD__ ) && defined( HAVE_COPY_FILE_RANGE )
36+ #elif defined(HAVE_COPY_FILE_RANGE )
3737#include <unistd.h> // copy_file_range()
38- #elif defined(__sun ) && defined( HAVE_REFLINK )
38+ #elif defined(HAVE_REFLINK )
3939#include <unistd.h> // reflink()
40- #elif defined(__APPLE__ ) && defined( HAVE_SYS_CLONEFILE_H )
40+ #elif defined(HAVE_SYS_CLONEFILE_H )
4141#include <sys/clonefile.h> // clonefile()
4242#endif
4343
@@ -53,7 +53,7 @@ static gboolean clone_syscall__call_arguments_are_proper = FALSE;
5353static const char test_filename1 [] = "mctestclone1.tst" ;
5454static const char test_filename2 [] = "mctestclone2.tst" ;
5555
56- #ifdef __FreeBSD__
56+ #ifdef HAVE_COPY_FILE_RANGE
5757/* @Mock */
5858ssize_t
5959copy_file_range (int infd , off_t * inoffp , int outfd , off_t * outoffp , size_t len , unsigned int flags )
@@ -71,7 +71,7 @@ copy_file_range (int infd, off_t *inoffp, int outfd, off_t *outoffp, size_t len,
7171}
7272#endif
7373
74- #ifdef __linux__
74+ #ifdef HAVE_FICLONERANGE
7575#ifdef __GLIBC__
7676/* @Mock */
7777int
@@ -85,12 +85,12 @@ ioctl (int fd, int request, ...)
8585 (void ) fd ;
8686
8787 clone_syscall__call_count ++ ;
88- clone_syscall__call_arguments_are_proper = (request == FICLONE );
88+ clone_syscall__call_arguments_are_proper = (request == FICLONERANGE );
8989 return -1 ;
9090}
9191#endif
9292
93- #if defined( HAVE_SYS_CLONEFILE_H )
93+ #ifdef HAVE_SYS_CLONEFILE_H
9494/* @Mock */
9595int
9696my_clonefile (const char * src , const char * dst , uint32_t flags )
@@ -104,7 +104,7 @@ my_clonefile (const char *src, const char *dst, uint32_t flags)
104104}
105105#endif
106106
107- #if defined( HAVE_REFLINK )
107+ #ifdef HAVE_REFLINK
108108/* @Mock */
109109int
110110reflink (const char * src , const char * dst , int preserve )
@@ -182,7 +182,7 @@ START_TEST (test_vfs_clone_file)
182182 vfs_clone_file (fdout , fdin );
183183
184184 // then
185- #if defined(FICLONE ) || defined(HAVE_COPY_FILE_RANGE )
185+ #if defined(HAVE_FICLONERANGE ) || defined(HAVE_COPY_FILE_RANGE )
186186 ck_assert (clone_syscall__call_count > 0 );
187187 ck_assert (clone_syscall__call_arguments_are_proper );
188188#else
0 commit comments