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

Function test_rem_buf_single

test/read-write.c:702–747  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

700}
701
702static int test_rem_buf_single(int to_rem)
703{
704 struct io_uring_sqe *sqe;
705 struct io_uring_cqe *cqe;
706 struct io_uring ring;
707 int ret, expected;
708 int bgid = 1;
709
710 if (no_buf_select)
711 return 0;
712
713 ret = io_uring_queue_init(64, &ring, 0);
714 if (ret) {
715 fprintf(stderr, "ring create failed: %d\n", ret);
716 return 1;
717 }
718
719 ret = provide_buffers_iovec(&ring, bgid);
720 if (ret)
721 return ret;
722
723 expected = (to_rem > BUFFERS) ? BUFFERS : to_rem;
724
725 sqe = io_uring_get_sqe(&ring);
726 io_uring_prep_remove_buffers(sqe, to_rem, bgid);
727
728 ret = io_uring_submit(&ring);
729 if (ret != 1) {
730 fprintf(stderr, "submit: %d\n", ret);
731 return -1;
732 }
733
734 ret = io_uring_wait_cqe(&ring, &cqe);
735 if (ret) {
736 fprintf(stderr, "wait_cqe=%d\n", ret);
737 return 1;
738 }
739 if (cqe->res != expected) {
740 fprintf(stderr, "cqe->res=%d, expected=%d\n", cqe->res, expected);
741 return 1;
742 }
743 io_uring_cqe_seen(&ring, cqe);
744
745 io_uring_queue_exit(&ring);
746 return ret;
747}
748
749static int test_io_link(const char *file)
750{

Callers 1

mainFunction · 0.85

Calls 5

io_uring_queue_initFunction · 0.85
provide_buffers_iovecFunction · 0.85
io_uring_submitFunction · 0.85
io_uring_queue_exitFunction · 0.85
io_uring_get_sqeFunction · 0.50

Tested by

no test coverage detected