Document the namespaces and the opaque handles
dpm_core carries a namespace block saying what it holds and why its members keep external linkage while staying off the export table. Each unnamed namespace says its contents are private to that translation unit, and the one in the info module says why it has to be unnamed there: a module is built without hidden visibility or a version script, so a helper with external linkage would reach that module's exports. The three opaque handles in the public header were undocumented. What documentation they had came from the struct definitions in include/internal, which a consumer never sees. EXTRACT_ANON_NSPACES was off, so the documentation on every file-private helper was written and discarded. Doxygen also capitalizes the first letter of a brief, which turned libdpm-core.so into Libdpm-core.so wherever a brief opened with it; those are reworded. Bare references to the library are replaced with the artifact name throughout, including three in the info module's output. The cli_info_version regex follows.
This commit is contained in:
@@ -55,8 +55,45 @@ extern "C" {
|
||||
/* Opaque handles */
|
||||
/* ------------------------------------------------------------------ */
|
||||
|
||||
/**
|
||||
* @brief A libdpm-core.so context
|
||||
*
|
||||
* Everything a consumer does happens through one of these. It carries
|
||||
* the resolved configuration, the module path, the target root, the log
|
||||
* targets, and the modules loaded so far.
|
||||
*
|
||||
* Obtained from dpm_open() and released by dpm_close(). The context owns
|
||||
* everything it hands out: every string and handle a caller receives
|
||||
* from it stays valid until it is closed, and the caller frees none of
|
||||
* them.
|
||||
*
|
||||
* Several contexts may be open at once, each with its own target root.
|
||||
*/
|
||||
typedef struct dpm_ctx dpm_ctx;
|
||||
|
||||
/**
|
||||
* @brief A loaded, fully validated module
|
||||
*
|
||||
* Obtained from dpm_require(). A handle is issued only for a module that
|
||||
* passed validation completely, so holding one means the contract is
|
||||
* satisfied.
|
||||
*
|
||||
* Owned by the context that loaded it: a module is loaded at most once
|
||||
* per context, repeated requests return the same handle, and closing the
|
||||
* context unloads it.
|
||||
*/
|
||||
typedef struct dpm_module dpm_module;
|
||||
|
||||
/**
|
||||
* @brief A cursor over the valid modules in the module path
|
||||
*
|
||||
* Obtained from dpm_list_modules(), advanced with dpm_cursor_next(), and
|
||||
* released with dpm_cursor_free().
|
||||
*
|
||||
* The cursor holds its own copy of what it reports, so releasing it
|
||||
* leaves the modules loaded and the strings it produced valid until the
|
||||
* context closes.
|
||||
*/
|
||||
typedef struct dpm_cursor dpm_cursor;
|
||||
|
||||
/* ------------------------------------------------------------------ */
|
||||
@@ -136,7 +173,7 @@ typedef struct dpm_module_info {
|
||||
/* ------------------------------------------------------------------ */
|
||||
|
||||
/**
|
||||
* @brief Creates a libdpm-core context
|
||||
* @brief Creates a libdpm-core.so context
|
||||
*
|
||||
* Reads configuration from /etc/dpm/conf.d/ (or the overridden config
|
||||
* directory), resolves the module path (override > config > built-in
|
||||
@@ -154,7 +191,7 @@ DPM_PUBLIC_ABI_EXPORT
|
||||
dpm_ctx* dpm_open(const dpm_open_overrides* overrides);
|
||||
|
||||
/**
|
||||
* @brief Releases a libdpm-core context
|
||||
* @brief Releases a libdpm-core.so context
|
||||
*
|
||||
* Unloads every module handle the context issued, closes log targets,
|
||||
* and frees all memory owned by the context. All handles and strings
|
||||
@@ -181,7 +218,7 @@ void dpm_close(dpm_ctx* ctx);
|
||||
* module's version with dpm_module_info_of() and decide whether it is
|
||||
* acceptable.
|
||||
*
|
||||
* @param ctx The libdpm-core context
|
||||
* @param ctx The libdpm-core.so context
|
||||
* @param name The module name (its filename minus .so)
|
||||
* @return A module handle owned by the context, or NULL on failure
|
||||
* with the precise reason retrievable via dpm_last_error()
|
||||
@@ -196,7 +233,7 @@ dpm_module* dpm_require(dpm_ctx* ctx, const char* name);
|
||||
* exactly as they were read at load. The caller decides whether the
|
||||
* version it is looking at suits its purposes.
|
||||
*
|
||||
* @param ctx The libdpm-core context
|
||||
* @param ctx The libdpm-core.so context
|
||||
* @param mod A module handle from dpm_require()
|
||||
* @param out Receives the module's information; the string pointers
|
||||
* remain valid until context close
|
||||
@@ -218,7 +255,7 @@ int dpm_module_info_of(dpm_ctx* ctx, dpm_module* mod,
|
||||
* compile-time knowledge of the module it is calling — the same call
|
||||
* a module makes to reach a peer.
|
||||
*
|
||||
* @param ctx The libdpm-core context
|
||||
* @param ctx The libdpm-core.so context
|
||||
* @param mod A module handle from dpm_require()
|
||||
* @param command The command name; NULL or empty behaves as the
|
||||
* module's help command
|
||||
@@ -240,7 +277,7 @@ int dpm_execute(dpm_ctx* ctx, dpm_module* mod, const char* command,
|
||||
* Scans the module path and validates each candidate .so; failures
|
||||
* are logged and excluded from the results.
|
||||
*
|
||||
* @param ctx The libdpm-core context
|
||||
* @param ctx The libdpm-core.so context
|
||||
* @return A cursor over all valid modules, or NULL on an unreadable
|
||||
* module path
|
||||
*/
|
||||
@@ -273,9 +310,9 @@ void dpm_cursor_free(dpm_cursor* cur);
|
||||
/* ------------------------------------------------------------------ */
|
||||
|
||||
/**
|
||||
* @brief Returns libdpm-core's own version
|
||||
* @brief Returns the version of libdpm-core.so
|
||||
*
|
||||
* @return The libdpm-core version as a static X.Y.Z string; callable
|
||||
* @return The libdpm-core.so version as a static X.Y.Z string; callable
|
||||
* without a context
|
||||
*/
|
||||
DPM_PUBLIC_ABI_EXPORT
|
||||
@@ -288,7 +325,7 @@ const char* dpm_core_version(void);
|
||||
* context's configuration directory; the namespace named "core", from
|
||||
* core.conf, is the library's own.
|
||||
*
|
||||
* @param ctx The libdpm-core context
|
||||
* @param ctx The libdpm-core.so context
|
||||
* @param module The configuration namespace to read
|
||||
* @param section The section name within the file
|
||||
* @param key The key within the section
|
||||
@@ -305,7 +342,7 @@ const char* dpm_config_get(dpm_ctx* ctx, const char* module,
|
||||
* Targets are the console and, when configured, the log file.
|
||||
* Messages above the configured level are dropped.
|
||||
*
|
||||
* @param ctx The libdpm-core context
|
||||
* @param ctx The libdpm-core.so context
|
||||
* @param level The severity (DPM_LOG_FATAL through DPM_LOG_DEBUG)
|
||||
* @param message The message to log; NULL is a no-op
|
||||
*/
|
||||
@@ -315,7 +352,7 @@ void dpm_log(dpm_ctx* ctx, int level, const char* message);
|
||||
/**
|
||||
* @brief Returns the resolved module directory path
|
||||
*
|
||||
* @param ctx The libdpm-core context
|
||||
* @param ctx The libdpm-core.so context
|
||||
* @return The module directory path this context resolved
|
||||
*/
|
||||
DPM_PUBLIC_ABI_EXPORT
|
||||
@@ -324,7 +361,7 @@ const char* dpm_module_path(dpm_ctx* ctx);
|
||||
/**
|
||||
* @brief Returns the most recent failure recorded on the context
|
||||
*
|
||||
* @param ctx The libdpm-core context
|
||||
* @param ctx The libdpm-core.so context
|
||||
* @return A human-readable description of the most recent failure, or
|
||||
* NULL if none; overwritten by the next failing call
|
||||
*/
|
||||
@@ -332,7 +369,7 @@ DPM_PUBLIC_ABI_EXPORT
|
||||
const char* dpm_last_error(dpm_ctx* ctx);
|
||||
|
||||
/* ------------------------------------------------------------------ */
|
||||
/* Module contract (implemented by modules, called by libdpm-core) */
|
||||
/* Module contract (implemented by modules, called by libdpm-core.so) */
|
||||
/* ------------------------------------------------------------------ */
|
||||
|
||||
/*
|
||||
|
||||
Reference in New Issue
Block a user