Changeset 984a9ba in mainline for uspace/app/wavplay/dplay.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/app/wavplay/dplay.c

    r76f566d r984a9ba  
    8888}
    8989
    90 /**
    91  * Fragment playback callback function.
     90/** Fragment playback callback function.
    9291 *
    93  * @param icall_handle  Call capability handle.
    94  * @param icall         Pointer to the call structure
    95  * @param arg           Argument, pointer to the playback helper function
    96  */
    97 static void device_event_callback(cap_call_handle_t icall_handle,
    98     ipc_call_t *icall, void *arg)
    99 {
    100         async_answer_0(icall_handle, EOK);
     92 * @param icall Pointer to the call structure
     93 * @param arg   Argument, pointer to the playback helper function
     94 *
     95 */
     96static void device_event_callback(ipc_call_t *icall, void *arg)
     97{
     98        async_answer_0(icall, EOK);
    10199        playback_t *pb = arg;
    102100        const size_t fragment_size = pb->buffer.size / DEFAULT_FRAGMENTS;
     101
    103102        while (true) {
    104103                ipc_call_t call;
    105                 cap_call_handle_t chandle = async_get_call(&call);
     104                async_get_call(&call);
     105
    106106                switch (IPC_GET_IMETHOD(call)) {
    107107                case PCM_EVENT_PLAYBACK_STARTED:
    108108                case PCM_EVENT_FRAMES_PLAYED:
    109109                        printf("%" PRIun " frames: ", IPC_GET_ARG1(call));
    110                         async_answer_0(chandle, EOK);
     110                        async_answer_0(&call, EOK);
    111111                        break;
    112112                case PCM_EVENT_PLAYBACK_TERMINATED:
     
    115115                        pb->playing = false;
    116116                        fibril_condvar_signal(&pb->cv);
    117                         async_answer_0(chandle, EOK);
     117                        async_answer_0(&call, EOK);
    118118                        fibril_mutex_unlock(&pb->mutex);
    119119                        return;
    120120                default:
    121121                        printf("Unknown event %" PRIun ".\n", IPC_GET_IMETHOD(call));
    122                         async_answer_0(chandle, ENOTSUP);
     122                        async_answer_0(&call, ENOTSUP);
    123123                        continue;
    124124
Note: See TracChangeset for help on using the changeset viewer.