Changeset 984a9ba in mainline for uspace/srv/net/ethip


Ignore:
Timestamp:
2018-07-05T09:34:09Z (8 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.

Location:
uspace/srv/net/ethip
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • uspace/srv/net/ethip/ethip.c

    r76f566d r984a9ba  
    6363static errno_t ethip_addr_remove(iplink_srv_t *srv, inet_addr_t *addr);
    6464
    65 static void ethip_client_conn(cap_call_handle_t icall_handle, ipc_call_t *icall, void *arg);
     65static void ethip_client_conn(ipc_call_t *icall, void *arg);
    6666
    6767static iplink_ops_t ethip_iplink_ops = {
     
    142142}
    143143
    144 static void ethip_client_conn(cap_call_handle_t icall_handle, ipc_call_t *icall, void *arg)
     144static void ethip_client_conn(ipc_call_t *icall, void *arg)
    145145{
    146146        ethip_nic_t *nic;
     
    155155        }
    156156
    157         iplink_conn(icall_handle, icall, &nic->iplink);
     157        iplink_conn(icall, &nic->iplink);
    158158}
    159159
  • uspace/srv/net/ethip/ethip_nic.c

    r76f566d r984a9ba  
    5252
    5353static errno_t ethip_nic_open(service_id_t sid);
    54 static void ethip_nic_cb_conn(cap_call_handle_t icall_handle, ipc_call_t *icall, void *arg);
     54static void ethip_nic_cb_conn(ipc_call_t *icall, void *arg);
    5555
    5656static LIST_INITIALIZE(ethip_nic_list);
     
    229229}
    230230
    231 static void ethip_nic_addr_changed(ethip_nic_t *nic, cap_call_handle_t chandle,
    232     ipc_call_t *call)
     231static void ethip_nic_addr_changed(ethip_nic_t *nic, ipc_call_t *call)
    233232{
    234233        uint8_t *addr;
     
    236235        errno_t rc;
    237236
    238         rc = async_data_write_accept((void **)&addr, false, 0, 0, 0, &size);
     237        rc = async_data_write_accept((void **) &addr, false, 0, 0, 0, &size);
    239238        if (rc != EOK) {
    240239                log_msg(LOG_DEFAULT, LVL_DEBUG, "data_write_accept() failed");
     
    255254
    256255        free(addr);
    257         async_answer_0(chandle, EOK);
    258 }
    259 
    260 static void ethip_nic_received(ethip_nic_t *nic, cap_call_handle_t chandle,
    261     ipc_call_t *call)
     256        async_answer_0(call, EOK);
     257}
     258
     259static void ethip_nic_received(ethip_nic_t *nic, ipc_call_t *call)
    262260{
    263261        errno_t rc;
     
    282280
    283281        log_msg(LOG_DEFAULT, LVL_DEBUG, "ethip_nic_received() done, rc=%s", str_error_name(rc));
    284         async_answer_0(chandle, rc);
    285 }
    286 
    287 static void ethip_nic_device_state(ethip_nic_t *nic, cap_call_handle_t chandle,
    288     ipc_call_t *call)
     282        async_answer_0(call, rc);
     283}
     284
     285static void ethip_nic_device_state(ethip_nic_t *nic, ipc_call_t *call)
    289286{
    290287        log_msg(LOG_DEFAULT, LVL_DEBUG, "ethip_nic_device_state()");
    291         async_answer_0(chandle, ENOTSUP);
    292 }
    293 
    294 static void ethip_nic_cb_conn(cap_call_handle_t icall_handle, ipc_call_t *icall, void *arg)
     288        async_answer_0(call, ENOTSUP);
     289}
     290
     291static void ethip_nic_cb_conn(ipc_call_t *icall, void *arg)
    295292{
    296293        ethip_nic_t *nic = (ethip_nic_t *)arg;
     
    300297        while (true) {
    301298                ipc_call_t call;
    302                 cap_call_handle_t chandle = async_get_call(&call);
     299                async_get_call(&call);
    303300
    304301                if (!IPC_GET_IMETHOD(call)) {
     
    309306                switch (IPC_GET_IMETHOD(call)) {
    310307                case NIC_EV_ADDR_CHANGED:
    311                         ethip_nic_addr_changed(nic, chandle, &call);
     308                        ethip_nic_addr_changed(nic, &call);
    312309                        break;
    313310                case NIC_EV_RECEIVED:
    314                         ethip_nic_received(nic, chandle, &call);
     311                        ethip_nic_received(nic, &call);
    315312                        break;
    316313                case NIC_EV_DEVICE_STATE:
    317                         ethip_nic_device_state(nic, chandle, &call);
     314                        ethip_nic_device_state(nic, &call);
    318315                        break;
    319316                default:
    320317                        log_msg(LOG_DEFAULT, LVL_DEBUG, "unknown IPC method: %" PRIun, IPC_GET_IMETHOD(call));
    321                         async_answer_0(chandle, ENOTSUP);
     318                        async_answer_0(&call, ENOTSUP);
    322319                }
    323320        }
Note: See TracChangeset for help on using the changeset viewer.