qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v2 2/4] Avoid conflicting types for 'copy_file_range'
@ 2024-01-18 16:02 Manolo de Medici
  2024-01-22 17:04 ` Peter Maydell
  0 siblings, 1 reply; 6+ messages in thread
From: Manolo de Medici @ 2024-01-18 16:02 UTC (permalink / raw)
  To: qemu-devel, bug-hurd

Compilation fails on systems where copy_file_range is already defined as a
stub.

The prototype of copy_file_range in glibc returns an ssize_t, not an off_t.

The function currently only exists on linux and freebsd, and in both cases
the return type is ssize_t

Signed-off-by: Manolo de Medici <manolo.demedici@gmail.com>
---
 block/file-posix.c | 9 +++++----
 1 file changed, 5 insertions(+), 4 deletions(-)

diff --git a/block/file-posix.c b/block/file-posix.c
index 35684f7e21..f744b35642 100644
--- a/block/file-posix.c
+++ b/block/file-posix.c
@@ -2000,12 +2000,13 @@ static int handle_aiocb_write_zeroes_unmap(void *opaque)
 }

 #ifndef HAVE_COPY_FILE_RANGE
-static off_t copy_file_range(int in_fd, off_t *in_off, int out_fd,
-                             off_t *out_off, size_t len, unsigned int flags)
+ssize_t copy_file_range (int infd, off_t *pinoff,
+                         int outfd, off_t *poutoff,
+                         size_t length, unsigned int flags)
 {
 #ifdef __NR_copy_file_range
-    return syscall(__NR_copy_file_range, in_fd, in_off, out_fd,
-                   out_off, len, flags);
+    return (ssize_t)syscall(__NR_copy_file_range, infd, pinoff, outfd,
+                            poutoff, length, flags);
 #else
     errno = ENOSYS;
     return -1;
--
2.43.0


^ permalink raw reply related	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2024-01-23 17:20 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-01-18 16:02 [PATCH v2 2/4] Avoid conflicting types for 'copy_file_range' Manolo de Medici
2024-01-22 17:04 ` Peter Maydell
2024-01-22 18:23   ` Sergey Bugaev
2024-01-22 18:26     ` Sergey Bugaev
2024-01-23 15:19   ` Manolo de Medici
2024-01-23 17:19   ` Kevin Wolf

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).