Changeset c028b22 in mainline for uspace/lib/fs/libfs.c


Ignore:
Timestamp:
2011-07-08T17:01:01Z (13 years ago)
Author:
Martin Sucha <sucha14@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
cc1a727
Parents:
4e36219 (diff), 026793d (diff)
Note: this is a merge changeset, the changes displayed below correspond to the merge itself.
Use the (diff) links above to see all the changes relative to each parent.
Message:

Merge mainline changes

File:
1 edited

Legend:

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

    r4e36219 rc028b22  
    6767 * code.
    6868 *
    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.
     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.
    7676 *
    7777 * @return EOK on success or a non-zero error code on errror.
    7878 *
    7979 */
    80 int fs_register(int vfs_phone, fs_reg_t *reg, vfs_info_t *info,
     80int fs_register(async_sess_t *sess, 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       
    8891        ipc_call_t answer;
    89         aid_t req = async_send_0(vfs_phone, VFS_IN_REGISTER, &answer);
     92        aid_t req = async_send_0(exch, VFS_IN_REGISTER, &answer);
    9093       
    9194        /*
    9295         * Send our VFS info structure to VFS.
    9396         */
    94         int rc = async_data_write_start(vfs_phone, info, sizeof(*info));
     97        int rc = async_data_write_start(exch, info, sizeof(*info));
     98       
    9599        if (rc != EOK) {
     100                async_exchange_end(exch);
    96101                async_wait_for(req, NULL);
    97102                return rc;
     
    101106         * Ask VFS for callback connection.
    102107         */
    103         async_connect_to_me(vfs_phone, 0, 0, 0, conn);
     108        async_connect_to_me(exch, 0, 0, 0, conn, NULL);
    104109       
    105110        /*
     
    108113        reg->plb_ro = as_get_mappable_page(PLB_SIZE);
    109114        if (!reg->plb_ro) {
     115                async_exchange_end(exch);
    110116                async_wait_for(req, NULL);
    111117                return ENOMEM;
     
    115121         * Request sharing the Path Lookup Buffer with VFS.
    116122         */
    117         rc = async_share_in_start_0_0(vfs_phone, reg->plb_ro, PLB_SIZE);
     123        rc = async_share_in_start_0_0(exch, reg->plb_ro, PLB_SIZE);
     124       
     125        async_exchange_end(exch);
     126       
    118127        if (rc) {
    119128                async_wait_for(req, NULL);
     
    148157        fs_handle_t mr_fs_handle = (fs_handle_t) IPC_GET_ARG3(*request);
    149158        devmap_handle_t mr_devmap_handle = (devmap_handle_t) IPC_GET_ARG4(*request);
    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);
     159       
     160        async_sess_t *mountee_sess = async_clone_receive(EXCHANGE_PARALLEL);
     161        if (mountee_sess == NULL) {
    162162                async_answer_0(rid, EINVAL);
    163163                return;
    164164        }
    165165       
    166         /* Acknowledge the mountee_phone */
    167         async_answer_0(callid, EOK);
    168        
    169166        fs_node_t *fn;
    170         res = ops->node_get(&fn, mp_devmap_handle, mp_fs_index);
     167        int res = ops->node_get(&fn, mp_devmap_handle, mp_fs_index);
    171168        if ((res != EOK) || (!fn)) {
    172                 async_hangup(mountee_phone);
     169                async_hangup(mountee_sess);
    173170                async_data_write_void(combine_rc(res, ENOENT));
    174171                async_answer_0(rid, combine_rc(res, ENOENT));
     
    177174       
    178175        if (fn->mp_data.mp_active) {
    179                 async_hangup(mountee_phone);
     176                async_hangup(mountee_sess);
    180177                (void) ops->node_put(fn);
    181178                async_data_write_void(EBUSY);
     
    184181        }
    185182       
    186         rc = async_req_0_0(mountee_phone, IPC_M_CONNECT_ME);
    187         if (rc != EOK) {
    188                 async_hangup(mountee_phone);
     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);
    189189                (void) ops->node_put(fn);
    190                 async_data_write_void(rc);
    191                 async_answer_0(rid, rc);
     190                async_data_write_void(errno);
     191                async_answer_0(rid, errno);
    192192                return;
    193193        }
    194194       
    195195        ipc_call_t answer;
    196         rc = async_data_write_forward_1_1(mountee_phone, VFS_OUT_MOUNTED,
     196        int rc = async_data_write_forward_1_1(exch, VFS_OUT_MOUNTED,
    197197            mr_devmap_handle, &answer);
     198        async_exchange_end(exch);
    198199       
    199200        if (rc == EOK) {
     
    201202                fn->mp_data.fs_handle = mr_fs_handle;
    202203                fn->mp_data.devmap_handle = mr_devmap_handle;
    203                 fn->mp_data.phone = mountee_phone;
     204                fn->mp_data.sess = mountee_sess;
    204205        }
    205206       
     
    236237         * Tell the mounted file system to unmount.
    237238         */
    238         res = async_req_1_0(fn->mp_data.phone, VFS_OUT_UNMOUNTED,
    239             fn->mp_data.devmap_handle);
     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);
    240242
    241243        /*
     
    243245         */
    244246        if (res == EOK) {
    245                 async_hangup(fn->mp_data.phone);
     247                async_hangup(fn->mp_data.sess);
    246248                fn->mp_data.mp_active = false;
    247249                fn->mp_data.fs_handle = 0;
    248250                fn->mp_data.devmap_handle = 0;
    249                 fn->mp_data.phone = 0;
     251                fn->mp_data.sess = NULL;
     252               
    250253                /* Drop the reference created in libfs_mount(). */
    251254                (void) ops->node_put(fn);
     
    293296       
    294297        if (cur->mp_data.mp_active) {
    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);
     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               
    298303                (void) ops->node_put(cur);
    299304                return;
     
    351356                                next--;
    352357                       
    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);
     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                       
    356364                        (void) ops->node_put(cur);
    357365                        (void) ops->node_put(tmp);
Note: See TracChangeset for help on using the changeset viewer.