0
0
Fork 0
mirror of https://github.com/matrix-construct/construct synced 2024-06-25 21:38:18 +02:00

ircd::fs::aio: Add struct aio_ring from the kernel ABI.

This commit is contained in:
Jason Volk 2019-03-17 18:41:45 -07:00
parent 4e2a445426
commit effc34c86f
2 changed files with 24 additions and 0 deletions

View file

@ -412,6 +412,14 @@ try
}
{
syscall<SYS_io_setup>(this->max_events(), &idp);
const aio_ring *const ring
{
reinterpret_cast<const aio_ring *>(idp)
};
assert(ring->magic == aio_ring::MAGIC);
log::debug
{
"Established AIO(%p) context (fd:%d max_events:%zu max_submit:%zu)",

View file

@ -23,6 +23,22 @@ namespace ircd::fs::aio
void fsync(const fd &, const sync_opts &);
}
struct aio_ring
{
static constexpr uint MAGIC {0xa10a10a1};
uint id; // kernel internal index number
uint nr; // number of io_events
uint head;
uint tail;
uint magic;
uint compat_features;
uint incompat_features;
uint header_length; // size of aio_ring
struct io_event io_events[0];
};
// 128 bytes + ring size
/// AIO context instance from the system. Right now this is a singleton with
/// an extern instance pointer at fs::aio::context maintained by fs::aio::init.
struct ircd::fs::aio::system