Skip to content

Commit 2c8fa70

Browse files
committed
io_uring/kbuf: move io_ring_head_to_buf() to kbuf.h
In preparation for using this helper in kbuf.h as well, move it there and turn it into a macro. Signed-off-by: Jens Axboe <[email protected]>
1 parent ecd5c9b commit 2c8fa70

File tree

2 files changed

+3
-6
lines changed

2 files changed

+3
-6
lines changed

io_uring/kbuf.c

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -132,12 +132,6 @@ static int io_provided_buffers_select(struct io_kiocb *req, size_t *len,
132132
return 0;
133133
}
134134

135-
static struct io_uring_buf *io_ring_head_to_buf(struct io_uring_buf_ring *br,
136-
__u16 head, __u16 mask)
137-
{
138-
return &br->bufs[head & mask];
139-
}
140-
141135
static void __user *io_ring_buffer_select(struct io_kiocb *req, size_t *len,
142136
struct io_buffer_list *bl,
143137
unsigned int issue_flags)

io_uring/kbuf.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -121,6 +121,9 @@ static inline bool io_kbuf_recycle(struct io_kiocb *req, unsigned issue_flags)
121121
return false;
122122
}
123123

124+
/* Mapped buffer ring, return io_uring_buf from head */
125+
#define io_ring_head_to_buf(br, head, mask) &(br)->bufs[(head) & (mask)]
126+
124127
static inline void io_kbuf_commit(struct io_kiocb *req,
125128
struct io_buffer_list *bl, int nr)
126129
{

0 commit comments

Comments
 (0)