[LTP] [PATCH] syscalls/memfd_create: Fix build fail when HAVE_FALLOCATE not defined
    Cyril Hrubis 
    chrubis@suse.cz
       
    Thu Mar 30 11:35:40 CEST 2017
    
    
  
Hi!
>  	/* Deal with 32bit ABIs that have 64bit syscalls. */
>  # if LTP_USE_64_ABI
> +#ifdef __TEST_H__
>  	return ltp_syscall(__NR_fallocate, fd, mode, offset, len);
> +#else
> +	return tst_syscall(__NR_fallocate, fd, mode, offset, len);
> +#endif /* __TEST_H__ */
>  # else
> +#ifdef __TEST_H__
>  	return (long)ltp_syscall(__NR_fallocate, fd, mode,
>  				 __LONG_LONG_PAIR((off_t) (offset >> 32),
>  						  (off_t) offset),
>  				 __LONG_LONG_PAIR((off_t) (len >> 32),
>  						  (off_t) len));
> +#else
> +	return (long)tst_syscall(__NR_fallocate, fd, mode,
> +				 __LONG_LONG_PAIR((off_t) (offset >> 32),
> +						  (off_t) offset),
> +				 __LONG_LONG_PAIR((off_t) (len >> 32),
> +						  (off_t) len));
> +#endif /* __TEST_H__ */
We can spare a bit of the duplication by definign the function name:
...
#ifdef __TEST_H__
# define TST_SYSCALL_WRAPPER ltp_syscall
#else
# define TST_SYSCALL_WRAPPER tst_syscall
#endif
...
	return (long)TST_SYSCALL_WRAPPER(__NR_fallocate, fd, mode,
				 __LONG_LONG_PAIR((off_t) (offset >> 32),
						  (off_t) offset),
				 __LONG_LONG_PAIR((off_t) (len >> 32),
						  (off_t) len));
-- 
Cyril Hrubis
chrubis@suse.cz
    
    
More information about the ltp
mailing list