static dir_t* _cast_dir(const oe_fd_t* desc)
{
    dir_t* ret = NULL;
    dir_t* dir = (dir_t*)desc;

    if (dir == NULL || dir->magic != DIR_MAGIC)
        OE_RAISE_ERRNO(OE_EINVAL);

    ret = dir;

done:
    return ret;
}
static dir_t* _cast_dir(const oe_fd_t* desc)
{
    dir_t* ret = NULL;
    dir_t* dir = (dir_t*)desc;

    if (dir == NULL || dir->magic != DIR_MAGIC)
        OE_RAISE_ERRNO(OE_EINVAL);

    ret = dir;

done:
    return ret;
}