Changeset 984a9ba in mainline for uspace/srv/net/dhcp/main.c


Ignore:
Timestamp:
2018-07-05T09:34:09Z (7 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/srv/net/dhcp/main.c

    r76f566d r984a9ba  
    5050#define NAME  "dhcp"
    5151
    52 static void dhcp_client_conn(cap_call_handle_t, ipc_call_t *, void *);
     52static void dhcp_client_conn(ipc_call_t *, void *);
    5353
    5454static errno_t dhcp_init(void)
     
    8484}
    8585
    86 static void dhcp_link_add_srv(cap_call_handle_t chandle, ipc_call_t *call)
     86static void dhcp_link_add_srv(ipc_call_t *call)
    8787{
    8888        sysarg_t link_id;
     
    9494
    9595        rc = dhcpsrv_link_add(link_id);
    96         async_answer_0(chandle, rc);
     96        async_answer_0(call, rc);
    9797}
    9898
    99 static void dhcp_link_remove_srv(cap_call_handle_t chandle, ipc_call_t *call)
     99static void dhcp_link_remove_srv(ipc_call_t *call)
    100100{
    101101        sysarg_t link_id;
     
    107107
    108108        rc = dhcpsrv_link_remove(link_id);
    109         async_answer_0(chandle, rc);
     109        async_answer_0(call, rc);
    110110}
    111111
    112 static void dhcp_discover_srv(cap_call_handle_t chandle, ipc_call_t *call)
     112static void dhcp_discover_srv(ipc_call_t *call)
    113113{
    114114        sysarg_t link_id;
     
    120120
    121121        rc = dhcpsrv_discover(link_id);
    122         async_answer_0(chandle, rc);
     122        async_answer_0(call, rc);
    123123}
    124124
    125 static void dhcp_client_conn(cap_call_handle_t icall_handle, ipc_call_t *icall, void *arg)
     125static void dhcp_client_conn(ipc_call_t *icall, void *arg)
    126126{
    127127        log_msg(LOG_DEFAULT, LVL_DEBUG, "dhcp_client_conn()");
    128128
    129129        /* Accept the connection */
    130         async_answer_0(icall_handle, EOK);
     130        async_answer_0(icall, EOK);
    131131
    132132        while (true) {
    133133                ipc_call_t call;
    134                 cap_call_handle_t chandle = async_get_call(&call);
     134                async_get_call(&call);
    135135                sysarg_t method = IPC_GET_IMETHOD(call);
    136136
    137137                if (!method) {
    138138                        /* The other side has hung up */
    139                         async_answer_0(chandle, EOK);
     139                        async_answer_0(&call, EOK);
    140140                        return;
    141141                }
     
    143143                switch (method) {
    144144                case DHCP_LINK_ADD:
    145                         dhcp_link_add_srv(chandle, &call);
     145                        dhcp_link_add_srv(&call);
    146146                        break;
    147147                case DHCP_LINK_REMOVE:
    148                         dhcp_link_remove_srv(chandle, &call);
     148                        dhcp_link_remove_srv(&call);
    149149                        break;
    150150                case DHCP_DISCOVER:
    151                         dhcp_discover_srv(chandle, &call);
     151                        dhcp_discover_srv(&call);
    152152                        break;
    153153                default:
    154                         async_answer_0(chandle, EINVAL);
     154                        async_answer_0(&call, EINVAL);
    155155                }
    156156        }
Note: See TracChangeset for help on using the changeset viewer.