diff options
author | Stephen Rothwell <sfr@canb.auug.org.au> | 2017-04-24 15:50:38 +1000 |
---|---|---|
committer | Stephen Rothwell <sfr@canb.auug.org.au> | 2017-04-24 16:09:20 +1000 |
commit | 3518e7429c1f1430cc49abbc46c280f8f68dffcc (patch) | |
tree | fa87a49a3c9cb9dcffbaf1997c2d89d2b930a473 /lib | |
parent | bacd3a2528c73be4d936e371d972fd9c2bb241a6 (diff) | |
parent | b29ee17b74854bffe1ca126cca01b1d5f16ab184 (diff) |
Merge remote-tracking branch 'nvdimm/libnvdimm-for-next'
Diffstat (limited to 'lib')
-rw-r--r-- | lib/Kconfig | 6 | ||||
-rw-r--r-- | lib/iov_iter.c | 25 |
2 files changed, 28 insertions, 3 deletions
diff --git a/lib/Kconfig b/lib/Kconfig index 0c8b78a9ae2e..4d8f575e65b3 100644 --- a/lib/Kconfig +++ b/lib/Kconfig @@ -404,6 +404,9 @@ config DMA_VIRT_OPS depends on HAS_DMA && (!64BIT || ARCH_DMA_ADDR_T_64BIT) default n +config COPY_FROM_ITER_OPS + bool + config CHECK_SIGNATURE bool @@ -545,9 +548,6 @@ config SG_POOL config ARCH_HAS_SG_CHAIN def_bool n -config ARCH_HAS_PMEM_API - bool - config ARCH_HAS_MMIO_FLUSH bool diff --git a/lib/iov_iter.c b/lib/iov_iter.c index f7c93568ec99..1c9b0d80bdda 100644 --- a/lib/iov_iter.c +++ b/lib/iov_iter.c @@ -571,6 +571,31 @@ size_t copy_from_iter(void *addr, size_t bytes, struct iov_iter *i) } EXPORT_SYMBOL(copy_from_iter); +#ifdef CONFIG_COPY_FROM_ITER_OPS +size_t copy_from_iter_ops(void *addr, size_t bytes, struct iov_iter *i, + int (*user)(void *, const void __user *, unsigned), + void (*page)(char *, struct page *, size_t, size_t), + void (*copy)(void *, void *, unsigned)) +{ + char *to = addr; + + if (unlikely(i->type & ITER_PIPE)) { + WARN_ON(1); + return 0; + } + iterate_and_advance(i, bytes, v, + user((to += v.iov_len) - v.iov_len, v.iov_base, + v.iov_len), + page((to += v.bv_len) - v.bv_len, v.bv_page, v.bv_offset, + v.bv_len), + copy((to += v.iov_len) - v.iov_len, v.iov_base, v.iov_len) + ) + + return bytes; +} +EXPORT_SYMBOL_GPL(copy_from_iter_ops); +#endif + bool copy_from_iter_full(void *addr, size_t bytes, struct iov_iter *i) { char *to = addr; |