aboutsummaryrefslogtreecommitdiffstats
path: root/include/linux/fs.h
diff options
context:
space:
mode:
Diffstat (limited to 'include/linux/fs.h')
-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 *);