Ignore:
File:
1 edited

Legend:

Unmodified
Added
Removed
  • kernel/generic/src/cap/cap.c

    r9675296 re394c196  
    8888#include <stdlib.h>
    8989
    90 #define CAPS_START      ((intptr_t) CAP_NIL + 1)
    91 #define CAPS_SIZE       (INT_MAX - (int) CAPS_START)
     90#define CAPS_START      (CAP_NIL + 1)
     91#define CAPS_SIZE       (INT_MAX - CAPS_START)
    9292#define CAPS_LAST       (CAPS_SIZE - 1)
    9393
     
    9898{
    9999        cap_t *cap = hash_table_get_inst(item, cap_t, caps_link);
    100         return hash_mix(cap_handle_raw(cap->handle));
    101 }
    102 
    103 static size_t caps_key_hash(const void *key)
    104 {
    105         const cap_handle_t *handle = key;
    106         return hash_mix(cap_handle_raw(*handle));
    107 }
    108 
    109 static bool caps_key_equal(const void *key, const ht_link_t *item)
    110 {
    111         const cap_handle_t *handle = key;
     100        return hash_mix(CAP_HANDLE_RAW(cap->handle));
     101}
     102
     103static size_t caps_key_hash(void *key)
     104{
     105        cap_handle_t *handle = (cap_handle_t *) key;
     106        return hash_mix(CAP_HANDLE_RAW(*handle));
     107}
     108
     109static bool caps_key_equal(void *key, const ht_link_t *item)
     110{
     111        cap_handle_t *handle = (cap_handle_t *) key;
    112112        cap_t *cap = hash_table_get_inst(item, cap_t, caps_link);
    113113        return *handle == cap->handle;
     
    232232        assert(mutex_locked(&task->cap_info->lock));
    233233
    234         if ((cap_handle_raw(handle) < CAPS_START) ||
    235             (cap_handle_raw(handle) > CAPS_LAST))
     234        if ((CAP_HANDLE_RAW(handle) < CAPS_START) ||
     235            (CAP_HANDLE_RAW(handle) > CAPS_LAST))
    236236                return NULL;
    237237        ht_link_t *link = hash_table_find(&task->cap_info->caps, &handle);
     
    383383void cap_free(task_t *task, cap_handle_t handle)
    384384{
    385         assert(cap_handle_raw(handle) >= CAPS_START);
    386         assert(cap_handle_raw(handle) <= CAPS_LAST);
     385        assert(CAP_HANDLE_RAW(handle) >= CAPS_START);
     386        assert(CAP_HANDLE_RAW(handle) <= CAPS_LAST);
    387387
    388388        mutex_lock(&task->cap_info->lock);
     
    392392
    393393        hash_table_remove_item(&task->cap_info->caps, &cap->caps_link);
    394         ra_free(task->cap_info->handles, cap_handle_raw(handle), 1);
     394        ra_free(task->cap_info->handles, CAP_HANDLE_RAW(handle), 1);
    395395        slab_free(cap_cache, cap);
    396396        mutex_unlock(&task->cap_info->lock);
Note: See TracChangeset for help on using the changeset viewer.