| 17 | static struct iovec rvec, wvec; |
| 18 | |
| 19 | static int read_it(struct io_uring *ring, int fd, int len, int off) |
| 20 | { |
| 21 | struct io_uring_sqe *sqe; |
| 22 | struct io_uring_cqe *cqe; |
| 23 | int ret; |
| 24 | |
| 25 | sqe = io_uring_get_sqe(ring); |
| 26 | io_uring_prep_read_fixed(sqe, fd, rvec.iov_base + off, len, 0, 0); |
| 27 | sqe->user_data = 1; |
| 28 | |
| 29 | io_uring_submit(ring); |
| 30 | |
| 31 | ret = io_uring_wait_cqe(ring, &cqe); |
| 32 | if (ret) { |
| 33 | fprintf(stderr, "wait %d\n", ret); |
| 34 | return 1; |
| 35 | } |
| 36 | if (cqe->res < 0) { |
| 37 | fprintf(stderr, "cqe res %s\n", strerror(-cqe->res)); |
| 38 | return 1; |
| 39 | } |
| 40 | if (cqe->res != len) { |
| 41 | fprintf(stderr, "Bad read amount: %d\n", cqe->res); |
| 42 | return 1; |
| 43 | } |
| 44 | io_uring_cqe_seen(ring, cqe); |
| 45 | |
| 46 | if (memcmp(wvec.iov_base, rvec.iov_base + off, len)) { |
| 47 | fprintf(stderr, "%d %d verify failed\n", len, off); |
| 48 | return 1; |
| 49 | } |
| 50 | |
| 51 | return 0; |
| 52 | } |
| 53 | |
| 54 | static int test(struct io_uring *ring, int fd, int vec_off) |
| 55 | { |
no test coverage detected