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