MCPcopy Create free account
hub / github.com/axboe/liburing / test_mixed_reg

Function test_mixed_reg

test/buf-ring.c:65–105  ·  view source on GitHub ↗

test trying to register ring group when classic group exists */

Source from the content-addressed store, hash-verified

63
64/* test trying to register ring group when classic group exists */
65static int test_mixed_reg(int bgid)
66{
67 struct io_uring_buf_ring *br;
68 struct io_uring_sqe *sqe;
69 struct io_uring_cqe *cqe;
70 struct io_uring ring;
71 void *bufs;
72 int ret;
73
74 ret = t_create_ring(1, &ring, 0);
75 if (ret == T_SETUP_SKIP)
76 return 0;
77 else if (ret != T_SETUP_OK)
78 return 1;
79
80 /* provide classic buffers, group 1 */
81 bufs = malloc(8 * 1024);
82 sqe = io_uring_get_sqe(&ring);
83 io_uring_prep_provide_buffers(sqe, bufs, 1024, 8, bgid, 0);
84 io_uring_submit(&ring);
85 ret = io_uring_wait_cqe(&ring, &cqe);
86 if (ret) {
87 fprintf(stderr, "wait_cqe %d\n", ret);
88 return 1;
89 }
90 if (cqe->res) {
91 fprintf(stderr, "cqe res %d\n", cqe->res);
92 return 1;
93 }
94 io_uring_cqe_seen(&ring, cqe);
95
96 br = io_uring_setup_buf_ring(&ring, 32, bgid, 0, &ret);
97 if (br) {
98 fprintf(stderr, "Buffer ring setup succeeded unexpectedly %d\n", ret);
99 return 1;
100 }
101
102 io_uring_queue_exit(&ring);
103 free(bufs);
104 return 0;
105}
106
107static int test_double_reg_unreg(int bgid)
108{

Callers 1

mainFunction · 0.85

Calls 5

t_create_ringFunction · 0.85
io_uring_submitFunction · 0.85
io_uring_setup_buf_ringFunction · 0.85
io_uring_queue_exitFunction · 0.85
io_uring_get_sqeFunction · 0.50

Tested by

no test coverage detected