/* Send 'sd->len' bytes to socket from 'sd->file' at position 'sd->pos' using sendpage(). Return the number of bytes sent.  */
static int pipe_to_sendpage(struct pipe_inode_info *pipe, struct pipe_buffer *buf, struct splice_desc *sd)
/* Send 'sd->len' bytes to socket from 'sd->file' at position 'sd->pos' using sendpage(). Return the number of bytes sent.  */
static int pipe_to_sendpage(struct pipe_inode_info *pipe, struct pipe_buffer *buf, struct splice_desc *sd)
{
	struct file *file = sd->u.file;
	loff_t pos = sd->pos;
	int ret, more;
	ret = buf->ops->confirm(pipe, buf);
	if (!ret) {
		more = (sd->flags & SPLICE_F_MORE) || sd->len < sd->total_len;
		if (file->f_op && file->f_op->sendpage)
			ret = file->f_op->sendpage(file, buf->page, buf->offset,
						   sd->len, &pos, more);
		else
			ret = -EINVAL;
	}
	return ret;
}