Ignore:
Timestamp:
2012-08-20T23:21:41Z (12 years ago)
Author:
Jakub Jermar <jakub@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
0343a1b
Parents:
642dc72
Message:

Separate system IPC logic into dedicated ops structure hooks.

File:
1 edited

Legend:

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

    r642dc72 re8039a86  
    3434
    3535#include <ipc/sysipc_ops.h>
     36#include <ipc/ipc.h>
     37#include <synch/mutex.h>
     38#include <abi/errno.h>
     39
     40static int request_preprocess(call_t *call, phone_t *phone)
     41{
     42        IPC_SET_ARG5(call->data, (sysarg_t) phone);
     43
     44        return EOK;     
     45}
     46
     47static int answer_preprocess(call_t *answer, ipc_data_t *olddata)
     48{
     49        phone_t *phone = (phone_t *) IPC_GET_ARG5(*olddata);
     50
     51        if (IPC_GET_RETVAL(answer->data) != EOK) {
     52                /*
     53                 * The other party on the cloned phone rejected our request
     54                 * for connection on the protocol level.  We need to break the
     55                 * connection without sending IPC_M_HUNGUP back.
     56                 */
     57                mutex_lock(&phone->lock);
     58                if (phone->state == IPC_PHONE_CONNECTED) {
     59                        irq_spinlock_lock(&phone->callee->lock, true);
     60                        list_remove(&phone->link);
     61                        phone->state = IPC_PHONE_SLAMMED;
     62                        irq_spinlock_unlock(&phone->callee->lock, true);
     63                }
     64                mutex_unlock(&phone->lock);
     65        }
     66       
     67        return EOK;
     68}
    3669
    3770sysipc_ops_t ipc_m_clone_establish_ops = {
    38         .request_preprocess = null_request_preprocess,
     71        .request_preprocess = request_preprocess,
    3972        .request_process = null_request_process,
    40         .answer_preprocess = null_answer_preprocess,
     73        .answer_preprocess = answer_preprocess,
    4174        .answer_process = null_answer_process,
    4275};
Note: See TracChangeset for help on using the changeset viewer.