1 |
The loff_t type is a GNU extension, so use the portable off_t |
2 |
type instead. Also, enable Large File Support macros in setup.py, |
3 |
for 64-bit offsets. |
4 |
|
5 |
Reported-by: Patrick Steinhardt <ps@×××.im> |
6 |
X-Gentoo-bug: 617778 |
7 |
X-Gentoo-bug-url: https://bugs.gentoo.org/show_bug.cgi?id=617778 |
8 |
--- |
9 |
setup.py | 5 ++++- |
10 |
src/portage_util_file_copy_reflink_linux.c | 6 +++--- |
11 |
2 files changed, 7 insertions(+), 4 deletions(-) |
12 |
|
13 |
diff --git a/setup.py b/setup.py |
14 |
index e993177..1ba6f87 100755 |
15 |
--- a/setup.py |
16 |
+++ b/setup.py |
17 |
@@ -676,7 +676,10 @@ setup( |
18 |
['$sysconfdir/portage/repo.postsync.d', ['cnf/repo.postsync.d/example']], |
19 |
], |
20 |
|
21 |
- ext_modules = [Extension(name=n, sources=m) for n, m in x_c_helpers.items()], |
22 |
+ ext_modules = [Extension(name=n, sources=m, |
23 |
+ extra_compile_args=['-D_FILE_OFFSET_BITS=64', |
24 |
+ '-D_LARGEFILE_SOURCE', '-D_LARGEFILE64_SOURCE']) |
25 |
+ for n, m in x_c_helpers.items()], |
26 |
|
27 |
cmdclass = { |
28 |
'build': x_build, |
29 |
diff --git a/src/portage_util_file_copy_reflink_linux.c b/src/portage_util_file_copy_reflink_linux.c |
30 |
index b031d96..2fb17a0 100644 |
31 |
--- a/src/portage_util_file_copy_reflink_linux.c |
32 |
+++ b/src/portage_util_file_copy_reflink_linux.c |
33 |
@@ -66,7 +66,7 @@ initreflink_linux(void) |
34 |
* (errno is set appropriately). |
35 |
*/ |
36 |
static ssize_t |
37 |
-cfr_wrapper(int fd_out, int fd_in, loff_t *off_out, size_t len) |
38 |
+cfr_wrapper(int fd_out, int fd_in, off_t *off_out, size_t len) |
39 |
{ |
40 |
#ifdef __NR_copy_file_range |
41 |
return syscall(__NR_copy_file_range, fd_in, NULL, fd_out, |
42 |
@@ -96,7 +96,7 @@ cfr_wrapper(int fd_out, int fd_in, loff_t *off_out, size_t len) |
43 |
* reaches EOF. |
44 |
*/ |
45 |
static off_t |
46 |
-do_lseek_data(int fd_out, int fd_in, loff_t *off_out) { |
47 |
+do_lseek_data(int fd_out, int fd_in, off_t *off_out) { |
48 |
#ifdef SEEK_DATA |
49 |
/* Use lseek SEEK_DATA/SEEK_HOLE for sparse file support, |
50 |
* as suggested in the copy_file_range man page. |
51 |
@@ -189,7 +189,7 @@ _reflink_linux_file_copy(PyObject *self, PyObject *args) |
52 |
ssize_t buf_bytes, buf_offset, copyfunc_ret; |
53 |
struct stat stat_in, stat_out; |
54 |
char* buf; |
55 |
- ssize_t (*copyfunc)(int, int, loff_t *, size_t); |
56 |
+ ssize_t (*copyfunc)(int, int, off_t *, size_t); |
57 |
|
58 |
if (!PyArg_ParseTuple(args, "ii", &fd_in, &fd_out)) |
59 |
return NULL; |
60 |
-- |
61 |
2.10.2 |