[LTP] [PATCH] syscalls/memfd_create: Fix build fail when HAVE_FALLOCATE not defined

Guangwen Feng fenggw-fnst@cn.fujitsu.com
Thu Mar 30 11:49:37 CEST 2017


Hi!

On 03/30/2017 05:35 PM, Cyril Hrubis wrote:
> 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));
> 

Oh, right, thanks a lot...
I will send a V2 soon.

Best Regards,
Guangwen Feng




More information about the ltp mailing list