Subversion Repositories HelenOS

Rev

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

Rev 2659 Rev 2663
Line 51... Line 51...
51
     *
51
     *
52
     * Additional synchronization needs to be added once the 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
    /*
-
 
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
-
 
59
     * area.
-
 
60
     */
-
 
61
 
-
 
62
    int fd = IPC_GET_ARG1(*request);
56
    int fd = IPC_GET_ARG1(*request);
63
    size_t size = IPC_GET_ARG2(*request);
-
 
64
 
57
 
65
    /*
58
    /*
66
     * Lookup the file structure corresponding to the file descriptor.
59
     * Lookup the file structure corresponding to the file descriptor.
67
     */
60
     */
68
    vfs_file_t *file = vfs_file_get(fd);
61
    vfs_file_t *file = vfs_file_get(fd);
Line 70... Line 63...
70
        ipc_answer_0(rid, ENOENT);
63
        ipc_answer_0(rid, ENOENT);
71
        return;
64
        return;
72
    }
65
    }
73
 
66
 
74
    /*
67
    /*
75
     * Now we need to receive a call with client's address space area.
68
     * Now we need to receive a call with client's IPC_M_DATA_READ request.
76
     */
69
     */
77
    ipc_callid_t callid;
70
    ipc_callid_t callid;
78
    ipc_call_t call;
-
 
79
    callid = async_get_call(&call);
-
 
80
    if (IPC_GET_METHOD(call) != IPC_M_AS_AREA_SEND) {
71
    if (!ipc_data_read_receive(&callid, NULL)) {
81
        ipc_answer_0(callid, EINVAL);
72
        ipc_answer_0(callid, EINVAL);
82
        ipc_answer_0(rid, EINVAL);
73
        ipc_answer_0(rid, EINVAL);
83
        return;
74
        return;
84
    }
75
    }
85
 
76
 
Line 88... Line 79...
88
    /*
79
    /*
89
     * Make a VFS_READ request at the destination FS server.
80
     * Make a VFS_READ request at the destination FS server.
90
     */
81
     */
91
    aid_t msg;
82
    aid_t msg;
92
    ipc_call_t answer;
83
    ipc_call_t answer;
93
    msg = async_send_4(fs_phone, VFS_READ, file->node->dev_handle,
84
    msg = async_send_3(fs_phone, VFS_READ, file->node->dev_handle,
94
        file->node->index, file->pos, size, &answer);
85
        file->node->index, file->pos, &answer);
95
   
86
   
96
    /*
87
    /*
97
     * Forward the address space area offer to the destination FS server.
88
     * Forward the IPC_M_DATA_READ request to the destination FS server.
98
     * The call will be routed as if sent by ourselves.
89
     * The call will be routed as if sent by ourselves. Note that call
-
 
90
     * arguments are immutable in this case so we don't have to bother.
99
     */
91
     */
100
    ipc_forward_fast(callid, fs_phone, IPC_GET_METHOD(call),
92
    ipc_forward_fast(callid, fs_phone, 0, 0, 0, IPC_FF_ROUTE_FROM_ME);
101
        IPC_GET_ARG1(call), 0, IPC_FF_ROUTE_FROM_ME);
-
 
102
 
93
 
103
    vfs_release_phone(fs_phone);
94
    vfs_release_phone(fs_phone);
104
 
95
 
105
    /*
96
    /*
106
     * Wait for reply from the FS server.
97
     * Wait for reply from the FS server.