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