Changes in uspace/lib/fs/libfs.c [9934f7d:b946bf83] in mainline


Ignore:
File:
1 edited

Legend:

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

    r9934f7d rb946bf83  
    6767 * code.
    6868 *
    69  * @param sess Session for communication with VFS.
    70  * @param reg  File system registration structure. It will be
    71  *             initialized by this function.
    72  * @param info VFS info structure supplied by the file system
    73  *             implementation.
    74  * @param conn Connection fibril for handling all calls originating in
    75  *             VFS.
     69 * @param vfs_phone Open phone for communication with VFS.
     70 * @param reg       File system registration structure. It will be
     71 *                  initialized by this function.
     72 * @param info      VFS info structure supplied by the file system
     73 *                  implementation.
     74 * @param conn      Connection fibril for handling all calls originating in
     75 *                  VFS.
    7676 *
    7777 * @return EOK on success or a non-zero error code on errror.
    7878 *
    7979 */
    80 int fs_register(async_sess_t *sess, fs_reg_t *reg, vfs_info_t *info,
     80int fs_register(int vfs_phone, fs_reg_t *reg, vfs_info_t *info,
    8181    async_client_conn_t conn)
    8282{
     
    8686         * out-of-order, when it knows that the operation succeeded or failed.
    8787         */
    88        
    89         async_exch_t *exch = async_exchange_begin(sess);
    90        
    9188        ipc_call_t answer;
    92         aid_t req = async_send_0(exch, VFS_IN_REGISTER, &answer);
     89        aid_t req = async_send_0(vfs_phone, VFS_IN_REGISTER, &answer);
    9390       
    9491        /*
    9592         * Send our VFS info structure to VFS.
    9693         */
    97         int rc = async_data_write_start(exch, info, sizeof(*info));
    98        
     94        int rc = async_data_write_start(vfs_phone, info, sizeof(*info));
    9995        if (rc != EOK) {
    100                 async_exchange_end(exch);
    10196                async_wait_for(req, NULL);
    10297                return rc;
     
    106101         * Ask VFS for callback connection.
    107102         */
    108         async_connect_to_me(exch, 0, 0, 0, conn, NULL);
     103        async_connect_to_me(vfs_phone, 0, 0, 0, conn);
    109104       
    110105        /*
     
    113108        reg->plb_ro = as_get_mappable_page(PLB_SIZE);
    114109        if (!reg->plb_ro) {
    115                 async_exchange_end(exch);
    116110                async_wait_for(req, NULL);
    117111                return ENOMEM;
     
    121115         * Request sharing the Path Lookup Buffer with VFS.
    122116         */
    123         rc = async_share_in_start_0_0(exch, reg->plb_ro, PLB_SIZE);
    124        
    125         async_exchange_end(exch);
    126        
     117        rc = async_share_in_start_0_0(vfs_phone, reg->plb_ro, PLB_SIZE);
    127118        if (rc) {
    128119                async_wait_for(req, NULL);
     
    157148        fs_handle_t mr_fs_handle = (fs_handle_t) IPC_GET_ARG3(*request);
    158149        devmap_handle_t mr_devmap_handle = (devmap_handle_t) IPC_GET_ARG4(*request);
    159        
    160         async_sess_t *mountee_sess = async_clone_receive(EXCHANGE_PARALLEL);
    161         if (mountee_sess == NULL) {
     150        int res;
     151        sysarg_t rc;
     152       
     153        ipc_call_t call;
     154        ipc_callid_t callid;
     155       
     156        /* Accept the phone */
     157        callid = async_get_call(&call);
     158        int mountee_phone = (int) IPC_GET_ARG1(call);
     159        if ((IPC_GET_IMETHOD(call) != IPC_M_CONNECTION_CLONE) ||
     160            (mountee_phone < 0)) {
     161                async_answer_0(callid, EINVAL);
    162162                async_answer_0(rid, EINVAL);
    163163                return;
    164164        }
    165165       
     166        /* Acknowledge the mountee_phone */
     167        async_answer_0(callid, EOK);
     168       
    166169        fs_node_t *fn;
    167         int res = ops->node_get(&fn, mp_devmap_handle, mp_fs_index);
     170        res = ops->node_get(&fn, mp_devmap_handle, mp_fs_index);
    168171        if ((res != EOK) || (!fn)) {
    169                 async_hangup(mountee_sess);
     172                async_hangup(mountee_phone);
    170173                async_data_write_void(combine_rc(res, ENOENT));
    171174                async_answer_0(rid, combine_rc(res, ENOENT));
     
    174177       
    175178        if (fn->mp_data.mp_active) {
    176                 async_hangup(mountee_sess);
     179                async_hangup(mountee_phone);
    177180                (void) ops->node_put(fn);
    178181                async_data_write_void(EBUSY);
     
    181184        }
    182185       
    183         async_exch_t *exch = async_exchange_begin(mountee_sess);
    184         async_sess_t *sess = async_connect_me(EXCHANGE_PARALLEL, exch);
    185        
    186         if (!sess) {
    187                 async_exchange_end(exch);
    188                 async_hangup(mountee_sess);
     186        rc = async_req_0_0(mountee_phone, IPC_M_CONNECT_ME);
     187        if (rc != EOK) {
     188                async_hangup(mountee_phone);
    189189                (void) ops->node_put(fn);
    190                 async_data_write_void(errno);
    191                 async_answer_0(rid, errno);
     190                async_data_write_void(rc);
     191                async_answer_0(rid, rc);
    192192                return;
    193193        }
    194194       
    195195        ipc_call_t answer;
    196         int rc = async_data_write_forward_1_1(exch, VFS_OUT_MOUNTED,
     196        rc = async_data_write_forward_1_1(mountee_phone, VFS_OUT_MOUNTED,
    197197            mr_devmap_handle, &answer);
    198         async_exchange_end(exch);
    199198       
    200199        if (rc == EOK) {
     
    202201                fn->mp_data.fs_handle = mr_fs_handle;
    203202                fn->mp_data.devmap_handle = mr_devmap_handle;
    204                 fn->mp_data.sess = mountee_sess;
     203                fn->mp_data.phone = mountee_phone;
    205204        }
    206205       
     
    237236         * Tell the mounted file system to unmount.
    238237         */
    239         async_exch_t *exch = async_exchange_begin(fn->mp_data.sess);
    240         res = async_req_1_0(exch, VFS_OUT_UNMOUNTED, fn->mp_data.devmap_handle);
    241         async_exchange_end(exch);
     238        res = async_req_1_0(fn->mp_data.phone, VFS_OUT_UNMOUNTED,
     239            fn->mp_data.devmap_handle);
    242240
    243241        /*
     
    245243         */
    246244        if (res == EOK) {
    247                 async_hangup(fn->mp_data.sess);
     245                async_hangup(fn->mp_data.phone);
    248246                fn->mp_data.mp_active = false;
    249247                fn->mp_data.fs_handle = 0;
    250248                fn->mp_data.devmap_handle = 0;
    251                 fn->mp_data.sess = NULL;
    252                
     249                fn->mp_data.phone = 0;
    253250                /* Drop the reference created in libfs_mount(). */
    254251                (void) ops->node_put(fn);
     
    296293       
    297294        if (cur->mp_data.mp_active) {
    298                 async_exch_t *exch = async_exchange_begin(cur->mp_data.sess);
    299                 async_forward_slow(rid, exch, VFS_OUT_LOOKUP, next, last,
    300                     cur->mp_data.devmap_handle, lflag, index, IPC_FF_ROUTE_FROM_ME);
    301                 async_exchange_end(exch);
    302                
     295                async_forward_slow(rid, cur->mp_data.phone, VFS_OUT_LOOKUP,
     296                    next, last, cur->mp_data.devmap_handle, lflag, index,
     297                    IPC_FF_ROUTE_FROM_ME);
    303298                (void) ops->node_put(cur);
    304299                return;
     
    356351                                next--;
    357352                       
    358                         async_exch_t *exch = async_exchange_begin(tmp->mp_data.sess);
    359                         async_forward_slow(rid, exch, VFS_OUT_LOOKUP, next, last,
    360                             tmp->mp_data.devmap_handle, lflag, index,
    361                             IPC_FF_ROUTE_FROM_ME);
    362                         async_exchange_end(exch);
    363                        
     353                        async_forward_slow(rid, tmp->mp_data.phone,
     354                            VFS_OUT_LOOKUP, next, last, tmp->mp_data.devmap_handle,
     355                            lflag, index, IPC_FF_ROUTE_FROM_ME);
    364356                        (void) ops->node_put(cur);
    365357                        (void) ops->node_put(tmp);
Note: See TracChangeset for help on using the changeset viewer.