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