lib/aos/slot_alloc/slot_alloc.c
errval_t slot_free(struct capref ret)
{
    struct slot_alloc_state *state = get_slot_alloc_state();

    if (cnodecmp(ret.cnode, cnode_base)) { // Detect frees in basecn
        return SYS_ERR_OK;
    }

    if (cnodecmp(ret.cnode, cnode_root)) {
        struct slot_allocator *ca = (struct slot_allocator*)(&state->rootca);
        return ca->free(ca, ret);
    }

    struct slot_allocator *ca = (struct slot_allocator*)(&state->defca);
    errval_t err = ca->free(ca, ret);
    // XXX: Detect frees in special case of init and mem_serv
    if (err_no(err) == LIB_ERR_SLOT_ALLOC_WRONG_CNODE) {
        return SYS_ERR_OK;
    }
    return err;
}
/**
 * \brief Default slot free
 *
 * \param ret The cap to free
 *
 * Frees the passed in slot.
 *
 * \bug During dispatcher initialization and special domains like
 * init and mem_serv free slots which
 * are not allocated by the default allocator.
 * This function detects such cases and ignores the errors.
 * It maybe ignoring errors that must be caught.
 */
\brief Default slot free
\param ret The cap to free

Frees the passed in slot.

\bug During dispatcher initialization and special domains like
init and mem_serv free slots which
are not allocated by the default allocator.
This function detects such cases and ignores the errors.
It maybe ignoring errors that must be caught.
\ brief Default slot free \ param ret The cap to free Frees the passed in slot . \ bug During dispatcher initialization and special domains like init and mem_serv free slots which are not allocated by the default allocator . This function detects such cases and ignores the errors . It maybe ignoring errors that must be caught .
errval_t slot_free(struct capref ret)
{
    struct slot_alloc_state *state = get_slot_alloc_state();
    if (cnodecmp(ret.cnode, cnode_base)) { 
        return SYS_ERR_OK;
    }
    if (cnodecmp(ret.cnode, cnode_root)) {
        struct slot_allocator *ca = (struct slot_allocator*)(&state->rootca);
        return ca->free(ca, ret);
    }
    struct slot_allocator *ca = (struct slot_allocator*)(&state->defca);
    errval_t err = ca->free(ca, ret);
    if (err_no(err) == LIB_ERR_SLOT_ALLOC_WRONG_CNODE) {
        return SYS_ERR_OK;
    }
    return err;
}
errval_t slot_free ( struct capref ret ) { struct slot_alloc_state * state = get_slot_alloc_state ( ) ; if ( cnodecmp ( ret . cnode , cnode_base ) ) { return SYS_ERR_OK ; } if ( cnodecmp ( ret . cnode , cnode_root ) ) { struct slot_allocator * ca = ( struct slot_allocator * ) ( & state -> rootca ) ; return ca -> free ( ca , ret ) ; } struct slot_allocator * ca = ( struct slot_allocator * ) ( & state -> defca ) ; errval_t err = ca -> free ( ca , ret ) ; if ( err_no ( err ) == LIB_ERR_SLOT_ALLOC_WRONG_CNODE ) { return SYS_ERR_OK ; } return err ; }
\brief Default slot free
 \param ret The cap to free
\ brief Default slot free \ param ret The cap to free
// Detect frees in basecn // XXX: Detect frees in special case of init and mem_serv