From e09a48ec7e1415477ba606d08a976ca443003acc Mon Sep 17 00:00:00 2001 From: Jason Volk Date: Tue, 14 Jun 2022 14:04:51 -0700 Subject: [PATCH] ircd::mods: Reorg internal header w/ unit; internalized pimpls. --- ircd/mods.cc | 37 ++++++++++++++++++++----------------- ircd/mods.h | 18 ++++++++---------- 2 files changed, 28 insertions(+), 27 deletions(-) diff --git a/ircd/mods.cc b/ircd/mods.cc index 2f52095cd..0f471e2e7 100644 --- a/ircd/mods.cc +++ b/ircd/mods.cc @@ -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 -#include - -namespace filesystem = boost::filesystem; -namespace load_mode = boost::dll::load_mode; - -#include // Module's internal API #include "mods.h" +namespace ircd::mods +{ + template + 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 { diff --git a/ircd/mods.h b/ircd/mods.h index 219a698fa..616e4c93f 100644 --- a/ircd/mods.h +++ b/ircd/mods.h @@ -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 +#include +#include // Module's internal API + +namespace filesystem = boost::filesystem; +namespace load_mode = boost::dll::load_mode; namespace ircd::mods { struct mod; - - template 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 { static std::forward_list loading; // State of current dlopen() recursion.