aboutsummaryrefslogtreecommitdiffstats
path: root/include/linux
diff options
context:
space:
mode:
authorNick Piggin <npiggin@suse.de>2007-10-16 04:24:59 -0400
committerLinus Torvalds <torvalds@woody.linux-foundation.org>2007-10-16 12:42:55 -0400
commit2f718ffc16c43a435d12919c75dbfad518abd056 (patch)
tree55588cb2815d844e9d0b2404cf8ceafe98b5c55d /include/linux
parent08291429cfa6258c4cd95d8833beb40f828b194e (diff)
mm: buffered write iterator
Add an iterator data structure to operate over an iovec. Add usercopy operators needed by generic_file_buffered_write, and convert that function over. Signed-off-by: Nick Piggin <npiggin@suse.de> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'include/linux')
-rw-r--r--include/linux/fs.h33
1 files changed, 33 insertions, 0 deletions
diff --git a/include/linux/fs.h b/include/linux/fs.h
index 500ffc0e4ac7..86ce27c72554 100644
--- a/include/linux/fs.h
+++ b/include/linux/fs.h
@@ -401,6 +401,39 @@ struct page;
401struct address_space; 401struct address_space;
402struct writeback_control; 402struct writeback_control;
403 403
404struct iov_iter {
405 const struct iovec *iov;
406 unsigned long nr_segs;
407 size_t iov_offset;
408 size_t count;
409};
410
411size_t iov_iter_copy_from_user_atomic(struct page *page,
412 struct iov_iter *i, unsigned long offset, size_t bytes);
413size_t iov_iter_copy_from_user(struct page *page,
414 struct iov_iter *i, unsigned long offset, size_t bytes);
415void iov_iter_advance(struct iov_iter *i, size_t bytes);
416int iov_iter_fault_in_readable(struct iov_iter *i);
417size_t iov_iter_single_seg_count(struct iov_iter *i);
418
419static inline void iov_iter_init(struct iov_iter *i,
420 const struct iovec *iov, unsigned long nr_segs,
421 size_t count, size_t written)
422{
423 i->iov = iov;
424 i->nr_segs = nr_segs;
425 i->iov_offset = 0;
426 i->count = count + written;
427
428 iov_iter_advance(i, written);
429}
430
431static inline size_t iov_iter_count(struct iov_iter *i)
432{
433 return i->count;
434}
435
436
404struct address_space_operations { 437struct address_space_operations {
405 int (*writepage)(struct page *page, struct writeback_control *wbc); 438 int (*writepage)(struct page *page, struct writeback_control *wbc);
406 int (*readpage)(struct file *, struct page *); 439 int (*readpage)(struct file *, struct page *);