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

Function test_buf_select

test/read-write.c:602–644  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

600}
601
602static int test_buf_select(const char *filename, int nonvec)
603{
604 struct io_uring_probe *p;
605 struct io_uring ring;
606 int ret, i;
607
608 ret = io_uring_queue_init(64, &ring, 0);
609 if (ret) {
610 fprintf(stderr, "ring create failed: %d\n", ret);
611 return 1;
612 }
613
614 p = io_uring_get_probe_ring(&ring);
615 if (!p || !io_uring_opcode_supported(p, IORING_OP_PROVIDE_BUFFERS)) {
616 no_buf_select = 1;
617 fprintf(stdout, "Buffer select not supported, skipping\n");
618 return 0;
619 }
620 io_uring_free_probe(p);
621
622 /*
623 * Write out data with known pattern
624 */
625 for (i = 0; i < BUFFERS; i++)
626 memset(vecs[i].iov_base, i, vecs[i].iov_len);
627
628 ret = __test_io(filename, &ring, 1, 0, 0, 0, 0, 0, 1, BS, false);
629 if (ret) {
630 fprintf(stderr, "failed writing data\n");
631 return 1;
632 }
633
634 for (i = 0; i < BUFFERS; i++)
635 memset(vecs[i].iov_base, 0x55, vecs[i].iov_len);
636
637 ret = provide_buffers_iovec(&ring, 1);
638 if (ret)
639 return ret;
640
641 ret = __test_io(filename, &ring, 0, 0, 0, 0, nonvec, 1, 1, BS, false);
642 io_uring_queue_exit(&ring);
643 return ret;
644}
645
646static int test_rem_buf(int batch, int sqe_flags)
647{

Callers 1

mainFunction · 0.85

Calls 6

io_uring_queue_initFunction · 0.85
io_uring_get_probe_ringFunction · 0.85
io_uring_free_probeFunction · 0.85
provide_buffers_iovecFunction · 0.85
io_uring_queue_exitFunction · 0.85
__test_ioFunction · 0.70

Tested by

no test coverage detected