Changes in uspace/srv/vfs/vfs_ops.c [228e490:4fe94c66] in mainline
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/srv/vfs/vfs_ops.c
r228e490 r4fe94c66 491 491 void vfs_open(ipc_callid_t rid, ipc_call_t *request) 492 492 { 493 if (!vfs_files_init()) {494 ipc_answer_0(rid, ENOMEM);495 return;496 }497 498 493 /* 499 494 * The POSIX interface is open(path, oflag, mode). … … 609 604 vfs_node_addref(node); 610 605 vfs_node_put(node); 606 vfs_file_put(file); 611 607 612 608 /* Success! Return the new file descriptor to the client. */ … … 617 613 { 618 614 // 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 }624 615 625 616 /* … … 686 677 vfs_node_addref(node); 687 678 vfs_node_put(node); 679 vfs_file_put(file); 688 680 689 681 /* Success! Return the new file descriptor to the client. */ … … 721 713 vfs_release_phone(file->node->fs_handle, fs_phone); 722 714 fibril_mutex_unlock(&file->lock); 723 715 716 vfs_file_put(file); 724 717 ipc_answer_0(rid, rc); 725 718 } … … 775 768 ipc_answer_0(rid, ret); 776 769 770 vfs_file_put(file); 777 771 ret = vfs_fd_free(fd); 778 772 ipc_answer_0(rid, ret); … … 875 869 file->pos += bytes; 876 870 fibril_mutex_unlock(&file->lock); 877 871 vfs_file_put(file); 872 878 873 /* 879 874 * FS server's reply is the final result of the whole operation we … … 915 910 file->pos = (aoff64_t) off; 916 911 fibril_mutex_unlock(&file->lock); 912 vfs_file_put(file); 917 913 ipc_answer_1(rid, EOK, off); 918 914 return; … … 922 918 if ((off >= 0) && (file->pos + off < file->pos)) { 923 919 fibril_mutex_unlock(&file->lock); 920 vfs_file_put(file); 924 921 ipc_answer_0(rid, EOVERFLOW); 925 922 return; … … 928 925 if ((off < 0) && (file->pos < (aoff64_t) -off)) { 929 926 fibril_mutex_unlock(&file->lock); 927 vfs_file_put(file); 930 928 ipc_answer_0(rid, EOVERFLOW); 931 929 return; … … 936 934 937 935 fibril_mutex_unlock(&file->lock); 936 vfs_file_put(file); 938 937 ipc_answer_2(rid, EOK, LOWER32(newoff), 939 938 UPPER32(newoff)); … … 946 945 fibril_rwlock_read_unlock(&file->node->contents_rwlock); 947 946 fibril_mutex_unlock(&file->lock); 947 vfs_file_put(file); 948 948 ipc_answer_0(rid, EOVERFLOW); 949 949 return; … … 953 953 fibril_rwlock_read_unlock(&file->node->contents_rwlock); 954 954 fibril_mutex_unlock(&file->lock); 955 vfs_file_put(file); 955 956 ipc_answer_0(rid, EOVERFLOW); 956 957 return; … … 962 963 fibril_rwlock_read_unlock(&file->node->contents_rwlock); 963 964 fibril_mutex_unlock(&file->lock); 965 vfs_file_put(file); 964 966 ipc_answer_2(rid, EOK, LOWER32(newoff), UPPER32(newoff)); 965 967 return; … … 967 969 968 970 fibril_mutex_unlock(&file->lock); 971 vfs_file_put(file); 969 972 ipc_answer_0(rid, EINVAL); 970 973 } … … 1005 1008 1006 1009 fibril_mutex_unlock(&file->lock); 1010 vfs_file_put(file); 1007 1011 ipc_answer_0(rid, (sysarg_t)rc); 1008 1012 } … … 1021 1025 ipc_callid_t callid; 1022 1026 if (!async_data_read_receive(&callid, NULL)) { 1027 vfs_file_put(file); 1023 1028 ipc_answer_0(callid, EINVAL); 1024 1029 ipc_answer_0(rid, EINVAL); … … 1038 1043 1039 1044 fibril_mutex_unlock(&file->lock); 1045 vfs_file_put(file); 1040 1046 ipc_answer_0(rid, rc); 1041 1047 } … … 1339 1345 int newfd = IPC_GET_ARG2(*request); 1340 1346 1347 /* If the file descriptors are the same, do nothing. */ 1348 if (oldfd == newfd) { 1349 ipc_answer_1(rid, EOK, newfd); 1350 return; 1351 } 1352 1341 1353 /* Lookup the file structure corresponding to oldfd. */ 1342 1354 vfs_file_t *oldfile = vfs_file_get(oldfd); 1343 1355 if (!oldfile) { 1344 1356 ipc_answer_0(rid, EBADF); 1345 return;1346 }1347 1348 /* If the file descriptors are the same, do nothing. */1349 if (oldfd == newfd) {1350 ipc_answer_1(rid, EOK, newfd);1351 1357 return; 1352 1358 } … … 1365 1371 if (ret != EOK) { 1366 1372 fibril_mutex_unlock(&oldfile->lock); 1373 vfs_file_put(oldfile); 1374 vfs_file_put(newfile); 1367 1375 ipc_answer_0(rid, ret); 1368 1376 return; … … 1372 1380 if (ret != EOK) { 1373 1381 fibril_mutex_unlock(&oldfile->lock); 1382 vfs_file_put(oldfile); 1383 vfs_file_put(newfile); 1374 1384 ipc_answer_0(rid, ret); 1375 1385 return; 1376 1386 } 1387 vfs_file_put(newfile); 1377 1388 } 1378 1389 … … 1380 1391 int ret = vfs_fd_assign(oldfile, newfd); 1381 1392 fibril_mutex_unlock(&oldfile->lock); 1393 vfs_file_put(oldfile); 1382 1394 1383 1395 if (ret != EOK)
Note:
See TracChangeset
for help on using the changeset viewer.