diff options
author | Paul Osmialowski <p.osmialowsk@samsung.com> | 2015-04-16 16:47:03 +0200 |
---|---|---|
committer | Maciej Wereski <m.wereski@partner.samsung.com> | 2015-06-09 11:31:26 +0200 |
commit | a0ed95c2dbc4714990220eab4b0771ad1813c8a4 (patch) | |
tree | 015c242478bf14b7c7a104c5f03c6e0e5cb61345 | |
parent | b973cc8ff0d4a90290f1ae1420e86a3ec072ed8e (diff) | |
download | linux-3.10-a0ed95c2dbc4714990220eab4b0771ad1813c8a4.tar.gz linux-3.10-a0ed95c2dbc4714990220eab4b0771ad1813c8a4.tar.bz2 linux-3.10-a0ed95c2dbc4714990220eab4b0771ad1813c8a4.zip |
Import vfs_iter_* functions from Linux 4.0
These 2 functions are used by kdbus and backporting patches that
add desired functions (with dependencies) would introduce too many
changes for 3.10.
Change-Id: I8554252cdf819a329088a8a083ebdb32e8a19727
Signed-off-by: Paul Osmialowski <p.osmialowsk@samsung.com>
-rw-r--r-- | compat/Makefile | 1 | ||||
-rw-r--r-- | compat/fs/Makefile | 1 | ||||
-rw-r--r-- | compat/fs/read_write.c | 56 |
3 files changed, 58 insertions, 0 deletions
diff --git a/compat/Makefile b/compat/Makefile index 35a2017a7d4..4d550a1abfb 100644 --- a/compat/Makefile +++ b/compat/Makefile @@ -1,4 +1,5 @@ ifdef CONFIG_KDBUS override LINUXINCLUDE := $(patsubst -Iinclude, -Icompat/include -Iinclude , $(LINUXINCLUDE)) +obj-y += fs/ obj-y += lib/ endif diff --git a/compat/fs/Makefile b/compat/fs/Makefile new file mode 100644 index 00000000000..689a5f05ec8 --- /dev/null +++ b/compat/fs/Makefile @@ -0,0 +1 @@ +obj-y += read_write.o diff --git a/compat/fs/read_write.c b/compat/fs/read_write.c new file mode 100644 index 00000000000..f3c31c69682 --- /dev/null +++ b/compat/fs/read_write.c @@ -0,0 +1,56 @@ +#include <linux/aio.h> +#include <linux/slab.h> +#include <linux/stat.h> +#include <linux/fcntl.h> +#include <linux/file.h> +#include <linux/uio.h> +#include <linux/fsnotify.h> +#include <linux/security.h> +#include <linux/export.h> +#include <linux/syscalls.h> +#include <linux/pagemap.h> +#include <linux/splice.h> +#include <linux/compat.h> + +#include <asm/uaccess.h> +#include <asm/unistd.h> + +ssize_t vfs_iter_read(struct file *file, struct iov_iter *iter, loff_t *ppos) +{ + struct kiocb kiocb; + ssize_t ret; + + if (!file->f_op->read_iter) + return -EINVAL; + + init_sync_kiocb(&kiocb, file); + kiocb.ki_pos = *ppos; + + iter->type |= READ; + ret = file->f_op->read_iter(&kiocb, iter); + BUG_ON(ret == -EIOCBQUEUED); + if (ret > 0) + *ppos = kiocb.ki_pos; + return ret; +} +EXPORT_SYMBOL(vfs_iter_read); + +ssize_t vfs_iter_write(struct file *file, struct iov_iter *iter, loff_t *ppos) +{ + struct kiocb kiocb; + ssize_t ret; + + if (!file->f_op->write_iter) + return -EINVAL; + + init_sync_kiocb(&kiocb, file); + kiocb.ki_pos = *ppos; + + iter->type |= WRITE; + ret = file->f_op->write_iter(&kiocb, iter); + BUG_ON(ret == -EIOCBQUEUED); + if (ret > 0) + *ppos = kiocb.ki_pos; + return ret; +} +EXPORT_SYMBOL(vfs_iter_write); |