Changeset a92da0a in mainline


Ignore:
Timestamp:
2007-12-23T21:46:52Z (16 years ago)
Author:
Jakub Jermar <jakub@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
7dab6b8
Parents:
a55d5f9f
Message:

Reimplement VFS_READ using IPC_M_DATA_READ.

Location:
uspace
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • uspace/lib/libc/generic/ipc.c

    ra55d5f9f ra92da0a  
    690690 * @param callid        Storage where the hash of the IPC_M_DATA_READ call will
    691691 *                      be stored.
    692  * @param size          Storage where the maximum size will be stored.
     692 * @param size          Storage where the maximum size will be stored. Can be
     693 *                      NULL.
    693694 *
    694695 * @return              Non-zero on success, zero on failure.
     
    703704        if (IPC_GET_METHOD(data) != IPC_M_DATA_READ)
    704705                return 0;
    705         assert(size);
    706         *size = (size_t) IPC_GET_ARG2(data);
     706        if (size)
     707                *size = (size_t) IPC_GET_ARG2(data);
    707708        return 1;
    708709}
  • uspace/srv/fs/tmpfs/tmpfs_ops.c

    ra55d5f9f ra92da0a  
    283283        unsigned long index = IPC_GET_ARG2(*request);
    284284        off_t pos = IPC_GET_ARG3(*request);
    285         size_t size = IPC_GET_ARG4(*request);
    286285
    287286        /*
     
    298297
    299298        /*
    300          * Receive the communication area.
     299         * Receive the read request.
    301300         */
    302301        ipc_callid_t callid;
    303         ipc_call_t call;
    304         callid = async_get_call(&call);
    305         if (IPC_GET_METHOD(call) != IPC_M_AS_AREA_SEND) {
     302        size_t size;
     303        if (!ipc_data_read_receive(&callid, size)) {
    306304                ipc_answer_0(callid, EINVAL);   
    307305                ipc_answer_0(rid, EINVAL);
     
    309307        }
    310308
    311         int flags = IPC_GET_ARG3(call);
    312         if (!(flags & AS_AREA_WRITE)) {
    313                 ipc_answer_0(callid, EINVAL);
    314                 ipc_answer_0(rid, EINVAL);
    315                 return;
    316         }
    317         size_t sz = IPC_GET_ARG2(call);
    318         uint8_t *buf = as_get_mappable_page(sz);
    319         if (!buf) {
    320                 ipc_answer_0(callid, ENOMEM);
    321                 ipc_answer_0(rid, ENOMEM);
    322                 return;
    323         }
    324         ipc_answer_1(callid, EOK, buf);         /* commit to share the area */
    325 
    326309        size_t bytes = max(0, min(dentry->size - pos, size));
    327         memcpy(buf, dentry->data + pos, bytes);
    328 
    329         (void) as_area_destroy(buf);
    330 
    331         ipc_answer_1(rid, EOK, bytes);
     310        (void) ipc_data_read_deliver(callid, dentry->data + pos, bytes);
    332311}
    333312
  • uspace/srv/vfs/vfs_read.c

    ra55d5f9f ra92da0a  
    5454         */
    5555
    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 
    6256        int fd = IPC_GET_ARG1(*request);
    63         size_t size = IPC_GET_ARG2(*request);
    6457
    6558        /*
     
    7366
    7467        /*
    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.
    7669         */
    7770        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)) {
    8172                ipc_answer_0(callid, EINVAL);
    8273                ipc_answer_0(rid, EINVAL);
     
    9182        aid_t msg;
    9283        ipc_call_t answer;
    93         msg = async_send_4(fs_phone, VFS_READ, file->node->dev_handle,
    94             file->node->index, file->pos, size, &answer);
     84        msg = async_send_3(fs_phone, VFS_READ, file->node->dev_handle,
     85            file->node->index, file->pos, &answer);
    9586       
    9687        /*
    97          * Forward the address space area offer to the destination FS server.
    98          * The call will be routed as if sent by ourselves.
     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.
    9991         */
    100         ipc_forward_fast(callid, fs_phone, IPC_GET_METHOD(call),
    101             IPC_GET_ARG1(call), 0, IPC_FF_ROUTE_FROM_ME);
     92        ipc_forward_fast(callid, fs_phone, 0, 0, 0, IPC_FF_ROUTE_FROM_ME);
    10293
    10394        vfs_release_phone(fs_phone);
Note: See TracChangeset for help on using the changeset viewer.