Mike Marshall | f7ab093 | 2015-07-17 10:38:11 -0400 | [diff] [blame^] | 1 | /* |
| 2 | * (C) 2001 Clemson University and The University of Chicago |
| 3 | * |
| 4 | * See COPYING in top-level directory. |
| 5 | */ |
| 6 | |
| 7 | #ifndef __PVFS2_BUFMAP_H |
| 8 | #define __PVFS2_BUFMAP_H |
| 9 | |
| 10 | /* used to describe mapped buffers */ |
| 11 | struct pvfs_bufmap_desc { |
| 12 | void *uaddr; /* user space address pointer */ |
| 13 | struct page **page_array; /* array of mapped pages */ |
| 14 | int array_count; /* size of above arrays */ |
| 15 | struct list_head list_link; |
| 16 | }; |
| 17 | |
| 18 | struct pvfs2_bufmap; |
| 19 | |
| 20 | struct pvfs2_bufmap *pvfs2_bufmap_ref(void); |
| 21 | void pvfs2_bufmap_unref(struct pvfs2_bufmap *bufmap); |
| 22 | |
| 23 | /* |
| 24 | * pvfs_bufmap_size_query is now an inline function because buffer |
| 25 | * sizes are not hardcoded |
| 26 | */ |
| 27 | int pvfs_bufmap_size_query(void); |
| 28 | |
| 29 | int pvfs_bufmap_shift_query(void); |
| 30 | |
| 31 | int pvfs_bufmap_initialize(struct PVFS_dev_map_desc *user_desc); |
| 32 | |
| 33 | int get_bufmap_init(void); |
| 34 | |
| 35 | void pvfs_bufmap_finalize(void); |
| 36 | |
| 37 | int pvfs_bufmap_get(struct pvfs2_bufmap **mapp, int *buffer_index); |
| 38 | |
| 39 | void pvfs_bufmap_put(struct pvfs2_bufmap *bufmap, int buffer_index); |
| 40 | |
| 41 | int readdir_index_get(struct pvfs2_bufmap **mapp, int *buffer_index); |
| 42 | |
| 43 | void readdir_index_put(struct pvfs2_bufmap *bufmap, int buffer_index); |
| 44 | |
| 45 | int pvfs_bufmap_copy_iovec_from_user(struct pvfs2_bufmap *bufmap, |
| 46 | int buffer_index, |
| 47 | const struct iovec *iov, |
| 48 | unsigned long nr_segs, |
| 49 | size_t size); |
| 50 | |
| 51 | int pvfs_bufmap_copy_iovec_from_kernel(struct pvfs2_bufmap *bufmap, |
| 52 | int buffer_index, |
| 53 | const struct iovec *iov, |
| 54 | unsigned long nr_segs, |
| 55 | size_t size); |
| 56 | |
| 57 | int pvfs_bufmap_copy_to_user_iovec(struct pvfs2_bufmap *bufmap, |
| 58 | int buffer_index, |
| 59 | const struct iovec *iov, |
| 60 | unsigned long nr_segs, |
| 61 | size_t size); |
| 62 | |
| 63 | int pvfs_bufmap_copy_to_kernel_iovec(struct pvfs2_bufmap *bufmap, |
| 64 | int buffer_index, |
| 65 | const struct iovec *iov, |
| 66 | unsigned long nr_segs, |
| 67 | size_t size); |
| 68 | |
| 69 | size_t pvfs_bufmap_copy_to_user_task_iovec(struct task_struct *tsk, |
| 70 | struct iovec *iovec, |
| 71 | unsigned long nr_segs, |
| 72 | struct pvfs2_bufmap *bufmap, |
| 73 | int buffer_index, |
| 74 | size_t bytes_to_be_copied); |
| 75 | |
| 76 | #endif /* __PVFS2_BUFMAP_H */ |