Ignore:
File:
1 edited

Legend:

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

    rce732e74 rc1f68b0  
    8484
    8585static slab_cache_t *cap_slab;
    86 
    87 static kobject_t *cap_unpublish_locked(task_t *, cap_handle_t, kobject_type_t);
    8886
    8987static size_t caps_hash(const ht_link_t *item)
     
    150148void caps_task_init(task_t *task)
    151149{
    152         mutex_initialize(&task->cap_info->lock, MUTEX_PASSIVE);
     150        mutex_initialize(&task->cap_info->lock, MUTEX_RECURSIVE);
    153151
    154152        for (kobject_type_t t = 0; t < KOBJECT_TYPE_MAX; t++)
     
    240238        if (cap->state == CAP_STATE_PUBLISHED && cap->kobject->ops->reclaim &&
    241239            cap->kobject->ops->reclaim(cap->kobject)) {
    242                 kobject_t *kobj = cap_unpublish_locked(cap->task, cap->handle,
     240                kobject_t *kobj = cap_unpublish(cap->task, cap->handle,
    243241                    cap->kobject->type);
    244242                kobject_put(kobj);
     
    320318}
    321319
    322 static kobject_t *
    323 cap_unpublish_locked(task_t *task, cap_handle_t handle, kobject_type_t type)
     320/** Unpublish published capability
     321 *
     322 * The kernel object is moved out of the capability. In other words, the
     323 * capability's reference to the objects is handed over to the kernel object
     324 * pointer returned by this function. Once unpublished, the capability does not
     325 * refer to any kernel object anymore.
     326 *
     327 * @param task    Task in which to unpublish the capability.
     328 * @param handle  Capability handle.
     329 * @param type    Kernel object type of the object associated with the
     330 *                capability.
     331 */
     332kobject_t *cap_unpublish(task_t *task, cap_handle_t handle, kobject_type_t type)
    324333{
    325334        kobject_t *kobj = NULL;
    326335
     336        mutex_lock(&task->cap_info->lock);
    327337        cap_t *cap = cap_get(task, handle, CAP_STATE_PUBLISHED);
    328338        if (cap) {
     
    335345                }
    336346        }
    337 
    338         return kobj;
    339 }
    340 
    341 /** Unpublish published capability
    342  *
    343  * The kernel object is moved out of the capability. In other words, the
    344  * capability's reference to the objects is handed over to the kernel object
    345  * pointer returned by this function. Once unpublished, the capability does not
    346  * refer to any kernel object anymore.
    347  *
    348  * @param task    Task in which to unpublish the capability.
    349  * @param handle  Capability handle.
    350  * @param type    Kernel object type of the object associated with the
    351  *                capability.
    352  */
    353 kobject_t *cap_unpublish(task_t *task, cap_handle_t handle, kobject_type_t type)
    354 {
    355 
    356         mutex_lock(&task->cap_info->lock);
    357         kobject_t *kobj = cap_unpublish_locked(task, handle, type);
    358347        mutex_unlock(&task->cap_info->lock);
    359348
Note: See TracChangeset for help on using the changeset viewer.