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

Function test

test/file-verify.c:325–501  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

323}
324
325static int test(struct io_uring *ring, const char *fname, int buffered,
326 int vectored, int small_vecs, int registered, int provide)
327{
328 struct iovec vecs[READ_BATCH][MAX_VECS];
329 struct io_uring_cqe *cqe;
330 struct io_uring_sqe *sqe;
331 void *buf[READ_BATCH];
332 int ret, fd, flags;
333 int i, j, nr_vecs;
334 off_t off, voff;
335 size_t left;
336
337 if (registered) {
338 assert(!provide);
339 assert(!vectored && !small_vecs);
340 }
341 if (provide) {
342 assert(!registered);
343 assert(!vectored && !small_vecs);
344 }
345
346 flags = O_RDONLY;
347 if (!buffered)
348 flags |= O_DIRECT;
349 fd = open(fname, flags);
350 if (fd < 0) {
351 if (errno == EINVAL || errno == EPERM || errno == EACCES)
352 return T_EXIT_SKIP;
353 perror("open");
354 return 1;
355 }
356
357 if (do_punch(fd))
358 return 1;
359
360 if (vectored) {
361 if (small_vecs)
362 nr_vecs = MIN_VECS;
363 else
364 nr_vecs = MAX_VECS;
365
366 for (j = 0; j < READ_BATCH; j++) {
367 for (i = 0; i < nr_vecs; i++) {
368 void *ptr;
369
370 t_posix_memalign(&ptr, 4096, CHUNK_SIZE / nr_vecs);
371 vecs[j][i].iov_base = ptr;
372 vecs[j][i].iov_len = CHUNK_SIZE / nr_vecs;
373 }
374 }
375 } else {
376 for (j = 0; j < READ_BATCH; j++)
377 t_posix_memalign(&buf[j], 4096, CHUNK_SIZE);
378 nr_vecs = 0;
379 }
380
381 if (registered) {
382 struct iovec v[READ_BATCH];

Callers 1

mainFunction · 0.70

Calls 8

do_punchFunction · 0.85
t_posix_memalignFunction · 0.85
t_register_buffersFunction · 0.85
io_uring_submitFunction · 0.85
provide_buffersFunction · 0.70
verify_bufFunction · 0.70
io_uring_get_sqeFunction · 0.50

Tested by

no test coverage detected