Changeset 984a9ba in mainline for uspace/lib/c/generic/iplink.c


Ignore:
Timestamp:
2018-07-05T09:34:09Z (6 years ago)
Author:
Martin Decky <martin@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
63d46341
Parents:
76f566d
Message:

do not expose the call capability handler from the async framework

Keep the call capability handler encapsulated within the async framework
and do not expose it explicitly via its API. Use the pointer to
ipc_call_t as the sole object identifying an IPC call in the code that
uses the async framework.

This plugs a major leak in the abstraction and also simplifies both the
async framework (slightly) and all IPC servers.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • uspace/lib/c/generic/iplink.c

    r76f566d r984a9ba  
    4545#include <stdlib.h>
    4646
    47 static void iplink_cb_conn(cap_call_handle_t icall_handle, ipc_call_t *icall, void *arg);
     47static void iplink_cb_conn(ipc_call_t *icall, void *arg);
    4848
    4949errno_t iplink_open(async_sess_t *sess, iplink_ev_ops_t *ev_ops, void *arg,
     
    197197}
    198198
    199 
    200199errno_t iplink_addr_add(iplink_t *iplink, inet_addr_t *addr)
    201200{
     
    245244}
    246245
    247 static void iplink_ev_recv(iplink_t *iplink, cap_call_handle_t icall_handle,
    248     ipc_call_t *icall)
     246static void iplink_ev_recv(iplink_t *iplink, ipc_call_t *icall)
    249247{
    250248        iplink_recv_sdu_t sdu;
     
    255253            &sdu.size);
    256254        if (rc != EOK) {
    257                 async_answer_0(icall_handle, rc);
     255                async_answer_0(icall, rc);
    258256                return;
    259257        }
     
    261259        rc = iplink->ev_ops->recv(iplink, &sdu, ver);
    262260        free(sdu.data);
    263         async_answer_0(icall_handle, rc);
    264 }
    265 
    266 static void iplink_ev_change_addr(iplink_t *iplink, cap_call_handle_t icall_handle,
    267     ipc_call_t *icall)
     261        async_answer_0(icall, rc);
     262}
     263
     264static void iplink_ev_change_addr(iplink_t *iplink, ipc_call_t *icall)
    268265{
    269266        addr48_t *addr;
    270267        size_t size;
    271268
    272         errno_t rc = async_data_write_accept((void **)&addr, false,
     269        errno_t rc = async_data_write_accept((void **) &addr, false,
    273270            sizeof(addr48_t), sizeof(addr48_t), 0, &size);
    274271        if (rc != EOK) {
    275                 async_answer_0(icall_handle, rc);
     272                async_answer_0(icall, rc);
    276273                return;
    277274        }
     
    279276        rc = iplink->ev_ops->change_addr(iplink, *addr);
    280277        free(addr);
    281         async_answer_0(icall_handle, EOK);
    282 }
    283 
    284 static void iplink_cb_conn(cap_call_handle_t icall_handle, ipc_call_t *icall, void *arg)
     278        async_answer_0(icall, EOK);
     279}
     280
     281static void iplink_cb_conn(ipc_call_t *icall, void *arg)
    285282{
    286283        iplink_t *iplink = (iplink_t *) arg;
     
    288285        while (true) {
    289286                ipc_call_t call;
    290                 cap_call_handle_t chandle = async_get_call(&call);
     287                async_get_call(&call);
    291288
    292289                if (!IPC_GET_IMETHOD(call)) {
     
    297294                switch (IPC_GET_IMETHOD(call)) {
    298295                case IPLINK_EV_RECV:
    299                         iplink_ev_recv(iplink, chandle, &call);
     296                        iplink_ev_recv(iplink, &call);
    300297                        break;
    301298                case IPLINK_EV_CHANGE_ADDR:
    302                         iplink_ev_change_addr(iplink, chandle, &call);
     299                        iplink_ev_change_addr(iplink, &call);
    303300                        break;
    304301                default:
    305                         async_answer_0(chandle, ENOTSUP);
     302                        async_answer_0(&call, ENOTSUP);
    306303                }
    307304        }
Note: See TracChangeset for help on using the changeset viewer.