Changes in uspace/srv/fs/devfs/devfs_ops.c [7ea7db31:b366a1bc] in mainline
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/srv/fs/devfs/devfs_ops.c
r7ea7db31 rb366a1bc 36 36 */ 37 37 38 #include <ipc/ipc.h>39 38 #include <macros.h> 40 39 #include <bool.h> … … 131 130 { 132 131 devfs_node_t *node = (devfs_node_t *) pfn->data; 132 int ret; 133 133 134 134 if (node->handle == 0) { … … 146 146 147 147 if (str_cmp(devs[pos].name, component) == 0) { 148 ret = devfs_node_get_internal(rfn, DEV_HANDLE_NAMESPACE, devs[pos].handle); 148 149 free(devs); 149 return devfs_node_get_internal(rfn, DEV_HANDLE_NAMESPACE, devs[pos].handle);150 return ret; 150 151 } 151 152 } … … 163 164 for (pos = 0; pos < count; pos++) { 164 165 if (str_cmp(devs[pos].name, component) == 0) { 166 ret = devfs_node_get_internal(rfn, DEV_HANDLE_DEVICE, devs[pos].handle); 165 167 free(devs); 166 return devfs_node_get_internal(rfn, DEV_HANDLE_DEVICE, devs[pos].handle);168 return ret; 167 169 } 168 170 } … … 185 187 for (pos = 0; pos < count; pos++) { 186 188 if (str_cmp(devs[pos].name, component) == 0) { 189 ret = devfs_node_get_internal(rfn, DEV_HANDLE_DEVICE, devs[pos].handle); 187 190 free(devs); 188 return devfs_node_get_internal(rfn, DEV_HANDLE_DEVICE, devs[pos].handle);191 return ret; 189 192 } 190 193 } … … 465 468 0, NULL); 466 469 if (retval != EOK) { 467 ipc_answer_0(rid, retval);470 async_answer_0(rid, retval); 468 471 return; 469 472 } 470 473 471 474 free(opts); 472 ipc_answer_3(rid, EOK, 0, 0, 0);475 async_answer_3(rid, EOK, 0, 0, 0); 473 476 } 474 477 … … 480 483 void devfs_unmounted(ipc_callid_t rid, ipc_call_t *request) 481 484 { 482 ipc_answer_0(rid, ENOTSUP);485 async_answer_0(rid, ENOTSUP); 483 486 } 484 487 … … 513 516 size_t size; 514 517 if (!async_data_read_receive(&callid, &size)) { 515 ipc_answer_0(callid, EINVAL);516 ipc_answer_0(rid, EINVAL);518 async_answer_0(callid, EINVAL); 519 async_answer_0(rid, EINVAL); 517 520 return; 518 521 } … … 535 538 async_data_read_finalize(callid, desc[pos].name, str_size(desc[pos].name) + 1); 536 539 free(desc); 537 ipc_answer_1(rid, EOK, 1);540 async_answer_1(rid, EOK, 1); 538 541 return; 539 542 } … … 550 553 async_data_read_finalize(callid, desc[pos].name, str_size(desc[pos].name) + 1); 551 554 free(desc); 552 ipc_answer_1(rid, EOK, 1);555 async_answer_1(rid, EOK, 1); 553 556 return; 554 557 } … … 557 560 } 558 561 559 ipc_answer_0(callid, ENOENT);560 ipc_answer_1(rid, ENOENT, 0);562 async_answer_0(callid, ENOENT); 563 async_answer_1(rid, ENOENT, 0); 561 564 return; 562 565 } … … 569 572 size_t size; 570 573 if (!async_data_read_receive(&callid, &size)) { 571 ipc_answer_0(callid, EINVAL);572 ipc_answer_0(rid, EINVAL);574 async_answer_0(callid, EINVAL); 575 async_answer_0(rid, EINVAL); 573 576 return; 574 577 } … … 580 583 async_data_read_finalize(callid, desc[pos].name, str_size(desc[pos].name) + 1); 581 584 free(desc); 582 ipc_answer_1(rid, EOK, 1);585 async_answer_1(rid, EOK, 1); 583 586 return; 584 587 } 585 588 586 589 free(desc); 587 ipc_answer_0(callid, ENOENT);588 ipc_answer_1(rid, ENOENT, 0);590 async_answer_0(callid, ENOENT); 591 async_answer_1(rid, ENOENT, 0); 589 592 return; 590 593 } … … 601 604 if (lnk == NULL) { 602 605 fibril_mutex_unlock(&devices_mutex); 603 ipc_answer_0(rid, ENOENT);606 async_answer_0(rid, ENOENT); 604 607 return; 605 608 } … … 611 614 if (!async_data_read_receive(&callid, NULL)) { 612 615 fibril_mutex_unlock(&devices_mutex); 613 ipc_answer_0(callid, EINVAL);614 ipc_answer_0(rid, EINVAL);616 async_answer_0(callid, EINVAL); 617 async_answer_0(rid, EINVAL); 615 618 return; 616 619 } … … 623 626 624 627 /* Forward the IPC_M_DATA_READ request to the driver */ 625 ipc_forward_fast(callid, dev->phone, 0, 0, 0, IPC_FF_ROUTE_FROM_ME);628 async_forward_fast(callid, dev->phone, 0, 0, 0, IPC_FF_ROUTE_FROM_ME); 626 629 fibril_mutex_unlock(&devices_mutex); 627 630 … … 632 635 633 636 /* Driver reply is the final result of the whole operation */ 634 ipc_answer_1(rid, rc, bytes);635 return; 636 } 637 638 ipc_answer_0(rid, ENOENT);637 async_answer_1(rid, rc, bytes); 638 return; 639 } 640 641 async_answer_0(rid, ENOENT); 639 642 } 640 643 … … 643 646 fs_index_t index = (fs_index_t) IPC_GET_ARG2(*request); 644 647 if (index == 0) { 645 ipc_answer_0(rid, ENOTSUP);648 async_answer_0(rid, ENOTSUP); 646 649 return; 647 650 } … … 651 654 if (type == DEV_HANDLE_NAMESPACE) { 652 655 /* Namespace directory */ 653 ipc_answer_0(rid, ENOTSUP);656 async_answer_0(rid, ENOTSUP); 654 657 return; 655 658 } … … 665 668 if (lnk == NULL) { 666 669 fibril_mutex_unlock(&devices_mutex); 667 ipc_answer_0(rid, ENOENT);670 async_answer_0(rid, ENOENT); 668 671 return; 669 672 } … … 675 678 if (!async_data_write_receive(&callid, NULL)) { 676 679 fibril_mutex_unlock(&devices_mutex); 677 ipc_answer_0(callid, EINVAL);678 ipc_answer_0(rid, EINVAL);680 async_answer_0(callid, EINVAL); 681 async_answer_0(rid, EINVAL); 679 682 return; 680 683 } … … 687 690 688 691 /* Forward the IPC_M_DATA_WRITE request to the driver */ 689 ipc_forward_fast(callid, dev->phone, 0, 0, 0, IPC_FF_ROUTE_FROM_ME);692 async_forward_fast(callid, dev->phone, 0, 0, 0, IPC_FF_ROUTE_FROM_ME); 690 693 691 694 fibril_mutex_unlock(&devices_mutex); … … 697 700 698 701 /* Driver reply is the final result of the whole operation */ 699 ipc_answer_1(rid, rc, bytes);700 return; 701 } 702 703 ipc_answer_0(rid, ENOENT);702 async_answer_1(rid, rc, bytes); 703 return; 704 } 705 706 async_answer_0(rid, ENOENT); 704 707 } 705 708 706 709 void devfs_truncate(ipc_callid_t rid, ipc_call_t *request) 707 710 { 708 ipc_answer_0(rid, ENOTSUP);711 async_answer_0(rid, ENOTSUP); 709 712 } 710 713 … … 714 717 715 718 if (index == 0) { 716 ipc_answer_0(rid, EOK);719 async_answer_0(rid, EOK); 717 720 return; 718 721 } … … 722 725 if (type == DEV_HANDLE_NAMESPACE) { 723 726 /* Namespace directory */ 724 ipc_answer_0(rid, EOK);727 async_answer_0(rid, EOK); 725 728 return; 726 729 } … … 735 738 if (lnk == NULL) { 736 739 fibril_mutex_unlock(&devices_mutex); 737 ipc_answer_0(rid, ENOENT);740 async_answer_0(rid, ENOENT); 738 741 return; 739 742 } … … 744 747 745 748 if (dev->refcount == 0) { 746 ipc_hangup(dev->phone);749 async_hangup(dev->phone); 747 750 hash_table_remove(&devices, key, DEVICES_KEYS); 748 751 } … … 750 753 fibril_mutex_unlock(&devices_mutex); 751 754 752 ipc_answer_0(rid, EOK);753 return; 754 } 755 756 ipc_answer_0(rid, ENOENT);755 async_answer_0(rid, EOK); 756 return; 757 } 758 759 async_answer_0(rid, ENOENT); 757 760 } 758 761 … … 762 765 763 766 if (index == 0) { 764 ipc_answer_0(rid, EOK);767 async_answer_0(rid, EOK); 765 768 return; 766 769 } … … 770 773 if (type == DEV_HANDLE_NAMESPACE) { 771 774 /* Namespace directory */ 772 ipc_answer_0(rid, EOK);775 async_answer_0(rid, EOK); 773 776 return; 774 777 } … … 783 786 if (lnk == NULL) { 784 787 fibril_mutex_unlock(&devices_mutex); 785 ipc_answer_0(rid, ENOENT);788 async_answer_0(rid, ENOENT); 786 789 return; 787 790 } … … 802 805 803 806 /* Driver reply is the final result of the whole operation */ 804 ipc_answer_0(rid, rc);805 return; 806 } 807 808 ipc_answer_0(rid, ENOENT);807 async_answer_0(rid, rc); 808 return; 809 } 810 811 async_answer_0(rid, ENOENT); 809 812 } 810 813 811 814 void devfs_destroy(ipc_callid_t rid, ipc_call_t *request) 812 815 { 813 ipc_answer_0(rid, ENOTSUP);816 async_answer_0(rid, ENOTSUP); 814 817 } 815 818
Note:
See TracChangeset
for help on using the changeset viewer.