Changes in uspace/srv/devmap/devmap.c [ffa2c8ef:124c061] in mainline
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/srv/devmap/devmap.c
rffa2c8ef r124c061 374 374 375 375 if (IPC_GET_IMETHOD(icall) != DEVMAP_DRIVER_REGISTER) { 376 async_answer_0(iid, EREFUSED);376 ipc_answer_0(iid, EREFUSED); 377 377 return NULL; 378 378 } … … 381 381 (devmap_driver_t *) malloc(sizeof(devmap_driver_t)); 382 382 if (driver == NULL) { 383 async_answer_0(iid, ENOMEM);383 ipc_answer_0(iid, ENOMEM); 384 384 return NULL; 385 385 } … … 392 392 if (rc != EOK) { 393 393 free(driver); 394 async_answer_0(iid, rc);394 ipc_answer_0(iid, rc); 395 395 return NULL; 396 396 } … … 405 405 free(driver->name); 406 406 free(driver); 407 async_answer_0(callid, ENOTSUP);408 async_answer_0(iid, ENOTSUP);407 ipc_answer_0(callid, ENOTSUP); 408 ipc_answer_0(iid, ENOTSUP); 409 409 return NULL; 410 410 } 411 411 412 412 driver->phone = IPC_GET_ARG5(call); 413 async_answer_0(callid, EOK);413 ipc_answer_0(callid, EOK); 414 414 415 415 /* … … 438 438 fibril_mutex_unlock(&drivers_list_mutex); 439 439 440 async_answer_0(iid, EOK);440 ipc_answer_0(iid, EOK); 441 441 442 442 return driver; … … 456 456 457 457 if (driver->phone != 0) 458 async_hangup(driver->phone);458 ipc_hangup(driver->phone); 459 459 460 460 /* Remove it from list of drivers */ … … 491 491 { 492 492 if (driver == NULL) { 493 async_answer_0(iid, EREFUSED);493 ipc_answer_0(iid, EREFUSED); 494 494 return; 495 495 } … … 499 499 (devmap_device_t *) malloc(sizeof(devmap_device_t)); 500 500 if (device == NULL) { 501 async_answer_0(iid, ENOMEM);501 ipc_answer_0(iid, ENOMEM); 502 502 return; 503 503 } … … 512 512 if (rc != EOK) { 513 513 free(device); 514 async_answer_0(iid, rc);514 ipc_answer_0(iid, rc); 515 515 return; 516 516 } … … 520 520 free(fqdn); 521 521 free(device); 522 async_answer_0(iid, EINVAL);522 ipc_answer_0(iid, EINVAL); 523 523 return; 524 524 } … … 534 534 free(device->name); 535 535 free(device); 536 async_answer_0(iid, ENOMEM);536 ipc_answer_0(iid, ENOMEM); 537 537 return; 538 538 } … … 549 549 free(device->name); 550 550 free(device); 551 async_answer_0(iid, EEXISTS);551 ipc_answer_0(iid, EEXISTS); 552 552 return; 553 553 } … … 571 571 fibril_mutex_unlock(&devices_list_mutex); 572 572 573 async_answer_1(iid, EOK, device->handle);573 ipc_answer_1(iid, EOK, device->handle); 574 574 } 575 575 … … 602 602 if ((dev == NULL) || (dev->driver == NULL) || (dev->driver->phone == 0)) { 603 603 fibril_mutex_unlock(&devices_list_mutex); 604 async_answer_0(callid, ENOENT);604 ipc_answer_0(callid, ENOENT); 605 605 return; 606 606 } 607 607 608 608 if (dev->forward_interface == 0) { 609 async_forward_fast(callid, dev->driver->phone,609 ipc_forward_fast(callid, dev->driver->phone, 610 610 dev->handle, 0, 0, 611 611 IPC_FF_NONE); 612 612 } else { 613 async_forward_fast(callid, dev->driver->phone,613 ipc_forward_fast(callid, dev->driver->phone, 614 614 dev->forward_interface, dev->handle, 0, 615 615 IPC_FF_NONE); … … 633 633 DEVMAP_NAME_MAXLEN, 0, NULL); 634 634 if (rc != EOK) { 635 async_answer_0(iid, rc);635 ipc_answer_0(iid, rc); 636 636 return; 637 637 } … … 641 641 if (!devmap_fqdn_split(fqdn, &ns_name, &name)) { 642 642 free(fqdn); 643 async_answer_0(iid, EINVAL);643 ipc_answer_0(iid, EINVAL); 644 644 return; 645 645 } … … 668 668 } 669 669 670 async_answer_0(iid, ENOENT);670 ipc_answer_0(iid, ENOENT); 671 671 free(ns_name); 672 672 free(name); … … 675 675 } 676 676 677 async_answer_1(iid, EOK, dev->handle);677 ipc_answer_1(iid, EOK, dev->handle); 678 678 679 679 fibril_mutex_unlock(&devices_list_mutex); … … 696 696 DEVMAP_NAME_MAXLEN, 0, NULL); 697 697 if (rc != EOK) { 698 async_answer_0(iid, rc);698 ipc_answer_0(iid, rc); 699 699 return; 700 700 } … … 721 721 } 722 722 723 async_answer_0(iid, ENOENT);723 ipc_answer_0(iid, ENOENT); 724 724 free(name); 725 725 fibril_mutex_unlock(&devices_list_mutex); … … 727 727 } 728 728 729 async_answer_1(iid, EOK, namespace->handle);729 ipc_answer_1(iid, EOK, namespace->handle); 730 730 731 731 fibril_mutex_unlock(&devices_list_mutex); … … 743 743 devmap_device_find_handle(IPC_GET_ARG1(*icall)); 744 744 if (dev == NULL) 745 async_answer_1(iid, EOK, DEV_HANDLE_NONE);745 ipc_answer_1(iid, EOK, DEV_HANDLE_NONE); 746 746 else 747 async_answer_1(iid, EOK, DEV_HANDLE_DEVICE);747 ipc_answer_1(iid, EOK, DEV_HANDLE_DEVICE); 748 748 } else 749 async_answer_1(iid, EOK, DEV_HANDLE_NAMESPACE);749 ipc_answer_1(iid, EOK, DEV_HANDLE_NAMESPACE); 750 750 751 751 fibril_mutex_unlock(&devices_list_mutex); … … 755 755 { 756 756 fibril_mutex_lock(&devices_list_mutex); 757 async_answer_1(iid, EOK, list_count(&namespaces_list));757 ipc_answer_1(iid, EOK, list_count(&namespaces_list)); 758 758 fibril_mutex_unlock(&devices_list_mutex); 759 759 } … … 766 766 devmap_namespace_find_handle(IPC_GET_ARG1(*icall)); 767 767 if (namespace == NULL) 768 async_answer_0(iid, EEXISTS);768 ipc_answer_0(iid, EEXISTS); 769 769 else 770 async_answer_1(iid, EOK, namespace->refcnt);770 ipc_answer_1(iid, EOK, namespace->refcnt); 771 771 772 772 fibril_mutex_unlock(&devices_list_mutex); … … 778 778 size_t size; 779 779 if (!async_data_read_receive(&callid, &size)) { 780 async_answer_0(callid, EREFUSED);781 async_answer_0(iid, EREFUSED);780 ipc_answer_0(callid, EREFUSED); 781 ipc_answer_0(iid, EREFUSED); 782 782 return; 783 783 } 784 784 785 785 if ((size % sizeof(dev_desc_t)) != 0) { 786 async_answer_0(callid, EINVAL);787 async_answer_0(iid, EINVAL);786 ipc_answer_0(callid, EINVAL); 787 ipc_answer_0(iid, EINVAL); 788 788 return; 789 789 } … … 794 794 if (count != list_count(&namespaces_list)) { 795 795 fibril_mutex_unlock(&devices_list_mutex); 796 async_answer_0(callid, EOVERFLOW);797 async_answer_0(iid, EOVERFLOW);796 ipc_answer_0(callid, EOVERFLOW); 797 ipc_answer_0(iid, EOVERFLOW); 798 798 return; 799 799 } … … 802 802 if (desc == NULL) { 803 803 fibril_mutex_unlock(&devices_list_mutex); 804 async_answer_0(callid, ENOMEM);805 async_answer_0(iid, ENOMEM);804 ipc_answer_0(callid, ENOMEM); 805 ipc_answer_0(iid, ENOMEM); 806 806 return; 807 807 } … … 824 824 fibril_mutex_unlock(&devices_list_mutex); 825 825 826 async_answer_0(iid, retval);826 ipc_answer_0(iid, retval); 827 827 } 828 828 … … 835 835 size_t size; 836 836 if (!async_data_read_receive(&callid, &size)) { 837 async_answer_0(callid, EREFUSED);838 async_answer_0(iid, EREFUSED);837 ipc_answer_0(callid, EREFUSED); 838 ipc_answer_0(iid, EREFUSED); 839 839 return; 840 840 } 841 841 842 842 if ((size % sizeof(dev_desc_t)) != 0) { 843 async_answer_0(callid, EINVAL);844 async_answer_0(iid, EINVAL);843 ipc_answer_0(callid, EINVAL); 844 ipc_answer_0(iid, EINVAL); 845 845 return; 846 846 } … … 852 852 if (namespace == NULL) { 853 853 fibril_mutex_unlock(&devices_list_mutex); 854 async_answer_0(callid, ENOENT);855 async_answer_0(iid, ENOENT);854 ipc_answer_0(callid, ENOENT); 855 ipc_answer_0(iid, ENOENT); 856 856 return; 857 857 } … … 860 860 if (count != namespace->refcnt) { 861 861 fibril_mutex_unlock(&devices_list_mutex); 862 async_answer_0(callid, EOVERFLOW);863 async_answer_0(iid, EOVERFLOW);862 ipc_answer_0(callid, EOVERFLOW); 863 ipc_answer_0(iid, EOVERFLOW); 864 864 return; 865 865 } … … 868 868 if (desc == NULL) { 869 869 fibril_mutex_unlock(&devices_list_mutex); 870 async_answer_0(callid, ENOMEM);871 async_answer_0(iid, EREFUSED);870 ipc_answer_0(callid, ENOMEM); 871 ipc_answer_0(iid, EREFUSED); 872 872 return; 873 873 } … … 891 891 fibril_mutex_unlock(&devices_list_mutex); 892 892 893 async_answer_0(iid, retval);893 ipc_answer_0(iid, retval); 894 894 } 895 895 … … 910 910 if (!fnd) { 911 911 fibril_mutex_unlock(&null_devices_mutex); 912 async_answer_0(iid, ENOMEM);912 ipc_answer_0(iid, ENOMEM); 913 913 return; 914 914 } … … 920 920 if (dev_name == NULL) { 921 921 fibril_mutex_unlock(&null_devices_mutex); 922 async_answer_0(iid, ENOMEM);922 ipc_answer_0(iid, ENOMEM); 923 923 return; 924 924 } … … 928 928 if (device == NULL) { 929 929 fibril_mutex_unlock(&null_devices_mutex); 930 async_answer_0(iid, ENOMEM);930 ipc_answer_0(iid, ENOMEM); 931 931 return; 932 932 } … … 938 938 fibril_mutex_lock(&devices_list_mutex); 939 939 fibril_mutex_unlock(&null_devices_mutex); 940 async_answer_0(iid, ENOMEM);940 ipc_answer_0(iid, ENOMEM); 941 941 return; 942 942 } … … 960 960 fibril_mutex_unlock(&null_devices_mutex); 961 961 962 async_answer_1(iid, EOK, (sysarg_t) i);962 ipc_answer_1(iid, EOK, (sysarg_t) i); 963 963 } 964 964 … … 967 967 sysarg_t i = IPC_GET_ARG1(*icall); 968 968 if (i >= NULL_DEVICES) { 969 async_answer_0(iid, ELIMIT);969 ipc_answer_0(iid, ELIMIT); 970 970 return; 971 971 } … … 975 975 if (null_devices[i] == NULL) { 976 976 fibril_mutex_unlock(&null_devices_mutex); 977 async_answer_0(iid, ENOENT);977 ipc_answer_0(iid, ENOENT); 978 978 return; 979 979 } … … 986 986 987 987 fibril_mutex_unlock(&null_devices_mutex); 988 async_answer_0(iid, EOK);988 ipc_answer_0(iid, EOK); 989 989 } 990 990 … … 1012 1012 { 1013 1013 /* Accept connection */ 1014 async_answer_0(iid, EOK);1014 ipc_answer_0(iid, EOK); 1015 1015 1016 1016 devmap_driver_t *driver = devmap_driver_register(); … … 1029 1029 case DEVMAP_DRIVER_UNREGISTER: 1030 1030 if (NULL == driver) 1031 async_answer_0(callid, ENOENT);1031 ipc_answer_0(callid, ENOENT); 1032 1032 else 1033 async_answer_0(callid, EOK);1033 ipc_answer_0(callid, EOK); 1034 1034 break; 1035 1035 case DEVMAP_DEVICE_REGISTER: … … 1048 1048 break; 1049 1049 default: 1050 async_answer_0(callid, ENOENT);1050 ipc_answer_0(callid, ENOENT); 1051 1051 } 1052 1052 } … … 1067 1067 { 1068 1068 /* Accept connection */ 1069 async_answer_0(iid, EOK);1069 ipc_answer_0(iid, EOK); 1070 1070 1071 1071 bool cont = true; … … 1106 1106 break; 1107 1107 default: 1108 async_answer_0(callid, ENOENT);1108 ipc_answer_0(callid, ENOENT); 1109 1109 } 1110 1110 } … … 1130 1130 default: 1131 1131 /* No such interface */ 1132 async_answer_0(iid, ENOENT);1132 ipc_answer_0(iid, ENOENT); 1133 1133 } 1134 1134 } … … 1150 1150 1151 1151 /* Register device mapper at naming service */ 1152 if ( service_register(SERVICE_DEVMAP) != EOK)1152 if (ipc_connect_to_me(PHONE_NS, SERVICE_DEVMAP, 0, 0, NULL, NULL) != 0) 1153 1153 return -1; 1154 1154
Note:
See TracChangeset
for help on using the changeset viewer.