Changes in uspace/srv/fs/devfs/devfs_ops.c [7ea7db31:cfd630af] in mainline
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/srv/fs/devfs/devfs_ops.c
r7ea7db31 rcfd630af 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 } … … 275 278 fibril_mutex_unlock(&devices_mutex); 276 279 277 free(dev);278 280 return ENOENT; 279 281 } … … 465 467 0, NULL); 466 468 if (retval != EOK) { 467 ipc_answer_0(rid, retval);469 async_answer_0(rid, retval); 468 470 return; 469 471 } 470 472 471 473 free(opts); 472 ipc_answer_3(rid, EOK, 0, 0, 0);474 async_answer_3(rid, EOK, 0, 0, 0); 473 475 } 474 476 … … 480 482 void devfs_unmounted(ipc_callid_t rid, ipc_call_t *request) 481 483 { 482 ipc_answer_0(rid, ENOTSUP);484 async_answer_0(rid, ENOTSUP); 483 485 } 484 486 … … 513 515 size_t size; 514 516 if (!async_data_read_receive(&callid, &size)) { 515 ipc_answer_0(callid, EINVAL);516 ipc_answer_0(rid, EINVAL);517 async_answer_0(callid, EINVAL); 518 async_answer_0(rid, EINVAL); 517 519 return; 518 520 } … … 535 537 async_data_read_finalize(callid, desc[pos].name, str_size(desc[pos].name) + 1); 536 538 free(desc); 537 ipc_answer_1(rid, EOK, 1);539 async_answer_1(rid, EOK, 1); 538 540 return; 539 541 } … … 550 552 async_data_read_finalize(callid, desc[pos].name, str_size(desc[pos].name) + 1); 551 553 free(desc); 552 ipc_answer_1(rid, EOK, 1);554 async_answer_1(rid, EOK, 1); 553 555 return; 554 556 } … … 557 559 } 558 560 559 ipc_answer_0(callid, ENOENT);560 ipc_answer_1(rid, ENOENT, 0);561 async_answer_0(callid, ENOENT); 562 async_answer_1(rid, ENOENT, 0); 561 563 return; 562 564 } … … 569 571 size_t size; 570 572 if (!async_data_read_receive(&callid, &size)) { 571 ipc_answer_0(callid, EINVAL);572 ipc_answer_0(rid, EINVAL);573 async_answer_0(callid, EINVAL); 574 async_answer_0(rid, EINVAL); 573 575 return; 574 576 } … … 580 582 async_data_read_finalize(callid, desc[pos].name, str_size(desc[pos].name) + 1); 581 583 free(desc); 582 ipc_answer_1(rid, EOK, 1);584 async_answer_1(rid, EOK, 1); 583 585 return; 584 586 } 585 587 586 588 free(desc); 587 ipc_answer_0(callid, ENOENT);588 ipc_answer_1(rid, ENOENT, 0);589 async_answer_0(callid, ENOENT); 590 async_answer_1(rid, ENOENT, 0); 589 591 return; 590 592 } … … 601 603 if (lnk == NULL) { 602 604 fibril_mutex_unlock(&devices_mutex); 603 ipc_answer_0(rid, ENOENT);605 async_answer_0(rid, ENOENT); 604 606 return; 605 607 } … … 611 613 if (!async_data_read_receive(&callid, NULL)) { 612 614 fibril_mutex_unlock(&devices_mutex); 613 ipc_answer_0(callid, EINVAL);614 ipc_answer_0(rid, EINVAL);615 async_answer_0(callid, EINVAL); 616 async_answer_0(rid, EINVAL); 615 617 return; 616 618 } … … 623 625 624 626 /* 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);627 async_forward_fast(callid, dev->phone, 0, 0, 0, IPC_FF_ROUTE_FROM_ME); 626 628 fibril_mutex_unlock(&devices_mutex); 627 629 … … 632 634 633 635 /* 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);636 async_answer_1(rid, rc, bytes); 637 return; 638 } 639 640 async_answer_0(rid, ENOENT); 639 641 } 640 642 … … 643 645 fs_index_t index = (fs_index_t) IPC_GET_ARG2(*request); 644 646 if (index == 0) { 645 ipc_answer_0(rid, ENOTSUP);647 async_answer_0(rid, ENOTSUP); 646 648 return; 647 649 } … … 651 653 if (type == DEV_HANDLE_NAMESPACE) { 652 654 /* Namespace directory */ 653 ipc_answer_0(rid, ENOTSUP);655 async_answer_0(rid, ENOTSUP); 654 656 return; 655 657 } … … 665 667 if (lnk == NULL) { 666 668 fibril_mutex_unlock(&devices_mutex); 667 ipc_answer_0(rid, ENOENT);669 async_answer_0(rid, ENOENT); 668 670 return; 669 671 } … … 675 677 if (!async_data_write_receive(&callid, NULL)) { 676 678 fibril_mutex_unlock(&devices_mutex); 677 ipc_answer_0(callid, EINVAL);678 ipc_answer_0(rid, EINVAL);679 async_answer_0(callid, EINVAL); 680 async_answer_0(rid, EINVAL); 679 681 return; 680 682 } … … 687 689 688 690 /* 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);691 async_forward_fast(callid, dev->phone, 0, 0, 0, IPC_FF_ROUTE_FROM_ME); 690 692 691 693 fibril_mutex_unlock(&devices_mutex); … … 697 699 698 700 /* 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);701 async_answer_1(rid, rc, bytes); 702 return; 703 } 704 705 async_answer_0(rid, ENOENT); 704 706 } 705 707 706 708 void devfs_truncate(ipc_callid_t rid, ipc_call_t *request) 707 709 { 708 ipc_answer_0(rid, ENOTSUP);710 async_answer_0(rid, ENOTSUP); 709 711 } 710 712 … … 714 716 715 717 if (index == 0) { 716 ipc_answer_0(rid, EOK);718 async_answer_0(rid, EOK); 717 719 return; 718 720 } … … 722 724 if (type == DEV_HANDLE_NAMESPACE) { 723 725 /* Namespace directory */ 724 ipc_answer_0(rid, EOK);726 async_answer_0(rid, EOK); 725 727 return; 726 728 } … … 735 737 if (lnk == NULL) { 736 738 fibril_mutex_unlock(&devices_mutex); 737 ipc_answer_0(rid, ENOENT);739 async_answer_0(rid, ENOENT); 738 740 return; 739 741 } … … 744 746 745 747 if (dev->refcount == 0) { 746 ipc_hangup(dev->phone);748 async_hangup(dev->phone); 747 749 hash_table_remove(&devices, key, DEVICES_KEYS); 748 750 } … … 750 752 fibril_mutex_unlock(&devices_mutex); 751 753 752 ipc_answer_0(rid, EOK);753 return; 754 } 755 756 ipc_answer_0(rid, ENOENT);754 async_answer_0(rid, EOK); 755 return; 756 } 757 758 async_answer_0(rid, ENOENT); 757 759 } 758 760 … … 762 764 763 765 if (index == 0) { 764 ipc_answer_0(rid, EOK);766 async_answer_0(rid, EOK); 765 767 return; 766 768 } … … 770 772 if (type == DEV_HANDLE_NAMESPACE) { 771 773 /* Namespace directory */ 772 ipc_answer_0(rid, EOK);774 async_answer_0(rid, EOK); 773 775 return; 774 776 } … … 783 785 if (lnk == NULL) { 784 786 fibril_mutex_unlock(&devices_mutex); 785 ipc_answer_0(rid, ENOENT);787 async_answer_0(rid, ENOENT); 786 788 return; 787 789 } … … 802 804 803 805 /* 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);806 async_answer_0(rid, rc); 807 return; 808 } 809 810 async_answer_0(rid, ENOENT); 809 811 } 810 812 811 813 void devfs_destroy(ipc_callid_t rid, ipc_call_t *request) 812 814 { 813 ipc_answer_0(rid, ENOTSUP);815 async_answer_0(rid, ENOTSUP); 814 816 } 815 817
Note:
See TracChangeset
for help on using the changeset viewer.