Changeset 984a9ba in mainline for uspace/app


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/app/wavplay
Files:
2 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
  • uspace/app/wavplay/drec.c

    r76f566d r984a9ba  
    8585}
    8686
    87 /**
    88  * Recording callback.
     87/** Recording callback.
    8988 *
    9089 * Writes recorded data.
    9190 *
    92  * @param icall_handle  IPC call handle.
    93  * @param icall         Poitner to IPC call structure.
    94  * @param arg           Argument. Poitner to recording helper structure.
    95  */
    96 static void device_event_callback(cap_call_handle_t icall_handle,
    97     ipc_call_t *icall, void *arg)
    98 {
    99         async_answer_0(icall_handle, EOK);
     91 * @param icall Poitner to IPC call structure.
     92 * @param arg   Argument. Poitner to recording helper structure.
     93 *
     94 */
     95static void device_event_callback(ipc_call_t *icall, void *arg)
     96{
     97        async_answer_0(icall, EOK);
    10098        record_t *rec = arg;
    10199        const size_t buffer_part = rec->buffer.size / BUFFER_PARTS;
    102100        bool record = true;
     101
    103102        while (record) {
    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_CAPTURE_TERMINATED:
     
    114114                default:
    115115                        printf("Unknown event %" PRIun ".\n", IPC_GET_IMETHOD(call));
    116                         async_answer_0(chandle, ENOTSUP);
     116                        async_answer_0(&call, ENOTSUP);
    117117                        continue;
    118118                }
    119119
    120120                if (!record) {
    121                         async_answer_0(chandle, EOK);
     121                        async_answer_0(&call, EOK);
    122122                        break;
    123123                }
     
    131131                if (rec->buffer.position >= (rec->buffer.base + rec->buffer.size))
    132132                        rec->buffer.position = rec->buffer.base;
    133                 async_answer_0(chandle, EOK);
     133                async_answer_0(&call, EOK);
    134134        }
    135135}
Note: See TracChangeset for help on using the changeset viewer.