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