Changes in uspace/lib/c/generic/async/server.c [5e801dc:fec7ba0] in mainline
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/lib/c/generic/async/server.c
r5e801dc rfec7ba0 96 96 */ 97 97 98 #define _LIBC_ASYNC_C_98 #define LIBC_ASYNC_C_ 99 99 #include <ipc/ipc.h> 100 100 #include <async.h> 101 101 #include "../private/async.h" 102 #undef _LIBC_ASYNC_C_102 #undef LIBC_ASYNC_C_ 103 103 104 104 #include <ipc/irq.h> … … 231 231 static sysarg_t notification_avail = 0; 232 232 233 static size_t client_key_hash( constvoid *key)234 { 235 const task_id_t *in_task_id =key;236 return *in_task_id;233 static size_t client_key_hash(void *key) 234 { 235 task_id_t in_task_id = *(task_id_t *) key; 236 return in_task_id; 237 237 } 238 238 … … 243 243 } 244 244 245 static bool client_key_equal( constvoid *key, const ht_link_t *item)246 { 247 const task_id_t *in_task_id =key;245 static bool client_key_equal(void *key, const ht_link_t *item) 246 { 247 task_id_t in_task_id = *(task_id_t *) key; 248 248 client_t *client = hash_table_get_inst(item, client_t, link); 249 return *in_task_id == client->in_task_id;249 return in_task_id == client->in_task_id; 250 250 } 251 251 … … 490 490 } 491 491 492 static size_t notification_key_hash( constvoid *key)493 { 494 const sysarg_t *id =key;495 return *id;492 static size_t notification_key_hash(void *key) 493 { 494 sysarg_t id = *(sysarg_t *) key; 495 return id; 496 496 } 497 497 … … 503 503 } 504 504 505 static bool notification_key_equal( constvoid *key, const ht_link_t *item)506 { 507 const sysarg_t *id =key;505 static bool notification_key_equal(void *key, const ht_link_t *item) 506 { 507 sysarg_t id = *(sysarg_t *) key; 508 508 notification_t *notification = 509 509 hash_table_get_inst(item, notification_t, htlink); 510 return *id == notification->imethod;510 return id == notification->imethod; 511 511 } 512 512 … … 546 546 errno_t rc = mpsc_send(conn->msg_channel, call); 547 547 548 if ( ipc_get_imethod(call) == IPC_M_PHONE_HUNGUP) {548 if (IPC_GET_IMETHOD(*call) == IPC_M_PHONE_HUNGUP) { 549 549 /* Close the channel, but let the connection fibril answer. */ 550 550 mpsc_close(conn->msg_channel); … … 656 656 } 657 657 658 sysarg_t imethod = ipc_get_imethod(call);659 ht_link_t *link = hash_table_find(¬ification_hash_table, &imethod);658 ht_link_t *link = hash_table_find(¬ification_hash_table, 659 &IPC_GET_IMETHOD(*call)); 660 660 if (!link) { 661 661 /* Invalid notification. */ … … 871 871 872 872 memset(call, 0, sizeof(ipc_call_t)); 873 ipc_set_imethod(call, IPC_M_PHONE_HUNGUP);873 IPC_SET_IMETHOD(*call, IPC_M_PHONE_HUNGUP); 874 874 call->cap_handle = CAP_NIL; 875 875 } 876 876 877 877 return true; 878 }879 880 bool async_get_call(ipc_call_t *call)881 {882 return async_get_call_timeout(call, 0);883 878 } 884 879 … … 944 939 945 940 /* New connection */ 946 if ( ipc_get_imethod(call) == IPC_M_CONNECT_ME_TO) {941 if (IPC_GET_IMETHOD(*call) == IPC_M_CONNECT_ME_TO) { 947 942 connection_t *conn = calloc(1, sizeof(*conn)); 948 943 if (!conn) { … … 951 946 } 952 947 953 iface_t iface = (iface_t) ipc_get_arg1(call);948 iface_t iface = (iface_t) IPC_GET_ARG1(*call); 954 949 955 950 // TODO: Currently ignores all ports but the first one. … … 1101 1096 } 1102 1097 1103 staticerrno_t async_forward_fast(ipc_call_t *call, async_exch_t *exch,1098 errno_t async_forward_fast(ipc_call_t *call, async_exch_t *exch, 1104 1099 sysarg_t imethod, sysarg_t arg1, sysarg_t arg2, unsigned int mode) 1105 1100 { … … 1117 1112 } 1118 1113 1119 staticerrno_t async_forward_slow(ipc_call_t *call, async_exch_t *exch,1114 errno_t async_forward_slow(ipc_call_t *call, async_exch_t *exch, 1120 1115 sysarg_t imethod, sysarg_t arg1, sysarg_t arg2, sysarg_t arg3, 1121 1116 sysarg_t arg4, sysarg_t arg5, unsigned int mode) … … 1132 1127 return ipc_forward_slow(chandle, exch->phone, imethod, arg1, arg2, arg3, 1133 1128 arg4, arg5, mode); 1134 }1135 1136 errno_t async_forward_0(ipc_call_t *call, async_exch_t *exch, sysarg_t imethod,1137 unsigned int mode)1138 {1139 return async_forward_fast(call, exch, imethod, 0, 0, mode);1140 }1141 1142 errno_t async_forward_1(ipc_call_t *call, async_exch_t *exch, sysarg_t imethod,1143 sysarg_t arg1, unsigned int mode)1144 {1145 return async_forward_fast(call, exch, imethod, arg1, 0, mode);1146 }1147 1148 errno_t async_forward_2(ipc_call_t *call, async_exch_t *exch, sysarg_t imethod,1149 sysarg_t arg1, sysarg_t arg2, unsigned int mode)1150 {1151 return async_forward_fast(call, exch, imethod, arg1, arg2, mode);1152 }1153 1154 errno_t async_forward_3(ipc_call_t *call, async_exch_t *exch, sysarg_t imethod,1155 sysarg_t arg1, sysarg_t arg2, sysarg_t arg3, unsigned int mode)1156 {1157 return async_forward_slow(call, exch, imethod, arg1, arg2, arg3, 0, 0,1158 mode);1159 }1160 1161 errno_t async_forward_4(ipc_call_t *call, async_exch_t *exch, sysarg_t imethod,1162 sysarg_t arg1, sysarg_t arg2, sysarg_t arg3, sysarg_t arg4,1163 unsigned int mode)1164 {1165 return async_forward_slow(call, exch, imethod, arg1, arg2, arg3, arg4,1166 0, mode);1167 }1168 1169 errno_t async_forward_5(ipc_call_t *call, async_exch_t *exch, sysarg_t imethod,1170 sysarg_t arg1, sysarg_t arg2, sysarg_t arg3, sysarg_t arg4, sysarg_t arg5,1171 unsigned int mode)1172 {1173 return async_forward_slow(call, exch, imethod, arg1, arg2, arg3, arg4,1174 arg5, mode);1175 1129 } 1176 1130 … … 1221 1175 async_get_call(call); 1222 1176 1223 if ( ipc_get_imethod(call) != IPC_M_SHARE_IN)1177 if (IPC_GET_IMETHOD(*call) != IPC_M_SHARE_IN) 1224 1178 return false; 1225 1179 1226 *size = (size_t) ipc_get_arg1(call);1180 *size = (size_t) IPC_GET_ARG1(*call); 1227 1181 return true; 1228 1182 } … … 1276 1230 async_get_call(call); 1277 1231 1278 if ( ipc_get_imethod(call) != IPC_M_SHARE_OUT)1232 if (IPC_GET_IMETHOD(*call) != IPC_M_SHARE_OUT) 1279 1233 return false; 1280 1234 1281 *size = (size_t) ipc_get_arg2(call);1282 *flags = (unsigned int) ipc_get_arg3(call);1235 *size = (size_t) IPC_GET_ARG2(*call); 1236 *flags = (unsigned int) IPC_GET_ARG3(*call); 1283 1237 return true; 1284 1238 } … … 1329 1283 async_get_call(call); 1330 1284 1331 if ( ipc_get_imethod(call) != IPC_M_DATA_READ)1285 if (IPC_GET_IMETHOD(*call) != IPC_M_DATA_READ) 1332 1286 return false; 1333 1287 1334 1288 if (size) 1335 *size = (size_t) ipc_get_arg2(call);1289 *size = (size_t) IPC_GET_ARG2(*call); 1336 1290 1337 1291 return true; … … 1366 1320 * 1367 1321 */ 1368 staticerrno_t async_data_read_forward_fast(async_exch_t *exch, sysarg_t imethod,1322 errno_t async_data_read_forward_fast(async_exch_t *exch, sysarg_t imethod, 1369 1323 sysarg_t arg1, sysarg_t arg2, sysarg_t arg3, sysarg_t arg4, 1370 1324 ipc_call_t *dataptr) … … 1379 1333 } 1380 1334 1381 aid_t msg = async_send_ 4(exch, imethod, arg1, arg2, arg3, arg4,1335 aid_t msg = async_send_fast(exch, imethod, arg1, arg2, arg3, arg4, 1382 1336 dataptr); 1383 1337 if (msg == 0) { … … 1400 1354 } 1401 1355 1402 errno_t async_data_read_forward_0_0(async_exch_t *exch, sysarg_t imethod)1403 {1404 return async_data_read_forward_fast(exch, imethod, 0, 0, 0, 0, NULL);1405 }1406 1407 errno_t async_data_read_forward_1_0(async_exch_t *exch, sysarg_t imethod,1408 sysarg_t arg1)1409 {1410 return async_data_read_forward_fast(exch, imethod, arg1, 0, 0, 0, NULL);1411 }1412 1413 errno_t async_data_read_forward_2_0(async_exch_t *exch, sysarg_t imethod,1414 sysarg_t arg1, sysarg_t arg2)1415 {1416 return async_data_read_forward_fast(exch, imethod, arg1, arg2, 0,1417 0, NULL);1418 }1419 1420 errno_t async_data_read_forward_3_0(async_exch_t *exch, sysarg_t imethod,1421 sysarg_t arg1, sysarg_t arg2, sysarg_t arg3)1422 {1423 return async_data_read_forward_fast(exch, imethod, arg1, arg2, arg3,1424 0, NULL);1425 }1426 1427 errno_t async_data_read_forward_4_0(async_exch_t *exch, sysarg_t imethod,1428 sysarg_t arg1, sysarg_t arg2, sysarg_t arg3, sysarg_t arg4)1429 {1430 return async_data_read_forward_fast(exch, imethod, arg1, arg2, arg3,1431 arg4, NULL);1432 }1433 1434 errno_t async_data_read_forward_0_1(async_exch_t *exch, sysarg_t imethod,1435 ipc_call_t *dataptr)1436 {1437 return async_data_read_forward_fast(exch, imethod, 0, 0, 0,1438 0, dataptr);1439 }1440 1441 errno_t async_data_read_forward_1_1(async_exch_t *exch, sysarg_t imethod,1442 sysarg_t arg1, ipc_call_t *dataptr)1443 {1444 return async_data_read_forward_fast(exch, imethod, arg1, 0, 0,1445 0, dataptr);1446 }1447 1448 errno_t async_data_read_forward_2_1(async_exch_t *exch, sysarg_t imethod,1449 sysarg_t arg1, sysarg_t arg2, ipc_call_t *dataptr)1450 {1451 return async_data_read_forward_fast(exch, imethod, arg1, arg2, 0,1452 0, dataptr);1453 }1454 1455 errno_t async_data_read_forward_3_1(async_exch_t *exch, sysarg_t imethod,1456 sysarg_t arg1, sysarg_t arg2, sysarg_t arg3, ipc_call_t *dataptr)1457 {1458 return async_data_read_forward_fast(exch, imethod, arg1, arg2, arg3,1459 0, dataptr);1460 }1461 1462 errno_t async_data_read_forward_4_1(async_exch_t *exch, sysarg_t imethod,1463 sysarg_t arg1, sysarg_t arg2, sysarg_t arg3, sysarg_t arg4,1464 ipc_call_t *dataptr)1465 {1466 return async_data_read_forward_fast(exch, imethod, arg1, arg2, arg3,1467 arg4, dataptr);1468 }1469 1470 1356 /** Wrapper for receiving the IPC_M_DATA_WRITE calls using the async framework. 1471 1357 * … … 1488 1374 async_get_call(call); 1489 1375 1490 if ( ipc_get_imethod(call) != IPC_M_DATA_WRITE)1376 if (IPC_GET_IMETHOD(*call) != IPC_M_DATA_WRITE) 1491 1377 return false; 1492 1378 1493 1379 if (size) 1494 *size = (size_t) ipc_get_arg2(call);1380 *size = (size_t) IPC_GET_ARG2(*call); 1495 1381 1496 1382 return true; … … 1611 1497 * 1612 1498 */ 1613 static errno_t async_data_write_forward_fast(async_exch_t *exch,1614 sysarg_t imethod, sysarg_t arg1, sysarg_t arg2, sysarg_t arg3,1615 sysarg_t arg4,ipc_call_t *dataptr)1499 errno_t async_data_write_forward_fast(async_exch_t *exch, sysarg_t imethod, 1500 sysarg_t arg1, sysarg_t arg2, sysarg_t arg3, sysarg_t arg4, 1501 ipc_call_t *dataptr) 1616 1502 { 1617 1503 if (exch == NULL) … … 1624 1510 } 1625 1511 1626 aid_t msg = async_send_ 4(exch, imethod, arg1, arg2, arg3, arg4,1512 aid_t msg = async_send_fast(exch, imethod, arg1, arg2, arg3, arg4, 1627 1513 dataptr); 1628 1514 if (msg == 0) { … … 1645 1531 } 1646 1532 1647 errno_t async_data_write_forward_0_0(async_exch_t *exch, sysarg_t imethod)1648 {1649 return async_data_write_forward_fast(exch, imethod, 0, 0, 0,1650 0, NULL);1651 }1652 1653 errno_t async_data_write_forward_1_0(async_exch_t *exch, sysarg_t imethod,1654 sysarg_t arg1)1655 {1656 return async_data_write_forward_fast(exch, imethod, arg1, 0, 0,1657 0, NULL);1658 }1659 1660 errno_t async_data_write_forward_2_0(async_exch_t *exch, sysarg_t imethod,1661 sysarg_t arg1, sysarg_t arg2)1662 {1663 return async_data_write_forward_fast(exch, imethod, arg1, arg2, 0,1664 0, NULL);1665 }1666 1667 errno_t async_data_write_forward_3_0(async_exch_t *exch, sysarg_t imethod,1668 sysarg_t arg1, sysarg_t arg2, sysarg_t arg3)1669 {1670 return async_data_write_forward_fast(exch, imethod, arg1, arg2, arg3,1671 0, NULL);1672 }1673 1674 errno_t async_data_write_forward_4_0(async_exch_t *exch, sysarg_t imethod,1675 sysarg_t arg1, sysarg_t arg2, sysarg_t arg3, sysarg_t arg4)1676 {1677 return async_data_write_forward_fast(exch, imethod, arg1, arg2, arg3,1678 arg4, NULL);1679 }1680 1681 errno_t async_data_write_forward_0_1(async_exch_t *exch, sysarg_t imethod,1682 ipc_call_t *dataptr)1683 {1684 return async_data_write_forward_fast(exch, imethod, 0, 0, 0,1685 0, dataptr);1686 }1687 1688 errno_t async_data_write_forward_1_1(async_exch_t *exch, sysarg_t imethod,1689 sysarg_t arg1, ipc_call_t *dataptr)1690 {1691 return async_data_write_forward_fast(exch, imethod, arg1, 0, 0,1692 0, dataptr);1693 }1694 1695 errno_t async_data_write_forward_2_1(async_exch_t *exch, sysarg_t imethod,1696 sysarg_t arg1, sysarg_t arg2, ipc_call_t *dataptr)1697 {1698 return async_data_write_forward_fast(exch, imethod, arg1, arg2, 0,1699 0, dataptr);1700 }1701 1702 errno_t async_data_write_forward_3_1(async_exch_t *exch, sysarg_t imethod,1703 sysarg_t arg1, sysarg_t arg2, sysarg_t arg3, ipc_call_t *dataptr)1704 {1705 return async_data_write_forward_fast(exch, imethod, arg1, arg2, arg3,1706 0, dataptr);1707 }1708 1709 errno_t async_data_write_forward_4_1(async_exch_t *exch, sysarg_t imethod,1710 sysarg_t arg1, sysarg_t arg2, sysarg_t arg3, sysarg_t arg4,1711 ipc_call_t *dataptr)1712 {1713 return async_data_write_forward_fast(exch, imethod, arg1, arg2, arg3,1714 arg4, dataptr);1715 }1716 1717 1533 /** Wrapper for receiving the IPC_M_CONNECT_TO_ME calls. 1718 1534 * … … 1732 1548 async_get_call(&call); 1733 1549 1734 cap_phone_handle_t phandle = (cap_handle_t) ipc_get_arg5(&call);1735 1736 if (( ipc_get_imethod(&call) != IPC_M_CONNECT_TO_ME) ||1737 ! cap_handle_valid((phandle))) {1550 cap_phone_handle_t phandle = (cap_handle_t) IPC_GET_ARG5(call); 1551 1552 if ((IPC_GET_IMETHOD(call) != IPC_M_CONNECT_TO_ME) || 1553 !CAP_HANDLE_VALID((phandle))) { 1738 1554 async_answer_0(&call, EINVAL); 1739 1555 return NULL; … … 1776 1592 async_sess_t *async_callback_receive_start(exch_mgmt_t mgmt, ipc_call_t *call) 1777 1593 { 1778 cap_phone_handle_t phandle = (cap_handle_t) ipc_get_arg5(call);1779 1780 if (( ipc_get_imethod(call) != IPC_M_CONNECT_TO_ME) ||1781 ! cap_handle_valid((phandle)))1594 cap_phone_handle_t phandle = (cap_handle_t) IPC_GET_ARG5(*call); 1595 1596 if ((IPC_GET_IMETHOD(*call) != IPC_M_CONNECT_TO_ME) || 1597 !CAP_HANDLE_VALID((phandle))) 1782 1598 return NULL; 1783 1599 … … 1803 1619 async_get_call(call); 1804 1620 1805 if ( ipc_get_imethod(call) != IPC_M_STATE_CHANGE_AUTHORIZE)1621 if (IPC_GET_IMETHOD(*call) != IPC_M_STATE_CHANGE_AUTHORIZE) 1806 1622 return false; 1807 1623 … … 1813 1629 assert(call); 1814 1630 1815 return async_answer_1(call, EOK, cap_handle_raw(other_exch->phone));1631 return async_answer_1(call, EOK, CAP_HANDLE_RAW(other_exch->phone)); 1816 1632 } 1817 1633
Note:
See TracChangeset
for help on using the changeset viewer.