Changeset 19a1800 in mainline for uspace/srv/fs/tmpfs/tmpfs_ops.c
- Timestamp:
- 2011-03-01T22:20:56Z (14 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- e24e7b1
- Parents:
- 976f546 (diff), ac8285d (diff)
Note: this is a merge changeset, the changes displayed below correspond to the merge itself.
Use the(diff)
links above to see all the changes relative to each parent. - File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/srv/fs/tmpfs/tmpfs_ops.c
r976f546 r19a1800 39 39 #include "tmpfs.h" 40 40 #include "../../vfs/vfs.h" 41 #include <ipc/ipc.h>42 41 #include <macros.h> 43 42 #include <stdint.h> … … 450 449 rc = async_data_write_accept((void **) &opts, true, 0, 0, 0, NULL); 451 450 if (rc != EOK) { 452 ipc_answer_0(rid, rc);451 async_answer_0(rid, rc); 453 452 return; 454 453 } … … 459 458 (void) tmpfs_node_put(rootfn); 460 459 free(opts); 461 ipc_answer_0(rid, EEXIST);460 async_answer_0(rid, EEXIST); 462 461 return; 463 462 } … … 466 465 if (!tmpfs_instance_init(devmap_handle)) { 467 466 free(opts); 468 ipc_answer_0(rid, ENOMEM);467 async_answer_0(rid, ENOMEM); 469 468 return; 470 469 } … … 475 474 if (str_cmp(opts, "restore") == 0) { 476 475 if (tmpfs_restore(devmap_handle)) 477 ipc_answer_3(rid, EOK, rootp->index, rootp->size,476 async_answer_3(rid, EOK, rootp->index, rootp->size, 478 477 rootp->lnkcnt); 479 478 else 480 ipc_answer_0(rid, ELIMIT);479 async_answer_0(rid, ELIMIT); 481 480 } else { 482 ipc_answer_3(rid, EOK, rootp->index, rootp->size,481 async_answer_3(rid, EOK, rootp->index, rootp->size, 483 482 rootp->lnkcnt); 484 483 } … … 496 495 497 496 tmpfs_instance_done(devmap_handle); 498 ipc_answer_0(rid, EOK);497 async_answer_0(rid, EOK); 499 498 } 500 499 … … 526 525 hlp = hash_table_find(&nodes, key); 527 526 if (!hlp) { 528 ipc_answer_0(rid, ENOENT);527 async_answer_0(rid, ENOENT); 529 528 return; 530 529 } … … 538 537 size_t size; 539 538 if (!async_data_read_receive(&callid, &size)) { 540 ipc_answer_0(callid, EINVAL);541 ipc_answer_0(rid, EINVAL);539 async_answer_0(callid, EINVAL); 540 async_answer_0(rid, EINVAL); 542 541 return; 543 542 } … … 566 565 567 566 if (lnk == &nodep->cs_head) { 568 ipc_answer_0(callid, ENOENT);569 ipc_answer_1(rid, ENOENT, 0);567 async_answer_0(callid, ENOENT); 568 async_answer_1(rid, ENOENT, 0); 570 569 return; 571 570 } … … 581 580 * Answer the VFS_READ call. 582 581 */ 583 ipc_answer_1(rid, EOK, bytes);582 async_answer_1(rid, EOK, bytes); 584 583 } 585 584 … … 601 600 hlp = hash_table_find(&nodes, key); 602 601 if (!hlp) { 603 ipc_answer_0(rid, ENOENT);602 async_answer_0(rid, ENOENT); 604 603 return; 605 604 } … … 613 612 size_t size; 614 613 if (!async_data_write_receive(&callid, &size)) { 615 ipc_answer_0(callid, EINVAL);616 ipc_answer_0(rid, EINVAL);614 async_answer_0(callid, EINVAL); 615 async_answer_0(rid, EINVAL); 617 616 return; 618 617 } … … 624 623 /* The file size is not changing. */ 625 624 (void) async_data_write_finalize(callid, nodep->data + pos, size); 626 ipc_answer_2(rid, EOK, size, nodep->size);625 async_answer_2(rid, EOK, size, nodep->size); 627 626 return; 628 627 } … … 637 636 void *newdata = realloc(nodep->data, nodep->size + delta); 638 637 if (!newdata) { 639 ipc_answer_0(callid, ENOMEM);640 ipc_answer_2(rid, EOK, 0, nodep->size);638 async_answer_0(callid, ENOMEM); 639 async_answer_2(rid, EOK, 0, nodep->size); 641 640 return; 642 641 } … … 646 645 nodep->data = newdata; 647 646 (void) async_data_write_finalize(callid, nodep->data + pos, size); 648 ipc_answer_2(rid, EOK, size, nodep->size);647 async_answer_2(rid, EOK, size, nodep->size); 649 648 } 650 649 … … 665 664 link_t *hlp = hash_table_find(&nodes, key); 666 665 if (!hlp) { 667 ipc_answer_0(rid, ENOENT);666 async_answer_0(rid, ENOENT); 668 667 return; 669 668 } … … 672 671 673 672 if (size == nodep->size) { 674 ipc_answer_0(rid, EOK);673 async_answer_0(rid, EOK); 675 674 return; 676 675 } 677 676 678 677 if (size > SIZE_MAX) { 679 ipc_answer_0(rid, ENOMEM);678 async_answer_0(rid, ENOMEM); 680 679 return; 681 680 } … … 683 682 void *newdata = realloc(nodep->data, size); 684 683 if (!newdata) { 685 ipc_answer_0(rid, ENOMEM);684 async_answer_0(rid, ENOMEM); 686 685 return; 687 686 } … … 694 693 nodep->size = size; 695 694 nodep->data = newdata; 696 ipc_answer_0(rid, EOK);695 async_answer_0(rid, EOK); 697 696 } 698 697 699 698 void tmpfs_close(ipc_callid_t rid, ipc_call_t *request) 700 699 { 701 ipc_answer_0(rid, EOK);700 async_answer_0(rid, EOK); 702 701 } 703 702 … … 715 714 hlp = hash_table_find(&nodes, key); 716 715 if (!hlp) { 717 ipc_answer_0(rid, ENOENT);716 async_answer_0(rid, ENOENT); 718 717 return; 719 718 } … … 721 720 nh_link); 722 721 rc = tmpfs_destroy_node(FS_NODE(nodep)); 723 ipc_answer_0(rid, rc);722 async_answer_0(rid, rc); 724 723 } 725 724 … … 740 739 * thus the sync operation is a no-op. 741 740 */ 742 ipc_answer_0(rid, EOK);741 async_answer_0(rid, EOK); 743 742 } 744 743
Note:
See TracChangeset
for help on using the changeset viewer.