| 13 | #include "helpers.h" |
| 14 | |
| 15 | static int do_linkat(struct io_uring *ring, int olddirfd, const char *oldname, |
| 16 | const char *newname, int flags) |
| 17 | { |
| 18 | struct io_uring_sqe *sqe; |
| 19 | struct io_uring_cqe *cqe; |
| 20 | int ret; |
| 21 | |
| 22 | sqe = io_uring_get_sqe(ring); |
| 23 | if (!sqe) { |
| 24 | fprintf(stderr, "sqe get failed\n"); |
| 25 | return 1; |
| 26 | } |
| 27 | io_uring_prep_linkat(sqe, olddirfd, oldname, AT_FDCWD, newname, flags); |
| 28 | |
| 29 | ret = io_uring_submit(ring); |
| 30 | if (ret != 1) { |
| 31 | fprintf(stderr, "submit failed: %d\n", ret); |
| 32 | return 1; |
| 33 | } |
| 34 | |
| 35 | ret = io_uring_wait_cqes(ring, &cqe, 1, 0, 0); |
| 36 | if (ret) { |
| 37 | fprintf(stderr, "wait_cqe failed: %d\n", ret); |
| 38 | return 1; |
| 39 | } |
| 40 | ret = cqe->res; |
| 41 | io_uring_cqe_seen(ring, cqe); |
| 42 | return ret; |
| 43 | } |
| 44 | |
| 45 | static int files_linked_ok(const char* fn1, const char *fn2) |
| 46 | { |
no test coverage detected