Gentoo Archives: gentoo-portage-dev

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

Replies