140-copy-file-range.patch 1.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748
  1. From 8041435de7ed028a27ecca64302945ad455c69a6 Mon Sep 17 00:00:00 2001
  2. From: "Darrick J. Wong" <darrick.wong@oracle.com>
  3. Date: Mon, 5 Feb 2018 14:38:02 -0600
  4. Subject: [PATCH] xfs_io: fix copy_file_range symbol name collision
  5. glibc 2.27 has a copy_file_range wrapper, so we need to change our
  6. internal function out of the way to avoid compiler warnings.
  7. Reported-by: fredrik@crux.nu
  8. Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
  9. Reviewed-by: Eric Sandeen <sandeen@redhat.com>
  10. Signed-off-by: Eric Sandeen <sandeen@sandeen.net>
  11. ---
  12. io/copy_file_range.c | 11 ++++++++---
  13. 1 file changed, 8 insertions(+), 3 deletions(-)
  14. --- a/io/copy_file_range.c
  15. +++ b/io/copy_file_range.c
  16. @@ -42,13 +42,18 @@ copy_range_help(void)
  17. "));
  18. }
  19. +/*
  20. + * Issue a raw copy_file_range syscall; for our test program we don't want the
  21. + * glibc buffered copy fallback.
  22. + */
  23. static loff_t
  24. -copy_file_range(int fd, loff_t *src, loff_t *dst, size_t len)
  25. +copy_file_range_cmd(int fd, loff_t *src, loff_t *dst, size_t len)
  26. {
  27. loff_t ret;
  28. do {
  29. - ret = syscall(__NR_copy_file_range, fd, src, file->fd, dst, len, 0);
  30. + ret = syscall(__NR_copy_file_range, fd, src, file->fd, dst,
  31. + len, 0);
  32. if (ret == -1) {
  33. perror("copy_range");
  34. return errno;
  35. @@ -130,7 +135,7 @@ copy_range_f(int argc, char **argv)
  36. copy_dst_truncate();
  37. }
  38. - ret = copy_file_range(fd, &src, &dst, len);
  39. + ret = copy_file_range_cmd(fd, &src, &dst, len);
  40. close(fd);
  41. return ret;
  42. }