Modules determine their own compatibility with the library

A module is built against the system-installed libdpm-core.so and is
responsible for being correct against it. Where it needs to act on the
version it is running under, dpm_core_version() reports that and the
module decides for itself.

dpm_module_core_min() is removed. It was a declaration handed to the
library to enforce on the module's behalf, and enforcement of that kind
belongs nowhere in a library that routes and hosts. The contract is now
three reserved symbols and load validation is two steps: the reserved
symbols resolve, and the version and description probes return
well-formed values.

compare_versions had no remaining caller and is removed; parse_version
stays for the well-formedness probe. The core_too_new fixture went with
the handshake it existed to exercise.
This commit is contained in:
2026-08-15 04:21:58 -04:00
parent 97b39cac6c
commit 17acad2b02
17 changed files with 101 additions and 185 deletions

View File

@@ -92,7 +92,6 @@ typedef struct dpm_module_info {
const char* name; /* module name (filename minus .so) */
const char* version; /* module's own X.Y.Z */
const char* description; /* one-line description */
const char* core_min; /* minimum libdpm-core version it supports */
} dpm_module_info;
/* ------------------------------------------------------------------ */
@@ -139,9 +138,9 @@ DPM_API void dpm_close(dpm_ctx* ctx);
* context. Modules are loaded at most once per context; repeated
* calls return the same handle.
*
* Version compatibility is the caller's judgement, not this library's:
* read the loaded module's version with dpm_module_info_of() and
* decide whether it is acceptable.
* Version compatibility is the caller's judgement: read the loaded
* module's version with dpm_module_info_of() and decide whether it is
* acceptable.
*
* @param ctx The libdpm-core context
* @param name The module name (its filename minus .so)
@@ -151,13 +150,11 @@ DPM_API void dpm_close(dpm_ctx* ctx);
DPM_API dpm_module* dpm_require(dpm_ctx* ctx, const char* name);
/**
* @brief Reports what libdpm-core sees in a loaded module
* @brief Reports what the library sees in a loaded module
*
* Fills `out` with the module's name, version, description, and
* minimum-libdpm-core version, exactly as they were read at load. No
* compatibility conclusion is drawn from these values; the caller
* decides whether the version it is looking at is too new or too
* old for its purposes.
* Fills `out` with the module's name, version, and description,
* 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 mod A module handle from dpm_require()
@@ -210,9 +207,8 @@ DPM_API dpm_cursor* dpm_list_modules(dpm_ctx* ctx);
/**
* @brief Advances an enumeration cursor
*
* Fills `out` with the next module's name, version, description, and
* minimum-libdpm-core version; the string pointers remain valid until
* context close.
* Fills `out` with the next module's name, version, and description;
* the string pointers remain valid until context close.
*
* @param cur The cursor from dpm_list_modules()
* @param out Receives the next module's information
@@ -296,11 +292,17 @@ DPM_API const char* dpm_last_error(dpm_ctx* ctx);
* int argc, char** argv);
* const char* dpm_module_version(void);
* const char* dpm_module_description(void);
* const char* dpm_module_core_min(void);
*
* dpm_module_execute is the module's entire functional surface; its
* capabilities are addressed by command string, so a module publishes
* no headers, struct layouts, or symbols to anything that calls it.
*
* A module determines for itself whether it can work with the library
* it is running against: dpm_core_version() reports the running
* version, and the module proceeds or fails on its own judgement. A
* module is built against the system-installed libdpm-core.so and is
* responsible for being correct against it.
*
* The library refuses to load any module that does not validate
* completely (see the DPM specification: load-time enforcement).
*/