Subversion Repositories HelenOS

Rev

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

Rev 2635 Rev 2658
Line 47... Line 47...
47
     * The following code strongly depends on the fact that the files data
47
     * The following code strongly depends on the fact that the files data
48
     * structure can be only accessed by a single fibril and all file
48
     * structure can be only accessed by a single fibril and all file
49
     * operations are serialized (i.e. the reads and writes cannot
49
     * operations are serialized (i.e. the reads and writes cannot
50
     * interleave and a file cannot be closed while it is being read).
50
     * interleave and a file cannot be closed while it is being read).
51
     *
51
     *
52
     * Additional synchronization needs to be added once table table of
52
     * Additional synchronization needs to be added once the table of
53
     * open files supports parallel access!
53
     * open files supports parallel access!
54
     */
54
     */
55
 
55
 
56
    /*
56
    /*
57
     * Because we don't support the receive analogy of IPC_M_DATA_SEND,
57
     * Because we don't support the receive analogy of IPC_M_DATA_SEND,
58
     * VFS_READ is emulutating its behavior via sharing an address space
58
     * VFS_READ is emulutating its behavior via sharing an address space
59
     * area.
59
     * area.
60
     */
60
     */
61
 
61
 
62
    int fd = IPC_GET_ARG1(*request);
62
    int fd = IPC_GET_ARG1(*request);
-
 
63
    size_t size = IPC_GET_ARG2(*request);
63
 
64
 
64
    /*
65
    /*
65
     * Lookup the file structure corresponding to the file descriptor.
66
     * Lookup the file structure corresponding to the file descriptor.
66
     */
67
     */
67
    vfs_file_t *file = vfs_file_get(fd);
68
    vfs_file_t *file = vfs_file_get(fd);
Line 86... Line 87...
86
   
87
   
87
    /*
88
    /*
88
     * Make a VFS_READ request at the destination FS server.
89
     * Make a VFS_READ request at the destination FS server.
89
     */
90
     */
90
    aid_t msg;
91
    aid_t msg;
-
 
92
    ipc_call_t answer;
91
    msg = async_send_3(fs_phone, VFS_READ, file->node->dev_handle,
93
    msg = async_send_4(fs_phone, VFS_READ, file->node->dev_handle,
92
        file->node->index, file->pos, NULL);
94
        file->node->index, file->pos, size, &answer);
93
   
95
   
94
    /*
96
    /*
95
     * Forward the address space area offer to the destination FS server.
97
     * Forward the address space area offer to the destination FS server.
96
     * The call will be routed as if sent by ourselves.
98
     * The call will be routed as if sent by ourselves.
97
     */
99
     */
Line 103... Line 105...
103
    /*
105
    /*
104
     * Wait for reply from the FS server.
106
     * Wait for reply from the FS server.
105
     */
107
     */
106
    ipcarg_t rc;
108
    ipcarg_t rc;
107
    async_wait_for(msg, &rc);
109
    async_wait_for(msg, &rc);
-
 
110
    size_t bytes = IPC_GET_ARG1(answer);
108
 
111
 
109
    /*
112
    /*
110
     * FS server's reply is the final result of the whole operation we
113
     * FS server's reply is the final result of the whole operation we
111
     * return to the client.
114
     * return to the client.
112
     */
115
     */
113
    ipc_answer_0(rid, rc);
116
    ipc_answer_1(rid, rc, bytes);
114
}
117
}
115
 
118
 
116
/**
119
/**
117
 * @}
120
 * @}
118
 */
121
 */