Changeset 984a9ba in mainline for uspace/drv/hid/adb-mouse/adb-mouse.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/drv/hid/adb-mouse/adb-mouse.c

    r76f566d r984a9ba  
    4141#include "adb-mouse.h"
    4242
    43 static void adb_mouse_conn(cap_call_handle_t, ipc_call_t *, void *);
     43static void adb_mouse_conn(ipc_call_t *, void *);
    4444
    4545static void adb_mouse_event_button(adb_mouse_t *mouse, int bnum, int bpress)
     
    8888}
    8989
    90 static void adb_mouse_events(cap_call_handle_t icall_handle, ipc_call_t *icall, void *arg)
     90static void adb_mouse_events(ipc_call_t *icall, void *arg)
    9191{
    9292        adb_mouse_t *mouse = (adb_mouse_t *) arg;
     
    9595        while (true) {
    9696                ipc_call_t call;
    97                 cap_call_handle_t chandle = async_get_call(&call);
     97                async_get_call(&call);
    9898
    9999                errno_t retval = EOK;
     
    112112                }
    113113
    114                 async_answer_0(chandle, retval);
     114                async_answer_0(&call, retval);
    115115        }
    116116}
     
    200200
    201201/** Handle client connection */
    202 static void adb_mouse_conn(cap_call_handle_t icall_handle, ipc_call_t *icall, void *arg)
    203 {
    204         cap_call_handle_t chandle;
     202static void adb_mouse_conn(ipc_call_t *icall, void *arg)
     203{
    205204        ipc_call_t call;
    206205        sysarg_t method;
     
    210209         * Answer the first IPC_M_CONNECT_ME_TO call.
    211210         */
    212         async_answer_0(icall_handle, EOK);
     211        async_answer_0(icall, EOK);
    213212
    214213        mouse = (adb_mouse_t *)ddf_dev_data_get(ddf_fun_get_dev((ddf_fun_t *)arg));
    215214
    216215        while (true) {
    217                 chandle = async_get_call(&call);
     216                async_get_call(&call);
    218217                method = IPC_GET_IMETHOD(call);
    219218
    220219                if (!method) {
    221220                        /* The other side has hung up. */
    222                         async_answer_0(chandle, EOK);
     221                        async_answer_0(&call, EOK);
    223222                        return;
    224223                }
     
    228227                if (sess != NULL) {
    229228                        mouse->client_sess = sess;
    230                         async_answer_0(chandle, EOK);
     229                        async_answer_0(&call, EOK);
    231230                } else {
    232                         async_answer_0(chandle, EINVAL);
    233                 }
    234         }
    235 }
    236 
     231                        async_answer_0(&call, EINVAL);
     232                }
     233        }
     234}
    237235
    238236/**
Note: See TracChangeset for help on using the changeset viewer.