Ignore:
File:
1 edited

Legend:

Unmodified
Added
Removed
  • kernel/generic/src/ipc/ipcrsc.c

    r48bcf49 rcde999a  
    137137#include <mm/slab.h>
    138138
    139 /** Find call_t * in call table according to callid.
    140  *
    141  * @todo Some speedup (hash table?)
    142  *
    143  * @param callid Userspace hash of the call. Currently it is the call structure
    144  *               kernel address.
    145  *
    146  * @return NULL on not found, otherwise pointer to the call structure.
    147  *
    148  */
    149 call_t *get_call(sysarg_t callid)
    150 {
    151         call_t *result = NULL;
    152        
    153         irq_spinlock_lock(&TASK->answerbox.lock, true);
    154        
    155         list_foreach(TASK->answerbox.dispatched_calls, ab_link, call_t, call) {
    156                 if ((sysarg_t) call == callid) {
    157                         result = call;
    158                         break;
    159                 }
    160         }
    161        
    162         irq_spinlock_unlock(&TASK->answerbox.lock, true);
    163         return result;
    164 }
    165 
    166139static bool phone_reclaim(kobject_t *kobj)
    167140{
     
    180153{
    181154        phone_t *phone = (phone_t *) arg;
    182         slab_free(phone_slab, phone);
     155        slab_free(phone_cache, phone);
    183156}
    184157
     
    193166 * @param task  Task for which to allocate a new phone.
    194167 *
    195  * @return  New phone capability handle.
    196  * @return  Negative error code if a new capability cannot be allocated.
    197  */
    198 cap_handle_t phone_alloc(task_t *task)
    199 {
    200         cap_handle_t handle = cap_alloc(task);
    201         if (handle >= 0) {
    202                 phone_t *phone = slab_alloc(phone_slab, FRAME_ATOMIC);
     168 * @param[out] out_handle  New phone capability handle.
     169 *
     170 * @return  An error code if a new capability cannot be allocated.
     171 */
     172int phone_alloc(task_t *task, cap_handle_t *out_handle)
     173{
     174        cap_handle_t handle;
     175        int rc = cap_alloc(task, &handle);
     176        if (rc == EOK) {
     177                phone_t *phone = slab_alloc(phone_cache, FRAME_ATOMIC);
    203178                if (!phone) {
    204179                        cap_free(TASK, handle);
     
    208183                if (!kobject) {
    209184                        cap_free(TASK, handle);
    210                         slab_free(phone_slab, phone);
     185                        slab_free(phone_cache, phone);
    211186                        return ENOMEM;
    212187                }
     
    220195               
    221196                cap_publish(task, handle, kobject);
     197
     198                *out_handle = handle;
    222199        }
    223        
    224         return handle;
     200        return rc;
    225201}
    226202
Note: See TracChangeset for help on using the changeset viewer.