Changeset 17aca1c in mainline for uspace/srv/devman/main.c
- Timestamp:
- 2011-02-04T20:56:52Z (14 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- 0397e5a4, e29e09cf
- Parents:
- e778543 (diff), 0b37882 (diff)
Note: this is a merge changeset, the changes displayed below correspond to the merge itself.
Use the(diff)
links above to see all the changes relative to each parent. - File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/srv/devman/main.c
re778543 r17aca1c 75 75 iid = async_get_call(&icall); 76 76 if (IPC_GET_IMETHOD(icall) != DEVMAN_DRIVER_REGISTER) { 77 ipc_answer_0(iid, EREFUSED);77 async_answer_0(iid, EREFUSED); 78 78 return NULL; 79 79 } … … 84 84 int rc = async_data_write_accept((void **) &drv_name, true, 0, 0, 0, 0); 85 85 if (rc != EOK) { 86 ipc_answer_0(iid, rc);86 async_answer_0(iid, rc); 87 87 return NULL; 88 88 } … … 98 98 free(drv_name); 99 99 drv_name = NULL; 100 ipc_answer_0(iid, ENOENT);100 async_answer_0(iid, ENOENT); 101 101 return NULL; 102 102 } … … 110 110 ipc_callid_t callid = async_get_call(&call); 111 111 if (IPC_GET_IMETHOD(call) != IPC_M_CONNECT_TO_ME) { 112 ipc_answer_0(callid, ENOTSUP);113 ipc_answer_0(iid, ENOTSUP);112 async_answer_0(callid, ENOTSUP); 113 async_answer_0(iid, ENOTSUP); 114 114 return NULL; 115 115 } … … 121 121 driver->name); 122 122 123 ipc_answer_0(callid, EOK);124 ipc_answer_0(iid, EOK);123 async_answer_0(callid, EOK); 124 async_answer_0(iid, EOK); 125 125 126 126 return driver; … … 144 144 printf(NAME ": ERROR: devman_receive_match_id - invalid " 145 145 "protocol.\n"); 146 ipc_answer_0(callid, EINVAL);146 async_answer_0(callid, EINVAL); 147 147 delete_match_id(match_id); 148 148 return EINVAL; … … 152 152 printf(NAME ": ERROR: devman_receive_match_id - failed to " 153 153 "allocate match id.\n"); 154 ipc_answer_0(callid, ENOMEM);154 async_answer_0(callid, ENOMEM); 155 155 return ENOMEM; 156 156 } 157 157 158 ipc_answer_0(callid, EOK);158 async_answer_0(callid, EOK); 159 159 160 160 match_id->score = IPC_GET_ARG1(call); … … 219 219 if (parent == NULL) { 220 220 fibril_rwlock_write_unlock(&tree->rwlock); 221 ipc_answer_0(callid, ENOENT);221 async_answer_0(callid, ENOENT); 222 222 return; 223 223 } … … 227 227 if (rc != EOK) { 228 228 fibril_rwlock_write_unlock(&tree->rwlock); 229 ipc_answer_0(callid, rc);229 async_answer_0(callid, rc); 230 230 return; 231 231 } … … 235 235 fibril_rwlock_write_unlock(&tree->rwlock); 236 236 delete_dev_node(node); 237 ipc_answer_0(callid, ENOMEM);237 async_answer_0(callid, ENOMEM); 238 238 return; 239 239 } … … 264 264 265 265 /* Return device handle to parent's driver. */ 266 ipc_answer_1(callid, EOK, node->handle);266 async_answer_1(callid, EOK, node->handle); 267 267 } 268 268 … … 302 302 0, 0, 0, 0); 303 303 if (rc != EOK) { 304 ipc_answer_0(callid, rc);304 async_answer_0(callid, rc); 305 305 return; 306 306 } … … 308 308 node_t *dev = find_dev_node(&device_tree, handle); 309 309 if (dev == NULL) { 310 ipc_answer_0(callid, ENOENT);310 async_answer_0(callid, ENOENT); 311 311 return; 312 312 } … … 321 321 "asigned to it\n", dev->pathname, class_name, class_info->dev_name); 322 322 323 ipc_answer_0(callid, EOK);323 async_answer_0(callid, EOK); 324 324 } 325 325 … … 343 343 { 344 344 /* Accept the connection. */ 345 ipc_answer_0(iid, EOK);345 async_answer_0(iid, EOK); 346 346 347 347 driver_t *driver = devman_driver_register(); … … 379 379 break; 380 380 default: 381 ipc_answer_0(callid, EINVAL);381 async_answer_0(callid, EINVAL); 382 382 break; 383 383 } … … 393 393 int rc = async_data_write_accept((void **) &pathname, true, 0, 0, 0, 0); 394 394 if (rc != EOK) { 395 ipc_answer_0(iid, rc);395 async_answer_0(iid, rc); 396 396 return; 397 397 } … … 402 402 403 403 if (dev == NULL) { 404 ipc_answer_0(iid, ENOENT);405 return; 406 } 407 408 ipc_answer_1(iid, EOK, dev->handle);404 async_answer_0(iid, ENOENT); 405 return; 406 } 407 408 async_answer_1(iid, EOK, dev->handle); 409 409 } 410 410 … … 414 414 { 415 415 /* Accept connection. */ 416 ipc_answer_0(iid, EOK);416 async_answer_0(iid, EOK); 417 417 418 418 bool cont = true; … … 429 429 break; 430 430 default: 431 ipc_answer_0(callid, ENOENT);431 async_answer_0(callid, ENOENT); 432 432 } 433 433 } … … 443 443 printf(NAME ": devman_forward error - no device with handle %" PRIun 444 444 " was found.\n", handle); 445 ipc_answer_0(iid, ENOENT);445 async_answer_0(iid, ENOENT); 446 446 return; 447 447 } … … 461 461 " (%s) is not in usable state.\n", 462 462 handle, dev->pathname); 463 ipc_answer_0(iid, ENOENT);463 async_answer_0(iid, ENOENT); 464 464 return; 465 465 } … … 475 475 driver->name); 476 476 printf("the driver's phone is %" PRIun ").\n", driver->phone); 477 ipc_answer_0(iid, EINVAL);478 return; 479 } 480 481 //printf(NAME ": devman_forward: forward connection to device %s to "482 //"driver %s.\n", dev->pathname, driver->name);483 ipc_forward_fast(iid, driver->phone, method, dev->handle, 0, IPC_FF_NONE);477 async_answer_0(iid, EINVAL); 478 return; 479 } 480 481 printf(NAME ": devman_forward: forward connection to device %s to " 482 "driver %s.\n", dev->pathname, driver->name); 483 async_forward_fast(iid, driver->phone, method, dev->handle, 0, IPC_FF_NONE); 484 484 } 485 485 … … 496 496 497 497 if (dev == NULL || dev->drv == NULL) { 498 ipc_answer_0(iid, ENOENT);498 async_answer_0(iid, ENOENT); 499 499 return; 500 500 } 501 501 502 502 if (dev->state != DEVICE_USABLE || dev->drv->phone <= 0) { 503 ipc_answer_0(iid, EINVAL);504 return; 505 } 506 507 ipc_forward_fast(iid, dev->drv->phone, DRIVER_CLIENT, dev->handle, 0,503 async_answer_0(iid, EINVAL); 504 return; 505 } 506 507 async_forward_fast(iid, dev->drv->phone, DRIVER_CLIENT, dev->handle, 0, 508 508 IPC_FF_NONE); 509 509 printf(NAME ": devman_connection_devmapper: forwarded connection to " … … 536 536 default: 537 537 /* No such interface */ 538 ipc_answer_0(iid, ENOENT);538 async_answer_0(iid, ENOENT); 539 539 } 540 540 } … … 587 587 588 588 /* Register device manager at naming service. */ 589 if ( ipc_connect_to_me(PHONE_NS, SERVICE_DEVMAN, 0, 0, NULL, NULL) != 0)589 if (service_register(SERVICE_DEVMAN) != EOK) 590 590 return -1; 591 591
Note:
See TracChangeset
for help on using the changeset viewer.