Changeset ffa2c8ef in mainline for uspace/srv/devman/main.c
- Timestamp:
- 2011-01-29T11:36:08Z (14 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- 46b881c
- Parents:
- 64d2b10
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/srv/devman/main.c
r64d2b10 rffa2c8ef 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 } … … 460 460 printf(NAME ": devman_forward error - the device is not in %" PRIun 461 461 " usable state.\n", handle); 462 ipc_answer_0(iid, ENOENT);462 async_answer_0(iid, ENOENT); 463 463 return; 464 464 } … … 474 474 driver->name); 475 475 printf("the driver's phone is %" PRIun ").\n", driver->phone); 476 ipc_answer_0(iid, EINVAL);476 async_answer_0(iid, EINVAL); 477 477 return; 478 478 } … … 480 480 printf(NAME ": devman_forward: forward connection to device %s to " 481 481 "driver %s.\n", dev->pathname, driver->name); 482 ipc_forward_fast(iid, driver->phone, method, dev->handle, 0, IPC_FF_NONE);482 async_forward_fast(iid, driver->phone, method, dev->handle, 0, IPC_FF_NONE); 483 483 } 484 484 … … 495 495 496 496 if (dev == NULL || dev->drv == NULL) { 497 ipc_answer_0(iid, ENOENT);497 async_answer_0(iid, ENOENT); 498 498 return; 499 499 } 500 500 501 501 if (dev->state != DEVICE_USABLE || dev->drv->phone <= 0) { 502 ipc_answer_0(iid, EINVAL);503 return; 504 } 505 506 ipc_forward_fast(iid, dev->drv->phone, DRIVER_CLIENT, dev->handle, 0,502 async_answer_0(iid, EINVAL); 503 return; 504 } 505 506 async_forward_fast(iid, dev->drv->phone, DRIVER_CLIENT, dev->handle, 0, 507 507 IPC_FF_NONE); 508 508 printf(NAME ": devman_connection_devmapper: forwarded connection to " … … 535 535 default: 536 536 /* No such interface */ 537 ipc_answer_0(iid, ENOENT);537 async_answer_0(iid, ENOENT); 538 538 } 539 539 }
Note:
See TracChangeset
for help on using the changeset viewer.