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

ircd::mods: Reorg internal header w/ unit; internalized pimpls.

This commit is contained in:
Jason Volk 2022-06-14 14:04:51 -07:00
parent 169eda8da4
commit e09a48ec7e
2 changed files with 28 additions and 27 deletions

View file

@ -8,15 +8,19 @@
// copyright notice and this permission notice is present in all copies. The
// full license for this software is available in the LICENSE file.
#include <boost/filesystem.hpp>
#include <boost/dll.hpp>
namespace filesystem = boost::filesystem;
namespace load_mode = boost::dll::load_mode;
#include <ircd/mods/mapi.h> // Module's internal API
#include "mods.h"
namespace ircd::mods
{
template<class R,
class F>
static R info(const string_view &, F&& closure);
static void handle_ebadf(const string_view &what);
static void handle_stuck(mod &);
static bool unload(mod &) noexcept;
}
ircd::log::log
ircd::mods::log
{
@ -39,21 +43,14 @@ ircd::mods::autoload
{ "persist", false },
};
//
// mods::mod
//
decltype(ircd::mods::mod::loading)
ircd::mods::mod::loading
{};
ircd::mods::mod::loading;
decltype(ircd::mods::mod::unloading)
ircd::mods::mod::unloading
{};
ircd::mods::mod::unloading;
decltype(ircd::mods::mod::loaded)
ircd::mods::mod::loaded
{};
ircd::mods::mod::loaded;
const char *const
ircd::mapi::import_section_names[]
@ -1157,6 +1154,12 @@ catch(const boost::system::system_error &e)
// mods/paths.h
//
namespace ircd::mods
{
[[gnu::visibility("internal")]]
extern const std::string prefix, suffix;
}
decltype(ircd::mods::prefix)
ircd::mods::prefix
{

View file

@ -8,18 +8,15 @@
// copyright notice and this permission notice is present in all copies. The
// full license for this software is available in the LICENSE file.
#include <boost/filesystem.hpp>
#include <boost/dll.hpp>
#include <ircd/mods/mapi.h> // Module's internal API
namespace filesystem = boost::filesystem;
namespace load_mode = boost::dll::load_mode;
namespace ircd::mods
{
struct mod;
template<class R, class F> R info(const string_view &, F&& closure);
void handle_ebadf(const string_view &what);
void handle_stuck(mod &);
bool unload(mod &) noexcept;
extern const std::string prefix;
extern const std::string suffix;
}
/// Internal module representation. This object closely wraps the dlopen()
@ -33,7 +30,8 @@ namespace ircd::mods
/// It is a critical error if static initialization and destruction is not
/// congruent with the lifetime of this instance.
///
struct ircd::mods::mod
struct [[gnu::visibility("hidden")]]
ircd::mods::mod
:std::enable_shared_from_this<mod>
{
static std::forward_list<mod *> loading; // State of current dlopen() recursion.