On Wed, May 09, 2018 at 10:58:10PM +0800, Fam Zheng wrote:
> +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)
> +{
> +#ifdef __NR_copy_file_range
> + return syscall(__NR_copy_file_range, in_fd, in_off, out_fd,
> + out_off, len, flags);
> +#else
> + errno = ENOSYS;
> + return -1;
> +#endif
> +}
> +
> +static ssize_t handle_aiocb_copy_range(RawPosixAIOData *aiocb)
> +{
> + uint64_t bytes = aiocb->aio_nbytes;
> + off_t in_off = aiocb->aio_offset;
> + off_t out_off = aiocb->aio_offset2;
> +
> + while (bytes) {
> + ssize_t ret = copy_file_range(aiocb->aio_fildes, &in_off,
> + aiocb->aio_fd2, &out_off,
> + bytes, 0);
> + if (ret == -EINTR) {
> + continue;
> + }
> + if (ret < 0) {
> + return -errno;Convert ENOSYS to ENOTSUP? Reviewed-by: Stefan Hajnoczi <[email protected]>
signature.asc
Description: PGP signature
