summaryrefslogtreecommitdiff
path: root/io_uring/memmap.h
diff options
context:
space:
mode:
authorPavel Begunkov <asml.silence@gmail.com>2025-11-10 13:04:49 +0000
committerJens Axboe <axboe@kernel.dk>2025-11-11 07:53:33 -0700
commit4aed5b4e6d276d2308d0ea8932b0c6ebfd3d19f8 (patch)
tree0174d8328b8ae30afa74af28413a70f01731cd19 /io_uring/memmap.h
parent21bd7b14a32de35bc6c4fff7a739dc5d33ce04f1 (diff)
io_uring: add helper calculating region byte size
There has been type related issues with region size calculation, add an utility helper function that returns the size and handles type conversions right. Signed-off-by: Pavel Begunkov <asml.silence@gmail.com> Signed-off-by: Jens Axboe <axboe@kernel.dk>
Diffstat (limited to 'io_uring/memmap.h')
-rw-r--r--io_uring/memmap.h5
1 files changed, 5 insertions, 0 deletions
diff --git a/io_uring/memmap.h b/io_uring/memmap.h
index a6c63ca2c6f1..a39d9e518905 100644
--- a/io_uring/memmap.h
+++ b/io_uring/memmap.h
@@ -43,4 +43,9 @@ static inline void io_region_publish(struct io_ring_ctx *ctx,
*dst_region = *src_region;
}
+static inline size_t io_region_size(struct io_mapped_region *mr)
+{
+ return (size_t) mr->nr_pages << PAGE_SHIFT;
+}
+
#endif