From 6b1ca206c66dbeeec380813cd183a09de839b4bd Mon Sep 17 00:00:00 2001 From: Christoph Hellwig Date: Sat, 27 Jul 2002 21:24:07 +0200 Subject: VFS: implement sendfile file operation Currently the sendfile syscalls hardcode assumptions about the implementation of the read file operations implementation. Although it checks for the presence of a readpage address-space operation filesystems in Linux are free to implement read differently from the generic version (generic_file_read). Many filesystems such as tmpfs, smbfs or xfs chose to implement it differently and need additional locking, revalidation or checks. --- include/linux/fs.h | 2 ++ 1 file changed, 2 insertions(+) (limited to 'include/linux') diff --git a/include/linux/fs.h b/include/linux/fs.h index 21aa43cc5c4d..1d3334ca66d9 100644 --- a/include/linux/fs.h +++ b/include/linux/fs.h @@ -757,6 +757,7 @@ struct file_operations { int (*lock) (struct file *, int, struct file_lock *); ssize_t (*readv) (struct file *, const struct iovec *, unsigned long, loff_t *); ssize_t (*writev) (struct file *, const struct iovec *, unsigned long, loff_t *); + ssize_t (*sendfile) (struct file *, struct file *, loff_t *, size_t); ssize_t (*sendpage) (struct file *, struct page *, int, size_t, loff_t *, int); unsigned long (*get_unmapped_area)(struct file *, unsigned long, unsigned long, unsigned long, unsigned long); }; @@ -1234,6 +1235,7 @@ extern int generic_file_mmap(struct file *, struct vm_area_struct *); extern int file_read_actor(read_descriptor_t * desc, struct page *page, unsigned long offset, unsigned long size); extern ssize_t generic_file_read(struct file *, char *, size_t, loff_t *); extern ssize_t generic_file_write(struct file *, const char *, size_t, loff_t *); +extern ssize_t generic_file_sendfile(struct file *, struct file *, loff_t *, size_t); extern void do_generic_file_read(struct file *, loff_t *, read_descriptor_t *, read_actor_t); ssize_t generic_file_direct_IO(int rw, struct inode *inode, char *buf, loff_t offset, size_t count); -- cgit v1.2.3