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