diff options
author | Nick Piggin <npiggin@suse.de> | 2007-10-16 04:24:59 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@woody.linux-foundation.org> | 2007-10-16 12:42:55 -0400 |
commit | 2f718ffc16c43a435d12919c75dbfad518abd056 (patch) | |
tree | 55588cb2815d844e9d0b2404cf8ceafe98b5c55d /include/linux/fs.h | |
parent | 08291429cfa6258c4cd95d8833beb40f828b194e (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/fs.h')
-rw-r--r-- | include/linux/fs.h | 33 |
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; | |||
401 | struct address_space; | 401 | struct address_space; |
402 | struct writeback_control; | 402 | struct writeback_control; |
403 | 403 | ||
404 | struct iov_iter { | ||
405 | const struct iovec *iov; | ||
406 | unsigned long nr_segs; | ||
407 | size_t iov_offset; | ||
408 | size_t count; | ||
409 | }; | ||
410 | |||
411 | size_t iov_iter_copy_from_user_atomic(struct page *page, | ||
412 | struct iov_iter *i, unsigned long offset, size_t bytes); | ||
413 | size_t iov_iter_copy_from_user(struct page *page, | ||
414 | struct iov_iter *i, unsigned long offset, size_t bytes); | ||
415 | void iov_iter_advance(struct iov_iter *i, size_t bytes); | ||
416 | int iov_iter_fault_in_readable(struct iov_iter *i); | ||
417 | size_t iov_iter_single_seg_count(struct iov_iter *i); | ||
418 | |||
419 | static 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 | |||
431 | static inline size_t iov_iter_count(struct iov_iter *i) | ||
432 | { | ||
433 | return i->count; | ||
434 | } | ||
435 | |||
436 | |||
404 | struct address_space_operations { | 437 | struct 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 *); |