dthain/basekernel

Error Handling Code Paths

Opened this issue · 0 comments

There are several points in kernel code where the internal interfaces prevent a proper passing of error codes.

For example struct dirent * fs_resolve( const *path) looks pretty, but has no way of returning a kerror to indicate why a resolve failed. As a result, the relevant syscall handlers assume a default of KERROR_NOT_FOUND which is not ideal.

To fix this, rework the following interfaces (and possibly others) to return an error code as the primary result, and fill in the new data structure via a doubly-indirect pointer.

For example, this:

struct dirent * fs_resolve( const char *path );

Should become this:

int fs_resolve( const char *path, struct dirent **d );

Similar comments apply to fs_mkdir fs_traverse and so forth. This requires fixing both the generic filesystem interface as well as the underlying filesystem drivers.