Changeset 984a9ba in mainline for uspace/lib/c/generic/async/server.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/lib/c/generic/async/server.c

    r76f566d r984a9ba  
    7777 *   }
    7878 *
    79  *   port_handler(ichandle, *icall)
     79 *   port_handler(ipc_call_t *icall)
    8080 *   {
    8181 *     if (want_refuse) {
    82  *       async_answer_0(ichandle, ELIMIT);
     82 *       async_answer_0(icall, ELIMIT);
    8383 *       return;
    8484 *     }
    85  *     async_answer_0(ichandle, EOK);
    86  *
    87  *     chandle = async_get_call(&call);
    88  *     somehow_handle_the_call(chandle, call);
    89  *     async_answer_2(chandle, 1, 2, 3);
    90  *
    91  *     chandle = async_get_call(&call);
     85 *
     86 *     async_answer_0(icall, EOK);
     87 *
     88 *     async_get_call(&call);
     89 *     somehow_handle_the_call(&call);
     90 *     async_answer_2(&call, 1, 2, 3);
     91 *
     92 *     async_get_call(&call);
    9293 *     ...
    9394 *   }
     
    133134typedef struct {
    134135        link_t link;
    135 
    136136        ipc_call_t call;
    137137} msg_t;
     
    418418         * Call the connection handler function.
    419419         */
    420         fibril_connection->handler(fibril_connection->call.cap_handle,
    421             &fibril_connection->call, fibril_connection->data);
     420        fibril_connection->handler(&fibril_connection->call,
     421            fibril_connection->data);
    422422
    423423        /*
     
    964964/** Return new incoming message for the current (fibril-local) connection.
    965965 *
    966  * @param call   Storage where the incoming call data will be stored.
    967  * @param usecs  Timeout in microseconds. Zero denotes no timeout.
    968  *
    969  * @return  If no timeout was specified, then a handle of the incoming call is
    970  *          returned. If a timeout is specified, then a handle of the incoming
    971  *          call is returned unless the timeout expires prior to receiving a
    972  *          message. In that case zero CAP_NIL is returned.
    973  */
    974 cap_call_handle_t async_get_call_timeout(ipc_call_t *call, suseconds_t usecs)
     966 * @param call  Storage where the incoming call data will be stored.
     967 * @param usecs Timeout in microseconds. Zero denotes no timeout.
     968 *
     969 * @return If no timeout was specified, then true is returned.
     970 * @return If a timeout is specified, then true is returned unless
     971 *         the timeout expires prior to receiving a message.
     972 *
     973 */
     974bool async_get_call_timeout(ipc_call_t *call, suseconds_t usecs)
    975975{
    976976        assert(call);
     
    10071007                        IPC_SET_IMETHOD(*call, IPC_M_PHONE_HUNGUP);
    10081008                        futex_unlock(&async_futex);
    1009                         return conn->close_chandle;
     1009                        return true;
    10101010                }
    10111011
     
    10271027                        /* If we timed out -> exit */
    10281028                        futex_unlock(&async_futex);
    1029                         return CAP_NIL;
     1029                        return false;
    10301030                }
    10311031        }
     
    10351035        list_remove(&msg->link);
    10361036
    1037         cap_call_handle_t chandle = msg->call.cap_handle;
    10381037        *call = msg->call;
    10391038        free(msg);
    10401039
    10411040        futex_unlock(&async_futex);
    1042         return chandle;
     1041        return true;
    10431042}
    10441043
     
    12511250}
    12521251
    1253 errno_t async_answer_0(cap_call_handle_t chandle, errno_t retval)
    1254 {
    1255         return ipc_answer_0(chandle, retval);
    1256 }
    1257 
    1258 errno_t async_answer_1(cap_call_handle_t chandle, errno_t retval, sysarg_t arg1)
    1259 {
    1260         return ipc_answer_1(chandle, retval, arg1);
    1261 }
    1262 
    1263 errno_t async_answer_2(cap_call_handle_t chandle, errno_t retval, sysarg_t arg1,
     1252errno_t async_answer_0(ipc_call_t *call, errno_t retval)
     1253{
     1254        return ipc_answer_0(call->cap_handle, retval);
     1255}
     1256
     1257errno_t async_answer_1(ipc_call_t *call, errno_t retval, sysarg_t arg1)
     1258{
     1259        return ipc_answer_1(call->cap_handle, retval, arg1);
     1260}
     1261
     1262errno_t async_answer_2(ipc_call_t *call, errno_t retval, sysarg_t arg1,
    12641263    sysarg_t arg2)
    12651264{
    1266         return ipc_answer_2(chandle, retval, arg1, arg2);
    1267 }
    1268 
    1269 errno_t async_answer_3(cap_call_handle_t chandle, errno_t retval, sysarg_t arg1,
     1265        return ipc_answer_2(call->cap_handle, retval, arg1, arg2);
     1266}
     1267
     1268errno_t async_answer_3(ipc_call_t *call, errno_t retval, sysarg_t arg1,
    12701269    sysarg_t arg2, sysarg_t arg3)
    12711270{
    1272         return ipc_answer_3(chandle, retval, arg1, arg2, arg3);
    1273 }
    1274 
    1275 errno_t async_answer_4(cap_call_handle_t chandle, errno_t retval, sysarg_t arg1,
     1271        return ipc_answer_3(call->cap_handle, retval, arg1, arg2, arg3);
     1272}
     1273
     1274errno_t async_answer_4(ipc_call_t *call, errno_t retval, sysarg_t arg1,
    12761275    sysarg_t arg2, sysarg_t arg3, sysarg_t arg4)
    12771276{
    1278         return ipc_answer_4(chandle, retval, arg1, arg2, arg3, arg4);
    1279 }
    1280 
    1281 errno_t async_answer_5(cap_call_handle_t chandle, errno_t retval, sysarg_t arg1,
     1277        return ipc_answer_4(call->cap_handle, retval, arg1, arg2, arg3, arg4);
     1278}
     1279
     1280errno_t async_answer_5(ipc_call_t *call, errno_t retval, sysarg_t arg1,
    12821281    sysarg_t arg2, sysarg_t arg3, sysarg_t arg4, sysarg_t arg5)
    12831282{
    1284         return ipc_answer_5(chandle, retval, arg1, arg2, arg3, arg4, arg5);
    1285 }
    1286 
    1287 errno_t async_forward_fast(cap_call_handle_t chandle, async_exch_t *exch,
     1283        return ipc_answer_5(call->cap_handle, retval, arg1, arg2, arg3, arg4,
     1284            arg5);
     1285}
     1286
     1287errno_t async_forward_fast(ipc_call_t *call, async_exch_t *exch,
    12881288    sysarg_t imethod, sysarg_t arg1, sysarg_t arg2, unsigned int mode)
    12891289{
     1290        assert(call);
     1291
    12901292        if (exch == NULL)
    12911293                return ENOENT;
    12921294
    1293         return ipc_forward_fast(chandle, exch->phone, imethod, arg1, arg2, mode);
    1294 }
    1295 
    1296 errno_t async_forward_slow(cap_call_handle_t chandle, async_exch_t *exch,
     1295        return ipc_forward_fast(call->cap_handle, exch->phone, imethod, arg1,
     1296            arg2, mode);
     1297}
     1298
     1299errno_t async_forward_slow(ipc_call_t *call, async_exch_t *exch,
    12971300    sysarg_t imethod, sysarg_t arg1, sysarg_t arg2, sysarg_t arg3,
    12981301    sysarg_t arg4, sysarg_t arg5, unsigned int mode)
    12991302{
     1303        assert(call);
     1304
    13001305        if (exch == NULL)
    13011306                return ENOENT;
    13021307
    1303         return ipc_forward_slow(chandle, exch->phone, imethod, arg1, arg2, arg3,
    1304             arg4, arg5, mode);
     1308        return ipc_forward_slow(call->cap_handle, exch->phone, imethod, arg1,
     1309            arg2, arg3, arg4, arg5, mode);
    13051310}
    13061311
     
    13091314 * Ask through phone for a new connection to some service.
    13101315 *
    1311  * @param exch            Exchange for sending the message.
    1312  * @param arg1            User defined argument.
    1313  * @param arg2            User defined argument.
    1314  * @param arg3            User defined argument.
     1316 * @param exch Exchange for sending the message.
     1317 * @param arg1 User defined argument.
     1318 * @param arg2 User defined argument.
     1319 * @param arg3 User defined argument.
    13151320 *
    13161321 * @return Zero on success or an error code.
     
    13501355 * So far, this wrapper is to be used from within a connection fibril.
    13511356 *
    1352  * @param chandle  Storage for the handle of the IPC_M_SHARE_IN call.
    1353  * @param size     Destination address space area size.
     1357 * @param call Storage for the data of the IPC_M_SHARE_IN call.
     1358 * @param size Destination address space area size.
    13541359 *
    13551360 * @return True on success, false on failure.
    13561361 *
    13571362 */
    1358 bool async_share_in_receive(cap_call_handle_t *chandle, size_t *size)
    1359 {
    1360         assert(chandle);
     1363bool async_share_in_receive(ipc_call_t *call, size_t *size)
     1364{
     1365        assert(call);
    13611366        assert(size);
    13621367
    1363         ipc_call_t data;
    1364         *chandle = async_get_call(&data);
    1365 
    1366         if (IPC_GET_IMETHOD(data) != IPC_M_SHARE_IN)
     1368        async_get_call(call);
     1369
     1370        if (IPC_GET_IMETHOD(*call) != IPC_M_SHARE_IN)
    13671371                return false;
    13681372
    1369         *size = (size_t) IPC_GET_ARG1(data);
     1373        *size = (size_t) IPC_GET_ARG1(*call);
    13701374        return true;
    13711375}
     
    13771381 * argument.
    13781382 *
    1379  * @param chandle  Handle of the IPC_M_DATA_READ call to answer.
    1380  * @param src      Source address space base.
    1381  * @param flags    Flags to be used for sharing. Bits can be only cleared.
     1383 * @param call IPC_M_DATA_READ call to answer.
     1384 * @param src   Source address space base.
     1385 * @param flags Flags to be used for sharing. Bits can be only cleared.
    13821386 *
    13831387 * @return Zero on success or a value from @ref errno.h on failure.
    13841388 *
    13851389 */
    1386 errno_t async_share_in_finalize(cap_call_handle_t chandle, void *src,
    1387     unsigned int flags)
    1388 {
     1390errno_t async_share_in_finalize(ipc_call_t *call, void *src, unsigned int flags)
     1391{
     1392        assert(call);
     1393
    13891394        // FIXME: The source has no business deciding destination address.
    1390         return ipc_answer_3(chandle, EOK, (sysarg_t) src, (sysarg_t) flags,
     1395        return ipc_answer_3(call->cap_handle, EOK, (sysarg_t) src, (sysarg_t) flags,
    13911396            (sysarg_t) _end);
    13921397}
     
    14001405 * So far, this wrapper is to be used from within a connection fibril.
    14011406 *
    1402  * @param chandle  Storage for the hash of the IPC_M_SHARE_OUT call.
    1403  * @param size     Storage for the source address space area size.
    1404  * @param flags    Storage for the sharing flags.
     1407 * @param call  Storage for the data of the IPC_M_SHARE_OUT call.
     1408 * @param size  Storage for the source address space area size.
     1409 * @param flags Storage for the sharing flags.
    14051410 *
    14061411 * @return True on success, false on failure.
    14071412 *
    14081413 */
    1409 bool async_share_out_receive(cap_call_handle_t *chandle, size_t *size,
     1414bool async_share_out_receive(ipc_call_t *call, size_t *size,
    14101415    unsigned int *flags)
    14111416{
    1412         assert(chandle);
     1417        assert(call);
    14131418        assert(size);
    14141419        assert(flags);
    14151420
    1416         ipc_call_t data;
    1417         *chandle = async_get_call(&data);
    1418 
    1419         if (IPC_GET_IMETHOD(data) != IPC_M_SHARE_OUT)
     1421        async_get_call(call);
     1422
     1423        if (IPC_GET_IMETHOD(*call) != IPC_M_SHARE_OUT)
    14201424                return false;
    14211425
    1422         *size = (size_t) IPC_GET_ARG2(data);
    1423         *flags = (unsigned int) IPC_GET_ARG3(data);
     1426        *size = (size_t) IPC_GET_ARG2(*call);
     1427        *flags = (unsigned int) IPC_GET_ARG3(*call);
    14241428        return true;
    14251429}
     
    14311435 * argument.
    14321436 *
    1433  * @param chandle  Handle of the IPC_M_DATA_WRITE call to answer.
    1434  * @param dst      Address of the storage for the destination address space area
    1435  *                 base address.
     1437 * @param call IPC_M_DATA_WRITE call to answer.
     1438 * @param dst  Address of the storage for the destination address space area
     1439 *             base address.
    14361440 *
    14371441 * @return  Zero on success or a value from @ref errno.h on failure.
    14381442 *
    14391443 */
    1440 errno_t async_share_out_finalize(cap_call_handle_t chandle, void **dst)
    1441 {
    1442         return ipc_answer_2(chandle, EOK, (sysarg_t) _end, (sysarg_t) dst);
     1444errno_t async_share_out_finalize(ipc_call_t *call, void **dst)
     1445{
     1446        assert(call);
     1447
     1448        return ipc_answer_2(call->cap_handle, EOK, (sysarg_t) _end,
     1449            (sysarg_t) dst);
    14431450}
    14441451
     
    14511458 * So far, this wrapper is to be used from within a connection fibril.
    14521459 *
    1453  * @param chandle  Storage for the handle of the IPC_M_DATA_READ.
    1454  * @param size     Storage for the maximum size. Can be NULL.
     1460 * @param call Storage for the data of the IPC_M_DATA_READ.
     1461 * @param size Storage for the maximum size. Can be NULL.
    14551462 *
    14561463 * @return True on success, false on failure.
    14571464 *
    14581465 */
    1459 bool async_data_read_receive(cap_call_handle_t *chandle, size_t *size)
    1460 {
    1461         ipc_call_t data;
    1462         return async_data_read_receive_call(chandle, &data, size);
    1463 }
    1464 
    1465 /** Wrapper for receiving the IPC_M_DATA_READ calls using the async framework.
    1466  *
    1467  * This wrapper only makes it more comfortable to receive IPC_M_DATA_READ
    1468  * calls so that the user doesn't have to remember the meaning of each IPC
    1469  * argument.
    1470  *
    1471  * So far, this wrapper is to be used from within a connection fibril.
    1472  *
    1473  * @param chandle  Storage for the handle of the IPC_M_DATA_READ.
    1474  * @param size     Storage for the maximum size. Can be NULL.
    1475  *
    1476  * @return True on success, false on failure.
    1477  *
    1478  */
    1479 bool async_data_read_receive_call(cap_call_handle_t *chandle, ipc_call_t *data,
    1480     size_t *size)
    1481 {
    1482         assert(chandle);
    1483         assert(data);
    1484 
    1485         *chandle = async_get_call(data);
    1486 
    1487         if (IPC_GET_IMETHOD(*data) != IPC_M_DATA_READ)
     1466bool async_data_read_receive(ipc_call_t *call, size_t *size)
     1467{
     1468        assert(call);
     1469
     1470        async_get_call(call);
     1471
     1472        if (IPC_GET_IMETHOD(*call) != IPC_M_DATA_READ)
    14881473                return false;
    14891474
    14901475        if (size)
    1491                 *size = (size_t) IPC_GET_ARG2(*data);
     1476                *size = (size_t) IPC_GET_ARG2(*call);
    14921477
    14931478        return true;
     
    15001485 * argument.
    15011486 *
    1502  * @param chandle  Handle of the IPC_M_DATA_READ call to answer.
    1503  * @param src      Source address for the IPC_M_DATA_READ call.
    1504  * @param size     Size for the IPC_M_DATA_READ call. Can be smaller than
    1505  *                 the maximum size announced by the sender.
     1487 * @param call IPC_M_DATA_READ call to answer.
     1488 * @param src  Source address for the IPC_M_DATA_READ call.
     1489 * @param size Size for the IPC_M_DATA_READ call. Can be smaller than
     1490 *             the maximum size announced by the sender.
    15061491 *
    15071492 * @return  Zero on success or a value from @ref errno.h on failure.
    15081493 *
    15091494 */
    1510 errno_t async_data_read_finalize(cap_call_handle_t chandle, const void *src,
    1511     size_t size)
    1512 {
    1513         return ipc_answer_2(chandle, EOK, (sysarg_t) src, (sysarg_t) size);
     1495errno_t async_data_read_finalize(ipc_call_t *call, const void *src, size_t size)
     1496{
     1497        assert(call);
     1498
     1499        return ipc_answer_2(call->cap_handle, EOK, (sysarg_t) src,
     1500            (sysarg_t) size);
    15141501}
    15151502
     
    15241511                return ENOENT;
    15251512
    1526         cap_call_handle_t chandle;
    1527         if (!async_data_read_receive(&chandle, NULL)) {
    1528                 ipc_answer_0(chandle, EINVAL);
     1513        ipc_call_t call;
     1514        if (!async_data_read_receive(&call, NULL)) {
     1515                async_answer_0(&call, EINVAL);
    15291516                return EINVAL;
    15301517        }
     
    15331520            dataptr);
    15341521        if (msg == 0) {
    1535                 ipc_answer_0(chandle, EINVAL);
     1522                async_answer_0(&call, EINVAL);
    15361523                return EINVAL;
    15371524        }
    15381525
    1539         errno_t retval = ipc_forward_fast(chandle, exch->phone, 0, 0, 0,
     1526        errno_t retval = ipc_forward_fast(call.cap_handle, exch->phone, 0, 0, 0,
    15401527            IPC_FF_ROUTE_FROM_ME);
    15411528        if (retval != EOK) {
    15421529                async_forget(msg);
    1543                 ipc_answer_0(chandle, retval);
     1530                async_answer_0(&call, retval);
    15441531                return retval;
    15451532        }
     
    15591546 * So far, this wrapper is to be used from within a connection fibril.
    15601547 *
    1561  * @param chandle  Storage for the handle of the IPC_M_DATA_WRITE.
    1562  * @param size     Storage for the suggested size. May be NULL.
    1563  *
    1564  * @return  True on success, false on failure.
    1565  *
    1566  */
    1567 bool async_data_write_receive(cap_call_handle_t *chandle, size_t *size)
    1568 {
    1569         ipc_call_t data;
    1570         return async_data_write_receive_call(chandle, &data, size);
    1571 }
    1572 
    1573 /** Wrapper for receiving the IPC_M_DATA_WRITE calls using the async framework.
    1574  *
    1575  * This wrapper only makes it more comfortable to receive IPC_M_DATA_WRITE
    1576  * calls so that the user doesn't have to remember the meaning of each IPC
    1577  * argument.
    1578  *
    1579  * So far, this wrapper is to be used from within a connection fibril.
    1580  *
    1581  * @param chandle  Storage for the handle of the IPC_M_DATA_WRITE.
    1582  * @param data     Storage for the ipc call data.
    1583  * @param size     Storage for the suggested size. May be NULL.
     1548 * @param call Storage for the data of the IPC_M_DATA_WRITE.
     1549 * @param size Storage for the suggested size. May be NULL.
    15841550 *
    15851551 * @return True on success, false on failure.
    15861552 *
    15871553 */
    1588 bool async_data_write_receive_call(cap_call_handle_t *chandle, ipc_call_t *data,
    1589     size_t *size)
    1590 {
    1591         assert(chandle);
    1592         assert(data);
    1593 
    1594         *chandle = async_get_call(data);
    1595 
    1596         if (IPC_GET_IMETHOD(*data) != IPC_M_DATA_WRITE)
     1554bool async_data_write_receive(ipc_call_t *call, size_t *size)
     1555{
     1556        assert(call);
     1557
     1558        async_get_call(call);
     1559
     1560        if (IPC_GET_IMETHOD(*call) != IPC_M_DATA_WRITE)
    15971561                return false;
    15981562
    15991563        if (size)
    1600                 *size = (size_t) IPC_GET_ARG2(*data);
     1564                *size = (size_t) IPC_GET_ARG2(*call);
    16011565
    16021566        return true;
     
    16091573 * argument.
    16101574 *
    1611  * @param chandle  Handle of the IPC_M_DATA_WRITE call to answer.
    1612  * @param dst      Final destination address for the IPC_M_DATA_WRITE call.
    1613  * @param size     Final size for the IPC_M_DATA_WRITE call.
     1575 * @param call IPC_M_DATA_WRITE call to answer.
     1576 * @param dst  Final destination address for the IPC_M_DATA_WRITE call.
     1577 * @param size Final size for the IPC_M_DATA_WRITE call.
    16141578 *
    16151579 * @return  Zero on success or a value from @ref errno.h on failure.
    16161580 *
    16171581 */
    1618 errno_t async_data_write_finalize(cap_call_handle_t chandle, void *dst,
    1619     size_t size)
    1620 {
    1621         return ipc_answer_2(chandle, EOK, (sysarg_t) dst, (sysarg_t) size);
     1582errno_t async_data_write_finalize(ipc_call_t *call, void *dst, size_t size)
     1583{
     1584        assert(call);
     1585
     1586        return async_answer_2(call, EOK, (sysarg_t) dst, (sysarg_t) size);
    16221587}
    16231588
     
    16491614        assert(data);
    16501615
    1651         cap_call_handle_t chandle;
     1616        ipc_call_t call;
    16521617        size_t size;
    1653         if (!async_data_write_receive(&chandle, &size)) {
    1654                 ipc_answer_0(chandle, EINVAL);
     1618        if (!async_data_write_receive(&call, &size)) {
     1619                async_answer_0(&call, EINVAL);
    16551620                return EINVAL;
    16561621        }
    16571622
    16581623        if (size < min_size) {
    1659                 ipc_answer_0(chandle, EINVAL);
     1624                async_answer_0(&call, EINVAL);
    16601625                return EINVAL;
    16611626        }
    16621627
    16631628        if ((max_size > 0) && (size > max_size)) {
    1664                 ipc_answer_0(chandle, EINVAL);
     1629                async_answer_0(&call, EINVAL);
    16651630                return EINVAL;
    16661631        }
    16671632
    16681633        if ((granularity > 0) && ((size % granularity) != 0)) {
    1669                 ipc_answer_0(chandle, EINVAL);
     1634                async_answer_0(&call, EINVAL);
    16701635                return EINVAL;
    16711636        }
     
    16791644
    16801645        if (arg_data == NULL) {
    1681                 ipc_answer_0(chandle, ENOMEM);
     1646                async_answer_0(&call, ENOMEM);
    16821647                return ENOMEM;
    16831648        }
    16841649
    1685         errno_t rc = async_data_write_finalize(chandle, arg_data, size);
     1650        errno_t rc = async_data_write_finalize(&call, arg_data, size);
    16861651        if (rc != EOK) {
    16871652                free(arg_data);
     
    17081673void async_data_write_void(errno_t retval)
    17091674{
    1710         cap_call_handle_t chandle;
    1711         async_data_write_receive(&chandle, NULL);
    1712         ipc_answer_0(chandle, retval);
     1675        ipc_call_t call;
     1676        async_data_write_receive(&call, NULL);
     1677        async_answer_0(&call, retval);
    17131678}
    17141679
     
    17231688                return ENOENT;
    17241689
    1725         cap_call_handle_t chandle;
    1726         if (!async_data_write_receive(&chandle, NULL)) {
    1727                 ipc_answer_0(chandle, EINVAL);
     1690        ipc_call_t call;
     1691        if (!async_data_write_receive(&call, NULL)) {
     1692                async_answer_0(&call, EINVAL);
    17281693                return EINVAL;
    17291694        }
     
    17321697            dataptr);
    17331698        if (msg == 0) {
    1734                 ipc_answer_0(chandle, EINVAL);
     1699                async_answer_0(&call, EINVAL);
    17351700                return EINVAL;
    17361701        }
    17371702
    1738         errno_t retval = ipc_forward_fast(chandle, exch->phone, 0, 0, 0,
     1703        errno_t retval = ipc_forward_fast(call.cap_handle, exch->phone, 0, 0, 0,
    17391704            IPC_FF_ROUTE_FROM_ME);
    17401705        if (retval != EOK) {
    17411706                async_forget(msg);
    1742                 ipc_answer_0(chandle, retval);
     1707                async_answer_0(&call, retval);
    17431708                return retval;
    17441709        }
     
    17651730        /* Accept the phone */
    17661731        ipc_call_t call;
    1767         cap_call_handle_t chandle = async_get_call(&call);
     1732        async_get_call(&call);
     1733
    17681734        cap_phone_handle_t phandle = (cap_handle_t) IPC_GET_ARG5(call);
    17691735
    17701736        if ((IPC_GET_IMETHOD(call) != IPC_M_CONNECT_TO_ME) ||
    17711737            !CAP_HANDLE_VALID((phandle))) {
    1772                 async_answer_0(chandle, EINVAL);
     1738                async_answer_0(&call, EINVAL);
    17731739                return NULL;
    17741740        }
     
    17761742        async_sess_t *sess = (async_sess_t *) malloc(sizeof(async_sess_t));
    17771743        if (sess == NULL) {
    1778                 async_answer_0(chandle, ENOMEM);
     1744                async_answer_0(&call, ENOMEM);
    17791745                return NULL;
    17801746        }
     
    17951761
    17961762        /* Acknowledge the connected phone */
    1797         async_answer_0(chandle, EOK);
     1763        async_answer_0(&call, EOK);
    17981764
    17991765        return sess;
     
    18431809}
    18441810
    1845 bool async_state_change_receive(cap_call_handle_t *chandle, sysarg_t *arg1,
    1846     sysarg_t *arg2, sysarg_t *arg3)
    1847 {
    1848         assert(chandle);
    1849 
    1850         ipc_call_t call;
    1851         *chandle = async_get_call(&call);
    1852 
    1853         if (IPC_GET_IMETHOD(call) != IPC_M_STATE_CHANGE_AUTHORIZE)
     1811bool async_state_change_receive(ipc_call_t *call)
     1812{
     1813        assert(call);
     1814
     1815        async_get_call(call);
     1816
     1817        if (IPC_GET_IMETHOD(*call) != IPC_M_STATE_CHANGE_AUTHORIZE)
    18541818                return false;
    18551819
    1856         if (arg1)
    1857                 *arg1 = IPC_GET_ARG1(call);
    1858         if (arg2)
    1859                 *arg2 = IPC_GET_ARG2(call);
    1860         if (arg3)
    1861                 *arg3 = IPC_GET_ARG3(call);
    1862 
    18631820        return true;
    18641821}
    18651822
    1866 errno_t async_state_change_finalize(cap_call_handle_t chandle,
    1867     async_exch_t *other_exch)
    1868 {
    1869         return ipc_answer_1(chandle, EOK, CAP_HANDLE_RAW(other_exch->phone));
     1823errno_t async_state_change_finalize(ipc_call_t *call, async_exch_t *other_exch)
     1824{
     1825        assert(call);
     1826
     1827        return async_answer_1(call, EOK, CAP_HANDLE_RAW(other_exch->phone));
    18701828}
    18711829
Note: See TracChangeset for help on using the changeset viewer.