Changes in kernel/generic/src/ipc/sysipc.c [c9fff17:20c7c40] in mainline
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
kernel/generic/src/ipc/sysipc.c
rc9fff17 r20c7c40 58 58 #define DATA_XFER_LIMIT (64 * 1024) 59 59 60 /** Get phone from the current task by ID. 61 * 62 * @param phoneid Phone ID. 63 * @param phone Place to store pointer to phone. 64 * @return EOK on success, EINVAL if ID is invalid. 65 */ 66 static int phone_get(unative_t phoneid, phone_t **phone) 67 { 68 if (phoneid >= IPC_MAX_PHONES) 69 return EINVAL; 70 71 *phone = &TASK->phones[phoneid]; 72 return EOK; 60 #define GET_CHECK_PHONE(phone, phoneid, err) \ 61 { \ 62 if (phoneid > IPC_MAX_PHONES) { \ 63 err \ 64 } \ 65 phone = &TASK->phones[phoneid]; \ 73 66 } 74 67 … … 381 374 case IPC_M_CONNECTION_CLONE: { 382 375 phone_t *cloned_phone; 383 384 if (phone_get(IPC_GET_ARG1(call->data), &cloned_phone) != EOK) 385 return ENOENT; 376 GET_CHECK_PHONE(cloned_phone, IPC_GET_ARG1(call->data), 377 return ENOENT;); 386 378 phones_lock(cloned_phone, phone); 387 388 379 if ((cloned_phone->state != IPC_PHONE_CONNECTED) || 389 380 phone->state != IPC_PHONE_CONNECTED) { … … 543 534 int res; 544 535 int rc; 545 546 if (phone_get(phoneid, &phone) != EOK) 547 return ENOENT; 536 537 GET_CHECK_PHONE(phone, phoneid, return ENOENT;); 548 538 549 539 call = ipc_call_alloc(0); … … 601 591 int rc; 602 592 603 if (phone_get(phoneid, &phone) != EOK) 604 return ENOENT; 593 GET_CHECK_PHONE(phone, phoneid, return ENOENT;); 605 594 606 595 call = ipc_call_alloc(0); … … 677 666 return IPC_CALLRET_TEMPORARY; 678 667 679 if (phone_get(phoneid, &phone) != EOK) 680 return IPC_CALLRET_FATAL; 668 GET_CHECK_PHONE(phone, phoneid, return IPC_CALLRET_FATAL;); 681 669 682 670 call = ipc_call_alloc(0); … … 717 705 return IPC_CALLRET_TEMPORARY; 718 706 719 if (phone_get(phoneid, &phone) != EOK) 720 return IPC_CALLRET_FATAL; 707 GET_CHECK_PHONE(phone, phoneid, return IPC_CALLRET_FATAL;); 721 708 722 709 call = ipc_call_alloc(0); … … 768 755 call->flags |= IPC_CALL_FORWARDED; 769 756 770 if (phone_get(phoneid, &phone) != EOK){757 GET_CHECK_PHONE(phone, phoneid, { 771 758 IPC_SET_RETVAL(call->data, EFORWARD); 772 759 ipc_answer(&TASK->answerbox, call); 773 760 return ENOENT; 774 } 761 }); 775 762 776 763 if (!method_is_forwardable(IPC_GET_METHOD(call->data))) { … … 969 956 * @return Return 0 on success or an error code. 970 957 */ 971 unative_t sys_ipc_hangup( unative_t phoneid)958 unative_t sys_ipc_hangup(int phoneid) 972 959 { 973 960 phone_t *phone; 974 961 975 if (phone_get(phoneid, &phone) != EOK) 976 return ENOENT; 962 GET_CHECK_PHONE(phone, phoneid, return ENOENT;); 977 963 978 964 if (ipc_phone_hangup(phone))
Note:
See TracChangeset
for help on using the changeset viewer.