1) Allocate less by not sorting the result with qsort. Instead,
insert the nodes in the correct order;
2) Do not maintain the whole path in memory, but rely on openat()
make the function names reflect the structure they are operating on.
the structure is now allocated and remembers the context it was
created, then no need to give the context in every function call.
functions that do not modify their parameters get them as const pointers.
special cases:
* kmod_get_userdata/kmod_set_userdata: return as void* for user convenience.
* kmod_list_append/kmod_list_prepend: take const void* for user convenience.