Changes in uspace/lib/fs/libfs.c [79ae36dd:b946bf83] in mainline
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/lib/fs/libfs.c
r79ae36dd rb946bf83 67 67 * code. 68 68 * 69 * @param sess Sessionfor communication with VFS.70 * @param reg File system registration structure. It will be71 * initialized by this function.72 * @param info VFS info structure supplied by the file system73 * implementation.74 * @param conn Connection fibril for handling all calls originating in75 * 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. 76 76 * 77 77 * @return EOK on success or a non-zero error code on errror. 78 78 * 79 79 */ 80 int fs_register( async_sess_t *sess, fs_reg_t *reg, vfs_info_t *info,80 int fs_register(int vfs_phone, 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 91 88 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); 93 90 94 91 /* 95 92 * Send our VFS info structure to VFS. 96 93 */ 97 int rc = async_data_write_start(exch, info, sizeof(*info)); 98 94 int rc = async_data_write_start(vfs_phone, info, sizeof(*info)); 99 95 if (rc != EOK) { 100 async_exchange_end(exch);101 96 async_wait_for(req, NULL); 102 97 return rc; … … 106 101 * Ask VFS for callback connection. 107 102 */ 108 async_connect_to_me( exch, 0, 0, 0, conn);103 async_connect_to_me(vfs_phone, 0, 0, 0, conn); 109 104 110 105 /* … … 113 108 reg->plb_ro = as_get_mappable_page(PLB_SIZE); 114 109 if (!reg->plb_ro) { 115 async_exchange_end(exch);116 110 async_wait_for(req, NULL); 117 111 return ENOMEM; … … 121 115 * Request sharing the Path Lookup Buffer with VFS. 122 116 */ 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); 127 118 if (rc) { 128 119 async_wait_for(req, NULL); … … 157 148 fs_handle_t mr_fs_handle = (fs_handle_t) IPC_GET_ARG3(*request); 158 149 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); 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 166 169 fs_node_t *fn; 167 intres = ops->node_get(&fn, mp_devmap_handle, mp_fs_index);170 res = ops->node_get(&fn, mp_devmap_handle, mp_fs_index); 168 171 if ((res != EOK) || (!fn)) { 169 async_hangup(mountee_ sess);172 async_hangup(mountee_phone); 170 173 async_data_write_void(combine_rc(res, ENOENT)); 171 174 async_answer_0(rid, combine_rc(res, ENOENT)); … … 174 177 175 178 if (fn->mp_data.mp_active) { 176 async_hangup(mountee_ sess);179 async_hangup(mountee_phone); 177 180 (void) ops->node_put(fn); 178 181 async_data_write_void(EBUSY); … … 181 184 } 182 185 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); 189 189 (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); 192 192 return; 193 193 } 194 194 195 195 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, 197 197 mr_devmap_handle, &answer); 198 async_exchange_end(exch);199 198 200 199 if (rc == EOK) { … … 202 201 fn->mp_data.fs_handle = mr_fs_handle; 203 202 fn->mp_data.devmap_handle = mr_devmap_handle; 204 fn->mp_data. sess = mountee_sess;203 fn->mp_data.phone = mountee_phone; 205 204 } 206 205 … … 237 236 * Tell the mounted file system to unmount. 238 237 */ 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); 242 240 243 241 /* … … 245 243 */ 246 244 if (res == EOK) { 247 async_hangup(fn->mp_data. sess);245 async_hangup(fn->mp_data.phone); 248 246 fn->mp_data.mp_active = false; 249 247 fn->mp_data.fs_handle = 0; 250 248 fn->mp_data.devmap_handle = 0; 251 fn->mp_data.sess = NULL; 252 249 fn->mp_data.phone = 0; 253 250 /* Drop the reference created in libfs_mount(). */ 254 251 (void) ops->node_put(fn); … … 296 293 297 294 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); 303 298 (void) ops->node_put(cur); 304 299 return; … … 356 351 next--; 357 352 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); 364 356 (void) ops->node_put(cur); 365 357 (void) ops->node_put(tmp);
Note:
See TracChangeset
for help on using the changeset viewer.