Changes in uspace/srv/vfs/vfs_ops.c [ffa2c8ef:3a4b3ba] in mainline
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/srv/vfs/vfs_ops.c
rffa2c8ef r3a4b3ba 37 37 38 38 #include "vfs.h" 39 #include <ipc/ipc.h> 39 40 #include <macros.h> 40 41 #include <stdint.h> … … 78 79 size_t rsize; 79 80 unsigned rlnkcnt; 80 sysarg_t rc;81 ipcarg_t rc; 81 82 int phone; 82 83 aid_t msg; … … 90 91 /* Trying to mount root FS over root FS */ 91 92 fibril_rwlock_write_unlock(&namespace_rwlock); 92 async_answer_0(rid, EBUSY);93 ipc_answer_0(rid, EBUSY); 93 94 return; 94 95 } … … 98 99 /* The lookup failed for some reason. */ 99 100 fibril_rwlock_write_unlock(&namespace_rwlock); 100 async_answer_0(rid, rc);101 ipc_answer_0(rid, rc); 101 102 return; 102 103 } … … 105 106 if (!mp_node) { 106 107 fibril_rwlock_write_unlock(&namespace_rwlock); 107 async_answer_0(rid, ENOMEM);108 ipc_answer_0(rid, ENOMEM); 108 109 return; 109 110 } … … 125 126 phone = vfs_grab_phone(fs_handle); 126 127 msg = async_send_1(phone, VFS_OUT_MOUNTED, 127 ( sysarg_t) devmap_handle, &answer);128 (ipcarg_t) devmap_handle, &answer); 128 129 /* send the mount options */ 129 130 rc = async_data_write_start(phone, (void *)opts, … … 133 134 vfs_release_phone(fs_handle, phone); 134 135 fibril_rwlock_write_unlock(&namespace_rwlock); 135 async_answer_0(rid, rc);136 ipc_answer_0(rid, rc); 136 137 return; 137 138 } … … 141 142 if (rc != EOK) { 142 143 fibril_rwlock_write_unlock(&namespace_rwlock); 143 async_answer_0(rid, rc);144 ipc_answer_0(rid, rc); 144 145 return; 145 146 } … … 164 165 165 166 fibril_rwlock_write_unlock(&namespace_rwlock); 166 async_answer_0(rid, rc);167 ipc_answer_0(rid, rc); 167 168 return; 168 169 } else { … … 172 173 */ 173 174 fibril_rwlock_write_unlock(&namespace_rwlock); 174 async_answer_0(rid, ENOENT);175 ipc_answer_0(rid, ENOENT); 175 176 return; 176 177 } … … 187 188 phone = vfs_grab_phone(mp_res.triplet.fs_handle); 188 189 msg = async_send_4(phone, VFS_OUT_MOUNT, 189 ( sysarg_t) mp_res.triplet.devmap_handle,190 ( sysarg_t) mp_res.triplet.index,191 ( sysarg_t) fs_handle,192 ( sysarg_t) devmap_handle, &answer);190 (ipcarg_t) mp_res.triplet.devmap_handle, 191 (ipcarg_t) mp_res.triplet.index, 192 (ipcarg_t) fs_handle, 193 (ipcarg_t) devmap_handle, &answer); 193 194 194 195 /* send connection */ … … 201 202 if (mp_node) 202 203 vfs_node_put(mp_node); 203 async_answer_0(rid, rc);204 ipc_answer_0(rid, rc); 204 205 fibril_rwlock_write_unlock(&namespace_rwlock); 205 206 return; … … 217 218 vfs_node_put(mp_node); 218 219 fibril_rwlock_write_unlock(&namespace_rwlock); 219 async_answer_0(rid, rc);220 ipc_answer_0(rid, rc); 220 221 return; 221 222 } … … 244 245 } 245 246 246 async_answer_0(rid, rc);247 ipc_answer_0(rid, rc); 247 248 fibril_rwlock_write_unlock(&namespace_rwlock); 248 249 } … … 274 275 0, NULL); 275 276 if (rc != EOK) { 276 async_answer_0(rid, rc);277 ipc_answer_0(rid, rc); 277 278 return; 278 279 } … … 284 285 if (rc != EOK) { 285 286 free(mp); 286 async_answer_0(rid, rc);287 ipc_answer_0(rid, rc); 287 288 return; 288 289 } … … 298 299 free(mp); 299 300 free(opts); 300 async_answer_0(rid, rc);301 ipc_answer_0(rid, rc); 301 302 return; 302 303 } … … 308 309 ipc_call_t data; 309 310 ipc_callid_t callid = async_get_call(&data); 310 if (IPC_GET_ IMETHOD(data) != IPC_M_PING) {311 async_answer_0(callid, ENOTSUP);312 async_answer_0(rid, ENOTSUP);311 if (IPC_GET_METHOD(data) != IPC_M_PING) { 312 ipc_answer_0(callid, ENOTSUP); 313 ipc_answer_0(rid, ENOTSUP); 313 314 free(mp); 314 315 free(opts); … … 332 333 333 334 fibril_mutex_unlock(&fs_head_lock); 334 async_answer_0(callid, ENOENT);335 async_answer_0(rid, ENOENT);335 ipc_answer_0(callid, ENOENT); 336 ipc_answer_0(rid, ENOENT); 336 337 free(mp); 337 338 free(fs_name); … … 342 343 343 344 /* Acknowledge that we know fs_name. */ 344 async_answer_0(callid, EOK);345 ipc_answer_0(callid, EOK); 345 346 346 347 /* Do the mount */ … … 366 367 0, NULL); 367 368 if (rc != EOK) 368 async_answer_0(rid, rc);369 ipc_answer_0(rid, rc); 369 370 370 371 /* … … 385 386 fibril_rwlock_write_unlock(&namespace_rwlock); 386 387 free(mp); 387 async_answer_0(rid, rc);388 ipc_answer_0(rid, rc); 388 389 return; 389 390 } … … 392 393 fibril_rwlock_write_unlock(&namespace_rwlock); 393 394 free(mp); 394 async_answer_0(rid, ENOMEM);395 ipc_answer_0(rid, ENOMEM); 395 396 return; 396 397 } … … 408 409 vfs_node_put(mr_node); 409 410 free(mp); 410 async_answer_0(rid, EBUSY);411 ipc_answer_0(rid, EBUSY); 411 412 return; 412 413 } … … 429 430 fibril_rwlock_write_unlock(&namespace_rwlock); 430 431 vfs_node_put(mr_node); 431 async_answer_0(rid, rc);432 ipc_answer_0(rid, rc); 432 433 return; 433 434 } … … 448 449 fibril_rwlock_write_unlock(&namespace_rwlock); 449 450 vfs_node_put(mr_node); 450 async_answer_0(rid, rc);451 ipc_answer_0(rid, rc); 451 452 return; 452 453 } … … 455 456 fibril_rwlock_write_unlock(&namespace_rwlock); 456 457 vfs_node_put(mr_node); 457 async_answer_0(rid, ENOMEM);458 ipc_answer_0(rid, ENOMEM); 458 459 return; 459 460 } … … 467 468 vfs_node_put(mp_node); 468 469 vfs_node_put(mr_node); 469 async_answer_0(rid, rc);470 ipc_answer_0(rid, rc); 470 471 return; 471 472 } … … 485 486 486 487 fibril_rwlock_write_unlock(&namespace_rwlock); 487 async_answer_0(rid, EOK);488 ipc_answer_0(rid, EOK); 488 489 } 489 490 490 491 void vfs_open(ipc_callid_t rid, ipc_call_t *request) 491 492 { 493 if (!vfs_files_init()) { 494 ipc_answer_0(rid, ENOMEM); 495 return; 496 } 497 492 498 /* 493 499 * The POSIX interface is open(path, oflag, mode). … … 513 519 ((lflag & (L_FILE | L_DIRECTORY)) == (L_FILE | L_DIRECTORY)) || 514 520 (lflag & (L_OPEN | L_ROOT | L_MP))) { 515 async_answer_0(rid, EINVAL);521 ipc_answer_0(rid, EINVAL); 516 522 return; 517 523 } … … 525 531 int rc = async_data_write_accept((void **) &path, true, 0, 0, 0, NULL); 526 532 if (rc != EOK) { 527 async_answer_0(rid, rc);533 ipc_answer_0(rid, rc); 528 534 return; 529 535 } … … 547 553 else 548 554 fibril_rwlock_read_unlock(&namespace_rwlock); 549 async_answer_0(rid, rc);555 ipc_answer_0(rid, rc); 550 556 free(path); 551 557 return; … … 570 576 fibril_rwlock_write_unlock(&node->contents_rwlock); 571 577 vfs_node_put(node); 572 async_answer_0(rid, rc);578 ipc_answer_0(rid, rc); 573 579 return; 574 580 } … … 585 591 if (fd < 0) { 586 592 vfs_node_put(node); 587 async_answer_0(rid, fd);593 ipc_answer_0(rid, fd); 588 594 return; 589 595 } … … 603 609 vfs_node_addref(node); 604 610 vfs_node_put(node); 605 vfs_file_put(file);606 611 607 612 /* Success! Return the new file descriptor to the client. */ 608 async_answer_1(rid, EOK, fd);613 ipc_answer_1(rid, EOK, fd); 609 614 } 610 615 … … 612 617 { 613 618 // FIXME: check for sanity of the supplied fs, dev and index 619 620 if (!vfs_files_init()) { 621 ipc_answer_0(rid, ENOMEM); 622 return; 623 } 614 624 615 625 /* … … 628 638 if (rc != EOK) { 629 639 fibril_rwlock_read_unlock(&namespace_rwlock); 630 async_answer_0(rid, rc);640 ipc_answer_0(rid, rc); 631 641 return; 632 642 } … … 644 654 fibril_rwlock_write_unlock(&node->contents_rwlock); 645 655 vfs_node_put(node); 646 async_answer_0(rid, rc);656 ipc_answer_0(rid, rc); 647 657 return; 648 658 } … … 659 669 if (fd < 0) { 660 670 vfs_node_put(node); 661 async_answer_0(rid, fd);671 ipc_answer_0(rid, fd); 662 672 return; 663 673 } … … 676 686 vfs_node_addref(node); 677 687 vfs_node_put(node); 678 vfs_file_put(file);679 688 680 689 /* Success! Return the new file descriptor to the client. */ 681 async_answer_1(rid, EOK, fd);690 ipc_answer_1(rid, EOK, fd); 682 691 } 683 692 … … 689 698 vfs_file_t *file = vfs_file_get(fd); 690 699 if (!file) { 691 async_answer_0(rid, ENOENT);700 ipc_answer_0(rid, ENOENT); 692 701 return; 693 702 } … … 707 716 708 717 /* Wait for reply from the FS server. */ 709 sysarg_t rc;718 ipcarg_t rc; 710 719 async_wait_for(msg, &rc); 711 720 712 721 vfs_release_phone(file->node->fs_handle, fs_phone); 713 722 fibril_mutex_unlock(&file->lock); 714 715 vfs_file_put(file); 716 async_answer_0(rid, rc); 723 724 ipc_answer_0(rid, rc); 717 725 } 718 726 … … 739 747 740 748 /* Wait for reply from the FS server. */ 741 sysarg_t rc;749 ipcarg_t rc; 742 750 async_wait_for(msg, &rc); 743 751 … … 759 767 vfs_file_t *file = vfs_file_get(fd); 760 768 if (!file) { 761 async_answer_0(rid, ENOENT);769 ipc_answer_0(rid, ENOENT); 762 770 return; 763 771 } … … 765 773 int ret = vfs_close_internal(file); 766 774 if (ret != EOK) 767 async_answer_0(rid, ret); 768 769 vfs_file_put(file); 775 ipc_answer_0(rid, ret); 776 770 777 ret = vfs_fd_free(fd); 771 async_answer_0(rid, ret);778 ipc_answer_0(rid, ret); 772 779 } 773 780 774 781 static void vfs_rdwr(ipc_callid_t rid, ipc_call_t *request, bool read) 775 782 { 776 vfs_info_t *vi;777 783 778 784 /* … … 791 797 vfs_file_t *file = vfs_file_get(fd); 792 798 if (!file) { 793 async_answer_0(rid, ENOENT);799 ipc_answer_0(rid, ENOENT); 794 800 return; 795 801 } … … 801 807 fibril_mutex_lock(&file->lock); 802 808 803 vi = fs_handle_to_info(file->node->fs_handle);804 assert(vi);805 806 809 /* 807 810 * Lock the file's node so that no other client can read/write to it at 808 * the same time unless the FS supports concurrent reads/writes and its 809 * write implementation does not modify the file size. 810 */ 811 if (read || (vi->concurrent_read_write && vi->write_retains_size)) 811 * the same time. 812 */ 813 if (read) 812 814 fibril_rwlock_read_lock(&file->node->contents_rwlock); 813 815 else … … 832 834 * don't have to bother. 833 835 */ 834 sysarg_t rc;836 ipcarg_t rc; 835 837 ipc_call_t answer; 836 838 if (read) { … … 855 857 856 858 /* Unlock the VFS node. */ 857 if (read || (vi->concurrent_read_write && vi->write_retains_size))859 if (read) 858 860 fibril_rwlock_read_unlock(&file->node->contents_rwlock); 859 861 else { … … 868 870 file->pos += bytes; 869 871 fibril_mutex_unlock(&file->lock); 870 vfs_file_put(file); 871 872 872 873 /* 873 874 * FS server's reply is the final result of the whole operation we 874 875 * return to the client. 875 876 */ 876 async_answer_1(rid, rc, bytes);877 ipc_answer_1(rid, rc, bytes); 877 878 } 878 879 … … 897 898 vfs_file_t *file = vfs_file_get(fd); 898 899 if (!file) { 899 async_answer_0(rid, ENOENT);900 ipc_answer_0(rid, ENOENT); 900 901 return; 901 902 } … … 909 910 file->pos = (aoff64_t) off; 910 911 fibril_mutex_unlock(&file->lock); 911 vfs_file_put(file); 912 async_answer_1(rid, EOK, off); 912 ipc_answer_1(rid, EOK, off); 913 913 return; 914 914 } … … 917 917 if ((off >= 0) && (file->pos + off < file->pos)) { 918 918 fibril_mutex_unlock(&file->lock); 919 vfs_file_put(file); 920 async_answer_0(rid, EOVERFLOW); 919 ipc_answer_0(rid, EOVERFLOW); 921 920 return; 922 921 } … … 924 923 if ((off < 0) && (file->pos < (aoff64_t) -off)) { 925 924 fibril_mutex_unlock(&file->lock); 926 vfs_file_put(file); 927 async_answer_0(rid, EOVERFLOW); 925 ipc_answer_0(rid, EOVERFLOW); 928 926 return; 929 927 } … … 933 931 934 932 fibril_mutex_unlock(&file->lock); 935 vfs_file_put(file); 936 async_answer_2(rid, EOK, LOWER32(newoff), 933 ipc_answer_2(rid, EOK, LOWER32(newoff), 937 934 UPPER32(newoff)); 938 935 return; … … 944 941 fibril_rwlock_read_unlock(&file->node->contents_rwlock); 945 942 fibril_mutex_unlock(&file->lock); 946 vfs_file_put(file); 947 async_answer_0(rid, EOVERFLOW); 943 ipc_answer_0(rid, EOVERFLOW); 948 944 return; 949 945 } … … 952 948 fibril_rwlock_read_unlock(&file->node->contents_rwlock); 953 949 fibril_mutex_unlock(&file->lock); 954 vfs_file_put(file); 955 async_answer_0(rid, EOVERFLOW); 950 ipc_answer_0(rid, EOVERFLOW); 956 951 return; 957 952 } … … 962 957 fibril_rwlock_read_unlock(&file->node->contents_rwlock); 963 958 fibril_mutex_unlock(&file->lock); 964 vfs_file_put(file); 965 async_answer_2(rid, EOK, LOWER32(newoff), UPPER32(newoff)); 959 ipc_answer_2(rid, EOK, LOWER32(newoff), UPPER32(newoff)); 966 960 return; 967 961 } 968 962 969 963 fibril_mutex_unlock(&file->lock); 970 vfs_file_put(file); 971 async_answer_0(rid, EINVAL); 964 ipc_answer_0(rid, EINVAL); 972 965 } 973 966 … … 975 968 fs_index_t index, aoff64_t size) 976 969 { 977 sysarg_t rc;970 ipcarg_t rc; 978 971 int fs_phone; 979 972 980 973 fs_phone = vfs_grab_phone(fs_handle); 981 rc = async_req_4_0(fs_phone, VFS_OUT_TRUNCATE, ( sysarg_t) devmap_handle,982 ( sysarg_t) index, LOWER32(size), UPPER32(size));974 rc = async_req_4_0(fs_phone, VFS_OUT_TRUNCATE, (ipcarg_t) devmap_handle, 975 (ipcarg_t) index, LOWER32(size), UPPER32(size)); 983 976 vfs_release_phone(fs_handle, fs_phone); 984 977 return (int)rc; … … 994 987 vfs_file_t *file = vfs_file_get(fd); 995 988 if (!file) { 996 async_answer_0(rid, ENOENT);989 ipc_answer_0(rid, ENOENT); 997 990 return; 998 991 } … … 1007 1000 1008 1001 fibril_mutex_unlock(&file->lock); 1009 vfs_file_put(file); 1010 async_answer_0(rid, (sysarg_t)rc); 1002 ipc_answer_0(rid, (ipcarg_t)rc); 1011 1003 } 1012 1004 … … 1014 1006 { 1015 1007 int fd = IPC_GET_ARG1(*request); 1016 sysarg_t rc;1008 ipcarg_t rc; 1017 1009 1018 1010 vfs_file_t *file = vfs_file_get(fd); 1019 1011 if (!file) { 1020 async_answer_0(rid, ENOENT);1012 ipc_answer_0(rid, ENOENT); 1021 1013 return; 1022 1014 } … … 1024 1016 ipc_callid_t callid; 1025 1017 if (!async_data_read_receive(&callid, NULL)) { 1026 vfs_file_put(file); 1027 async_answer_0(callid, EINVAL); 1028 async_answer_0(rid, EINVAL); 1018 ipc_answer_0(callid, EINVAL); 1019 ipc_answer_0(rid, EINVAL); 1029 1020 return; 1030 1021 } … … 1037 1028 msg = async_send_3(fs_phone, VFS_OUT_STAT, file->node->devmap_handle, 1038 1029 file->node->index, true, NULL); 1039 async_forward_fast(callid, fs_phone, 0, 0, 0, IPC_FF_ROUTE_FROM_ME);1030 ipc_forward_fast(callid, fs_phone, 0, 0, 0, IPC_FF_ROUTE_FROM_ME); 1040 1031 async_wait_for(msg, &rc); 1041 1032 vfs_release_phone(file->node->fs_handle, fs_phone); 1042 1033 1043 1034 fibril_mutex_unlock(&file->lock); 1044 vfs_file_put(file); 1045 async_answer_0(rid, rc); 1035 ipc_answer_0(rid, rc); 1046 1036 } 1047 1037 … … 1051 1041 int rc = async_data_write_accept((void **) &path, true, 0, 0, 0, NULL); 1052 1042 if (rc != EOK) { 1053 async_answer_0(rid, rc);1043 ipc_answer_0(rid, rc); 1054 1044 return; 1055 1045 } … … 1058 1048 if (!async_data_read_receive(&callid, NULL)) { 1059 1049 free(path); 1060 async_answer_0(callid, EINVAL);1061 async_answer_0(rid, EINVAL);1050 ipc_answer_0(callid, EINVAL); 1051 ipc_answer_0(rid, EINVAL); 1062 1052 return; 1063 1053 } … … 1069 1059 if (rc != EOK) { 1070 1060 fibril_rwlock_read_unlock(&namespace_rwlock); 1071 async_answer_0(callid, rc);1072 async_answer_0(rid, rc);1061 ipc_answer_0(callid, rc); 1062 ipc_answer_0(rid, rc); 1073 1063 return; 1074 1064 } … … 1076 1066 if (!node) { 1077 1067 fibril_rwlock_read_unlock(&namespace_rwlock); 1078 async_answer_0(callid, ENOMEM);1079 async_answer_0(rid, ENOMEM);1068 ipc_answer_0(callid, ENOMEM); 1069 ipc_answer_0(rid, ENOMEM); 1080 1070 return; 1081 1071 } … … 1087 1077 msg = async_send_3(fs_phone, VFS_OUT_STAT, node->devmap_handle, 1088 1078 node->index, false, NULL); 1089 async_forward_fast(callid, fs_phone, 0, 0, 0, IPC_FF_ROUTE_FROM_ME);1090 1091 sysarg_t rv;1079 ipc_forward_fast(callid, fs_phone, 0, 0, 0, IPC_FF_ROUTE_FROM_ME); 1080 1081 ipcarg_t rv; 1092 1082 async_wait_for(msg, &rv); 1093 1083 vfs_release_phone(node->fs_handle, fs_phone); 1094 1084 1095 async_answer_0(rid, rv);1085 ipc_answer_0(rid, rv); 1096 1086 1097 1087 vfs_node_put(node); … … 1105 1095 int rc = async_data_write_accept((void **) &path, true, 0, 0, 0, NULL); 1106 1096 if (rc != EOK) { 1107 async_answer_0(rid, rc);1097 ipc_answer_0(rid, rc); 1108 1098 return; 1109 1099 } … … 1117 1107 fibril_rwlock_write_unlock(&namespace_rwlock); 1118 1108 free(path); 1119 async_answer_0(rid, rc);1109 ipc_answer_0(rid, rc); 1120 1110 } 1121 1111 … … 1127 1117 int rc = async_data_write_accept((void **) &path, true, 0, 0, 0, NULL); 1128 1118 if (rc != EOK) { 1129 async_answer_0(rid, rc);1119 ipc_answer_0(rid, rc); 1130 1120 return; 1131 1121 } … … 1138 1128 if (rc != EOK) { 1139 1129 fibril_rwlock_write_unlock(&namespace_rwlock); 1140 async_answer_0(rid, rc);1130 ipc_answer_0(rid, rc); 1141 1131 return; 1142 1132 } … … 1153 1143 fibril_rwlock_write_unlock(&namespace_rwlock); 1154 1144 vfs_node_put(node); 1155 async_answer_0(rid, EOK);1145 ipc_answer_0(rid, EOK); 1156 1146 } 1157 1147 … … 1162 1152 int rc = async_data_write_accept((void **) &old, true, 0, 0, 0, NULL); 1163 1153 if (rc != EOK) { 1164 async_answer_0(rid, rc);1154 ipc_answer_0(rid, rc); 1165 1155 return; 1166 1156 } … … 1171 1161 if (rc != EOK) { 1172 1162 free(old); 1173 async_answer_0(rid, rc);1163 ipc_answer_0(rid, rc); 1174 1164 return; 1175 1165 } … … 1181 1171 1182 1172 if ((!oldc) || (!newc)) { 1183 async_answer_0(rid, EINVAL);1173 ipc_answer_0(rid, EINVAL); 1184 1174 free(old); 1185 1175 free(new); … … 1200 1190 * - oldc and newc are equal. 1201 1191 */ 1202 async_answer_0(rid, EINVAL);1192 ipc_answer_0(rid, EINVAL); 1203 1193 free(old); 1204 1194 free(new); … … 1215 1205 if (rc != EOK) { 1216 1206 fibril_rwlock_write_unlock(&namespace_rwlock); 1217 async_answer_0(rid, rc);1207 ipc_answer_0(rid, rc); 1218 1208 free(old); 1219 1209 free(new); … … 1224 1214 if (!old_node) { 1225 1215 fibril_rwlock_write_unlock(&namespace_rwlock); 1226 async_answer_0(rid, ENOMEM);1216 ipc_answer_0(rid, ENOMEM); 1227 1217 free(old); 1228 1218 free(new); … … 1234 1224 if (!parentc) { 1235 1225 fibril_rwlock_write_unlock(&namespace_rwlock); 1236 async_answer_0(rid, rc);1226 ipc_answer_0(rid, rc); 1237 1227 free(old); 1238 1228 free(new); … … 1251 1241 if (rc != EOK) { 1252 1242 fibril_rwlock_write_unlock(&namespace_rwlock); 1253 async_answer_0(rid, rc);1243 ipc_answer_0(rid, rc); 1254 1244 free(old); 1255 1245 free(new); … … 1261 1251 (old_node->devmap_handle != new_par_lr.triplet.devmap_handle)) { 1262 1252 fibril_rwlock_write_unlock(&namespace_rwlock); 1263 async_answer_0(rid, EXDEV); /* different file systems */1253 ipc_answer_0(rid, EXDEV); /* different file systems */ 1264 1254 free(old); 1265 1255 free(new); … … 1279 1269 if (!new_node) { 1280 1270 fibril_rwlock_write_unlock(&namespace_rwlock); 1281 async_answer_0(rid, ENOMEM);1271 ipc_answer_0(rid, ENOMEM); 1282 1272 free(old); 1283 1273 free(new); … … 1290 1280 default: 1291 1281 fibril_rwlock_write_unlock(&namespace_rwlock); 1292 async_answer_0(rid, ENOTEMPTY);1282 ipc_answer_0(rid, ENOTEMPTY); 1293 1283 free(old); 1294 1284 free(new); … … 1302 1292 if (new_node) 1303 1293 vfs_node_put(new_node); 1304 async_answer_0(rid, rc);1294 ipc_answer_0(rid, rc); 1305 1295 free(old); 1306 1296 free(new); … … 1319 1309 if (new_node) 1320 1310 vfs_node_put(new_node); 1321 async_answer_0(rid, rc);1311 ipc_answer_0(rid, rc); 1322 1312 free(old); 1323 1313 free(new); … … 1336 1326 free(old); 1337 1327 free(new); 1338 async_answer_0(rid, EOK);1328 ipc_answer_0(rid, EOK); 1339 1329 } 1340 1330 … … 1343 1333 int oldfd = IPC_GET_ARG1(*request); 1344 1334 int newfd = IPC_GET_ARG2(*request); 1345 1346 /* If the file descriptors are the same, do nothing. */1347 if (oldfd == newfd) {1348 async_answer_1(rid, EOK, newfd);1349 return;1350 }1351 1335 1352 1336 /* Lookup the file structure corresponding to oldfd. */ 1353 1337 vfs_file_t *oldfile = vfs_file_get(oldfd); 1354 1338 if (!oldfile) { 1355 async_answer_0(rid, EBADF); 1339 ipc_answer_0(rid, EBADF); 1340 return; 1341 } 1342 1343 /* If the file descriptors are the same, do nothing. */ 1344 if (oldfd == newfd) { 1345 ipc_answer_1(rid, EOK, newfd); 1356 1346 return; 1357 1347 } … … 1370 1360 if (ret != EOK) { 1371 1361 fibril_mutex_unlock(&oldfile->lock); 1372 vfs_file_put(oldfile); 1373 vfs_file_put(newfile); 1374 async_answer_0(rid, ret); 1362 ipc_answer_0(rid, ret); 1375 1363 return; 1376 1364 } … … 1379 1367 if (ret != EOK) { 1380 1368 fibril_mutex_unlock(&oldfile->lock); 1381 vfs_file_put(oldfile); 1382 vfs_file_put(newfile); 1383 async_answer_0(rid, ret); 1384 return; 1385 } 1386 vfs_file_put(newfile); 1369 ipc_answer_0(rid, ret); 1370 return; 1371 } 1387 1372 } 1388 1373 … … 1390 1375 int ret = vfs_fd_assign(oldfile, newfd); 1391 1376 fibril_mutex_unlock(&oldfile->lock); 1392 vfs_file_put(oldfile);1393 1377 1394 1378 if (ret != EOK) 1395 async_answer_0(rid, ret);1379 ipc_answer_0(rid, ret); 1396 1380 else 1397 async_answer_1(rid, EOK, newfd);1381 ipc_answer_1(rid, EOK, newfd); 1398 1382 } 1399 1383
Note:
See TracChangeset
for help on using the changeset viewer.