Ignore:
Timestamp:
2017-08-17T19:11:14Z (8 years ago)
Author:
Jakub Jermar <jakub@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
1c85bae
Parents:
7e3826d9
Message:

Turn IPC phones into kobjects

File:
1 edited

Legend:

Unmodified
Added
Removed
  • kernel/generic/src/ipc/ops/connclone.c

    r7e3826d9 r05ffb41  
    6161static int request_preprocess(call_t *call, phone_t *phone)
    6262{
    63         phone_t *cloned_phone;
    64 
    65         if (phone_get(IPC_GET_ARG1(call->data), &cloned_phone) != EOK)
     63        phone_t *cloned_phone = phone_get_current(IPC_GET_ARG1(call->data));
     64        if (!cloned_phone)
    6665                return ENOENT;
    67                
     66       
    6867        phones_lock(cloned_phone, phone);
    69                
     68       
    7069        if ((cloned_phone->state != IPC_PHONE_CONNECTED) ||
    7170            phone->state != IPC_PHONE_CONNECTED) {
     
    7372                return EINVAL;
    7473        }
    75                
     74       
    7675        /*
    7776         * We can be pretty sure now that both tasks exist and we are
     
    8180         *
    8281         */
    83         int newphid = phone_alloc(phone->callee->task);
    84         if (newphid < 0) {
     82        int cap = phone_alloc(phone->callee->task);
     83        if (cap < 0) {
    8584                phones_unlock(cloned_phone, phone);
    8685                return ELIMIT;
    8786        }
    88                
    89         (void) ipc_phone_connect(&phone->callee->task->phones[newphid],
     87       
     88        (void) ipc_phone_connect(phone_get(phone->callee->task, cap),
    9089            cloned_phone->callee);
    9190        phones_unlock(cloned_phone, phone);
    92                
     91       
    9392        /* Set the new phone for the callee. */
    94         IPC_SET_ARG1(call->data, newphid);
     93        IPC_SET_ARG1(call->data, cap);
    9594
    9695        return EOK;
     
    9998static int answer_cleanup(call_t *answer, ipc_data_t *olddata)
    10099{
    101         int phoneid = (int) IPC_GET_ARG1(*olddata);
    102         phone_t *phone = &TASK->phones[phoneid];
     100        int cap = (int) IPC_GET_ARG1(*olddata);
     101        phone_t *phone = phone_get_current(cap);
    103102
    104103        /*
Note: See TracChangeset for help on using the changeset viewer.