Ignore:
File:
1 edited

Legend:

Unmodified
Added
Removed
  • uspace/lib/libfs/libfs.c

    red903174 rc888102  
    3737#include "libfs.h"
    3838#include "../../srv/vfs/vfs.h"
    39 #include <macros.h>
    4039#include <errno.h>
    4140#include <async.h>
     
    162161        /* Accept the phone */
    163162        callid = async_get_call(&call);
    164         int mountee_phone = (int) IPC_GET_ARG1(call);
     163        int mountee_phone = (int)IPC_GET_ARG1(call);
    165164        if ((IPC_GET_METHOD(call) != IPC_M_CONNECTION_CLONE) ||
    166165            (mountee_phone < 0)) {
     
    173172        ipc_answer_0(callid, EOK);
    174173       
     174        res = async_data_write_receive(&callid, NULL);
     175        if (!res) {
     176                ipc_hangup(mountee_phone);
     177                ipc_answer_0(callid, EINVAL);
     178                ipc_answer_0(rid, EINVAL);
     179                return;
     180        }
     181       
    175182        fs_node_t *fn;
    176183        res = ops->node_get(&fn, mp_dev_handle, mp_fs_index);
    177184        if ((res != EOK) || (!fn)) {
    178185                ipc_hangup(mountee_phone);
    179                 async_data_write_void(combine_rc(res, ENOENT));
     186                ipc_answer_0(callid, combine_rc(res, ENOENT));
    180187                ipc_answer_0(rid, combine_rc(res, ENOENT));
    181188                return;
     
    185192                ipc_hangup(mountee_phone);
    186193                (void) ops->node_put(fn);
    187                 async_data_write_void(EBUSY);
     194                ipc_answer_0(callid, EBUSY);
    188195                ipc_answer_0(rid, EBUSY);
    189196                return;
     
    194201                ipc_hangup(mountee_phone);
    195202                (void) ops->node_put(fn);
    196                 async_data_write_void(rc);
     203                ipc_answer_0(callid, rc);
    197204                ipc_answer_0(rid, rc);
    198205                return;
     
    200207       
    201208        ipc_call_t answer;
    202         rc = async_data_write_forward_1_1(mountee_phone, VFS_OUT_MOUNTED,
    203             mr_dev_handle, &answer);
     209        aid_t msg = async_send_1(mountee_phone, VFS_OUT_MOUNTED, mr_dev_handle,
     210            &answer);
     211        ipc_forward_fast(callid, mountee_phone, 0, 0, 0, IPC_FF_ROUTE_FROM_ME);
     212        async_wait_for(msg, &rc);
    204213       
    205214        if (rc == EOK) {
     
    399408                                                ipc_answer_0(rid, rc);
    400409                                        } else {
    401                                                 aoff64_t size = ops->size_get(fn);
    402                                                 ipc_answer_5(rid, fs_handle,
    403                                                     dev_handle,
     410                                                ipc_answer_5(rid, EOK,
     411                                                    fs_handle, dev_handle,
    404412                                                    ops->index_get(fn),
    405                                                     LOWER32(size),
    406                                                     UPPER32(size),
     413                                                    ops->size_get(fn),
    407414                                                    ops->lnkcnt_get(fn));
    408415                                                (void) ops->node_put(fn);
     
    481488                                        ipc_answer_0(rid, rc);
    482489                                } else {
    483                                         aoff64_t size = ops->size_get(fn);
    484                                         ipc_answer_5(rid, fs_handle,
    485                                             dev_handle,
     490                                        ipc_answer_5(rid, EOK,
     491                                            fs_handle, dev_handle,
    486492                                            ops->index_get(fn),
    487                                             LOWER32(size),
    488                                             UPPER32(size),
     493                                            ops->size_get(fn),
    489494                                            ops->lnkcnt_get(fn));
    490495                                        (void) ops->node_put(fn);
     
    506511                unsigned int old_lnkcnt = ops->lnkcnt_get(cur);
    507512                rc = ops->unlink(par, cur, component);
    508                
    509                 if (rc == EOK) {
    510                         aoff64_t size = ops->size_get(cur);
    511                         ipc_answer_5(rid, fs_handle, dev_handle,
    512                             ops->index_get(cur), LOWER32(size), UPPER32(size),
    513                             old_lnkcnt);
    514                 } else
    515                         ipc_answer_0(rid, rc);
    516                
     513                ipc_answer_5(rid, (ipcarg_t) rc, fs_handle, dev_handle,
     514                    ops->index_get(cur), ops->size_get(cur), old_lnkcnt);
    517515                goto out;
    518516        }
     
    545543                        rc = ops->node_open(cur);
    546544               
    547                 if (rc == EOK) {
    548                         aoff64_t size = ops->size_get(cur);
    549                         ipc_answer_5(rid, fs_handle, dev_handle,
    550                             ops->index_get(cur), LOWER32(size), UPPER32(size),
    551                             ops->lnkcnt_get(cur));
    552                 } else
    553                         ipc_answer_0(rid, rc);
    554                
     545                ipc_answer_5(rid, rc, fs_handle, dev_handle,
     546                    ops->index_get(cur), ops->size_get(cur),
     547                    ops->lnkcnt_get(cur));
    555548        } else
    556549                ipc_answer_0(rid, rc);
     
    619612        dev_handle_t dev_handle = IPC_GET_ARG1(*request);
    620613        fs_index_t index = IPC_GET_ARG2(*request);
    621        
    622614        fs_node_t *fn;
    623         int rc = ops->node_get(&fn, dev_handle, index);
     615        int rc;
     616       
     617        rc = ops->node_get(&fn, dev_handle, index);
    624618        on_error(rc, answer_and_return(rid, rc));
    625619       
     
    630624       
    631625        rc = ops->node_open(fn);
    632         aoff64_t size = ops->size_get(fn);
    633         ipc_answer_4(rid, rc, LOWER32(size), UPPER32(size), ops->lnkcnt_get(fn),
     626        ipc_answer_3(rid, rc, ops->size_get(fn), ops->lnkcnt_get(fn),
    634627            (ops->is_file(fn) ? L_FILE : 0) | (ops->is_directory(fn) ? L_DIRECTORY : 0));
    635628       
Note: See TracChangeset for help on using the changeset viewer.