Changeset 4b9a410 in mainline
- Timestamp:
- 2010-11-25T23:21:25Z (14 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- 96b89acb, bf61d3a
- Parents:
- eb667613 (diff), 3a4b3ba (diff)
Note: this is a merge changeset, the changes displayed below correspond to the merge itself.
Use the(diff)
links above to see all the changes relative to each parent. - File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/srv/vfs/vfs_ops.c
reb667613 r4b9a410 55 55 56 56 /* Forward declarations of static functions. */ 57 static int vfs_truncate_internal(fs_handle_t, devmap_handle_t, fs_index_t, aoff64_t); 57 static int vfs_truncate_internal(fs_handle_t, devmap_handle_t, fs_index_t, 58 aoff64_t); 58 59 59 60 /** … … 250 251 void vfs_mount(ipc_callid_t rid, ipc_call_t *request) 251 252 { 253 devmap_handle_t devmap_handle; 254 252 255 /* 253 256 * We expect the library to do the device-name to device-handle … … 255 258 * in the request. 256 259 */ 257 devmap_handle _t devmap_handle= (devmap_handle_t) IPC_GET_ARG1(*request);260 devmap_handle = (devmap_handle_t) IPC_GET_ARG1(*request); 258 261 259 262 /* … … 291 294 */ 292 295 char *fs_name; 293 rc = async_data_write_accept((void **) &fs_name, true, 0, FS_NAME_MAXLEN,294 0, NULL);296 rc = async_data_write_accept((void **) &fs_name, true, 0, 297 FS_NAME_MAXLEN, 0, NULL); 295 298 if (rc != EOK) { 296 299 free(mp); … … 458 461 459 462 phone = vfs_grab_phone(mp_node->fs_handle); 460 rc = async_req_2_0(phone, VFS_OUT_UNMOUNT, mp_node->devmap_handle,461 mp_node-> index);463 rc = async_req_2_0(phone, VFS_OUT_UNMOUNT, 464 mp_node->devmap_handle, mp_node->index); 462 465 vfs_release_phone(mp_node->fs_handle, phone); 463 466 if (rc != EOK) { … … 740 743 aid_t msg; 741 744 ipc_call_t answer; 742 msg = async_send_2(fs_phone, VFS_OUT_CLOSE, file->node->devmap_handle,743 file->node-> index, &answer);745 msg = async_send_2(fs_phone, VFS_OUT_CLOSE, 746 file->node->devmap_handle, file->node->index, &answer); 744 747 745 748 /* Wait for reply from the FS server. */ … … 834 837 ipc_call_t answer; 835 838 if (read) { 836 if (file->append)837 file->pos = file->node->size;838 839 839 rc = async_data_read_forward_3_1(fs_phone, VFS_OUT_READ, 840 840 file->node->devmap_handle, file->node->index, file->pos, 841 841 &answer); 842 842 } else { 843 if (file->append) 844 file->pos = file->node->size; 845 843 846 rc = async_data_write_forward_3_1(fs_phone, VFS_OUT_WRITE, 844 847 file->node->devmap_handle, file->node->index, file->pos, … … 888 891 { 889 892 int fd = (int) IPC_GET_ARG1(*request); 890 off64_t off = 891 (off64_t) MERGE_LOUP32(IPC_GET_ARG2(*request),IPC_GET_ARG3(*request));893 off64_t off = (off64_t) MERGE_LOUP32(IPC_GET_ARG2(*request), 894 IPC_GET_ARG3(*request)); 892 895 int whence = (int) IPC_GET_ARG4(*request); 893 896 … … 903 906 off64_t newoff; 904 907 switch (whence) { 905 case SEEK_SET: 906 if (off >= 0) { 907 file->pos = (aoff64_t) off; 908 fibril_mutex_unlock(&file->lock); 909 ipc_answer_1(rid, EOK, off); 910 return; 911 } 912 break; 913 case SEEK_CUR: 914 if ((off >= 0) && (file->pos + off < file->pos)) { 915 fibril_mutex_unlock(&file->lock); 916 ipc_answer_0(rid, EOVERFLOW); 917 return; 918 } 919 920 if ((off < 0) && (file->pos < (aoff64_t) -off)) { 921 fibril_mutex_unlock(&file->lock); 922 ipc_answer_0(rid, EOVERFLOW); 923 return; 924 } 925 926 file->pos += off; 927 newoff = (file->pos > OFF64_MAX) ? OFF64_MAX : file->pos; 928 908 case SEEK_SET: 909 if (off >= 0) { 910 file->pos = (aoff64_t) off; 929 911 fibril_mutex_unlock(&file->lock); 930 ipc_answer_2(rid, EOK, LOWER32(newoff), UPPER32(newoff)); 931 return; 932 case SEEK_END: 933 fibril_rwlock_read_lock(&file->node->contents_rwlock); 934 aoff64_t size = file->node->size; 935 936 if ((off >= 0) && (size + off < size)) { 937 fibril_rwlock_read_unlock(&file->node->contents_rwlock); 938 fibril_mutex_unlock(&file->lock); 939 ipc_answer_0(rid, EOVERFLOW); 940 return; 941 } 942 943 if ((off < 0) && (size < (aoff64_t) -off)) { 944 fibril_rwlock_read_unlock(&file->node->contents_rwlock); 945 fibril_mutex_unlock(&file->lock); 946 ipc_answer_0(rid, EOVERFLOW); 947 return; 948 } 949 950 file->pos = size + off; 951 newoff = (file->pos > OFF64_MAX) ? OFF64_MAX : file->pos; 952 912 ipc_answer_1(rid, EOK, off); 913 return; 914 } 915 break; 916 case SEEK_CUR: 917 if ((off >= 0) && (file->pos + off < file->pos)) { 918 fibril_mutex_unlock(&file->lock); 919 ipc_answer_0(rid, EOVERFLOW); 920 return; 921 } 922 923 if ((off < 0) && (file->pos < (aoff64_t) -off)) { 924 fibril_mutex_unlock(&file->lock); 925 ipc_answer_0(rid, EOVERFLOW); 926 return; 927 } 928 929 file->pos += off; 930 newoff = (file->pos > OFF64_MAX) ? OFF64_MAX : file->pos; 931 932 fibril_mutex_unlock(&file->lock); 933 ipc_answer_2(rid, EOK, LOWER32(newoff), 934 UPPER32(newoff)); 935 return; 936 case SEEK_END: 937 fibril_rwlock_read_lock(&file->node->contents_rwlock); 938 aoff64_t size = file->node->size; 939 940 if ((off >= 0) && (size + off < size)) { 953 941 fibril_rwlock_read_unlock(&file->node->contents_rwlock); 954 942 fibril_mutex_unlock(&file->lock); 955 ipc_answer_2(rid, EOK, LOWER32(newoff), UPPER32(newoff)); 956 return; 943 ipc_answer_0(rid, EOVERFLOW); 944 return; 945 } 946 947 if ((off < 0) && (size < (aoff64_t) -off)) { 948 fibril_rwlock_read_unlock(&file->node->contents_rwlock); 949 fibril_mutex_unlock(&file->lock); 950 ipc_answer_0(rid, EOVERFLOW); 951 return; 952 } 953 954 file->pos = size + off; 955 newoff = (file->pos > OFF64_MAX) ? OFF64_MAX : file->pos; 956 957 fibril_rwlock_read_unlock(&file->node->contents_rwlock); 958 fibril_mutex_unlock(&file->lock); 959 ipc_answer_2(rid, EOK, LOWER32(newoff), UPPER32(newoff)); 960 return; 957 961 } 958 962 … … 977 981 { 978 982 int fd = IPC_GET_ARG1(*request); 979 aoff64_t size = 980 (aoff64_t) MERGE_LOUP32(IPC_GET_ARG2(*request),IPC_GET_ARG3(*request));983 aoff64_t size = (aoff64_t) MERGE_LOUP32(IPC_GET_ARG2(*request), 984 IPC_GET_ARG3(*request)); 981 985 int rc; 982 986
Note:
See TracChangeset
for help on using the changeset viewer.