Describe dpm_module_execute as the entry point, not the whole surface
A module's reported version is consumed: a calling module reads it through dpm_module_info_of and decides from it whether to issue a command. Calling dpm_module_execute the module's entire functional surface contradicted that. dpm_module_execute is the only entry through which a module performs work. dpm_module_version and dpm_module_description are what it reports about itself, read at load and served to consumers, and the contract page in the public header now says so.
This commit is contained in:
@@ -7,7 +7,7 @@ A DPM module is one shared object in the module directory. libdpm-core.so loads
|
||||
A module includes `<dpm/core.h>`, links `-ldpm-core`, and exports the following symbols as extern "C". All returned strings must be non-NULL, static or module-owned, and valid for the lifetime of the loaded module; callers never free them.
|
||||
|
||||
**`int dpm_module_execute(dpm_ctx* ctx, const char* command, int argc, char** argv)`**
|
||||
The command entry point, and the module's entire functional surface. `ctx` is the host context that dispatched the call; the module reaches every service (`dpm_log`, `dpm_config_get`, `dpm_module_path`, ...) through it, and reaches peer modules through it as well. `command` is the subcommand name, equal to argv[0] when argc > 0. NULL or empty `command` must behave as the module's help command. Returns 0 on success, nonzero on failure. It must be callable immediately after load with no other setup.
|
||||
The command entry point, and the only entry through which the module performs work. `ctx` is the host context that dispatched the call; the module reaches every service (`dpm_log`, `dpm_config_get`, `dpm_module_path`, ...) through it, and reaches peer modules through it as well. `command` is the subcommand name, equal to argv[0] when argc > 0. NULL or empty `command` must behave as the module's help command. Returns 0 on success, nonzero on failure. It must be callable immediately after load with no other setup.
|
||||
|
||||
**`const char* dpm_module_version(void)`**
|
||||
The module's own version as an X.Y.Z string. libdpm-core.so reports this value to consumers, and each consumer decides for itself whether the version suits it.
|
||||
|
||||
Reference in New Issue
Block a user