Index: mod/kcore/core.h ================================================================== --- mod/kcore/core.h +++ mod/kcore/core.h @@ -163,15 +163,15 @@ typedef struct kerror { const char* module_name, * module_desc, * error_string; - kcond error; + kcond cond; } kerror; kerror kexplain(kcond); #ifdef __cplusplus } #endif #endif ADDED mod/kcore/explain.fn.c Index: mod/kcore/explain.fn.c ================================================================== --- mod/kcore/explain.fn.c +++ mod/kcore/explain.fn.c @@ -0,0 +1,22 @@ +#include +#include +#include + +kerror kexplain(kcond val) { + kcond idx = val / kglobal_module_offset; + /* module index in table */ + kcond offset = val % kglobal_module_offset; + /* error index in module error table */ + + struct kglobal_module_record* rec = kglobal_module_ident + idx; + /* retrieve module identity from global table */ + + kerror k = { + .module_name = rec -> name, + .module_desc = rec -> desc, + .error_string = rec -> error_list[offset], + .cond = val, + }; + + return k; +}