diff options
Diffstat (limited to 'fs/smb/client/splice.h')
-rw-r--r-- | fs/smb/client/splice.h | 53 |
1 files changed, 53 insertions, 0 deletions
diff --git a/fs/smb/client/splice.h b/fs/smb/client/splice.h new file mode 100644 index 000000000000..6c88402bb489 --- /dev/null +++ b/fs/smb/client/splice.h @@ -0,0 +1,53 @@ +/* SPDX-License-Identifier: LGPL-2.1 */ +/* + * Copyright (C) SUSE 2024 + * Author(s): Enzo Matsumiya <ematsumiya@suse.de> + * + * Splice support for cifs.ko + */ +#ifndef _CIFS_SPLICE_H +#define _CIFS_SPLICE_H + +#include <linux/pagevec.h> +#include <linux/fs.h> +#include <linux/pipe_fs_i.h> + +/** + * cifs_splice_read - Splice data from a file's pagecache into a pipe + * @in: The file to read from + * @ppos: Pointer to the file position to read from + * @pipe: The pipe to splice into + * @len: The amount to splice + * @flags: The SPLICE_F_* flags + * + * This function gets folios from a file's pagecache and splices them into the + * pipe. Readahead will be called as necessary to fill more folios. This may + * be used for blockdevs also. + * + * Return: On success, the number of bytes read will be returned and *@ppos + * will be updated if appropriate; 0 will be returned if there is no more data + * to be read; -EAGAIN will be returned if the pipe had no space, and some + * other negative error code will be returned on error. A short read may occur + * if the pipe has insufficient space, we reach the end of the data or we hit a + * hole. + */ +ssize_t cifs_splice_read(struct file *in, loff_t *ppos, struct pipe_inode_info *pipe, + size_t len, unsigned int flags); + +/** + * cifs_splice_write - splice data from a pipe to a file + * @pipe: pipe info + * @out: file to write to + * @ppos: position in @out + * @len: number of bytes to splice + * @flags: splice modifier flags + * + * Description: + * Will either move or copy pages (determined by @flags options) from + * the given pipe inode to the given file. + * This one is ->write_iter-based. + * + */ +ssize_t cifs_splice_write(struct pipe_inode_info *pipe, struct file *out, loff_t *ppos, + size_t len, unsigned int flags); +#endif /* !_CIFS_SPLICE_H */ |