Changeset e2b9b341 in mainline
- Timestamp:
- 2011-09-02T16:33:02Z (13 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- 224c0e7
- Parents:
- c1a0488
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/srv/devman/main.c
rc1a0488 re2b9b341 391 391 fibril_rwlock_write_lock(&tree->rwlock); 392 392 393 /* Check device state */ 394 if (pdev->state == DEVICE_REMOVED) { 395 fibril_rwlock_write_unlock(&tree->rwlock); 396 dev_del_ref(pdev); 397 async_answer_0(callid, ENOENT); 398 return; 399 } 400 393 401 /* Check that function with same name is not there already. */ 394 402 if (find_fun_node_in_device(tree, pdev, fun_name) != NULL) { … … 453 461 fibril_rwlock_read_lock(&device_tree.rwlock); 454 462 463 /* Check function state */ 464 if (fun->state == FUN_REMOVED) { 465 fibril_rwlock_read_unlock(&device_tree.rwlock); 466 async_answer_0(callid, ENOENT); 467 return; 468 } 469 455 470 rc = loc_category_get_id(cat_name, &cat_id, IPC_FLAG_BLOCKING); 456 471 if (rc == EOK) { … … 561 576 562 577 log_msg(LVL_DEBUG, "devman_remove_function(fun='%s')", fun->pathname); 578 579 /* Check function state */ 580 if (fun->state == FUN_REMOVED) { 581 fibril_rwlock_write_unlock(&tree->rwlock); 582 async_answer_0(callid, ENOENT); 583 return; 584 } 563 585 564 586 if (fun->ftype == fun_inner) { … … 700 722 701 723 fibril_rwlock_read_lock(&device_tree.rwlock); 724 725 /* Check function state */ 726 if (fun->state == FUN_REMOVED) { 727 fibril_rwlock_read_unlock(&device_tree.rwlock); 728 async_answer_0(iid, ENOENT); 729 return; 730 } 702 731 handle = fun->handle; 732 703 733 fibril_rwlock_read_unlock(&device_tree.rwlock); 704 734 … … 738 768 fibril_rwlock_read_lock(&device_tree.rwlock); 739 769 770 /* Check function state */ 771 if (fun->state == FUN_REMOVED) { 772 fibril_rwlock_read_unlock(&device_tree.rwlock); 773 free(buffer); 774 775 async_answer_0(data_callid, ENOENT); 776 async_answer_0(iid, ENOENT); 777 fun_del_ref(fun); 778 return; 779 } 780 740 781 size_t sent_length = str_size(fun->name); 741 782 if (sent_length > data_len) { … … 781 822 fibril_rwlock_read_lock(&device_tree.rwlock); 782 823 824 /* Check function state */ 825 if (fun->state == FUN_REMOVED) { 826 fibril_rwlock_read_unlock(&device_tree.rwlock); 827 free(buffer); 828 829 async_answer_0(data_callid, ENOENT); 830 async_answer_0(iid, ENOENT); 831 fun_del_ref(fun); 832 return; 833 } 834 783 835 size_t sent_length = str_size(fun->pathname); 784 836 if (sent_length > data_len) { … … 811 863 dev_node_t *dev = find_dev_node_no_lock(&device_tree, 812 864 IPC_GET_ARG1(*icall)); 813 if (dev == NULL ) {865 if (dev == NULL || dev->state == DEVICE_REMOVED) { 814 866 fibril_rwlock_read_unlock(&device_tree.rwlock); 815 867 async_answer_0(callid, ENOENT); … … 850 902 fibril_rwlock_read_lock(&device_tree.rwlock); 851 903 852 fun = find_fun_node (&device_tree, IPC_GET_ARG1(*icall));853 if (fun == NULL ) {904 fun = find_fun_node_no_lock(&device_tree, IPC_GET_ARG1(*icall)); 905 if (fun == NULL || fun->state == FUN_REMOVED) { 854 906 fibril_rwlock_read_unlock(&device_tree.rwlock); 855 907 async_answer_0(iid, ENOENT); … … 858 910 859 911 if (fun->child == NULL) { 860 fun_del_ref(fun);861 912 fibril_rwlock_read_unlock(&device_tree.rwlock); 862 913 async_answer_0(iid, ENOENT); … … 866 917 async_answer_1(iid, EOK, fun->child->handle); 867 918 868 fun_del_ref(fun);869 919 fibril_rwlock_read_unlock(&device_tree.rwlock); 870 920 } … … 931 981 932 982 fibril_rwlock_read_lock(&device_tree.rwlock); 983 984 /* Check function state */ 985 if (fun->state == FUN_REMOVED) { 986 fibril_rwlock_read_unlock(&device_tree.rwlock); 987 async_answer_0(iid, ENOENT); 988 return; 989 } 990 933 991 async_answer_1(iid, EOK, fun->handle); 934 992 fibril_rwlock_read_unlock(&device_tree.rwlock); … … 1022 1080 driver_t *driver = NULL; 1023 1081 1082 fibril_rwlock_read_lock(&device_tree.rwlock); 1083 1024 1084 if (drv_to_parent) { 1025 1085 /* Connect to parent function of a device (or device function). */ … … 1035 1095 } 1036 1096 1097 fibril_rwlock_read_unlock(&device_tree.rwlock); 1098 1037 1099 if (driver == NULL) { 1038 1100 log_msg(LVL_ERROR, "IPC forwarding refused - " \ … … 1083 1145 fun_node_t *fun; 1084 1146 dev_node_t *dev; 1147 devman_handle_t handle; 1148 driver_t *driver; 1085 1149 1086 1150 fun = find_loc_tree_function(&device_tree, service_id); 1087 1151 1088 if (fun == NULL || fun->dev->drv == NULL) { 1152 fibril_rwlock_read_lock(&device_tree.rwlock); 1153 1154 if (fun == NULL || fun->dev == NULL || fun->dev->drv == NULL) { 1089 1155 log_msg(LVL_WARN, "devman_connection_loc(): function " 1090 1156 "not found.\n"); 1091 async_answer_0(iid, ENOENT);1092 return;1093 }1094 1095 fibril_rwlock_read_lock(&device_tree.rwlock);1157 fibril_rwlock_read_unlock(&device_tree.rwlock); 1158 async_answer_0(iid, ENOENT); 1159 return; 1160 } 1161 1096 1162 dev = fun->dev; 1097 fun_del_ref(fun); 1098 1099 async_exch_t *exch = async_exchange_begin(dev->drv->sess); 1100 async_forward_fast(iid, exch, DRIVER_CLIENT, fun->handle, 0, 1163 driver = dev->drv; 1164 handle = fun->handle; 1165 1166 fibril_rwlock_read_unlock(&device_tree.rwlock); 1167 1168 async_exch_t *exch = async_exchange_begin(driver->sess); 1169 async_forward_fast(iid, exch, DRIVER_CLIENT, handle, 0, 1101 1170 IPC_FF_NONE); 1102 1171 async_exchange_end(exch); 1103 1172 1104 fibril_rwlock_read_unlock(&device_tree.rwlock);1105 1106 1173 log_msg(LVL_DEBUG, 1107 1174 "Forwarding loc service request for `%s' function to driver `%s'.", 1108 fun->pathname, dev->drv->name); 1175 fun->pathname, driver->name); 1176 1177 fun_del_ref(fun); 1109 1178 } 1110 1179
Note:
See TracChangeset
for help on using the changeset viewer.