* [PATCH] Rename copy_file_range to _copy_file_range
@ 2017-12-29 2:18 Palmer Dabbelt
2017-12-29 3:55 ` Theodore Ts'o
0 siblings, 1 reply; 4+ messages in thread
From: Palmer Dabbelt @ 2017-12-29 2:18 UTC (permalink / raw)
To: linux-ext4, tytso; +Cc: patches, Palmer Dabbelt
As of 2.27, glibc will have a copy_file_range library call to wrap the
new copy_file_range system call. This conflicts with the function in
misc/create_inode.c, which this patch renames _copy_file_range.
Full disclosure: I found this when building e2fsprogs for RISC-V with a
glibc-2.27 prerelease, so it's very possible I screwed something up
here. Here's the relevant glibc commit:
commit bad7a0c81f501fbbcc79af9eaa4b8254441c4a1f
Author: Florian Weimer <fweimer@redhat.com>
Date: Fri Dec 22 10:55:40 2017 +0100
copy_file_range: New function to copy file data
The semantics are based on the Linux system call, but a very close
emulation in user space is provided.
...
diff --git a/posix/unistd.h b/posix/unistd.h
index 32b0f4898fd2..65317c79fd39 100644
--- a/posix/unistd.h
+++ b/posix/unistd.h
@@ -1105,7 +1105,12 @@ extern int lockf64 (int __fd, int __cmd, __off64_t __len) __wur;
do __result = (long int) (expression); \
while (__result == -1L && errno == EINTR); \
__result; }))
-#endif
+
+/* Copy LENGTH bytes from INFD to OUTFD. */
+ssize_t copy_file_range (int __infd, __off64_t *__pinoff,
+ int __outfd, __off64_t *__poutoff,
+ size_t __length, unsigned int __flags);
+#endif /* __USE_GNU */
Signed-off-by: Palmer Dabbelt <palmer@dabbelt.com>
---
misc/create_inode.c | 20 ++++++++++----------
1 file changed, 10 insertions(+), 10 deletions(-)
diff --git a/misc/create_inode.c b/misc/create_inode.c
index a07f8328e5f9..94fa13f8b3d0 100644
--- a/misc/create_inode.c
+++ b/misc/create_inode.c
@@ -398,9 +398,9 @@ static ssize_t my_pread(int fd, void *buf, size_t count, off_t offset)
}
#endif /* !defined HAVE_PREAD64 && !defined HAVE_PREAD */
-static errcode_t copy_file_range(ext2_filsys fs, int fd, ext2_file_t e2_file,
- off_t start, off_t end, char *buf,
- char *zerobuf)
+static errcode_t _copy_file_range(ext2_filsys fs, int fd, ext2_file_t e2_file,
+ off_t start, off_t end, char *buf,
+ char *zerobuf)
{
off_t off, bpos;
ssize_t got, blen;
@@ -472,8 +472,8 @@ static errcode_t try_lseek_copy(ext2_filsys fs, int fd, struct stat *statbuf,
data_blk = data & ~(fs->blocksize - 1);
hole_blk = (hole + (fs->blocksize - 1)) & ~(fs->blocksize - 1);
- err = copy_file_range(fs, fd, e2_file, data_blk, hole_blk, buf,
- zerobuf);
+ err = _copy_file_range(fs, fd, e2_file, data_blk, hole_blk, buf,
+ zerobuf);
if (err)
return err;
@@ -523,9 +523,9 @@ static errcode_t try_fiemap_copy(ext2_filsys fs, int fd, ext2_file_t e2_file,
goto out;
for (i = 0, ext = ext_buf; i < fiemap_buf->fm_mapped_extents;
i++, ext++) {
- err = copy_file_range(fs, fd, e2_file, ext->fe_logical,
- ext->fe_logical + ext->fe_length,
- buf, zerobuf);
+ err = _copy_file_range(fs, fd, e2_file, ext->fe_logical,
+ ext->fe_logical + ext->fe_length,
+ buf, zerobuf);
if (err)
goto out;
}
@@ -576,8 +576,8 @@ static errcode_t copy_file(ext2_filsys fs, int fd, struct stat *statbuf,
goto out;
#endif
- err = copy_file_range(fs, fd, e2_file, 0, statbuf->st_size, buf,
- zerobuf);
+ err = _copy_file_range(fs, fd, e2_file, 0, statbuf->st_size, buf,
+ zerobuf);
out:
ext2fs_free_mem(&zerobuf);
ext2fs_free_mem(&buf);
--
2.13.6
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [PATCH] Rename copy_file_range to _copy_file_range
2017-12-29 2:18 [PATCH] Rename copy_file_range to _copy_file_range Palmer Dabbelt
@ 2017-12-29 3:55 ` Theodore Ts'o
2017-12-29 18:19 ` [PATCH v2] Rename copy_file_range to copy_file_chunk Palmer Dabbelt
0 siblings, 1 reply; 4+ messages in thread
From: Theodore Ts'o @ 2017-12-29 3:55 UTC (permalink / raw)
To: Palmer Dabbelt; +Cc: linux-ext4, patches
On Thu, Dec 28, 2017 at 06:18:28PM -0800, Palmer Dabbelt wrote:
> As of 2.27, glibc will have a copy_file_range library call to wrap the
> new copy_file_range system call. This conflicts with the function in
> misc/create_inode.c, which this patch renames _copy_file_range.
Could you resend the patch renaming it to copy_file_chunk()? That's
less likely to cause confusion with the copy_file_range system call.
Thanks,
- Ted
^ permalink raw reply [flat|nested] 4+ messages in thread
* [PATCH v2] Rename copy_file_range to copy_file_chunk
2017-12-29 3:55 ` Theodore Ts'o
@ 2017-12-29 18:19 ` Palmer Dabbelt
2018-01-02 4:41 ` Theodore Ts'o
0 siblings, 1 reply; 4+ messages in thread
From: Palmer Dabbelt @ 2017-12-29 18:19 UTC (permalink / raw)
To: linux-ext4, tytso; +Cc: patches, Palmer Dabbelt
As of 2.27, glibc will have a copy_file_range library call to wrap the
new copy_file_range system call. This conflicts with the function in
misc/create_inode.c, which this patch renames _copy_file_range.
Full disclosure: I found this when building e2fsprogs for RISC-V with a
glibc-2.27 prerelease, so it's very possible I screwed something up
here. Here's the relevant glibc commit:
commit bad7a0c81f501fbbcc79af9eaa4b8254441c4a1f
Author: Florian Weimer <fweimer@redhat.com>
Date: Fri Dec 22 10:55:40 2017 +0100
copy_file_range: New function to copy file data
The semantics are based on the Linux system call, but a very close
emulation in user space is provided.
...
diff --git a/posix/unistd.h b/posix/unistd.h
index 32b0f4898fd2..65317c79fd39 100644
--- a/posix/unistd.h
+++ b/posix/unistd.h
@@ -1105,7 +1105,12 @@ extern int lockf64 (int __fd, int __cmd, __off64_t __len) __wur;
do __result = (long int) (expression); \
while (__result == -1L && errno == EINTR); \
__result; }))
-#endif
+
+/* Copy LENGTH bytes from INFD to OUTFD. */
+ssize_t copy_file_range (int __infd, __off64_t *__pinoff,
+ int __outfd, __off64_t *__poutoff,
+ size_t __length, unsigned int __flags);
+#endif /* __USE_GNU */
Changes since v1:
* The new name is now copy_file_chunk instead of _copy_file_range.
Signed-off-by: Palmer Dabbelt <palmer@dabbelt.com>
---
misc/create_inode.c | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)
diff --git a/misc/create_inode.c b/misc/create_inode.c
index a07f8328e5f9..51d25f8fb005 100644
--- a/misc/create_inode.c
+++ b/misc/create_inode.c
@@ -398,7 +398,7 @@ static ssize_t my_pread(int fd, void *buf, size_t count, off_t offset)
}
#endif /* !defined HAVE_PREAD64 && !defined HAVE_PREAD */
-static errcode_t copy_file_range(ext2_filsys fs, int fd, ext2_file_t e2_file,
+static errcode_t copy_file_chunk(ext2_filsys fs, int fd, ext2_file_t e2_file,
off_t start, off_t end, char *buf,
char *zerobuf)
{
@@ -472,7 +472,7 @@ static errcode_t try_lseek_copy(ext2_filsys fs, int fd, struct stat *statbuf,
data_blk = data & ~(fs->blocksize - 1);
hole_blk = (hole + (fs->blocksize - 1)) & ~(fs->blocksize - 1);
- err = copy_file_range(fs, fd, e2_file, data_blk, hole_blk, buf,
+ err = copy_file_chunk(fs, fd, e2_file, data_blk, hole_blk, buf,
zerobuf);
if (err)
return err;
@@ -523,7 +523,7 @@ static errcode_t try_fiemap_copy(ext2_filsys fs, int fd, ext2_file_t e2_file,
goto out;
for (i = 0, ext = ext_buf; i < fiemap_buf->fm_mapped_extents;
i++, ext++) {
- err = copy_file_range(fs, fd, e2_file, ext->fe_logical,
+ err = copy_file_chunk(fs, fd, e2_file, ext->fe_logical,
ext->fe_logical + ext->fe_length,
buf, zerobuf);
if (err)
@@ -576,7 +576,7 @@ static errcode_t copy_file(ext2_filsys fs, int fd, struct stat *statbuf,
goto out;
#endif
- err = copy_file_range(fs, fd, e2_file, 0, statbuf->st_size, buf,
+ err = copy_file_chunk(fs, fd, e2_file, 0, statbuf->st_size, buf,
zerobuf);
out:
ext2fs_free_mem(&zerobuf);
--
2.13.6
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [PATCH v2] Rename copy_file_range to copy_file_chunk
2017-12-29 18:19 ` [PATCH v2] Rename copy_file_range to copy_file_chunk Palmer Dabbelt
@ 2018-01-02 4:41 ` Theodore Ts'o
0 siblings, 0 replies; 4+ messages in thread
From: Theodore Ts'o @ 2018-01-02 4:41 UTC (permalink / raw)
To: Palmer Dabbelt; +Cc: linux-ext4, patches
On Fri, Dec 29, 2017 at 10:19:51AM -0800, Palmer Dabbelt wrote:
> As of 2.27, glibc will have a copy_file_range library call to wrap the
> new copy_file_range system call. This conflicts with the function in
> misc/create_inode.c, which this patch renames _copy_file_range.
Thanks, applied.
- Ted
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2018-01-02 4:41 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-12-29 2:18 [PATCH] Rename copy_file_range to _copy_file_range Palmer Dabbelt
2017-12-29 3:55 ` Theodore Ts'o
2017-12-29 18:19 ` [PATCH v2] Rename copy_file_range to copy_file_chunk Palmer Dabbelt
2018-01-02 4:41 ` Theodore Ts'o
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).