Changes in kernel/generic/src/cap/cap.c [9675296:e394c196] in mainline
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
kernel/generic/src/cap/cap.c
r9675296 re394c196 88 88 #include <stdlib.h> 89 89 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) 92 92 #define CAPS_LAST (CAPS_SIZE - 1) 93 93 … … 98 98 { 99 99 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( constvoid *key)104 { 105 c onst cap_handle_t *handle =key;106 return hash_mix( cap_handle_raw(*handle));107 } 108 109 static bool caps_key_equal( constvoid *key, const ht_link_t *item)110 { 111 c onst cap_handle_t *handle =key;100 return hash_mix(CAP_HANDLE_RAW(cap->handle)); 101 } 102 103 static 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 109 static bool caps_key_equal(void *key, const ht_link_t *item) 110 { 111 cap_handle_t *handle = (cap_handle_t *) key; 112 112 cap_t *cap = hash_table_get_inst(item, cap_t, caps_link); 113 113 return *handle == cap->handle; … … 232 232 assert(mutex_locked(&task->cap_info->lock)); 233 233 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)) 236 236 return NULL; 237 237 ht_link_t *link = hash_table_find(&task->cap_info->caps, &handle); … … 383 383 void cap_free(task_t *task, cap_handle_t handle) 384 384 { 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); 387 387 388 388 mutex_lock(&task->cap_info->lock); … … 392 392 393 393 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); 395 395 slab_free(cap_cache, cap); 396 396 mutex_unlock(&task->cap_info->lock);
Note:
See TracChangeset
for help on using the changeset viewer.