Skip to content

Commit 04afb02

Browse files
committed
lapi: Add abisize.h
This moves ifdefs that decides if we should use compat version of syscall or not from fallocate.h to lapi/abisize.h Signed-off-by: Cyril Hrubis <[email protected]>
1 parent a89e4a9 commit 04afb02

File tree

2 files changed

+37
-5
lines changed

2 files changed

+37
-5
lines changed

include/lapi/abisize.h

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
/*
2+
* Copyright (c) 2014 Linux Test Project
3+
* Cyril Hrubis <[email protected]>
4+
*
5+
* This program is free software; you can redistribute it and/or
6+
* modify it under the terms of the GNU General Public License as
7+
* published by the Free Software Foundation; either version 2 of
8+
* the License, or (at your option) any later version.
9+
*
10+
* This program is distributed in the hope that it would be useful,
11+
* but WITHOUT ANY WARRANTY; without even the implied warranty of
12+
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13+
* GNU General Public License for more details.
14+
*
15+
* You should have received a copy of the GNU General Public License
16+
* along with this program; if not, write the Free Software Foundation,
17+
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
18+
*/
19+
20+
#ifndef ABISIZE_H__
21+
#define ABISIZE_H__
22+
23+
/*
24+
* Determines if we have to split up 64 bit arguments or not
25+
*
26+
* Deals with 32bit ABIs that have 64bit syscalls
27+
*/
28+
#define LTP_USE_64_ABI \
29+
(defined(__mips__) && _MIPS_SIM == _ABIN32) || \
30+
(defined(__x86_64__) && defined(__ILP32__)) || \
31+
__WORDSIZE == 64
32+
33+
#endif /* ABISIZE_H__ */

testcases/kernel/syscalls/fallocate/fallocate.h

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -24,23 +24,22 @@
2424
#include <sys/types.h>
2525
#include <endian.h>
2626
#include "config.h"
27+
#include "lapi/abisize.h"
2728
#include "linux_syscall_numbers.h"
2829

2930
#if !defined(HAVE_FALLOCATE)
3031
static inline long fallocate(int fd, int mode, loff_t offset, loff_t len)
3132
{
3233
/* Deal with 32bit ABIs that have 64bit syscalls. */
33-
#if (defined(__mips__) && _MIPS_SIM == _ABIN32) || \
34-
(defined(__x86_64__) && defined(__ILP32__)) || \
35-
__WORDSIZE == 64
34+
# if LTP_USE_64_ABI
3635
return ltp_syscall(__NR_fallocate, fd, mode, offset, len);
37-
#else
36+
# else
3837
return (long)ltp_syscall(__NR_fallocate, fd, mode,
3938
__LONG_LONG_PAIR((off_t) (offset >> 32),
4039
(off_t) offset),
4140
__LONG_LONG_PAIR((off_t) (len >> 32),
4241
(off_t) len));
43-
#endif
42+
# endif
4443
}
4544
#endif
4645

0 commit comments

Comments
 (0)