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

Function queue_read

examples/io_uring-cp.c:80–105  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

78}
79
80static int queue_read(struct io_uring *ring, off_t size, off_t offset)
81{
82 struct io_uring_sqe *sqe;
83 struct io_data *data;
84
85 data = malloc(size + sizeof(*data));
86 if (!data)
87 return 1;
88
89 sqe = io_uring_get_sqe(ring);
90 if (!sqe) {
91 free(data);
92 return 1;
93 }
94
95 data->read = 1;
96 data->offset = data->first_offset = offset;
97
98 data->iov.iov_base = data + 1;
99 data->iov.iov_len = size;
100 data->first_len = size;
101
102 io_uring_prep_readv(sqe, infd, &data->iov, 1, offset);
103 io_uring_sqe_set_data(sqe, data);
104 return 0;
105}
106
107static void queue_write(struct io_uring *ring, struct io_data *data)
108{

Callers 1

copy_fileFunction · 0.85

Calls 1

io_uring_get_sqeFunction · 0.50

Tested by

no test coverage detected