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

Function __test_io

test/fdinfo.c:58–281  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

56}
57
58static int __test_io(const char *file, struct io_uring *ring, int write,
59 int buffered, int sqthread, int fixed, int nonvec,
60 int buf_select, int seq, int exp_len, int mixed)
61{
62 struct io_uring_sqe *sqe;
63 struct io_uring_cqe *cqe;
64 int open_flags;
65 int i, fd = -1, ret;
66 off_t offset;
67
68#ifdef VERBOSE
69 fprintf(stdout, "%s: start %d/%d/%d/%d/%d/%d: ", __FUNCTION__, write,
70 buffered, sqthread,
71 fixed, nonvec, mixed);
72#endif
73 if (write)
74 open_flags = O_WRONLY;
75 else
76 open_flags = O_RDONLY;
77 if (!buffered)
78 open_flags |= O_DIRECT;
79
80 if (fixed) {
81 ret = t_register_buffers(ring, vecs, BUFFERS);
82 if (ret == T_SETUP_SKIP)
83 return T_EXIT_SKIP;
84 if (ret != T_SETUP_OK) {
85 fprintf(stderr, "buffer reg failed: %d\n", ret);
86 goto err;
87 }
88 }
89
90 fd = open(file, open_flags);
91 if (fd < 0) {
92 if (errno == EINVAL)
93 return 0;
94 if (errno == EPERM || errno == EACCES)
95 return T_EXIT_SKIP;
96 perror("file open");
97 goto err;
98 }
99
100 if (sqthread) {
101 ret = io_uring_register_files(ring, &fd, 1);
102 if (ret) {
103 fprintf(stderr, "file reg failed: %d\n", ret);
104 goto err;
105 }
106 }
107
108 offset = 0;
109 for (i = 0; i < BUFFERS; i++) {
110 if (mixed && i & 1) {
111 sqe = io_uring_get_sqe128(ring);
112 if (!sqe) {
113 fprintf(stderr, "sqe get failed\n");
114 goto err;
115 }

Callers 1

test_ioFunction · 0.70

Calls 9

t_register_buffersFunction · 0.85
io_uring_register_filesFunction · 0.85
io_uring_get_sqe128Function · 0.85
io_uring_submitFunction · 0.85
__io_uring_flush_sqFunction · 0.70
fdinfo_readFunction · 0.70
io_uring_get_sqeFunction · 0.50

Tested by 1

test_ioFunction · 0.56