Changeset ee1b8ca in mainline for uspace/srv/vfs/vfs_rdwr.c


Ignore:
Timestamp:
2007-12-25T20:02:25Z (17 years ago)
Author:
Jakub Jermar <jakub@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
c1bf5cb
Parents:
1356a04c
Message:

VFS and TMPFS support for VFS_WRITE.

File:
1 moved

Legend:

Unmodified
Added
Removed
  • uspace/srv/vfs/vfs_rdwr.c

    r1356a04c ree1b8ca  
    3232
    3333/**
    34  * @file        vfs_read.c
     34 * @file        vfs_rdwr.c
    3535 * @brief
    3636 */
     
    4141#include <errno.h>
    4242
    43 void vfs_read(ipc_callid_t rid, ipc_call_t *request)
     43static void vfs_rdwr(ipc_callid_t rid, ipc_call_t *request, bool read)
    4444{
    4545
     
    6666
    6767        /*
    68          * Now we need to receive a call with client's IPC_M_DATA_READ request.
     68         * Now we need to receive a call with client's
     69         * IPC_M_DATA_READ/IPC_M_DATA_WRITE request.
    6970         */
    7071        ipc_callid_t callid;
    71         if (!ipc_data_read_receive(&callid, NULL)) {
     72        int res;
     73        if (read)
     74                res = ipc_data_read_receive(&callid, NULL);
     75        else
     76                res = ipc_data_write_receive(&callid, NULL, NULL);
     77        if (!res) {
    7278                ipc_answer_0(callid, EINVAL);
    7379                ipc_answer_0(rid, EINVAL);
     
    7884       
    7985        /*
    80          * Make a VFS_READ request at the destination FS server.
     86         * Make a VFS_READ/VFS_WRITE request at the destination FS server.
    8187         */
    8288        aid_t msg;
    8389        ipc_call_t answer;
    84         msg = async_send_3(fs_phone, VFS_READ, file->node->dev_handle,
    85             file->node->index, file->pos, &answer);
     90        msg = async_send_3(fs_phone, IPC_GET_METHOD(*request),
     91            file->node->dev_handle, file->node->index, file->pos, &answer);
    8692       
    8793        /*
    88          * Forward the IPC_M_DATA_READ request to the destination FS server.
    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.
     94         * Forward the IPC_M_DATA_READ/IPC_M_DATA_WRITE request to the
     95         * destination FS server. The call will be routed as if sent by
     96         * ourselves. Note that call arguments are immutable in this case so we
     97         * don't have to bother.
    9198         */
    9299        ipc_forward_fast(callid, fs_phone, 0, 0, 0, IPC_FF_ROUTE_FROM_ME);
     
    113120}
    114121
     122
     123void vfs_read(ipc_callid_t rid, ipc_call_t *request)
     124{
     125        vfs_rdwr(rid, request, true);
     126}
     127
     128void vfs_write(ipc_callid_t rid, ipc_call_t *request)
     129{
     130        vfs_rdwr(rid, request, false);
     131}
     132
    115133/**
    116134 * @}
Note: See TracChangeset for help on using the changeset viewer.