Changes in uspace/srv/devmap/devmap.c [79ae36dd:4ae90f9] in mainline
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/srv/devmap/devmap.c
r79ae36dd r4ae90f9 37 37 38 38 #include <ipc/services.h> 39 #include < ns.h>39 #include <ipc/ns.h> 40 40 #include <async.h> 41 41 #include <stdio.h> … … 59 59 /** Pointers to previous and next drivers in linked list */ 60 60 link_t drivers; 61 62 61 /** Pointer to the linked list of devices controlled by this driver */ 63 62 link_t devices; 64 65 /** Session asociated with this driver */ 66 async_sess_t *sess; 67 63 /** Phone asociated with this driver */ 64 sysarg_t phone; 68 65 /** Device driver name */ 69 66 char *name; 70 71 67 /** Fibril mutex for list of devices owned by this driver */ 72 68 fibril_mutex_t devices_mutex; … … 79 75 /** Pointer to the previous and next device in the list of all namespaces */ 80 76 link_t namespaces; 81 82 77 /** Unique namespace identifier */ 83 78 devmap_handle_t handle; 84 85 79 /** Namespace name */ 86 80 char *name; 87 88 81 /** Reference count */ 89 82 size_t refcnt; … … 412 405 * Create connection to the driver 413 406 */ 414 driver->sess = async_callback_receive(EXCHANGE_SERIALIZE); 415 if (!driver->sess) { 407 ipc_call_t call; 408 ipc_callid_t callid = async_get_call(&call); 409 410 if (IPC_GET_IMETHOD(call) != IPC_M_CONNECT_TO_ME) { 416 411 free(driver->name); 417 412 free(driver); 413 async_answer_0(callid, ENOTSUP); 418 414 async_answer_0(iid, ENOTSUP); 419 415 return NULL; 420 416 } 417 418 driver->phone = IPC_GET_ARG5(call); 419 async_answer_0(callid, EOK); 421 420 422 421 /* … … 463 462 fibril_mutex_lock(&drivers_list_mutex); 464 463 465 if (driver-> sess)466 async_hangup(driver-> sess);464 if (driver->phone != 0) 465 async_hangup(driver->phone); 467 466 468 467 /* Remove it from list of drivers */ … … 608 607 devmap_device_t *dev = devmap_device_find_handle(handle); 609 608 610 if ((dev == NULL) || (dev->driver == NULL) || ( !dev->driver->sess)) {609 if ((dev == NULL) || (dev->driver == NULL) || (dev->driver->phone == 0)) { 611 610 fibril_mutex_unlock(&devices_list_mutex); 612 611 async_answer_0(callid, ENOENT); … … 614 613 } 615 614 616 async_exch_t *exch = async_exchange_begin(dev->driver->sess);617 618 if (dev->forward_interface == 0)619 async_forward_fast(callid, exch, dev->handle, 0, 0,IPC_FF_NONE);620 else621 async_forward_fast(callid, exch, dev->forward_interface,622 dev-> handle, 0, IPC_FF_NONE);623 624 async_exchange_end(exch);615 if (dev->forward_interface == 0) { 616 async_forward_fast(callid, dev->driver->phone, 617 dev->handle, 0, 0, 618 IPC_FF_NONE); 619 } else { 620 async_forward_fast(callid, dev->driver->phone, 621 dev->forward_interface, dev->handle, 0, 622 IPC_FF_NONE); 623 } 625 624 626 625 fibril_mutex_unlock(&devices_list_mutex); … … 1030 1029 return; 1031 1030 1032 while (true) { 1031 bool cont = true; 1032 while (cont) { 1033 1033 ipc_call_t call; 1034 1034 ipc_callid_t callid = async_get_call(&call); 1035 1035 1036 if (!IPC_GET_IMETHOD(call))1037 break;1038 1039 1036 switch (IPC_GET_IMETHOD(call)) { 1037 case IPC_M_PHONE_HUNGUP: 1038 cont = false; 1039 continue; 1040 1040 case DEVMAP_DRIVER_UNREGISTER: 1041 1041 if (NULL == driver) … … 1080 1080 async_answer_0(iid, EOK); 1081 1081 1082 while (true) { 1082 bool cont = true; 1083 while (cont) { 1083 1084 ipc_call_t call; 1084 1085 ipc_callid_t callid = async_get_call(&call); 1085 1086 1086 if (!IPC_GET_IMETHOD(call))1087 break;1088 1089 1087 switch (IPC_GET_IMETHOD(call)) { 1088 case IPC_M_PHONE_HUNGUP: 1089 cont = false; 1090 continue; 1090 1091 case DEVMAP_DEVICE_GET_HANDLE: 1091 1092 devmap_device_get_handle(callid, &call);
Note:
See TracChangeset
for help on using the changeset viewer.