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/lib/drv/generic/remote_clock_dev.c

    r76f566d r984a9ba  
    4242#include <ddf/driver.h>
    4343
    44 static void remote_clock_time_get(ddf_fun_t *, void *, cap_call_handle_t,
    45     ipc_call_t *);
    46 static void remote_clock_time_set(ddf_fun_t *, void *, cap_call_handle_t,
    47     ipc_call_t *);
     44static void remote_clock_time_get(ddf_fun_t *, void *, ipc_call_t *);
     45static void remote_clock_time_set(ddf_fun_t *, void *, ipc_call_t *);
    4846
    4947/** Remote clock interface operations */
     
    6563/** Process the time_get() request from the remote client
    6664 *
    67  * @param fun   The function from which the time is read
    68  * @param ops   The local ops structure
     65 * @param fun The function from which the time is read
     66 * @param ops The local ops structure
     67 *
    6968 */
    70 static void
    71 remote_clock_time_get(ddf_fun_t *fun, void *ops, cap_call_handle_t chandle,
    72     ipc_call_t *call)
     69static void remote_clock_time_get(ddf_fun_t *fun, void *ops, ipc_call_t *call)
    7370{
    7471        clock_dev_ops_t *clock_dev_ops = (clock_dev_ops_t *) ops;
    75         cap_call_handle_t call_handle;
    7672        struct tm t;
    7773        errno_t rc;
     74
     75        ipc_call_t data;
    7876        size_t len;
    79 
    80         if (!async_data_read_receive(&call_handle, &len)) {
     77        if (!async_data_read_receive(&data, &len)) {
    8178                /* TODO: Handle protocol error */
    82                 async_answer_0(chandle, EINVAL);
     79                async_answer_0(call, EINVAL);
    8380                return;
    8481        }
     
    8683        if (!clock_dev_ops->time_get) {
    8784                /* The driver does not provide the time_get() functionality */
    88                 async_answer_0(call_handle, ENOTSUP);
    89                 async_answer_0(chandle, ENOTSUP);
     85                async_answer_0(&data, ENOTSUP);
     86                async_answer_0(call, ENOTSUP);
    9087                return;
    9188        }
     
    9592        if (rc != EOK) {
    9693                /* Some error occurred */
    97                 async_answer_0(call_handle, rc);
    98                 async_answer_0(chandle, rc);
     94                async_answer_0(&data, rc);
     95                async_answer_0(call, rc);
    9996                return;
    10097        }
    10198
    10299        /* The operation was successful */
    103         async_data_read_finalize(call_handle, &t, sizeof(struct tm));
    104         async_answer_0(chandle, rc);
     100        async_data_read_finalize(&data, &t, sizeof(struct tm));
     101        async_answer_0(call, rc);
    105102}
    106103
    107104/** Process the time_set() request from the remote client
    108105 *
    109  * @param fun   The function to which the data are written
    110  * @param ops   The local ops structure
     106 * @param fun The function to which the data are written
     107 * @param ops The local ops structure
     108 *
    111109 */
    112 static void remote_clock_time_set(ddf_fun_t *fun, void *ops,
    113     cap_call_handle_t chandle, ipc_call_t *call)
     110static void remote_clock_time_set(ddf_fun_t *fun, void *ops, ipc_call_t *call)
    114111{
    115112        clock_dev_ops_t *clock_dev_ops = (clock_dev_ops_t *) ops;
    116         errno_t      rc;
    117         struct tm    t;
    118         cap_call_handle_t call_handle;
    119         size_t       len;
     113        errno_t rc;
     114        struct tm t;
    120115
    121         if (!async_data_write_receive(&call_handle, &len)) {
     116        ipc_call_t data;
     117        size_t len;
     118
     119        if (!async_data_write_receive(&data, &len)) {
    122120                /* TODO: Handle protocol error */
    123                 async_answer_0(chandle, EINVAL);
     121                async_answer_0(call, EINVAL);
    124122                return;
    125123        }
     
    127125        if (!clock_dev_ops->time_set) {
    128126                /* The driver does not support the time_set() functionality */
    129                 async_answer_0(call_handle, ENOTSUP);
    130                 async_answer_0(chandle, ENOTSUP);
     127                async_answer_0(&data, ENOTSUP);
     128                async_answer_0(call, ENOTSUP);
    131129                return;
    132130        }
    133131
    134         async_data_write_finalize(call_handle, &t, sizeof(struct tm));
     132        async_data_write_finalize(&data, &t, sizeof(struct tm));
    135133
    136134        rc = (*clock_dev_ops->time_set)(fun, &t);
    137135
    138         async_answer_0(chandle, rc);
     136        async_answer_0(call, rc);
    139137}
    140138
     
    142140 * @}
    143141 */
    144 
Note: See TracChangeset for help on using the changeset viewer.