libk  Artifact [97dcae5195]

Artifact 97dcae51953ede0a749207eff0df724319d3bb1c8eb8c9c8c43f2396b72040e0:


#include <k/core.h>
#include <k/type.h>
#include <k/internal.egroup.h>

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;
}