Ignore:
Timestamp:
2012-08-24T22:27:44Z (13 years ago)
Author:
Jakub Jermar <jakub@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
20282ef3
Parents:
13dbaa8c
Message:

Add two new sysipc_ops_t members:

  • request_forget()
  • answer_cleanup()

Call these members to perform cleanup at appropriate times.

File:
1 edited

Legend:

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

    r13dbaa8c rb1e6269  
    9797}
    9898
     99static void answer_cleanup(call_t *answer, ipc_data_t *olddata)
     100{
     101        int phoneid = (int) IPC_GET_ARG1(*olddata);
     102        phone_t *phone = &TASK->phones[phoneid];
     103
     104        /*
     105         * In this case, the connection was established at the request
     106         * time and therefore we need to slam the phone.  We don't
     107         * merely hangup as that would result in sending IPC_M_HUNGUP
     108         * to the third party on the other side of the cloned phone.
     109         */
     110        mutex_lock(&phone->lock);
     111        if (phone->state == IPC_PHONE_CONNECTED) {
     112                irq_spinlock_lock(&phone->callee->lock, true);
     113                list_remove(&phone->link);
     114                phone->state = IPC_PHONE_SLAMMED;
     115                irq_spinlock_unlock(&phone->callee->lock, true);
     116        }
     117        mutex_unlock(&phone->lock);
     118}
     119
    99120static int answer_preprocess(call_t *answer, ipc_data_t *olddata)
    100121{
     
    103124                 * The recipient of the cloned phone rejected the offer.
    104125                 */
    105                 int phoneid = (int) IPC_GET_ARG1(*olddata);
    106                 phone_t *phone = &TASK->phones[phoneid];
    107 
    108                 /*
    109                  * In this case, the connection was established at the request
    110                  * time and therefore we need to slam the phone.  We don't
    111                  * merely hangup as that would result in sending IPC_M_HUNGUP
    112                  * to the third party on the other side of the cloned phone.
    113                  */
    114                 mutex_lock(&phone->lock);
    115                 if (phone->state == IPC_PHONE_CONNECTED) {
    116                         irq_spinlock_lock(&phone->callee->lock, true);
    117                         list_remove(&phone->link);
    118                         phone->state = IPC_PHONE_SLAMMED;
    119                         irq_spinlock_unlock(&phone->callee->lock, true);
    120                 }
    121                 mutex_unlock(&phone->lock);
     126                answer_cleanup(answer, olddata);
    122127        }
    123128
     
    127132sysipc_ops_t ipc_m_connection_clone_ops = {
    128133        .request_preprocess = request_preprocess,
     134        .request_forget = null_request_forget,
    129135        .request_process = null_request_process,
     136        .answer_cleanup = answer_cleanup,
    130137        .answer_preprocess = answer_preprocess,
    131138        .answer_process = null_answer_process,
Note: See TracChangeset for help on using the changeset viewer.