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