| 446 | } |
| 447 | |
| 448 | static int test_buf_select_short(const char *filename, int nonvec) |
| 449 | { |
| 450 | struct io_uring_sqe *sqe; |
| 451 | struct io_uring_cqe *cqe; |
| 452 | struct io_uring ring; |
| 453 | int ret, i, exp_len; |
| 454 | |
| 455 | if (no_buf_select) |
| 456 | return 0; |
| 457 | |
| 458 | ret = io_uring_queue_init(64, &ring, 0); |
| 459 | if (ret) { |
| 460 | fprintf(stderr, "ring create failed: %d\n", ret); |
| 461 | return 1; |
| 462 | } |
| 463 | |
| 464 | exp_len = 0; |
| 465 | for (i = 0; i < 2 * BUFFERS; i++) { |
| 466 | sqe = io_uring_get_sqe(&ring); |
| 467 | io_uring_prep_provide_buffers(sqe, vecs[i].iov_base, |
| 468 | vecs[i].iov_len / 2, 1, 1, i); |
| 469 | if (!exp_len) |
| 470 | exp_len = vecs[i].iov_len / 2; |
| 471 | } |
| 472 | |
| 473 | ret = io_uring_submit(&ring); |
| 474 | if (ret != BUFFERS * 2) { |
| 475 | fprintf(stderr, "submit: %d\n", ret); |
| 476 | return -1; |
| 477 | } |
| 478 | |
| 479 | for (i = 0; i < BUFFERS * 2; i++) { |
| 480 | ret = io_uring_wait_cqe(&ring, &cqe); |
| 481 | if (cqe->res < 0) { |
| 482 | fprintf(stderr, "cqe->res=%d\n", cqe->res); |
| 483 | return 1; |
| 484 | } |
| 485 | io_uring_cqe_seen(&ring, cqe); |
| 486 | } |
| 487 | |
| 488 | ret = __test_io(filename, &ring, 0, 0, 0, 0, nonvec, 1, 1, exp_len, |
| 489 | false); |
| 490 | |
| 491 | io_uring_queue_exit(&ring); |
| 492 | return ret; |
| 493 | } |
| 494 | |
| 495 | static int provide_buffers_iovec(struct io_uring *ring, int bgid) |
| 496 | { |
no test coverage detected