1 #ifndef IO_URING_MEMMAP_H
2 #define IO_URING_MEMMAP_H
3 
4 #define IORING_MAP_OFF_PARAM_REGION		0x20000000ULL
5 #define IORING_MAP_OFF_ZCRX_REGION		0x30000000ULL
6 
7 struct page **io_pin_pages(unsigned long ubuf, unsigned long len, int *npages);
8 
9 #ifndef CONFIG_MMU
10 unsigned int io_uring_nommu_mmap_capabilities(struct file *file);
11 #endif
12 unsigned long io_uring_get_unmapped_area(struct file *file, unsigned long addr,
13 					 unsigned long len, unsigned long pgoff,
14 					 unsigned long flags);
15 int io_uring_mmap(struct file *file, struct vm_area_struct *vma);
16 
17 void io_free_region(struct io_ring_ctx *ctx, struct io_mapped_region *mr);
18 int io_create_region(struct io_ring_ctx *ctx, struct io_mapped_region *mr,
19 		     struct io_uring_region_desc *reg,
20 		     unsigned long mmap_offset);
21 
22 int io_create_region_mmap_safe(struct io_ring_ctx *ctx,
23 				struct io_mapped_region *mr,
24 				struct io_uring_region_desc *reg,
25 				unsigned long mmap_offset);
26 
io_region_get_ptr(struct io_mapped_region * mr)27 static inline void *io_region_get_ptr(struct io_mapped_region *mr)
28 {
29 	return mr->ptr;
30 }
31 
io_region_is_set(struct io_mapped_region * mr)32 static inline bool io_region_is_set(struct io_mapped_region *mr)
33 {
34 	return !!mr->nr_pages;
35 }
36 
37 #endif
38