Subversion Repositories HelenOS

Rev

Rev 4539 | Rev 4566 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 4539 Rev 4551
Line 141... Line 141...
141
                (ipcarg_t) dev_handle, &answer);
141
                (ipcarg_t) dev_handle, &answer);
142
            /* send the mount options */
142
            /* send the mount options */
143
            rc = ipc_data_write_start(phone, (void *)opts,
143
            rc = ipc_data_write_start(phone, (void *)opts,
144
                str_size(opts));
144
                str_size(opts));
145
            if (rc != EOK) {
145
            if (rc != EOK) {
146
                vfs_release_phone(phone);
-
 
147
                async_wait_for(msg, NULL);
146
                async_wait_for(msg, NULL);
-
 
147
                vfs_release_phone(phone);
148
                fibril_rwlock_write_unlock(&namespace_rwlock);
148
                fibril_rwlock_write_unlock(&namespace_rwlock);
149
                ipc_answer_0(rid, rc);
149
                ipc_answer_0(rid, rc);
150
                return;
150
                return;
151
            }
151
            }
152
            vfs_release_phone(phone);
-
 
153
            async_wait_for(msg, &rc);
152
            async_wait_for(msg, &rc);
-
 
153
            vfs_release_phone(phone);
154
           
154
           
155
            if (rc != EOK) {
155
            if (rc != EOK) {
156
                fibril_rwlock_write_unlock(&namespace_rwlock);
156
                fibril_rwlock_write_unlock(&namespace_rwlock);
157
                ipc_answer_0(rid, rc);
157
                ipc_answer_0(rid, rc);
158
                return;
158
                return;
Line 195... Line 195...
195
     * handles, and we know the mount point VFS node.
195
     * handles, and we know the mount point VFS node.
196
     */
196
     */
197
   
197
   
198
    int mountee_phone = vfs_grab_phone(fs_handle);
198
    int mountee_phone = vfs_grab_phone(fs_handle);
199
    assert(mountee_phone >= 0);
199
    assert(mountee_phone >= 0);
200
    vfs_release_phone(mountee_phone);
-
 
201
 
200
 
202
    phone = vfs_grab_phone(mp_res.triplet.fs_handle);
201
    phone = vfs_grab_phone(mp_res.triplet.fs_handle);
203
    msg = async_send_4(phone, VFS_MOUNT,
202
    msg = async_send_4(phone, VFS_MOUNT,
204
        (ipcarg_t) mp_res.triplet.dev_handle,
203
        (ipcarg_t) mp_res.triplet.dev_handle,
205
        (ipcarg_t) mp_res.triplet.index,
204
        (ipcarg_t) mp_res.triplet.index,
Line 207... Line 206...
207
        (ipcarg_t) dev_handle, &answer);
206
        (ipcarg_t) dev_handle, &answer);
208
   
207
   
209
    /* send connection */
208
    /* send connection */
210
    rc = async_req_1_0(phone, IPC_M_CONNECTION_CLONE, mountee_phone);
209
    rc = async_req_1_0(phone, IPC_M_CONNECTION_CLONE, mountee_phone);
211
    if (rc != EOK) {
210
    if (rc != EOK) {
212
        vfs_release_phone(phone);
-
 
213
        async_wait_for(msg, NULL);
211
        async_wait_for(msg, NULL);
-
 
212
        vfs_release_phone(mountee_phone);
-
 
213
        vfs_release_phone(phone);
214
        /* Mount failed, drop reference to mp_node. */
214
        /* Mount failed, drop reference to mp_node. */
215
        if (mp_node)
215
        if (mp_node)
216
            vfs_node_put(mp_node);
216
            vfs_node_put(mp_node);
217
        ipc_answer_0(rid, rc);
217
        ipc_answer_0(rid, rc);
218
        fibril_rwlock_write_unlock(&namespace_rwlock);
218
        fibril_rwlock_write_unlock(&namespace_rwlock);
219
        return;
219
        return;
220
    }
220
    }
-
 
221
 
-
 
222
    vfs_release_phone(mountee_phone);
221
   
223
   
222
    /* send the mount options */
224
    /* send the mount options */
223
    rc = ipc_data_write_start(phone, (void *)opts, str_size(opts));
225
    rc = ipc_data_write_start(phone, (void *)opts, str_size(opts));
224
    if (rc != EOK) {
226
    if (rc != EOK) {
225
        vfs_release_phone(phone);
-
 
226
        async_wait_for(msg, NULL);
227
        async_wait_for(msg, NULL);
-
 
228
        vfs_release_phone(phone);
227
        /* Mount failed, drop reference to mp_node. */
229
        /* Mount failed, drop reference to mp_node. */
228
        if (mp_node)
230
        if (mp_node)
229
            vfs_node_put(mp_node);
231
            vfs_node_put(mp_node);
230
        fibril_rwlock_write_unlock(&namespace_rwlock);
232
        fibril_rwlock_write_unlock(&namespace_rwlock);
231
        ipc_answer_0(rid, rc);
233
        ipc_answer_0(rid, rc);
232
        return;
234
        return;
233
    }
235
    }
234
    vfs_release_phone(phone);
-
 
235
    async_wait_for(msg, &rc);
236
    async_wait_for(msg, &rc);
-
 
237
    vfs_release_phone(phone);
236
   
238
   
237
    if (rc == EOK) {
239
    if (rc == EOK) {
238
        rindex = (fs_index_t) IPC_GET_ARG1(answer);
240
        rindex = (fs_index_t) IPC_GET_ARG1(answer);
239
        rsize = (size_t) IPC_GET_ARG2(answer);
241
        rsize = (size_t) IPC_GET_ARG2(answer);
240
        rlnkcnt = (unsigned) IPC_GET_ARG3(answer);
242
        rlnkcnt = (unsigned) IPC_GET_ARG3(answer);
Line 753... Line 755...
753
    /* Make a VFS_DEVICE request at the destination FS server. */
755
    /* Make a VFS_DEVICE request at the destination FS server. */
754
    aid_t msg;
756
    aid_t msg;
755
    ipc_call_t answer;
757
    ipc_call_t answer;
756
    msg = async_send_2(fs_phone, IPC_GET_METHOD(*request),
758
    msg = async_send_2(fs_phone, IPC_GET_METHOD(*request),
757
        file->node->dev_handle, file->node->index, &answer);
759
        file->node->dev_handle, file->node->index, &answer);
758
   
-
 
759
    vfs_release_phone(fs_phone);
-
 
760
 
760
 
761
    /* Wait for reply from the FS server. */
761
    /* Wait for reply from the FS server. */
762
    ipcarg_t rc;
762
    ipcarg_t rc;
763
    async_wait_for(msg, &rc);
763
    async_wait_for(msg, &rc);
764
   
764
 
-
 
765
    vfs_release_phone(fs_phone);
765
    fibril_mutex_unlock(&file->lock);
766
    fibril_mutex_unlock(&file->lock);
766
   
767
   
767
    ipc_answer_1(rid, EOK, IPC_GET_ARG1(answer));
768
    ipc_answer_1(rid, EOK, IPC_GET_ARG1(answer));
768
}
769
}
769
 
770
 
Line 789... Line 790...
789
    aid_t msg;
790
    aid_t msg;
790
    ipc_call_t answer;
791
    ipc_call_t answer;
791
    msg = async_send_2(fs_phone, IPC_GET_METHOD(*request),
792
    msg = async_send_2(fs_phone, IPC_GET_METHOD(*request),
792
        file->node->dev_handle, file->node->index, &answer);
793
        file->node->dev_handle, file->node->index, &answer);
793
 
794
 
794
    vfs_release_phone(fs_phone);
-
 
795
 
-
 
796
    /* Wait for reply from the FS server. */
795
    /* Wait for reply from the FS server. */
797
    ipcarg_t rc;
796
    ipcarg_t rc;
798
    async_wait_for(msg, &rc);
797
    async_wait_for(msg, &rc);
799
   
798
   
-
 
799
    vfs_release_phone(fs_phone);
800
    fibril_mutex_unlock(&file->lock);
800
    fibril_mutex_unlock(&file->lock);
801
   
801
   
802
    ipc_answer_0(rid, rc);
802
    ipc_answer_0(rid, rc);
803
}
803
}
804
 
804
 
Line 816... Line 816...
816
    /*
816
    /*
817
     * Lock the open file structure so that no other thread can manipulate
817
     * Lock the open file structure so that no other thread can manipulate
818
     * the same open file at a time.
818
     * the same open file at a time.
819
     */
819
     */
820
    fibril_mutex_lock(&file->lock);
820
    fibril_mutex_lock(&file->lock);
821
   
-
 
822
    int fs_phone = vfs_grab_phone(file->node->fs_handle);
821
    int fs_phone = vfs_grab_phone(file->node->fs_handle);
823
   
822
   
824
    /* Make a VFS_CLOSE request at the destination FS server. */
823
    /* Make a VFS_CLOSE request at the destination FS server. */
825
    aid_t msg;
824
    aid_t msg;
826
    ipc_call_t answer;
825
    ipc_call_t answer;
827
    msg = async_send_2(fs_phone, IPC_GET_METHOD(*request),
826
    msg = async_send_2(fs_phone, IPC_GET_METHOD(*request),
828
        file->node->dev_handle, file->node->index, &answer);
827
        file->node->dev_handle, file->node->index, &answer);
829
 
828
 
830
    vfs_release_phone(fs_phone);
-
 
831
   
-
 
832
    /* Wait for reply from the FS server. */
829
    /* Wait for reply from the FS server. */
833
    ipcarg_t rc;
830
    ipcarg_t rc;
834
    async_wait_for(msg, &rc);
831
    async_wait_for(msg, &rc);
835
   
832
 
-
 
833
    vfs_release_phone(fs_phone);
836
    fibril_mutex_unlock(&file->lock);
834
    fibril_mutex_unlock(&file->lock);
837
   
835
   
838
    int retval = IPC_GET_ARG1(answer);
836
    int retval = IPC_GET_ARG1(answer);
839
    if (retval != EOK)
837
    if (retval != EOK)
840
        ipc_answer_0(rid, retval);
838
        ipc_answer_0(rid, retval);
Line 921... Line 919...
921
     * ourselves. Note that call arguments are immutable in this case so we
919
     * ourselves. Note that call arguments are immutable in this case so we
922
     * don't have to bother.
920
     * don't have to bother.
923
     */
921
     */
924
    ipc_forward_fast(callid, fs_phone, 0, 0, 0, IPC_FF_ROUTE_FROM_ME);
922
    ipc_forward_fast(callid, fs_phone, 0, 0, 0, IPC_FF_ROUTE_FROM_ME);
925
 
923
 
926
    vfs_release_phone(fs_phone);
-
 
927
   
-
 
928
    /* Wait for reply from the FS server. */
924
    /* Wait for reply from the FS server. */
929
    ipcarg_t rc;
925
    ipcarg_t rc;
930
    async_wait_for(msg, &rc);
926
    async_wait_for(msg, &rc);
931
   
927
   
-
 
928
    vfs_release_phone(fs_phone);
-
 
929
   
932
    size_t bytes = IPC_GET_ARG1(answer);
930
    size_t bytes = IPC_GET_ARG1(answer);
933
 
931
 
934
    if (file->node->type == VFS_NODE_DIRECTORY)
932
    if (file->node->type == VFS_NODE_DIRECTORY)
935
        fibril_rwlock_read_unlock(&namespace_rwlock);
933
        fibril_rwlock_read_unlock(&namespace_rwlock);
936
   
934