Changeset 984a9ba in mainline for uspace/srv/devman/main.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/srv/devman/main.c

    r76f566d r984a9ba  
    6666dev_tree_t device_tree;
    6767
    68 static void devman_connection_device(cap_call_handle_t icall_handle, ipc_call_t *icall,
    69     void *arg)
     68static void devman_connection_device(ipc_call_t *icall, void *arg)
    7069{
    7170        devman_handle_t handle = IPC_GET_ARG2(*icall);
     
    9493                log_msg(LOG_DEFAULT, LVL_ERROR, "IPC forwarding failed - no device or "
    9594                    "function with handle %" PRIun " was found.", handle);
    96                 async_answer_0(icall_handle, ENOENT);
     95                async_answer_0(icall, ENOENT);
    9796                goto cleanup;
    9897        }
     
    102101                    "connect to handle %" PRIun ", refers to a device.",
    103102                    handle);
    104                 async_answer_0(icall_handle, ENOENT);
     103                async_answer_0(icall, ENOENT);
    105104                goto cleanup;
    106105        }
     
    116115                log_msg(LOG_DEFAULT, LVL_ERROR, "IPC forwarding refused - "
    117116                    "the device %" PRIun " is not in usable state.", handle);
    118                 async_answer_0(icall_handle, ENOENT);
     117                async_answer_0(icall, ENOENT);
    119118                goto cleanup;
    120119        }
     
    123122                log_msg(LOG_DEFAULT, LVL_ERROR,
    124123                    "Could not forward to driver `%s'.", driver->name);
    125                 async_answer_0(icall_handle, EINVAL);
     124                async_answer_0(icall, EINVAL);
    126125                goto cleanup;
    127126        }
     
    138137
    139138        async_exch_t *exch = async_exchange_begin(driver->sess);
    140         async_forward_fast(icall_handle, exch, INTERFACE_DDF_CLIENT, handle, 0, IPC_FF_NONE);
     139        async_forward_fast(icall, exch, INTERFACE_DDF_CLIENT, handle, 0, IPC_FF_NONE);
    141140        async_exchange_end(exch);
    142141
     
    149148}
    150149
    151 static void devman_connection_parent(cap_call_handle_t icall_handle, ipc_call_t *icall,
    152     void *arg)
     150static void devman_connection_parent(ipc_call_t *icall, void *arg)
    153151{
    154152        devman_handle_t handle = IPC_GET_ARG2(*icall);
     
    177175                log_msg(LOG_DEFAULT, LVL_ERROR, "IPC forwarding failed - no device or "
    178176                    "function with handle %" PRIun " was found.", handle);
    179                 async_answer_0(icall_handle, ENOENT);
     177                async_answer_0(icall, ENOENT);
    180178                goto cleanup;
    181179        }
     
    196194                log_msg(LOG_DEFAULT, LVL_ERROR, "IPC forwarding refused - "
    197195                    "the device %" PRIun " is not in usable state.", handle);
    198                 async_answer_0(icall_handle, ENOENT);
     196                async_answer_0(icall, ENOENT);
    199197                goto cleanup;
    200198        }
     
    203201                log_msg(LOG_DEFAULT, LVL_ERROR,
    204202                    "Could not forward to driver `%s'.", driver->name);
    205                 async_answer_0(icall_handle, EINVAL);
     203                async_answer_0(icall, EINVAL);
    206204                goto cleanup;
    207205        }
     
    218216
    219217        async_exch_t *exch = async_exchange_begin(driver->sess);
    220         async_forward_fast(icall_handle, exch, INTERFACE_DDF_DRIVER, fun_handle, 0, IPC_FF_NONE);
     218        async_forward_fast(icall, exch, INTERFACE_DDF_DRIVER, fun_handle, 0, IPC_FF_NONE);
    221219        async_exchange_end(exch);
    222220
     
    229227}
    230228
    231 static void devman_forward(cap_call_handle_t icall_handle, ipc_call_t *icall, void *arg)
     229static void devman_forward(ipc_call_t *icall, void *arg)
    232230{
    233231        iface_t iface = IPC_GET_ARG1(*icall);
     
    242240                    "not found.\n");
    243241                fibril_rwlock_read_unlock(&device_tree.rwlock);
    244                 async_answer_0(icall_handle, ENOENT);
     242                async_answer_0(icall, ENOENT);
    245243                return;
    246244        }
     
    253251
    254252        async_exch_t *exch = async_exchange_begin(driver->sess);
    255         async_forward_fast(icall_handle, exch, iface, handle, 0, IPC_FF_NONE);
     253        async_forward_fast(icall, exch, iface, handle, 0, IPC_FF_NONE);
    256254        async_exchange_end(exch);
    257255
Note: See TracChangeset for help on using the changeset viewer.