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