0
0
Fork 0
mirror of https://github.com/matrix-construct/construct synced 2024-11-16 15:00:51 +01:00

ircd::fs::aio: Move ring struct into system::.

This commit is contained in:
Jason Volk 2019-03-27 01:52:37 -07:00
parent 55241c5309
commit 1e900217ee
2 changed files with 21 additions and 19 deletions

View file

@ -413,12 +413,12 @@ try
{ {
syscall<SYS_io_setup>(this->max_events(), &idp); syscall<SYS_io_setup>(this->max_events(), &idp);
const aio_ring *const ring const system::ring *const ring
{ {
reinterpret_cast<const aio_ring *>(idp) reinterpret_cast<const system::ring *>(idp)
}; };
assert(ring->magic == aio_ring::MAGIC); assert(ring->magic == ring::MAGIC);
log::debug log::debug
{ {

View file

@ -23,26 +23,12 @@ namespace ircd::fs::aio
void fsync(const fd &, const sync_opts &); 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 /// 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. /// an extern instance pointer at fs::aio::context maintained by fs::aio::init.
struct ircd::fs::aio::system struct ircd::fs::aio::system
{ {
struct ring;
static const int eventfd_flags; static const int eventfd_flags;
/// io_getevents vector (in) /// io_getevents vector (in)
@ -98,6 +84,22 @@ struct ircd::fs::aio::system
~system() noexcept; ~system() noexcept;
}; };
struct ircd::fs::aio::system::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
/// Generic request control block. /// Generic request control block.
struct ircd::fs::aio::request struct ircd::fs::aio::request
:iocb :iocb