Changeset 77f0a1d in mainline
- Timestamp:
- 2018-03-22T22:54:52Z (7 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- eed4139
- Parents:
- a46e56b
- Location:
- uspace
- Files:
-
- 6 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/lib/fs/libfs.c
ra46e56b r77f0a1d 58 58 ((rc1) == EOK ? (rc2) : (rc1)) 59 59 60 #define answer_and_return( rid, rc) \60 #define answer_and_return(chandle, rc) \ 61 61 do { \ 62 async_answer_0(( rid), (rc)); \62 async_answer_0((chandle), (rc)); \ 63 63 return; \ 64 64 } while (0) … … 75 75 static void libfs_lookup(libfs_ops_t *, fs_handle_t, cap_call_handle_t, 76 76 ipc_call_t *); 77 static void libfs_stat(libfs_ops_t *, fs_handle_t, cap_call_handle_t, ipc_call_t *); 77 static void libfs_stat(libfs_ops_t *, fs_handle_t, cap_call_handle_t, 78 ipc_call_t *); 78 79 static void libfs_open_node(libfs_ops_t *, fs_handle_t, cap_call_handle_t, 79 80 ipc_call_t *); … … 81 82 ipc_call_t *); 82 83 83 static void vfs_out_fsprobe(cap_call_handle_t r id, ipc_call_t *req)84 static void vfs_out_fsprobe(cap_call_handle_t req_handle, ipc_call_t *req) 84 85 { 85 86 service_id_t service_id = (service_id_t) IPC_GET_ARG1(*req); … … 92 93 (size != sizeof(info))) { 93 94 async_answer_0(chandle, EIO); 94 async_answer_0(r id, EIO);95 async_answer_0(req_handle, EIO); 95 96 return; 96 97 } … … 100 101 if (rc != EOK) { 101 102 async_answer_0(chandle, EIO); 102 async_answer_0(r id, rc);103 async_answer_0(req_handle, rc); 103 104 return; 104 105 } 105 106 106 107 async_data_read_finalize(chandle, &info, sizeof(info)); 107 async_answer_0(r id, EOK);108 } 109 110 static void vfs_out_mounted(cap_call_handle_t r id, ipc_call_t *req)108 async_answer_0(req_handle, EOK); 109 } 110 111 static void vfs_out_mounted(cap_call_handle_t req_handle, ipc_call_t *req) 111 112 { 112 113 service_id_t service_id = (service_id_t) IPC_GET_ARG1(*req); … … 117 118 rc = async_data_write_accept((void **) &opts, true, 0, 0, 0, NULL); 118 119 if (rc != EOK) { 119 async_answer_0(r id, rc);120 async_answer_0(req_handle, rc); 120 121 return; 121 122 } … … 125 126 rc = vfs_out_ops->mounted(service_id, opts, &index, &size); 126 127 127 if (rc == EOK) 128 async_answer_3(rid, EOK, index, LOWER32(size), UPPER32(size)); 129 else 130 async_answer_0(rid, rc); 128 if (rc == EOK) { 129 async_answer_3(req_handle, EOK, index, LOWER32(size), 130 UPPER32(size)); 131 } else 132 async_answer_0(req_handle, rc); 131 133 132 134 free(opts); 133 135 } 134 136 135 static void vfs_out_unmounted(cap_call_handle_t r id, ipc_call_t *req)137 static void vfs_out_unmounted(cap_call_handle_t req_handle, ipc_call_t *req) 136 138 { 137 139 service_id_t service_id = (service_id_t) IPC_GET_ARG1(*req); … … 140 142 rc = vfs_out_ops->unmounted(service_id); 141 143 142 async_answer_0(r id, rc);143 } 144 145 static void vfs_out_link(cap_call_handle_t r id, ipc_call_t *req)146 { 147 libfs_link(libfs_ops, reg.fs_handle, r id, req);148 } 149 150 static void vfs_out_lookup(cap_call_handle_t r id, ipc_call_t *req)151 { 152 libfs_lookup(libfs_ops, reg.fs_handle, r id, req);153 } 154 155 static void vfs_out_read(cap_call_handle_t r id, ipc_call_t *req)144 async_answer_0(req_handle, rc); 145 } 146 147 static void vfs_out_link(cap_call_handle_t req_handle, ipc_call_t *req) 148 { 149 libfs_link(libfs_ops, reg.fs_handle, req_handle, req); 150 } 151 152 static void vfs_out_lookup(cap_call_handle_t req_handle, ipc_call_t *req) 153 { 154 libfs_lookup(libfs_ops, reg.fs_handle, req_handle, req); 155 } 156 157 static void vfs_out_read(cap_call_handle_t req_handle, ipc_call_t *req) 156 158 { 157 159 service_id_t service_id = (service_id_t) IPC_GET_ARG1(*req); … … 165 167 166 168 if (rc == EOK) 167 async_answer_1(r id, EOK, rbytes);169 async_answer_1(req_handle, EOK, rbytes); 168 170 else 169 async_answer_0(r id, rc);170 } 171 172 static void vfs_out_write(cap_call_handle_t r id, ipc_call_t *req)171 async_answer_0(req_handle, rc); 172 } 173 174 static void vfs_out_write(cap_call_handle_t req_handle, ipc_call_t *req) 173 175 { 174 176 service_id_t service_id = (service_id_t) IPC_GET_ARG1(*req); … … 183 185 184 186 if (rc == EOK) { 185 async_answer_3(r id, EOK, wbytes, LOWER32(nsize),187 async_answer_3(req_handle, EOK, wbytes, LOWER32(nsize), 186 188 UPPER32(nsize)); 187 189 } else 188 async_answer_0(r id, rc);189 } 190 191 static void vfs_out_truncate(cap_call_handle_t r id, ipc_call_t *req)190 async_answer_0(req_handle, rc); 191 } 192 193 static void vfs_out_truncate(cap_call_handle_t req_handle, ipc_call_t *req) 192 194 { 193 195 service_id_t service_id = (service_id_t) IPC_GET_ARG1(*req); … … 199 201 rc = vfs_out_ops->truncate(service_id, index, size); 200 202 201 async_answer_0(r id, rc);202 } 203 204 static void vfs_out_close(cap_call_handle_t r id, ipc_call_t *req)203 async_answer_0(req_handle, rc); 204 } 205 206 static void vfs_out_close(cap_call_handle_t req_handle, ipc_call_t *req) 205 207 { 206 208 service_id_t service_id = (service_id_t) IPC_GET_ARG1(*req); … … 210 212 rc = vfs_out_ops->close(service_id, index); 211 213 212 async_answer_0(r id, rc);213 } 214 215 static void vfs_out_destroy(cap_call_handle_t r id, ipc_call_t *req)214 async_answer_0(req_handle, rc); 215 } 216 217 static void vfs_out_destroy(cap_call_handle_t req_handle, ipc_call_t *req) 216 218 { 217 219 service_id_t service_id = (service_id_t) IPC_GET_ARG1(*req); … … 227 229 rc = vfs_out_ops->destroy(service_id, index); 228 230 } 229 async_answer_0(r id, rc);230 } 231 232 static void vfs_out_open_node(cap_call_handle_t r id, ipc_call_t *req)233 { 234 libfs_open_node(libfs_ops, reg.fs_handle, r id, req);235 } 236 237 static void vfs_out_stat(cap_call_handle_t r id, ipc_call_t *req)238 { 239 libfs_stat(libfs_ops, reg.fs_handle, r id, req);240 } 241 242 static void vfs_out_sync(cap_call_handle_t r id, ipc_call_t *req)231 async_answer_0(req_handle, rc); 232 } 233 234 static void vfs_out_open_node(cap_call_handle_t req_handle, ipc_call_t *req) 235 { 236 libfs_open_node(libfs_ops, reg.fs_handle, req_handle, req); 237 } 238 239 static void vfs_out_stat(cap_call_handle_t req_handle, ipc_call_t *req) 240 { 241 libfs_stat(libfs_ops, reg.fs_handle, req_handle, req); 242 } 243 244 static void vfs_out_sync(cap_call_handle_t req_handle, ipc_call_t *req) 243 245 { 244 246 service_id_t service_id = (service_id_t) IPC_GET_ARG1(*req); … … 248 250 rc = vfs_out_ops->sync(service_id, index); 249 251 250 async_answer_0(r id, rc);251 } 252 253 static void vfs_out_statfs(cap_call_handle_t r id, ipc_call_t *req)254 { 255 libfs_statfs(libfs_ops, reg.fs_handle, r id, req);256 } 257 258 static void vfs_out_is_empty(cap_call_handle_t r id, ipc_call_t *req)252 async_answer_0(req_handle, rc); 253 } 254 255 static void vfs_out_statfs(cap_call_handle_t req_handle, ipc_call_t *req) 256 { 257 libfs_statfs(libfs_ops, reg.fs_handle, req_handle, req); 258 } 259 260 static void vfs_out_is_empty(cap_call_handle_t req_handle, ipc_call_t *req) 259 261 { 260 262 service_id_t service_id = (service_id_t) IPC_GET_ARG1(*req); … … 265 267 rc = libfs_ops->node_get(&node, service_id, index); 266 268 if (rc != EOK) 267 async_answer_0(r id, rc);269 async_answer_0(req_handle, rc); 268 270 if (node == NULL) 269 async_answer_0(r id, EINVAL);271 async_answer_0(req_handle, EINVAL); 270 272 271 273 bool children = false; … … 274 276 275 277 if (rc != EOK) 276 async_answer_0(rid, rc); 277 async_answer_0(rid, children ? ENOTEMPTY : EOK); 278 } 279 280 static void vfs_connection(cap_call_handle_t icall_handle, ipc_call_t *icall, void *arg) 278 async_answer_0(req_handle, rc); 279 async_answer_0(req_handle, children ? ENOTEMPTY : EOK); 280 } 281 282 static void vfs_connection(cap_call_handle_t icall_handle, ipc_call_t *icall, 283 void *arg) 281 284 { 282 285 if (icall_handle) { … … 492 495 /** Link a file at a path. 493 496 */ 494 void libfs_link(libfs_ops_t *ops, fs_handle_t fs_handle, cap_call_handle_t rid,495 ipc_call_t *req)497 void libfs_link(libfs_ops_t *ops, fs_handle_t fs_handle, 498 cap_call_handle_t req_handle, ipc_call_t *req) 496 499 { 497 500 service_id_t parent_sid = IPC_GET_ARG1(*req); … … 502 505 errno_t rc = receive_fname(component); 503 506 if (rc != EOK) { 504 async_answer_0(r id, rc);507 async_answer_0(req_handle, rc); 505 508 return; 506 509 } … … 509 512 rc = ops->node_get(&parent, parent_sid, parent_index); 510 513 if (parent == NULL) { 511 async_answer_0(r id, rc == EOK ? EBADF : rc);514 async_answer_0(req_handle, rc == EOK ? EBADF : rc); 512 515 return; 513 516 } … … 516 519 rc = ops->node_get(&child, parent_sid, child_index); 517 520 if (child == NULL) { 518 async_answer_0(r id, rc == EOK ? EBADF : rc);521 async_answer_0(req_handle, rc == EOK ? EBADF : rc); 519 522 ops->node_put(parent); 520 523 return; … … 524 527 ops->node_put(parent); 525 528 ops->node_put(child); 526 async_answer_0(r id, rc);529 async_answer_0(req_handle, rc); 527 530 } 528 531 … … 532 535 * as returned by the canonify() function. 533 536 * 534 * @param ops libfs operations structure with function pointers to535 * file system implementation536 * @param fs_handle File system handle of the file system where to perform537 * the lookup.538 * @param r id Request IDof the VFS_OUT_LOOKUP request.539 * @param request VFS_OUT_LOOKUP request data itself.537 * @param ops libfs operations structure with function pointers to 538 * file system implementation 539 * @param fs_handle File system handle of the file system where to perform 540 * the lookup. 541 * @param req_handle Call handle of the VFS_OUT_LOOKUP request. 542 * @param request VFS_OUT_LOOKUP request data itself. 540 543 * 541 544 */ 542 void libfs_lookup(libfs_ops_t *ops, fs_handle_t fs_handle, cap_call_handle_t rid,543 ipc_call_t *req)545 void libfs_lookup(libfs_ops_t *ops, fs_handle_t fs_handle, 546 cap_call_handle_t req_handle, ipc_call_t *req) 544 547 { 545 548 unsigned first = IPC_GET_ARG1(*req); … … 564 567 rc = ops->node_get(&cur, service_id, index); 565 568 if (rc != EOK) { 566 async_answer_0(r id, rc);569 async_answer_0(req_handle, rc); 567 570 goto out; 568 571 } … … 581 584 582 585 if (!ops->is_directory(cur)) { 583 async_answer_0(r id, ENOTDIR);586 async_answer_0(req_handle, ENOTDIR); 584 587 goto out; 585 588 } … … 590 593 assert(rc != ERANGE); 591 594 if (rc != EOK) { 592 async_answer_0(r id, rc);595 async_answer_0(req_handle, rc); 593 596 goto out; 594 597 } … … 604 607 rc = ops->match(&tmp, cur, component); 605 608 if (rc != EOK) { 606 async_answer_0(r id, rc);609 async_answer_0(req_handle, rc); 607 610 goto out; 608 611 } … … 612 615 rc = ops->node_put(par); 613 616 if (rc != EOK) { 614 async_answer_0(r id, rc);617 async_answer_0(req_handle, rc); 615 618 goto out; 616 619 } … … 632 635 633 636 if (cur && (lflag & L_FILE) && (ops->is_directory(cur))) { 634 async_answer_0(r id, EISDIR);637 async_answer_0(req_handle, EISDIR); 635 638 goto out; 636 639 } 637 640 638 641 if (cur && (lflag & L_DIRECTORY) && (ops->is_file(cur))) { 639 async_answer_0(r id, ENOTDIR);642 async_answer_0(req_handle, ENOTDIR); 640 643 goto out; 641 644 } … … 645 648 if (lflag & L_UNLINK) { 646 649 if (!cur) { 647 async_answer_0(r id, ENOENT);650 async_answer_0(req_handle, ENOENT); 648 651 goto out; 649 652 } 650 653 if (!par) { 651 async_answer_0(r id, EINVAL);654 async_answer_0(req_handle, EINVAL); 652 655 goto out; 653 656 } … … 656 659 if (rc == EOK) { 657 660 aoff64_t size = ops->size_get(cur); 658 async_answer_5(r id, EOK, fs_handle,661 async_answer_5(req_handle, EOK, fs_handle, 659 662 ops->index_get(cur), 660 663 (ops->is_directory(cur) << 16) | last, 661 664 LOWER32(size), UPPER32(size)); 662 665 } else { 663 async_answer_0(r id, rc);666 async_answer_0(req_handle, rc); 664 667 } 665 668 goto out; … … 670 673 if (lflag & L_CREATE) { 671 674 if (cur && (lflag & L_EXCLUSIVE)) { 672 async_answer_0(r id, EEXIST);675 async_answer_0(req_handle, EEXIST); 673 676 goto out; 674 677 } … … 678 681 lflag & (L_FILE | L_DIRECTORY)); 679 682 if (rc != EOK) { 680 async_answer_0(r id, rc);683 async_answer_0(req_handle, rc); 681 684 goto out; 682 685 } 683 686 if (!cur) { 684 async_answer_0(r id, ENOSPC);687 async_answer_0(req_handle, ENOSPC); 685 688 goto out; 686 689 } … … 690 693 (void) ops->destroy(cur); 691 694 cur = NULL; 692 async_answer_0(r id, rc);695 async_answer_0(req_handle, rc); 693 696 goto out; 694 697 } … … 699 702 out1: 700 703 if (!cur) { 701 async_answer_5(r id, EOK, fs_handle, ops->index_get(par),704 async_answer_5(req_handle, EOK, fs_handle, ops->index_get(par), 702 705 (ops->is_directory(par) << 16) | last_next, 703 706 LOWER32(ops->size_get(par)), UPPER32(ops->size_get(par))); … … 705 708 } 706 709 707 async_answer_5(r id, EOK, fs_handle, ops->index_get(cur),710 async_answer_5(req_handle, EOK, fs_handle, ops->index_get(cur), 708 711 (ops->is_directory(cur) << 16) | last, LOWER32(ops->size_get(cur)), 709 712 UPPER32(ops->size_get(cur))); … … 720 723 } 721 724 722 void libfs_stat(libfs_ops_t *ops, fs_handle_t fs_handle, cap_call_handle_t rid,723 ipc_call_t *request)725 void libfs_stat(libfs_ops_t *ops, fs_handle_t fs_handle, 726 cap_call_handle_t req_handle, ipc_call_t *request) 724 727 { 725 728 service_id_t service_id = (service_id_t) IPC_GET_ARG1(*request); … … 728 731 fs_node_t *fn; 729 732 errno_t rc = ops->node_get(&fn, service_id, index); 730 on_error(rc, answer_and_return(r id, rc));733 on_error(rc, answer_and_return(req_handle, rc)); 731 734 732 735 cap_call_handle_t chandle; … … 736 739 ops->node_put(fn); 737 740 async_answer_0(chandle, EINVAL); 738 async_answer_0(r id, EINVAL);741 async_answer_0(req_handle, EINVAL); 739 742 return; 740 743 } … … 756 759 757 760 async_data_read_finalize(chandle, &stat, sizeof(vfs_stat_t)); 758 async_answer_0(r id, EOK);759 } 760 761 void libfs_statfs(libfs_ops_t *ops, fs_handle_t fs_handle, cap_call_handle_t rid,762 ipc_call_t *request)761 async_answer_0(req_handle, EOK); 762 } 763 764 void libfs_statfs(libfs_ops_t *ops, fs_handle_t fs_handle, 765 cap_call_handle_t req_handle, ipc_call_t *request) 763 766 { 764 767 service_id_t service_id = (service_id_t) IPC_GET_ARG1(*request); … … 767 770 fs_node_t *fn; 768 771 errno_t rc = ops->node_get(&fn, service_id, index); 769 on_error(rc, answer_and_return(r id, rc));772 on_error(rc, answer_and_return(req_handle, rc)); 770 773 771 774 cap_call_handle_t chandle; … … 801 804 ops->node_put(fn); 802 805 async_data_read_finalize(chandle, &st, sizeof(vfs_statfs_t)); 803 async_answer_0(r id, EOK);806 async_answer_0(req_handle, EOK); 804 807 return; 805 808 … … 807 810 ops->node_put(fn); 808 811 async_answer_0(chandle, EINVAL); 809 async_answer_0(r id, EINVAL);812 async_answer_0(req_handle, EINVAL); 810 813 } 811 814 … … 813 816 /** Open VFS triplet. 814 817 * 815 * @param ops libfs operations structure with function pointers to816 * file system implementation817 * @param r id Request IDof the VFS_OUT_OPEN_NODE request.818 * @param request VFS_OUT_OPEN_NODE request data itself.818 * @param ops libfs operations structure with function pointers to 819 * file system implementation 820 * @param req_handle Call handle of the VFS_OUT_OPEN_NODE request. 821 * @param request VFS_OUT_OPEN_NODE request data itself. 819 822 * 820 823 */ 821 void libfs_open_node(libfs_ops_t *ops, fs_handle_t fs_handle, cap_call_handle_t rid,822 ipc_call_t *request)824 void libfs_open_node(libfs_ops_t *ops, fs_handle_t fs_handle, 825 cap_call_handle_t req_handle, ipc_call_t *request) 823 826 { 824 827 service_id_t service_id = IPC_GET_ARG1(*request); … … 827 830 fs_node_t *fn; 828 831 errno_t rc = ops->node_get(&fn, service_id, index); 829 on_error(rc, answer_and_return(r id, rc));832 on_error(rc, answer_and_return(req_handle, rc)); 830 833 831 834 if (fn == NULL) { 832 async_answer_0(r id, ENOENT);835 async_answer_0(req_handle, ENOENT); 833 836 return; 834 837 } … … 836 839 rc = ops->node_open(fn); 837 840 aoff64_t size = ops->size_get(fn); 838 async_answer_4(r id, rc, LOWER32(size), UPPER32(size),841 async_answer_4(req_handle, rc, LOWER32(size), UPPER32(size), 839 842 ops->lnkcnt_get(fn), 840 843 (ops->is_file(fn) ? L_FILE : 0) | -
uspace/srv/clipboard/clipboard.c
ra46e56b r77f0a1d 47 47 static service_id_t svc_id; 48 48 49 static void clip_put_data(cap_call_handle_t r id, ipc_call_t *request)49 static void clip_put_data(cap_call_handle_t req_handle, ipc_call_t *request) 50 50 { 51 51 char *data; … … 65 65 66 66 fibril_mutex_unlock(&clip_mtx); 67 async_answer_0(r id, EOK);67 async_answer_0(req_handle, EOK); 68 68 break; 69 69 case CLIPBOARD_TAG_DATA: 70 70 rc = async_data_write_accept((void **) &data, false, 0, 0, 0, &size); 71 71 if (rc != EOK) { 72 async_answer_0(r id, rc);72 async_answer_0(req_handle, rc); 73 73 break; 74 74 } … … 84 84 85 85 fibril_mutex_unlock(&clip_mtx); 86 async_answer_0(r id, EOK);86 async_answer_0(req_handle, EOK); 87 87 break; 88 88 default: 89 async_answer_0(r id, EINVAL);90 } 91 } 92 93 static void clip_get_data(cap_call_handle_t r id, ipc_call_t *request)89 async_answer_0(req_handle, EINVAL); 90 } 91 } 92 93 static void clip_get_data(cap_call_handle_t req_handle, ipc_call_t *request) 94 94 { 95 95 fibril_mutex_lock(&clip_mtx); … … 103 103 if (!async_data_read_receive(&chandle, &size)) { 104 104 async_answer_0(chandle, EINVAL); 105 async_answer_0(r id, EINVAL);105 async_answer_0(req_handle, EINVAL); 106 106 break; 107 107 } … … 110 110 /* So far we only understand binary data */ 111 111 async_answer_0(chandle, EOVERFLOW); 112 async_answer_0(r id, EOVERFLOW);112 async_answer_0(req_handle, EOVERFLOW); 113 113 break; 114 114 } … … 117 117 /* The client expects different size of data */ 118 118 async_answer_0(chandle, EOVERFLOW); 119 async_answer_0(r id, EOVERFLOW);119 async_answer_0(req_handle, EOVERFLOW); 120 120 break; 121 121 } … … 123 123 errno_t retval = async_data_read_finalize(chandle, clip_data, size); 124 124 if (retval != EOK) { 125 async_answer_0(r id, retval);126 break; 127 } 128 129 async_answer_0(r id, EOK);125 async_answer_0(req_handle, retval); 126 break; 127 } 128 129 async_answer_0(req_handle, EOK); 130 130 break; 131 131 default: … … 134 134 * data from the clipbard 135 135 */ 136 async_answer_0(r id, EINVAL);136 async_answer_0(req_handle, EINVAL); 137 137 break; 138 138 } … … 141 141 } 142 142 143 static void clip_content(cap_call_handle_t r id, ipc_call_t *request)143 static void clip_content(cap_call_handle_t req_handle, ipc_call_t *request) 144 144 { 145 145 fibril_mutex_lock(&clip_mtx); … … 149 149 150 150 fibril_mutex_unlock(&clip_mtx); 151 async_answer_2(rid, EOK, (sysarg_t) size, (sysarg_t) tag); 152 } 153 154 static void clip_connection(cap_call_handle_t icall_handle, ipc_call_t *icall, void *arg) 151 async_answer_2(req_handle, EOK, (sysarg_t) size, (sysarg_t) tag); 152 } 153 154 static void clip_connection(cap_call_handle_t icall_handle, ipc_call_t *icall, 155 void *arg) 155 156 { 156 157 /* Accept connection */ -
uspace/srv/loader/main.c
ra46e56b r77f0a1d 90 90 static bool connected = false; 91 91 92 static void ldr_get_taskid(cap_call_handle_t r id, ipc_call_t *request)92 static void ldr_get_taskid(cap_call_handle_t req_handle, ipc_call_t *request) 93 93 { 94 94 cap_call_handle_t chandle; … … 100 100 if (!async_data_read_receive(&chandle, &len)) { 101 101 async_answer_0(chandle, EINVAL); 102 async_answer_0(r id, EINVAL);102 async_answer_0(req_handle, EINVAL); 103 103 return; 104 104 } … … 108 108 109 109 async_data_read_finalize(chandle, &task_id, len); 110 async_answer_0(r id, EOK);110 async_answer_0(req_handle, EOK); 111 111 } 112 112 113 113 /** Receive a call setting the current working directory. 114 114 * 115 * @param r id116 * @param request 117 */ 118 static void ldr_set_cwd(cap_call_handle_t r id, ipc_call_t *request)115 * @param req_handle 116 * @param request 117 */ 118 static void ldr_set_cwd(cap_call_handle_t req_handle, ipc_call_t *request) 119 119 { 120 120 char *buf; … … 128 128 } 129 129 130 async_answer_0(r id, rc);130 async_answer_0(req_handle, rc); 131 131 } 132 132 133 133 /** Receive a call setting the program to execute. 134 134 * 135 * @param r id136 * @param request 137 */ 138 static void ldr_set_program(cap_call_handle_t r id, ipc_call_t *request)135 * @param req_handle 136 * @param request 137 */ 138 static void ldr_set_program(cap_call_handle_t req_handle, ipc_call_t *request) 139 139 { 140 140 cap_call_handle_t write_chandle; 141 141 size_t namesize; 142 142 if (!async_data_write_receive(&write_chandle, &namesize)) { 143 async_answer_0(r id, EINVAL);143 async_answer_0(req_handle, EINVAL); 144 144 return; 145 145 } … … 148 148 errno_t rc = async_data_write_finalize(write_chandle, name, namesize); 149 149 if (rc != EOK) { 150 async_answer_0(r id, EINVAL);150 async_answer_0(req_handle, EINVAL); 151 151 return; 152 152 } … … 155 155 rc = vfs_receive_handle(true, &file); 156 156 if (rc != EOK) { 157 async_answer_0(r id, EINVAL);157 async_answer_0(req_handle, EINVAL); 158 158 return; 159 159 } … … 161 161 progname = name; 162 162 program_fd = file; 163 async_answer_0(r id, EOK);163 async_answer_0(req_handle, EOK); 164 164 } 165 165 166 166 /** Receive a call setting arguments of the program to execute. 167 167 * 168 * @param r id169 * @param request 170 */ 171 static void ldr_set_args(cap_call_handle_t r id, ipc_call_t *request)168 * @param req_handle 169 * @param request 170 */ 171 static void ldr_set_args(cap_call_handle_t req_handle, ipc_call_t *request) 172 172 { 173 173 char *buf; … … 194 194 if (_argv == NULL) { 195 195 free(buf); 196 async_answer_0(r id, ENOMEM);196 async_answer_0(req_handle, ENOMEM); 197 197 return; 198 198 } … … 226 226 } 227 227 228 async_answer_0(r id, rc);228 async_answer_0(req_handle, rc); 229 229 } 230 230 231 231 /** Receive a call setting inbox files of the program to execute. 232 232 * 233 * @param r id234 * @param request 235 */ 236 static void ldr_add_inbox(cap_call_handle_t r id, ipc_call_t *request)233 * @param req_handle 234 * @param request 235 */ 236 static void ldr_add_inbox(cap_call_handle_t req_handle, ipc_call_t *request) 237 237 { 238 238 if (inbox_entries == INBOX_MAX_ENTRIES) { 239 async_answer_0(r id, ERANGE);239 async_answer_0(req_handle, ERANGE); 240 240 return; 241 241 } … … 244 244 size_t namesize; 245 245 if (!async_data_write_receive(&write_chandle, &namesize)) { 246 async_answer_0(r id, EINVAL);246 async_answer_0(req_handle, EINVAL); 247 247 return; 248 248 } … … 251 251 errno_t rc = async_data_write_finalize(write_chandle, name, namesize); 252 252 if (rc != EOK) { 253 async_answer_0(r id, EINVAL);253 async_answer_0(req_handle, EINVAL); 254 254 return; 255 255 } … … 258 258 rc = vfs_receive_handle(true, &file); 259 259 if (rc != EOK) { 260 async_answer_0(r id, EINVAL);260 async_answer_0(req_handle, EINVAL); 261 261 return; 262 262 } … … 272 272 inbox[inbox_entries].file = file; 273 273 inbox_entries++; 274 async_answer_0(r id, EOK);274 async_answer_0(req_handle, EOK); 275 275 } 276 276 277 277 /** Load the previously selected program. 278 278 * 279 * @param r id279 * @param req_handle 280 280 * @param request 281 281 * @return 0 on success, !0 on error. 282 282 */ 283 static int ldr_load(cap_call_handle_t r id, ipc_call_t *request)283 static int ldr_load(cap_call_handle_t req_handle, ipc_call_t *request) 284 284 { 285 285 int rc = elf_load(program_fd, &prog_info); 286 286 if (rc != EE_OK) { 287 287 DPRINTF("Failed to load executable for '%s'.\n", progname); 288 async_answer_0(r id, EINVAL);288 async_answer_0(req_handle, EINVAL); 289 289 return 1; 290 290 } … … 300 300 pcb.inbox_entries = inbox_entries; 301 301 302 async_answer_0(r id, EOK);302 async_answer_0(req_handle, EOK); 303 303 return 0; 304 304 } … … 306 306 /** Run the previously loaded program. 307 307 * 308 * @param r id308 * @param req_handle 309 309 * @param request 310 310 * @return 0 on success, !0 on error. 311 311 */ 312 static __attribute__((noreturn)) void ldr_run(cap_call_handle_t r id,312 static __attribute__((noreturn)) void ldr_run(cap_call_handle_t req_handle, 313 313 ipc_call_t *request) 314 314 { … … 320 320 /* Run program */ 321 321 DPRINTF("Reply OK\n"); 322 async_answer_0(r id, EOK);322 async_answer_0(req_handle, EOK); 323 323 DPRINTF("Jump to entry point at %p\n", pcb.entry); 324 324 entry_point_jmp(prog_info.finfo.entry, &pcb); … … 332 332 * to execute the loaded program). 333 333 */ 334 static void ldr_connection(cap_call_handle_t icall_handle, ipc_call_t *icall, void *arg) 334 static void ldr_connection(cap_call_handle_t icall_handle, ipc_call_t *icall, 335 void *arg) 335 336 { 336 337 /* Already have a connection? */ -
uspace/srv/vfs/vfs_ipc.c
ra46e56b r77f0a1d 35 35 #include <vfs/canonify.h> 36 36 37 static void vfs_in_clone(cap_call_handle_t r id, ipc_call_t *request)37 static void vfs_in_clone(cap_call_handle_t req_handle, ipc_call_t *request) 38 38 { 39 39 int oldfd = IPC_GET_ARG1(*request); … … 43 43 int outfd = -1; 44 44 errno_t rc = vfs_op_clone(oldfd, newfd, desc, &outfd); 45 async_answer_1(r id, rc, outfd);46 } 47 48 static void vfs_in_fsprobe(cap_call_handle_t r id, ipc_call_t *request)45 async_answer_1(req_handle, rc, outfd); 46 } 47 48 static void vfs_in_fsprobe(cap_call_handle_t req_handle, ipc_call_t *request) 49 49 { 50 50 service_id_t service_id = (service_id_t) IPC_GET_ARG1(*request); … … 62 62 FS_NAME_MAXLEN, 0, NULL); 63 63 if (rc != EOK) { 64 async_answer_0(r id, rc);64 async_answer_0(req_handle, rc); 65 65 return; 66 66 } 67 67 68 68 rc = vfs_op_fsprobe(fs_name, service_id, &info); 69 async_answer_0(r id, rc);69 async_answer_0(req_handle, rc); 70 70 if (rc != EOK) 71 71 goto out; … … 83 83 } 84 84 85 static void vfs_in_fstypes(cap_call_handle_t r id, ipc_call_t *request)85 static void vfs_in_fstypes(cap_call_handle_t req_handle, ipc_call_t *request) 86 86 { 87 87 cap_call_handle_t chandle; … … 92 92 rc = vfs_get_fstypes(&fstypes); 93 93 if (rc != EOK) { 94 async_answer_0(r id, ENOMEM);94 async_answer_0(req_handle, ENOMEM); 95 95 return; 96 96 } 97 97 98 98 /* Send size of the data */ 99 async_answer_1(r id, EOK, fstypes.size);99 async_answer_1(req_handle, EOK, fstypes.size); 100 100 101 101 /* Now we should get a read request */ … … 111 111 } 112 112 113 static void vfs_in_mount(cap_call_handle_t r id, ipc_call_t *request)113 static void vfs_in_mount(cap_call_handle_t req_handle, ipc_call_t *request) 114 114 { 115 115 int mpfd = IPC_GET_ARG1(*request); … … 132 132 MAX_MNTOPTS_LEN, 0, NULL); 133 133 if (rc != EOK) { 134 async_answer_0(r id, rc);134 async_answer_0(req_handle, rc); 135 135 return; 136 136 } … … 143 143 if (rc != EOK) { 144 144 free(opts); 145 async_answer_0(r id, rc);145 async_answer_0(req_handle, rc); 146 146 return; 147 147 } … … 150 150 rc = vfs_op_mount(mpfd, service_id, flags, instance, opts, fs_name, 151 151 &outfd); 152 async_answer_1(r id, rc, outfd);152 async_answer_1(req_handle, rc, outfd); 153 153 154 154 free(opts); … … 156 156 } 157 157 158 static void vfs_in_open(cap_call_handle_t r id, ipc_call_t *request)158 static void vfs_in_open(cap_call_handle_t req_handle, ipc_call_t *request) 159 159 { 160 160 int fd = IPC_GET_ARG1(*request); … … 162 162 163 163 errno_t rc = vfs_op_open(fd, mode); 164 async_answer_0(r id, rc);165 } 166 167 static void vfs_in_put(cap_call_handle_t r id, ipc_call_t *request)164 async_answer_0(req_handle, rc); 165 } 166 167 static void vfs_in_put(cap_call_handle_t req_handle, ipc_call_t *request) 168 168 { 169 169 int fd = IPC_GET_ARG1(*request); 170 170 errno_t rc = vfs_op_put(fd); 171 async_answer_0(r id, rc);172 } 173 174 static void vfs_in_read(cap_call_handle_t r id, ipc_call_t *request)171 async_answer_0(req_handle, rc); 172 } 173 174 static void vfs_in_read(cap_call_handle_t req_handle, ipc_call_t *request) 175 175 { 176 176 int fd = IPC_GET_ARG1(*request); … … 180 180 size_t bytes = 0; 181 181 errno_t rc = vfs_op_read(fd, pos, &bytes); 182 async_answer_1(r id, rc, bytes);183 } 184 185 static void vfs_in_rename(cap_call_handle_t r id, ipc_call_t *request)182 async_answer_1(req_handle, rc, bytes); 183 } 184 185 static void vfs_in_rename(cap_call_handle_t req_handle, ipc_call_t *request) 186 186 { 187 187 /* The common base directory. */ … … 219 219 220 220 out: 221 async_answer_0(r id, rc);221 async_answer_0(req_handle, rc); 222 222 223 223 if (old) … … 227 227 } 228 228 229 static void vfs_in_resize(cap_call_handle_t r id, ipc_call_t *request)229 static void vfs_in_resize(cap_call_handle_t req_handle, ipc_call_t *request) 230 230 { 231 231 int fd = IPC_GET_ARG1(*request); 232 232 int64_t size = MERGE_LOUP32(IPC_GET_ARG2(*request), IPC_GET_ARG3(*request)); 233 233 errno_t rc = vfs_op_resize(fd, size); 234 async_answer_0(r id, rc);235 } 236 237 static void vfs_in_stat(cap_call_handle_t r id, ipc_call_t *request)234 async_answer_0(req_handle, rc); 235 } 236 237 static void vfs_in_stat(cap_call_handle_t req_handle, ipc_call_t *request) 238 238 { 239 239 int fd = IPC_GET_ARG1(*request); 240 240 errno_t rc = vfs_op_stat(fd); 241 async_answer_0(r id, rc);242 } 243 244 static void vfs_in_statfs(cap_call_handle_t r id, ipc_call_t *request)241 async_answer_0(req_handle, rc); 242 } 243 244 static void vfs_in_statfs(cap_call_handle_t req_handle, ipc_call_t *request) 245 245 { 246 246 int fd = (int) IPC_GET_ARG1(*request); 247 247 248 248 errno_t rc = vfs_op_statfs(fd); 249 async_answer_0(r id, rc);250 } 251 252 static void vfs_in_sync(cap_call_handle_t r id, ipc_call_t *request)249 async_answer_0(req_handle, rc); 250 } 251 252 static void vfs_in_sync(cap_call_handle_t req_handle, ipc_call_t *request) 253 253 { 254 254 int fd = IPC_GET_ARG1(*request); 255 255 errno_t rc = vfs_op_sync(fd); 256 async_answer_0(r id, rc);257 } 258 259 static void vfs_in_unlink(cap_call_handle_t r id, ipc_call_t *request)256 async_answer_0(req_handle, rc); 257 } 258 259 static void vfs_in_unlink(cap_call_handle_t req_handle, ipc_call_t *request) 260 260 { 261 261 int parentfd = IPC_GET_ARG1(*request); … … 267 267 rc = vfs_op_unlink(parentfd, expectfd, path); 268 268 269 async_answer_0(r id, rc);270 } 271 272 static void vfs_in_unmount(cap_call_handle_t r id, ipc_call_t *request)269 async_answer_0(req_handle, rc); 270 } 271 272 static void vfs_in_unmount(cap_call_handle_t req_handle, ipc_call_t *request) 273 273 { 274 274 int mpfd = IPC_GET_ARG1(*request); 275 275 errno_t rc = vfs_op_unmount(mpfd); 276 async_answer_0(r id, rc);277 } 278 279 static void vfs_in_wait_handle(cap_call_handle_t r id, ipc_call_t *request)276 async_answer_0(req_handle, rc); 277 } 278 279 static void vfs_in_wait_handle(cap_call_handle_t req_handle, ipc_call_t *request) 280 280 { 281 281 bool high_fd = IPC_GET_ARG1(*request); 282 282 int fd = -1; 283 283 errno_t rc = vfs_op_wait_handle(high_fd, &fd); 284 async_answer_1(r id, rc, fd);285 } 286 287 static void vfs_in_walk(cap_call_handle_t r id, ipc_call_t *request)284 async_answer_1(req_handle, rc, fd); 285 } 286 287 static void vfs_in_walk(cap_call_handle_t req_handle, ipc_call_t *request) 288 288 { 289 289 /* … … 301 301 free(path); 302 302 } 303 async_answer_1(r id, rc, fd);304 } 305 306 static void vfs_in_write(cap_call_handle_t r id, ipc_call_t *request)303 async_answer_1(req_handle, rc, fd); 304 } 305 306 static void vfs_in_write(cap_call_handle_t req_handle, ipc_call_t *request) 307 307 { 308 308 int fd = IPC_GET_ARG1(*request); … … 312 312 size_t bytes = 0; 313 313 errno_t rc = vfs_op_write(fd, pos, &bytes); 314 async_answer_1(r id, rc, bytes);314 async_answer_1(req_handle, rc, bytes); 315 315 } 316 316 -
uspace/srv/vfs/vfs_pager.c
ra46e56b r77f0a1d 42 42 #include <as.h> 43 43 44 void vfs_page_in(cap_call_handle_t r id, ipc_call_t *request)44 void vfs_page_in(cap_call_handle_t req_handle, ipc_call_t *request) 45 45 { 46 46 aoff64_t offset = IPC_GET_ARG1(*request); … … 55 55 56 56 if (page == AS_MAP_FAILED) { 57 async_answer_0(r id, ENOMEM);57 async_answer_0(req_handle, ENOMEM); 58 58 return; 59 59 } … … 78 78 } while (total < page_size); 79 79 80 async_answer_1(r id, rc, (sysarg_t) page);80 async_answer_1(req_handle, rc, (sysarg_t) page); 81 81 82 82 /* -
uspace/srv/vfs/vfs_register.c
ra46e56b r77f0a1d 108 108 /** VFS_REGISTER protocol function. 109 109 * 110 * @param r id Hash of the call withthe request.111 * @param request Call structure with the request.112 * 113 */ 114 void vfs_register(cap_call_handle_t r id, ipc_call_t *request)110 * @param req_handle Call handle of the request. 111 * @param request Call structure with the request. 112 * 113 */ 114 void vfs_register(cap_call_handle_t req_handle, ipc_call_t *request) 115 115 { 116 116 dprintf("Processing VFS_REGISTER request received from %zx.\n", … … 124 124 dprintf("Failed to deliver the VFS info into our AS, rc=%d.\n", 125 125 rc); 126 async_answer_0(r id, rc);126 async_answer_0(req_handle, rc); 127 127 return; 128 128 } … … 134 134 if (!fs_info) { 135 135 dprintf("Could not allocate memory for FS info.\n"); 136 async_answer_0(r id, ENOMEM);136 async_answer_0(req_handle, ENOMEM); 137 137 return; 138 138 } … … 146 146 if (!vfs_info_sane(&fs_info->vfs_info)) { 147 147 free(fs_info); 148 async_answer_0(r id, EINVAL);148 async_answer_0(req_handle, EINVAL); 149 149 return; 150 150 } … … 163 163 fibril_mutex_unlock(&fs_list_lock); 164 164 free(fs_info); 165 async_answer_0(r id, EEXIST);165 async_answer_0(req_handle, EEXIST); 166 166 return; 167 167 } … … 184 184 fibril_mutex_unlock(&fs_list_lock); 185 185 free(fs_info); 186 async_answer_0(r id, EINVAL);186 async_answer_0(req_handle, EINVAL); 187 187 return; 188 188 } … … 203 203 free(fs_info); 204 204 async_answer_0(chandle, EINVAL); 205 async_answer_0(r id, EINVAL);205 async_answer_0(req_handle, EINVAL); 206 206 return; 207 207 } … … 217 217 free(fs_info); 218 218 async_answer_0(chandle, EINVAL); 219 async_answer_0(r id, EINVAL);219 async_answer_0(req_handle, EINVAL); 220 220 return; 221 221 } … … 235 235 */ 236 236 fs_info->fs_handle = (fs_handle_t) atomic_postinc(&fs_handle_next); 237 async_answer_1(r id, EOK, (sysarg_t) fs_info->fs_handle);237 async_answer_1(req_handle, EOK, (sysarg_t) fs_info->fs_handle); 238 238 239 239 fibril_condvar_broadcast(&fs_list_cv);
Note:
See TracChangeset
for help on using the changeset viewer.