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

Function do_linkat

test/hardlink.c:15–43  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

13#include "helpers.h"
14
15static 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
45static int files_linked_ok(const char* fn1, const char *fn2)
46{

Callers 1

mainFunction · 0.85

Calls 3

io_uring_submitFunction · 0.85
io_uring_wait_cqesFunction · 0.85
io_uring_get_sqeFunction · 0.50

Tested by

no test coverage detected