Changes in uspace/lib/fs/libfs.c [228e490:b946bf83] in mainline
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/lib/fs/libfs.c
r228e490 rb946bf83 40 40 #include <errno.h> 41 41 #include <async.h> 42 #include <ipc/ipc.h>43 42 #include <as.h> 44 43 #include <assert.h> … … 58 57 #define answer_and_return(rid, rc) \ 59 58 do { \ 60 ipc_answer_0((rid), (rc)); \59 async_answer_0((rid), (rc)); \ 61 60 return; \ 62 61 } while (0) … … 102 101 * Ask VFS for callback connection. 103 102 */ 104 ipc_connect_to_me(vfs_phone, 0, 0, 0, ®->vfs_phonehash);103 async_connect_to_me(vfs_phone, 0, 0, 0, conn); 105 104 106 105 /* … … 127 126 async_wait_for(req, NULL); 128 127 reg->fs_handle = (int) IPC_GET_ARG1(answer); 129 130 /*131 * Create a connection fibril to handle the callback connection.132 */133 async_new_connection(reg->vfs_phonehash, 0, NULL, conn);134 128 135 129 /* … … 165 159 if ((IPC_GET_IMETHOD(call) != IPC_M_CONNECTION_CLONE) || 166 160 (mountee_phone < 0)) { 167 ipc_answer_0(callid, EINVAL);168 ipc_answer_0(rid, EINVAL);161 async_answer_0(callid, EINVAL); 162 async_answer_0(rid, EINVAL); 169 163 return; 170 164 } 171 165 172 166 /* Acknowledge the mountee_phone */ 173 ipc_answer_0(callid, EOK);167 async_answer_0(callid, EOK); 174 168 175 169 fs_node_t *fn; 176 170 res = ops->node_get(&fn, mp_devmap_handle, mp_fs_index); 177 171 if ((res != EOK) || (!fn)) { 178 ipc_hangup(mountee_phone);172 async_hangup(mountee_phone); 179 173 async_data_write_void(combine_rc(res, ENOENT)); 180 ipc_answer_0(rid, combine_rc(res, ENOENT));174 async_answer_0(rid, combine_rc(res, ENOENT)); 181 175 return; 182 176 } 183 177 184 178 if (fn->mp_data.mp_active) { 185 ipc_hangup(mountee_phone);179 async_hangup(mountee_phone); 186 180 (void) ops->node_put(fn); 187 181 async_data_write_void(EBUSY); 188 ipc_answer_0(rid, EBUSY);182 async_answer_0(rid, EBUSY); 189 183 return; 190 184 } … … 192 186 rc = async_req_0_0(mountee_phone, IPC_M_CONNECT_ME); 193 187 if (rc != EOK) { 194 ipc_hangup(mountee_phone);188 async_hangup(mountee_phone); 195 189 (void) ops->node_put(fn); 196 190 async_data_write_void(rc); 197 ipc_answer_0(rid, rc);191 async_answer_0(rid, rc); 198 192 return; 199 193 } … … 213 207 * Do not release the FS node so that it stays in memory. 214 208 */ 215 ipc_answer_3(rid, rc, IPC_GET_ARG1(answer), IPC_GET_ARG2(answer),209 async_answer_3(rid, rc, IPC_GET_ARG1(answer), IPC_GET_ARG2(answer), 216 210 IPC_GET_ARG3(answer)); 217 211 } … … 226 220 res = ops->node_get(&fn, mp_devmap_handle, mp_fs_index); 227 221 if ((res != EOK) || (!fn)) { 228 ipc_answer_0(rid, combine_rc(res, ENOENT));222 async_answer_0(rid, combine_rc(res, ENOENT)); 229 223 return; 230 224 } … … 235 229 if (!fn->mp_data.mp_active) { 236 230 (void) ops->node_put(fn); 237 ipc_answer_0(rid, EINVAL);231 async_answer_0(rid, EINVAL); 238 232 return; 239 233 } … … 249 243 */ 250 244 if (res == EOK) { 251 ipc_hangup(fn->mp_data.phone);245 async_hangup(fn->mp_data.phone); 252 246 fn->mp_data.mp_active = false; 253 247 fn->mp_data.fs_handle = 0; … … 259 253 260 254 (void) ops->node_put(fn); 261 ipc_answer_0(rid, res);255 async_answer_0(rid, res); 262 256 } 263 257 … … 299 293 300 294 if (cur->mp_data.mp_active) { 301 ipc_forward_slow(rid, cur->mp_data.phone, VFS_OUT_LOOKUP,295 async_forward_slow(rid, cur->mp_data.phone, VFS_OUT_LOOKUP, 302 296 next, last, cur->mp_data.devmap_handle, lflag, index, 303 297 IPC_FF_ROUTE_FROM_ME); … … 323 317 if (len + 1 == NAME_MAX) { 324 318 /* Component length overflow */ 325 ipc_answer_0(rid, ENAMETOOLONG);319 async_answer_0(rid, ENAMETOOLONG); 326 320 goto out; 327 321 } … … 357 351 next--; 358 352 359 ipc_forward_slow(rid, tmp->mp_data.phone,353 async_forward_slow(rid, tmp->mp_data.phone, 360 354 VFS_OUT_LOOKUP, next, last, tmp->mp_data.devmap_handle, 361 355 lflag, index, IPC_FF_ROUTE_FROM_ME); … … 371 365 if (next <= last) { 372 366 /* There are unprocessed components */ 373 ipc_answer_0(rid, ENOENT);367 async_answer_0(rid, ENOENT); 374 368 goto out; 375 369 } … … 379 373 /* Request to create a new link */ 380 374 if (!ops->is_directory(cur)) { 381 ipc_answer_0(rid, ENOTDIR);375 async_answer_0(rid, ENOTDIR); 382 376 goto out; 383 377 } … … 397 391 if (lflag & L_CREATE) 398 392 (void) ops->destroy(fn); 399 ipc_answer_0(rid, rc); 393 else 394 (void) ops->node_put(fn); 395 async_answer_0(rid, rc); 400 396 } else { 401 397 aoff64_t size = ops->size_get(fn); 402 ipc_answer_5(rid, fs_handle,398 async_answer_5(rid, fs_handle, 403 399 devmap_handle, 404 400 ops->index_get(fn), … … 409 405 } 410 406 } else 411 ipc_answer_0(rid, ENOSPC);407 async_answer_0(rid, ENOSPC); 412 408 413 409 goto out; 414 410 } 415 411 416 ipc_answer_0(rid, ENOENT);412 async_answer_0(rid, ENOENT); 417 413 goto out; 418 414 } … … 440 436 if (lflag & (L_CREATE | L_LINK)) { 441 437 if (!ops->is_directory(cur)) { 442 ipc_answer_0(rid, ENOTDIR);438 async_answer_0(rid, ENOTDIR); 443 439 goto out; 444 440 } … … 449 445 if (ops->plb_get_char(next) == '/') { 450 446 /* More than one component */ 451 ipc_answer_0(rid, ENOENT);447 async_answer_0(rid, ENOENT); 452 448 goto out; 453 449 } … … 455 451 if (len + 1 == NAME_MAX) { 456 452 /* Component length overflow */ 457 ipc_answer_0(rid, ENAMETOOLONG);453 async_answer_0(rid, ENAMETOOLONG); 458 454 goto out; 459 455 } … … 479 475 if (lflag & L_CREATE) 480 476 (void) ops->destroy(fn); 481 ipc_answer_0(rid, rc); 477 else 478 (void) ops->node_put(fn); 479 async_answer_0(rid, rc); 482 480 } else { 483 481 aoff64_t size = ops->size_get(fn); 484 ipc_answer_5(rid, fs_handle,482 async_answer_5(rid, fs_handle, 485 483 devmap_handle, 486 484 ops->index_get(fn), … … 491 489 } 492 490 } else 493 ipc_answer_0(rid, ENOSPC);491 async_answer_0(rid, ENOSPC); 494 492 495 493 goto out; 496 494 } 497 495 498 ipc_answer_0(rid, ENOENT);496 async_answer_0(rid, ENOENT); 499 497 goto out; 500 498 } … … 509 507 if (rc == EOK) { 510 508 aoff64_t size = ops->size_get(cur); 511 ipc_answer_5(rid, fs_handle, devmap_handle,509 async_answer_5(rid, fs_handle, devmap_handle, 512 510 ops->index_get(cur), LOWER32(size), UPPER32(size), 513 511 old_lnkcnt); 514 512 } else 515 ipc_answer_0(rid, rc);513 async_answer_0(rid, rc); 516 514 517 515 goto out; … … 520 518 if (((lflag & (L_CREATE | L_EXCLUSIVE)) == (L_CREATE | L_EXCLUSIVE)) || 521 519 (lflag & L_LINK)) { 522 ipc_answer_0(rid, EEXIST);520 async_answer_0(rid, EEXIST); 523 521 goto out; 524 522 } 525 523 526 524 if ((lflag & L_FILE) && (ops->is_directory(cur))) { 527 ipc_answer_0(rid, EISDIR);525 async_answer_0(rid, EISDIR); 528 526 goto out; 529 527 } 530 528 531 529 if ((lflag & L_DIRECTORY) && (ops->is_file(cur))) { 532 ipc_answer_0(rid, ENOTDIR);530 async_answer_0(rid, ENOTDIR); 533 531 goto out; 534 532 } 535 533 536 534 if ((lflag & L_ROOT) && par) { 537 ipc_answer_0(rid, EINVAL);535 async_answer_0(rid, EINVAL); 538 536 goto out; 539 537 } … … 547 545 if (rc == EOK) { 548 546 aoff64_t size = ops->size_get(cur); 549 ipc_answer_5(rid, fs_handle, devmap_handle,547 async_answer_5(rid, fs_handle, devmap_handle, 550 548 ops->index_get(cur), LOWER32(size), UPPER32(size), 551 549 ops->lnkcnt_get(cur)); 552 550 } else 553 ipc_answer_0(rid, rc);551 async_answer_0(rid, rc); 554 552 555 553 } else 556 ipc_answer_0(rid, rc);554 async_answer_0(rid, rc); 557 555 558 556 out: … … 583 581 (size != sizeof(struct stat))) { 584 582 ops->node_put(fn); 585 ipc_answer_0(callid, EINVAL);586 ipc_answer_0(rid, EINVAL);583 async_answer_0(callid, EINVAL); 584 async_answer_0(rid, EINVAL); 587 585 return; 588 586 } … … 603 601 604 602 async_data_read_finalize(callid, &stat, sizeof(struct stat)); 605 ipc_answer_0(rid, EOK);603 async_answer_0(rid, EOK); 606 604 } 607 605 … … 625 623 626 624 if (fn == NULL) { 627 ipc_answer_0(rid, ENOENT);625 async_answer_0(rid, ENOENT); 628 626 return; 629 627 } … … 631 629 rc = ops->node_open(fn); 632 630 aoff64_t size = ops->size_get(fn); 633 ipc_answer_4(rid, rc, LOWER32(size), UPPER32(size), ops->lnkcnt_get(fn),631 async_answer_4(rid, rc, LOWER32(size), UPPER32(size), ops->lnkcnt_get(fn), 634 632 (ops->is_file(fn) ? L_FILE : 0) | (ops->is_directory(fn) ? L_DIRECTORY : 0)); 635 633
Note:
See TracChangeset
for help on using the changeset viewer.