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