0
0
Fork 0
mirror of https://github.com/matrix-construct/construct synced 2024-12-26 15:33:54 +01:00

ircd::mapi: Force the header inline so the module contains the constants.

This commit is contained in:
Jason Volk 2019-04-18 17:15:17 -07:00
parent 1312784518
commit c427223340
2 changed files with 32 additions and 12 deletions

View file

@ -99,7 +99,7 @@ struct ircd::mapi::header
operator const mods::mod &() const;
operator mods::mod &();
header(const string_view & = "<no description>",
header(const string_view &,
init_func = {},
fini_func = {});
@ -113,6 +113,8 @@ struct ircd::mapi::metablock
init_func init; // Executed after dlopen()
fini_func fini; // Executed before dlclose()
meta_data meta; // Various key-value metadata
metablock(const string_view &, init_func &&, fini_func &&);
};
static_assert
@ -127,3 +129,17 @@ static_assert
sizeof(ircd::mapi::header) == 4 + 4 + 8 + 8 + 8,
"The MAPI header size has changed on this platform."
);
inline
__attribute__((always_inline))
ircd::mapi::header::header(const string_view &description,
init_func init,
fini_func fini)
:meta
{
new metablock
{
description, std::move(init), std::move(fini)
}
}
{}

View file

@ -351,22 +351,26 @@ ircd::mods::handle_ebadf(const string_view &what)
// mods/mapi.h
//
ircd::mapi::header::header(const string_view &description,
init_func init,
fini_func fini)
:meta
//
// metablock
//
ircd::mapi::metablock::metablock(const string_view &description,
init_func &&init_func,
fini_func &&fini_func)
:init{std::move(init_func)}
,fini{std::move(fini_func)}
,meta
{
new metablock
{
std::move(init), std::move(fini), meta_data
{
{ "description", description }
}
}
{ "description", description }
}
{
}
//
// header
//
ircd::mapi::header::~header()
noexcept
{