Changeset 228e490 in mainline for uspace/lib/c
- Timestamp:
- 2010-12-14T17:00:02Z (15 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- a9b6bec, eb221e5
- Parents:
- dd8d5a7
- Location:
- uspace/lib/c
- Files:
-
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/lib/c/generic/async.c
rdd8d5a7 r228e490 288 288 list_append(&msg->link, &conn->msg_queue); 289 289 290 if (IPC_GET_ METHOD(*call) == IPC_M_PHONE_HUNGUP)290 if (IPC_GET_IMETHOD(*call) == IPC_M_PHONE_HUNGUP) 291 291 conn->close_callid = callid; 292 292 … … 401 401 */ 402 402 memset(call, 0, sizeof(ipc_call_t)); 403 IPC_SET_ METHOD(*call, IPC_M_PHONE_HUNGUP);403 IPC_SET_IMETHOD(*call, IPC_M_PHONE_HUNGUP); 404 404 futex_up(&async_futex); 405 405 return conn->close_callid; … … 588 588 } 589 589 590 switch (IPC_GET_ METHOD(*call)) {590 switch (IPC_GET_IMETHOD(*call)) { 591 591 case IPC_M_CONNECT_ME: 592 592 case IPC_M_CONNECT_ME_TO: … … 1199 1199 1200 1200 *callid = async_get_call(&data); 1201 if (IPC_GET_ METHOD(data) != IPC_M_SHARE_IN)1201 if (IPC_GET_IMETHOD(data) != IPC_M_SHARE_IN) 1202 1202 return 0; 1203 1203 *size = (size_t) IPC_GET_ARG2(data); … … 1259 1259 1260 1260 *callid = async_get_call(&data); 1261 if (IPC_GET_ METHOD(data) != IPC_M_SHARE_OUT)1261 if (IPC_GET_IMETHOD(data) != IPC_M_SHARE_OUT) 1262 1262 return 0; 1263 1263 *size = (size_t) IPC_GET_ARG2(data); … … 1317 1317 1318 1318 *callid = async_get_call(&data); 1319 if (IPC_GET_ METHOD(data) != IPC_M_DATA_READ)1319 if (IPC_GET_IMETHOD(data) != IPC_M_DATA_READ) 1320 1320 return 0; 1321 1321 if (size) … … 1412 1412 1413 1413 *callid = async_get_call(&data); 1414 if (IPC_GET_ METHOD(data) != IPC_M_DATA_WRITE)1414 if (IPC_GET_IMETHOD(data) != IPC_M_DATA_WRITE) 1415 1415 return 0; 1416 1416 -
uspace/lib/c/generic/ipc.c
rdd8d5a7 r228e490 131 131 /** Make a synchronous call transmitting 5 arguments of payload. 132 132 * 133 * @param phoneid Phone handle for the call. 134 * @param method Requested method. 135 * @param arg1 Service-defined payload argument. 136 * @param arg2 Service-defined payload argument. 137 * @param arg3 Service-defined payload argument. 138 * @param arg4 Service-defined payload argument. 139 * @param arg5 Service-defined payload argument. 140 * @param result1 If non-NULL, storage for the first return argument. 141 * @param result2 If non-NULL, storage for the second return argument. 142 * @param result3 If non-NULL, storage for the third return argument. 143 * @param result4 If non-NULL, storage for the fourth return argument. 144 * @param result5 If non-NULL, storage for the fifth return argument. 145 * 146 * @return Negative value means IPC error. 147 * Otherwise the RETVAL of the answer. 133 * @param phoneid Phone handle for the call. 134 * @param imethod Requested interface and method. 135 * @param arg1 Service-defined payload argument. 136 * @param arg2 Service-defined payload argument. 137 * @param arg3 Service-defined payload argument. 138 * @param arg4 Service-defined payload argument. 139 * @param arg5 Service-defined payload argument. 140 * @param result1 If non-NULL, storage for the first return argument. 141 * @param result2 If non-NULL, storage for the second return argument. 142 * @param result3 If non-NULL, storage for the third return argument. 143 * @param result4 If non-NULL, storage for the fourth return argument. 144 * @param result5 If non-NULL, storage for the fifth return argument. 145 * 146 * @return Negative value means IPC error. 147 * Otherwise the RETVAL of the answer. 148 * 148 149 */ 149 150 int 150 ipc_call_sync_slow(int phoneid, sysarg_t method, sysarg_t arg1, sysarg_t arg2,151 ipc_call_sync_slow(int phoneid, sysarg_t imethod, sysarg_t arg1, sysarg_t arg2, 151 152 sysarg_t arg3, sysarg_t arg4, sysarg_t arg5, sysarg_t *result1, 152 153 sysarg_t *result2, sysarg_t *result3, sysarg_t *result4, sysarg_t *result5) 153 154 { 154 155 ipc_call_t data; 155 int callres; 156 157 IPC_SET_METHOD(data, method); 156 157 IPC_SET_IMETHOD(data, imethod); 158 158 IPC_SET_ARG1(data, arg1); 159 159 IPC_SET_ARG2(data, arg2); … … 161 161 IPC_SET_ARG4(data, arg4); 162 162 IPC_SET_ARG5(data, arg5); 163 164 callres = __SYSCALL3(SYS_IPC_CALL_SYNC_SLOW, phoneid, (sysarg_t) &data,165 (sysarg_t) &data );163 164 int callres = __SYSCALL3(SYS_IPC_CALL_SYNC_SLOW, phoneid, 165 (sysarg_t) &data, (sysarg_t) &data); 166 166 if (callres) 167 167 return callres; 168 168 169 169 if (result1) 170 170 *result1 = IPC_GET_ARG1(data); … … 177 177 if (result5) 178 178 *result5 = IPC_GET_ARG5(data); 179 179 180 180 return IPC_GET_RETVAL(data); 181 181 } … … 183 183 /** Syscall to send asynchronous message. 184 184 * 185 * @param phoneid Phone handle for the call. 186 * @param data Call data with the request. 187 * 188 * @return Hash of the call or an error code. 185 * @param phoneid Phone handle for the call. 186 * @param data Call data with the request. 187 * 188 * @return Hash of the call or an error code. 189 * 189 190 */ 190 191 static ipc_callid_t _ipc_call_async(int phoneid, ipc_call_t *data) … … 277 278 * If the call cannot be temporarily made, queue it. 278 279 * 279 * @param phoneid Phone handle for the call. 280 * @param method Requested method. 281 * @param arg1 Service-defined payload argument. 282 * @param arg2 Service-defined payload argument. 283 * @param arg3 Service-defined payload argument. 284 * @param arg4 Service-defined payload argument. 285 * @param private Argument to be passed to the answer/error callback. 286 * @param callback Answer or error callback. 287 * @param can_preempt If non-zero, the current fibril will be preempted in 288 * case the kernel temporarily refuses to accept more 289 * asynchronous calls. 290 */ 291 void ipc_call_async_fast(int phoneid, sysarg_t method, sysarg_t arg1, 280 * @param phoneid Phone handle for the call. 281 * @param imethod Requested interface and method. 282 * @param arg1 Service-defined payload argument. 283 * @param arg2 Service-defined payload argument. 284 * @param arg3 Service-defined payload argument. 285 * @param arg4 Service-defined payload argument. 286 * @param private Argument to be passed to the answer/error callback. 287 * @param callback Answer or error callback. 288 * @param can_preempt If non-zero, the current fibril will be preempted in 289 * case the kernel temporarily refuses to accept more 290 * asynchronous calls. 291 * 292 */ 293 void ipc_call_async_fast(int phoneid, sysarg_t imethod, sysarg_t arg1, 292 294 sysarg_t arg2, sysarg_t arg3, sysarg_t arg4, void *private, 293 295 ipc_async_callback_t callback, int can_preempt) 294 296 { 295 297 async_call_t *call = NULL; 296 ipc_callid_t callid; 297 298 298 299 if (callback) { 299 300 call = ipc_prepare_async(private, callback); … … 301 302 return; 302 303 } 303 304 304 305 /* 305 306 * We need to make sure that we get callid before another thread … … 307 308 */ 308 309 futex_down(&ipc_futex); 309 callid = __SYSCALL6(SYS_IPC_CALL_ASYNC_FAST, phoneid, method, arg1,310 arg2, arg3, arg4);311 310 ipc_callid_t callid = __SYSCALL6(SYS_IPC_CALL_ASYNC_FAST, phoneid, 311 imethod, arg1, arg2, arg3, arg4); 312 312 313 if (callid == (ipc_callid_t) IPC_CALLRET_TEMPORARY) { 313 314 if (!call) { … … 316 317 return; 317 318 } 318 IPC_SET_ METHOD(call->u.msg.data,method);319 IPC_SET_IMETHOD(call->u.msg.data, imethod); 319 320 IPC_SET_ARG1(call->u.msg.data, arg1); 320 321 IPC_SET_ARG2(call->u.msg.data, arg2); … … 337 338 * If the call cannot be temporarily made, queue it. 338 339 * 339 * @param phoneid 340 * @param method Requested method.341 * @param arg1 342 * @param arg2 343 * @param arg3 344 * @param arg4 345 * @param arg5 346 * @param private 347 * @param callback 348 * @param can_preempt 349 * 350 * 351 * 352 */ 353 void ipc_call_async_slow(int phoneid, sysarg_t method, sysarg_t arg1,340 * @param phoneid Phone handle for the call. 341 * @param imethod Requested interface and method. 342 * @param arg1 Service-defined payload argument. 343 * @param arg2 Service-defined payload argument. 344 * @param arg3 Service-defined payload argument. 345 * @param arg4 Service-defined payload argument. 346 * @param arg5 Service-defined payload argument. 347 * @param private Argument to be passed to the answer/error callback. 348 * @param callback Answer or error callback. 349 * @param can_preempt If non-zero, the current fibril will be preempted in 350 * case the kernel temporarily refuses to accept more 351 * asynchronous calls. 352 * 353 */ 354 void ipc_call_async_slow(int phoneid, sysarg_t imethod, sysarg_t arg1, 354 355 sysarg_t arg2, sysarg_t arg3, sysarg_t arg4, sysarg_t arg5, void *private, 355 356 ipc_async_callback_t callback, int can_preempt) … … 362 363 return; 363 364 364 IPC_SET_ METHOD(call->u.msg.data,method);365 IPC_SET_IMETHOD(call->u.msg.data, imethod); 365 366 IPC_SET_ARG1(call->u.msg.data, arg1); 366 367 IPC_SET_ARG2(call->u.msg.data, arg2); … … 676 677 /** Forward a received call to another destination. 677 678 * 678 * @param callid 679 * @param phoneid 680 * @param method Newmethod for the forwarded call.681 * @param arg1 682 * @param arg2 683 * @param mode 684 * 685 * @return 679 * @param callid Hash of the call to forward. 680 * @param phoneid Phone handle to use for forwarding. 681 * @param imethod New interface and method for the forwarded call. 682 * @param arg1 New value of the first argument for the forwarded call. 683 * @param arg2 New value of the second argument for the forwarded call. 684 * @param mode Flags specifying mode of the forward operation. 685 * 686 * @return Zero on success or an error code. 686 687 * 687 688 * For non-system methods, the old method, arg1 and arg2 are rewritten by the … … 690 691 * methods are forwarded verbatim. 691 692 */ 692 int ipc_forward_fast(ipc_callid_t callid, int phoneid, int method,693 int ipc_forward_fast(ipc_callid_t callid, int phoneid, int imethod, 693 694 sysarg_t arg1, sysarg_t arg2, int mode) 694 695 { 695 return __SYSCALL6(SYS_IPC_FORWARD_FAST, callid, phoneid, method, arg1,696 return __SYSCALL6(SYS_IPC_FORWARD_FAST, callid, phoneid, imethod, arg1, 696 697 arg2, mode); 697 698 } 698 699 699 700 700 int ipc_forward_slow(ipc_callid_t callid, int phoneid, int method,701 int ipc_forward_slow(ipc_callid_t callid, int phoneid, int imethod, 701 702 sysarg_t arg1, sysarg_t arg2, sysarg_t arg3, sysarg_t arg4, sysarg_t arg5, 702 703 int mode) 703 704 { 704 705 ipc_call_t data; 705 706 IPC_SET_ METHOD(data,method);706 707 IPC_SET_IMETHOD(data, imethod); 707 708 IPC_SET_ARG1(data, arg1); 708 709 IPC_SET_ARG2(data, arg2); … … 710 711 IPC_SET_ARG4(data, arg4); 711 712 IPC_SET_ARG5(data, arg5); 712 713 713 714 return __SYSCALL4(SYS_IPC_FORWARD_SLOW, callid, phoneid, (sysarg_t) &data, mode); 714 715 } -
uspace/lib/c/generic/net/modules.c
rdd8d5a7 r228e490 283 283 IPC_SET_RETVAL(*answer, 0); 284 284 // just to be precize 285 IPC_SET_ METHOD(*answer, 0);285 IPC_SET_IMETHOD(*answer, 0); 286 286 IPC_SET_ARG1(*answer, 0); 287 287 IPC_SET_ARG2(*answer, 0); -
uspace/lib/c/generic/net/socket_client.c
rdd8d5a7 r228e490 214 214 callid = async_get_call(&call); 215 215 216 switch (IPC_GET_ METHOD(call)) {216 switch (IPC_GET_IMETHOD(call)) { 217 217 case NET_SOCKET_RECEIVED: 218 218 case NET_SOCKET_ACCEPTED: … … 229 229 } 230 230 231 switch (IPC_GET_ METHOD(call)) {231 switch (IPC_GET_IMETHOD(call)) { 232 232 case NET_SOCKET_RECEIVED: 233 233 fibril_mutex_lock(&socket->receive_lock); -
uspace/lib/c/include/ipc/net.h
rdd8d5a7 r228e490 192 192 */ 193 193 #define IS_NET_MESSAGE(call) \ 194 IS_IN_INTERVAL(IPC_GET_ METHOD(*call), NET_FIRST, NET_LAST)194 IS_IN_INTERVAL(IPC_GET_IMETHOD(*call), NET_FIRST, NET_LAST) 195 195 196 196 /** Returns a value indicating whether the IPC call is an ARP message. … … 198 198 */ 199 199 #define IS_NET_ARP_MESSAGE(call) \ 200 IS_IN_INTERVAL(IPC_GET_ METHOD(*call), NET_ARP_FIRST, NET_ARP_LAST)200 IS_IN_INTERVAL(IPC_GET_IMETHOD(*call), NET_ARP_FIRST, NET_ARP_LAST) 201 201 202 202 /** Returns a value indicating whether the IPC call is an Ethernet message. … … 204 204 */ 205 205 #define IS_NET_ETH_MESSAGE(call) \ 206 IS_IN_INTERVAL(IPC_GET_ METHOD(*call), NET_ETH_FIRST, NET_ETH_LAST)206 IS_IN_INTERVAL(IPC_GET_IMETHOD(*call), NET_ETH_FIRST, NET_ETH_LAST) 207 207 208 208 /** Returns a value indicating whether the IPC call is an ICMP message. … … 210 210 */ 211 211 #define IS_NET_ICMP_MESSAGE(call) \ 212 IS_IN_INTERVAL(IPC_GET_ METHOD(*call), NET_ICMP_FIRST, NET_ICMP_LAST)212 IS_IN_INTERVAL(IPC_GET_IMETHOD(*call), NET_ICMP_FIRST, NET_ICMP_LAST) 213 213 214 214 /** Returns a value indicating whether the IPC call is an inter-network layer … … 217 217 */ 218 218 #define IS_NET_IL_MESSAGE(call) \ 219 IS_IN_INTERVAL(IPC_GET_ METHOD(*call), NET_IL_FIRST, NET_IL_LAST)219 IS_IN_INTERVAL(IPC_GET_IMETHOD(*call), NET_IL_FIRST, NET_IL_LAST) 220 220 221 221 /** Returns a value indicating whether the IPC call is an IP message. … … 223 223 */ 224 224 #define IS_NET_IP_MESSAGE(call) \ 225 IS_IN_INTERVAL(IPC_GET_ METHOD(*call), NET_IP_FIRST, NET_IP_LAST)225 IS_IN_INTERVAL(IPC_GET_IMETHOD(*call), NET_IP_FIRST, NET_IP_LAST) 226 226 227 227 /** Returns a value indicating whether the IPC call is a generic networking … … 230 230 */ 231 231 #define IS_NET_NET_MESSAGE(call) \ 232 IS_IN_INTERVAL(IPC_GET_ METHOD(*call), NET_NET_FIRST, NET_NET_LAST)232 IS_IN_INTERVAL(IPC_GET_IMETHOD(*call), NET_NET_FIRST, NET_NET_LAST) 233 233 234 234 /** Returns a value indicating whether the IPC call is a network interface layer … … 237 237 */ 238 238 #define IS_NET_NIL_MESSAGE(call) \ 239 IS_IN_INTERVAL(IPC_GET_ METHOD(*call), NET_NIL_FIRST, NET_NIL_LAST)239 IS_IN_INTERVAL(IPC_GET_IMETHOD(*call), NET_NIL_FIRST, NET_NIL_LAST) 240 240 241 241 /** Returns a value indicating whether the IPC call is a packet manaagement … … 244 244 */ 245 245 #define IS_NET_PACKET_MESSAGE(call) \ 246 IS_IN_INTERVAL(IPC_GET_ METHOD(*call), NET_PACKET_FIRST, NET_PACKET_LAST)246 IS_IN_INTERVAL(IPC_GET_IMETHOD(*call), NET_PACKET_FIRST, NET_PACKET_LAST) 247 247 248 248 /** Returns a value indicating whether the IPC call is a socket message. … … 250 250 */ 251 251 #define IS_NET_SOCKET_MESSAGE(call) \ 252 IS_IN_INTERVAL(IPC_GET_ METHOD(*call), NET_SOCKET_FIRST, NET_SOCKET_LAST)252 IS_IN_INTERVAL(IPC_GET_IMETHOD(*call), NET_SOCKET_FIRST, NET_SOCKET_LAST) 253 253 254 254 /** Returns a value indicating whether the IPC call is a TCP message. … … 256 256 */ 257 257 #define IS_NET_TCP_MESSAGE(call) \ 258 IS_IN_INTERVAL(IPC_GET_ METHOD(*call), NET_TCP_FIRST, NET_TCP_LAST)258 IS_IN_INTERVAL(IPC_GET_IMETHOD(*call), NET_TCP_FIRST, NET_TCP_LAST) 259 259 260 260 /** Returns a value indicating whether the IPC call is a transport layer message. … … 262 262 */ 263 263 #define IS_NET_TL_MESSAGE(call) \ 264 IS_IN_INTERVAL(IPC_GET_ METHOD(*call), NET_TL_FIRST, NET_TL_LAST)264 IS_IN_INTERVAL(IPC_GET_IMETHOD(*call), NET_TL_FIRST, NET_TL_LAST) 265 265 266 266 /** Returns a value indicating whether the IPC call is a UDP message. … … 268 268 */ 269 269 #define IS_NET_UDP_MESSAGE(call) \ 270 IS_IN_INTERVAL(IPC_GET_ METHOD(*call), NET_UDP_FIRST, NET_UDP_LAST)270 IS_IN_INTERVAL(IPC_GET_IMETHOD(*call), NET_UDP_FIRST, NET_UDP_LAST) 271 271 272 272 /*@}*/
Note:
See TracChangeset
for help on using the changeset viewer.