| 14 | #include "liburing.h" |
| 15 | |
| 16 | static int test_single_fsync(struct io_uring *ring) |
| 17 | { |
| 18 | struct io_uring_cqe *cqe; |
| 19 | struct io_uring_sqe *sqe; |
| 20 | char buf[32]; |
| 21 | int fd, ret; |
| 22 | |
| 23 | sprintf(buf, "./XXXXXX"); |
| 24 | fd = mkstemp(buf); |
| 25 | if (fd < 0) { |
| 26 | perror("open"); |
| 27 | return 1; |
| 28 | } |
| 29 | |
| 30 | sqe = io_uring_get_sqe(ring); |
| 31 | if (!sqe) { |
| 32 | fprintf(stderr, "get sqe failed\n"); |
| 33 | goto err; |
| 34 | } |
| 35 | |
| 36 | io_uring_prep_fsync(sqe, fd, 0); |
| 37 | |
| 38 | ret = io_uring_submit(ring); |
| 39 | if (ret <= 0) { |
| 40 | fprintf(stderr, "sqe submit failed: %d\n", ret); |
| 41 | goto err; |
| 42 | } |
| 43 | |
| 44 | ret = io_uring_wait_cqe(ring, &cqe); |
| 45 | if (ret < 0) { |
| 46 | fprintf(stderr, "wait completion %d\n", ret); |
| 47 | goto err; |
| 48 | } |
| 49 | |
| 50 | io_uring_cqe_seen(ring, cqe); |
| 51 | unlink(buf); |
| 52 | return 0; |
| 53 | err: |
| 54 | unlink(buf); |
| 55 | return 1; |
| 56 | } |
| 57 | |
| 58 | static int test_barrier_fsync(struct io_uring *ring) |
| 59 | { |
no test coverage detected