Changeset 79ae36dd in mainline for uspace/lib/fs/libfs.c
- Timestamp:
- 2011-06-08T19:01:55Z (14 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- 0eff68e
- Parents:
- 764d71e
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/lib/fs/libfs.c
r764d71e r79ae36dd 67 67 * code. 68 68 * 69 * @param vfs_phone Open phonefor communication with VFS.70 * @param reg 71 * 72 * @param info 73 * 74 * @param conn 75 * 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. 76 76 * 77 77 * @return EOK on success or a non-zero error code on errror. 78 78 * 79 79 */ 80 int fs_register( int vfs_phone, fs_reg_t *reg, vfs_info_t *info,80 int fs_register(async_sess_t *sess, fs_reg_t *reg, vfs_info_t *info, 81 81 async_client_conn_t conn) 82 82 { … … 86 86 * out-of-order, when it knows that the operation succeeded or failed. 87 87 */ 88 89 async_exch_t *exch = async_exchange_begin(sess); 90 88 91 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); 90 93 91 94 /* 92 95 * Send our VFS info structure to VFS. 93 96 */ 94 int rc = async_data_write_start(vfs_phone, info, sizeof(*info)); 97 int rc = async_data_write_start(exch, info, sizeof(*info)); 98 95 99 if (rc != EOK) { 100 async_exchange_end(exch); 96 101 async_wait_for(req, NULL); 97 102 return rc; … … 101 106 * Ask VFS for callback connection. 102 107 */ 103 async_connect_to_me( vfs_phone, 0, 0, 0, conn);108 async_connect_to_me(exch, 0, 0, 0, conn); 104 109 105 110 /* … … 108 113 reg->plb_ro = as_get_mappable_page(PLB_SIZE); 109 114 if (!reg->plb_ro) { 115 async_exchange_end(exch); 110 116 async_wait_for(req, NULL); 111 117 return ENOMEM; … … 115 121 * Request sharing the Path Lookup Buffer with VFS. 116 122 */ 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 118 127 if (rc) { 119 128 async_wait_for(req, NULL); … … 148 157 fs_handle_t mr_fs_handle = (fs_handle_t) IPC_GET_ARG3(*request); 149 158 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) { 162 162 async_answer_0(rid, EINVAL); 163 163 return; 164 164 } 165 165 166 /* Acknowledge the mountee_phone */167 async_answer_0(callid, EOK);168 169 166 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); 171 168 if ((res != EOK) || (!fn)) { 172 async_hangup(mountee_ phone);169 async_hangup(mountee_sess); 173 170 async_data_write_void(combine_rc(res, ENOENT)); 174 171 async_answer_0(rid, combine_rc(res, ENOENT)); … … 177 174 178 175 if (fn->mp_data.mp_active) { 179 async_hangup(mountee_ phone);176 async_hangup(mountee_sess); 180 177 (void) ops->node_put(fn); 181 178 async_data_write_void(EBUSY); … … 184 181 } 185 182 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); 189 189 (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); 192 192 return; 193 193 } 194 194 195 195 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, 197 197 mr_devmap_handle, &answer); 198 async_exchange_end(exch); 198 199 199 200 if (rc == EOK) { … … 201 202 fn->mp_data.fs_handle = mr_fs_handle; 202 203 fn->mp_data.devmap_handle = mr_devmap_handle; 203 fn->mp_data. phone = mountee_phone;204 fn->mp_data.sess = mountee_sess; 204 205 } 205 206 … … 236 237 * Tell the mounted file system to unmount. 237 238 */ 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); 240 242 241 243 /* … … 243 245 */ 244 246 if (res == EOK) { 245 async_hangup(fn->mp_data. phone);247 async_hangup(fn->mp_data.sess); 246 248 fn->mp_data.mp_active = false; 247 249 fn->mp_data.fs_handle = 0; 248 250 fn->mp_data.devmap_handle = 0; 249 fn->mp_data.phone = 0; 251 fn->mp_data.sess = NULL; 252 250 253 /* Drop the reference created in libfs_mount(). */ 251 254 (void) ops->node_put(fn); … … 293 296 294 297 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 298 303 (void) ops->node_put(cur); 299 304 return; … … 351 356 next--; 352 357 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 356 364 (void) ops->node_put(cur); 357 365 (void) ops->node_put(tmp);
Note:
See TracChangeset
for help on using the changeset viewer.