0
0
Fork 0
mirror of https://github.com/matrix-construct/construct synced 2024-06-10 22:18:54 +02:00

ircd::fs::aio: Add iteration tool for kernel completion queue.

This commit is contained in:
Jason Volk 2019-03-30 13:09:44 -07:00
parent 881d3116cc
commit 9f534dea17
2 changed files with 13 additions and 0 deletions

View file

@ -258,6 +258,18 @@ ircd::fs::aio::write(const fd &fd,
return bytes;
}
bool
ircd::fs::aio::for_each_completed(const std::function<bool (const request &)> &closure)
{
assert(system);
const size_t max(system->max_events());
for(size_t i(system->head->head % max); i != system->head->tail % max; ++i %= max)
if(!closure(*reinterpret_cast<const request *>(system->ring[i].data)))
return false;
return true;
}
//
// request
//

View file

@ -17,6 +17,7 @@ namespace ircd::fs::aio
struct system;
struct request;
bool for_each_completed(const std::function<bool (const request &)> &);
size_t write(const fd &, const const_iovec_view &, const write_opts &);
size_t read(const fd &, const const_iovec_view &, const read_opts &);
void fdsync(const fd &, const sync_opts &);