Changes in / [4b9a410:eb667613] in mainline
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/srv/vfs/vfs_ops.c
r4b9a410 reb667613 55 55 56 56 /* Forward declarations of static functions. */ 57 static int vfs_truncate_internal(fs_handle_t, devmap_handle_t, fs_index_t, 58 aoff64_t); 57 static int vfs_truncate_internal(fs_handle_t, devmap_handle_t, fs_index_t, aoff64_t); 59 58 60 59 /** … … 251 250 void vfs_mount(ipc_callid_t rid, ipc_call_t *request) 252 251 { 253 devmap_handle_t devmap_handle;254 255 252 /* 256 253 * We expect the library to do the device-name to device-handle … … 258 255 * in the request. 259 256 */ 260 devmap_handle = (devmap_handle_t) IPC_GET_ARG1(*request);257 devmap_handle_t devmap_handle = (devmap_handle_t) IPC_GET_ARG1(*request); 261 258 262 259 /* … … 294 291 */ 295 292 char *fs_name; 296 rc = async_data_write_accept((void **) &fs_name, true, 0, 297 FS_NAME_MAXLEN,0, NULL);293 rc = async_data_write_accept((void **) &fs_name, true, 0, FS_NAME_MAXLEN, 294 0, NULL); 298 295 if (rc != EOK) { 299 296 free(mp); … … 461 458 462 459 phone = vfs_grab_phone(mp_node->fs_handle); 463 rc = async_req_2_0(phone, VFS_OUT_UNMOUNT, 464 mp_node-> devmap_handle, mp_node->index);460 rc = async_req_2_0(phone, VFS_OUT_UNMOUNT, mp_node->devmap_handle, 461 mp_node->index); 465 462 vfs_release_phone(mp_node->fs_handle, phone); 466 463 if (rc != EOK) { … … 743 740 aid_t msg; 744 741 ipc_call_t answer; 745 msg = async_send_2(fs_phone, VFS_OUT_CLOSE, 746 file->node-> devmap_handle, file->node->index, &answer);742 msg = async_send_2(fs_phone, VFS_OUT_CLOSE, file->node->devmap_handle, 743 file->node->index, &answer); 747 744 748 745 /* Wait for reply from the FS server. */ … … 837 834 ipc_call_t answer; 838 835 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 846 843 rc = async_data_write_forward_3_1(fs_phone, VFS_OUT_WRITE, 847 844 file->node->devmap_handle, file->node->index, file->pos, … … 891 888 { 892 889 int fd = (int) IPC_GET_ARG1(*request); 893 off64_t off = (off64_t) MERGE_LOUP32(IPC_GET_ARG2(*request),894 IPC_GET_ARG3(*request));890 off64_t off = 891 (off64_t) MERGE_LOUP32(IPC_GET_ARG2(*request), IPC_GET_ARG3(*request)); 895 892 int whence = (int) IPC_GET_ARG4(*request); 896 893 … … 906 903 off64_t newoff; 907 904 switch (whence) { 908 case SEEK_SET: 909 if (off >= 0) { 910 file->pos = (aoff64_t) off; 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 911 929 fibril_mutex_unlock(&file->lock); 912 ipc_answer_ 1(rid, EOK, off);930 ipc_answer_2(rid, EOK, LOWER32(newoff), UPPER32(newoff)); 913 931 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)) { 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 941 953 fibril_rwlock_read_unlock(&file->node->contents_rwlock); 942 954 fibril_mutex_unlock(&file->lock); 943 ipc_answer_ 0(rid, EOVERFLOW);955 ipc_answer_2(rid, EOK, LOWER32(newoff), UPPER32(newoff)); 944 956 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;961 957 } 962 958 … … 981 977 { 982 978 int fd = IPC_GET_ARG1(*request); 983 aoff64_t size = (aoff64_t) MERGE_LOUP32(IPC_GET_ARG2(*request),984 IPC_GET_ARG3(*request));979 aoff64_t size = 980 (aoff64_t) MERGE_LOUP32(IPC_GET_ARG2(*request), IPC_GET_ARG3(*request)); 985 981 int rc; 986 982
Note:
See TracChangeset
for help on using the changeset viewer.