Changes in uspace/lib/fs/libfs.c [b946bf83:228e490] in mainline
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/lib/fs/libfs.c
rb946bf83 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 else 394 (void) ops->node_put(fn); 395 async_answer_0(rid, rc); 399 ipc_answer_0(rid, rc); 396 400 } else { 397 401 aoff64_t size = ops->size_get(fn); 398 async_answer_5(rid, fs_handle,402 ipc_answer_5(rid, fs_handle, 399 403 devmap_handle, 400 404 ops->index_get(fn), … … 405 409 } 406 410 } else 407 async_answer_0(rid, ENOSPC);411 ipc_answer_0(rid, ENOSPC); 408 412 409 413 goto out; 410 414 } 411 415 412 async_answer_0(rid, ENOENT);416 ipc_answer_0(rid, ENOENT); 413 417 goto out; 414 418 } … … 436 440 if (lflag & (L_CREATE | L_LINK)) { 437 441 if (!ops->is_directory(cur)) { 438 async_answer_0(rid, ENOTDIR);442 ipc_answer_0(rid, ENOTDIR); 439 443 goto out; 440 444 } … … 445 449 if (ops->plb_get_char(next) == '/') { 446 450 /* More than one component */ 447 async_answer_0(rid, ENOENT);451 ipc_answer_0(rid, ENOENT); 448 452 goto out; 449 453 } … … 451 455 if (len + 1 == NAME_MAX) { 452 456 /* Component length overflow */ 453 async_answer_0(rid, ENAMETOOLONG);457 ipc_answer_0(rid, ENAMETOOLONG); 454 458 goto out; 455 459 } … … 475 479 if (lflag & L_CREATE) 476 480 (void) ops->destroy(fn); 477 else 478 (void) ops->node_put(fn); 479 async_answer_0(rid, rc); 481 ipc_answer_0(rid, rc); 480 482 } else { 481 483 aoff64_t size = ops->size_get(fn); 482 async_answer_5(rid, fs_handle,484 ipc_answer_5(rid, fs_handle, 483 485 devmap_handle, 484 486 ops->index_get(fn), … … 489 491 } 490 492 } else 491 async_answer_0(rid, ENOSPC);493 ipc_answer_0(rid, ENOSPC); 492 494 493 495 goto out; 494 496 } 495 497 496 async_answer_0(rid, ENOENT);498 ipc_answer_0(rid, ENOENT); 497 499 goto out; 498 500 } … … 507 509 if (rc == EOK) { 508 510 aoff64_t size = ops->size_get(cur); 509 async_answer_5(rid, fs_handle, devmap_handle,511 ipc_answer_5(rid, fs_handle, devmap_handle, 510 512 ops->index_get(cur), LOWER32(size), UPPER32(size), 511 513 old_lnkcnt); 512 514 } else 513 async_answer_0(rid, rc);515 ipc_answer_0(rid, rc); 514 516 515 517 goto out; … … 518 520 if (((lflag & (L_CREATE | L_EXCLUSIVE)) == (L_CREATE | L_EXCLUSIVE)) || 519 521 (lflag & L_LINK)) { 520 async_answer_0(rid, EEXIST);522 ipc_answer_0(rid, EEXIST); 521 523 goto out; 522 524 } 523 525 524 526 if ((lflag & L_FILE) && (ops->is_directory(cur))) { 525 async_answer_0(rid, EISDIR);527 ipc_answer_0(rid, EISDIR); 526 528 goto out; 527 529 } 528 530 529 531 if ((lflag & L_DIRECTORY) && (ops->is_file(cur))) { 530 async_answer_0(rid, ENOTDIR);532 ipc_answer_0(rid, ENOTDIR); 531 533 goto out; 532 534 } 533 535 534 536 if ((lflag & L_ROOT) && par) { 535 async_answer_0(rid, EINVAL);537 ipc_answer_0(rid, EINVAL); 536 538 goto out; 537 539 } … … 545 547 if (rc == EOK) { 546 548 aoff64_t size = ops->size_get(cur); 547 async_answer_5(rid, fs_handle, devmap_handle,549 ipc_answer_5(rid, fs_handle, devmap_handle, 548 550 ops->index_get(cur), LOWER32(size), UPPER32(size), 549 551 ops->lnkcnt_get(cur)); 550 552 } else 551 async_answer_0(rid, rc);553 ipc_answer_0(rid, rc); 552 554 553 555 } else 554 async_answer_0(rid, rc);556 ipc_answer_0(rid, rc); 555 557 556 558 out: … … 581 583 (size != sizeof(struct stat))) { 582 584 ops->node_put(fn); 583 async_answer_0(callid, EINVAL);584 async_answer_0(rid, EINVAL);585 ipc_answer_0(callid, EINVAL); 586 ipc_answer_0(rid, EINVAL); 585 587 return; 586 588 } … … 601 603 602 604 async_data_read_finalize(callid, &stat, sizeof(struct stat)); 603 async_answer_0(rid, EOK);605 ipc_answer_0(rid, EOK); 604 606 } 605 607 … … 623 625 624 626 if (fn == NULL) { 625 async_answer_0(rid, ENOENT);627 ipc_answer_0(rid, ENOENT); 626 628 return; 627 629 } … … 629 631 rc = ops->node_open(fn); 630 632 aoff64_t size = ops->size_get(fn); 631 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), 632 634 (ops->is_file(fn) ? L_FILE : 0) | (ops->is_directory(fn) ? L_DIRECTORY : 0)); 633 635
Note:
See TracChangeset
for help on using the changeset viewer.