Changeset f9b2cb4c in mainline for uspace/srv
- Timestamp:
- 2015-08-23T12:50:23Z (10 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- 9ef495f
- Parents:
- 0dd16778
- Location:
- uspace/srv
- Files:
-
- 38 edited
-
bd/part/guid_part/guid_part.c (modified) (1 diff)
-
bd/part/mbr_part/mbr_part.c (modified) (1 diff)
-
bd/sata_bd/sata_bd.c (modified) (1 diff)
-
devman/client_conn.c (modified) (1 diff)
-
devman/client_conn.h (modified) (1 diff)
-
devman/driver.c (modified) (3 diffs)
-
devman/drv_conn.c (modified) (3 diffs)
-
devman/drv_conn.h (modified) (1 diff)
-
devman/loc.c (modified) (1 diff)
-
devman/main.c (modified) (10 diffs)
-
fs/cdfs/cdfs.c (modified) (1 diff)
-
fs/exfat/exfat.c (modified) (1 diff)
-
fs/ext4fs/ext4fs.c (modified) (1 diff)
-
fs/fat/fat.c (modified) (1 diff)
-
fs/locfs/locfs.c (modified) (1 diff)
-
fs/locfs/locfs_ops.c (modified) (1 diff)
-
fs/mfs/mfs.c (modified) (1 diff)
-
fs/tmpfs/tmpfs.c (modified) (1 diff)
-
fs/udf/udf.c (modified) (1 diff)
-
hid/compositor/compositor.c (modified) (4 diffs)
-
hid/console/console.c (modified) (3 diffs)
-
hid/input/ctl/kbdev.c (modified) (2 diffs)
-
hid/input/input.c (modified) (1 diff)
-
hid/input/port/adb.c (modified) (2 diffs)
-
hid/input/port/adb_mouse.c (modified) (2 diffs)
-
hid/input/port/chardev.c (modified) (2 diffs)
-
hid/input/proto/mousedev.c (modified) (2 diffs)
-
hid/isdv4_tablet/main.c (modified) (2 diffs)
-
hid/remcons/remcons.c (modified) (1 diff)
-
hw/bus/cuda_adb/cuda_adb.c (modified) (1 diff)
-
locsrv/locsrv.c (modified) (8 diffs)
-
locsrv/locsrv.h (modified) (1 diff)
-
logger/main.c (modified) (2 diffs)
-
net/ethip/ethip.c (modified) (1 diff)
-
net/ethip/ethip_nic.c (modified) (1 diff)
-
net/inetsrv/inet_link.c (modified) (1 diff)
-
net/inetsrv/inetsrv.c (modified) (3 diffs)
-
net/slip/slip.c (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
uspace/srv/bd/part/guid_part/guid_part.c
r0dd16778 rf9b2cb4c 339 339 340 340 /* Get the device handle. */ 341 dh = IPC_GET_ARG 1(*icall);342 343 /* 341 dh = IPC_GET_ARG2(*icall); 342 343 /* 344 344 * Determine which partition device is the client connecting to. 345 345 * A linear search is not terribly fast, but we only do this -
uspace/srv/bd/part/mbr_part/mbr_part.c
r0dd16778 rf9b2cb4c 416 416 417 417 /* Get the device handle. */ 418 dh = IPC_GET_ARG 1(*icall);419 420 /* 418 dh = IPC_GET_ARG2(*icall); 419 420 /* 421 421 * Determine which partition device is the client connecting to. 422 422 * A linear search is not terribly fast, but we only do this -
uspace/srv/bd/sata_bd/sata_bd.c
r0dd16778 rf9b2cb4c 172 172 173 173 /* Get the device service ID. */ 174 dsid = IPC_GET_ARG 1(*icall);174 dsid = IPC_GET_ARG2(*icall); 175 175 176 176 /* Determine which disk device is the client connecting to. */ -
uspace/srv/devman/client_conn.c
r0dd16778 rf9b2cb4c 726 726 727 727 /** Function for handling connections from a client to the device manager. */ 728 void devman_connection_client(ipc_callid_t iid, ipc_call_t *icall )728 void devman_connection_client(ipc_callid_t iid, ipc_call_t *icall, void *arg) 729 729 { 730 730 /* Accept connection. */ -
uspace/srv/devman/client_conn.h
r0dd16778 rf9b2cb4c 36 36 #include "devman.h" 37 37 38 extern void devman_connection_client(ipc_callid_t, ipc_call_t * );38 extern void devman_connection_client(ipc_callid_t, ipc_call_t *, void *); 39 39 40 40 #endif -
uspace/srv/devman/driver.c
r0dd16778 rf9b2cb4c 36 36 #include <sys/stat.h> 37 37 #include <io/log.h> 38 #include <ipc/driver.h>39 38 #include <loc.h> 40 39 #include <str_error.h> … … 573 572 574 573 if (rc != EOK) { 575 /* TODO handle error */576 } 577 578 /* Wait for answer from the driver. */579 async_wait_for(req, &rc);580 581 switch (rc) {574 async_forget(req); 575 } else { 576 /* Wait for answer from the driver. */ 577 async_wait_for(req, &rc); 578 } 579 580 switch (rc) { 582 581 case EOK: 583 582 dev->state = DEVICE_USABLE; … … 592 591 593 592 dev->passed_to_driver = true; 594 595 return;596 593 } 597 594 -
uspace/srv/devman/drv_conn.c
r0dd16778 rf9b2cb4c 49 49 #include <io/log.h> 50 50 #include <ipc/devman.h> 51 #include <ipc/driver.h>52 51 #include <loc.h> 53 52 … … 131 130 } 132 131 /* FIXME: Work around problem with callback sessions */ 133 async_sess_args_set(driver->sess, DRIVER_DEVMAN, 0, 0);132 async_sess_args_set(driver->sess, INTERFACE_DDF_DEVMAN, 0, 0); 134 133 135 134 log_msg(LOG_DEFAULT, LVL_NOTE, … … 587 586 588 587 /** Function for handling connections from a driver to the device manager. */ 589 void devman_connection_driver(ipc_callid_t iid, ipc_call_t *icall )588 void devman_connection_driver(ipc_callid_t iid, ipc_call_t *icall, void *arg) 590 589 { 591 590 client_t *client; -
uspace/srv/devman/drv_conn.h
r0dd16778 rf9b2cb4c 37 37 #include "devman.h" 38 38 39 extern void devman_connection_driver(ipc_callid_t, ipc_call_t * );39 extern void devman_connection_driver(ipc_callid_t, ipc_call_t *, void *); 40 40 41 41 #endif -
uspace/srv/devman/loc.c
r0dd16778 rf9b2cb4c 59 59 } 60 60 61 loc_service_register_with_iface(loc_pathname, 62 &fun->service_id, INTERFACE_DDF_CLIENT); 61 loc_service_register(loc_pathname, &fun->service_id); 63 62 64 63 tree_add_loc_function(tree, fun); -
uspace/srv/devman/main.c
r0dd16778 rf9b2cb4c 49 49 #include <io/log.h> 50 50 #include <ipc/devman.h> 51 #include <ipc/driver.h>52 51 #include <loc.h> 53 52 … … 66 65 dev_tree_t device_tree; 67 66 68 static void devman_ forward(ipc_callid_t iid, ipc_call_t *icall,69 bool drv_to_parent)67 static void devman_connection_device(ipc_callid_t iid, ipc_call_t *icall, 68 void *arg) 70 69 { 71 70 devman_handle_t handle = IPC_GET_ARG2(*icall); 72 devman_handle_t fwd_h;73 fun_node_t *fun = NULL;74 71 dev_node_t *dev = NULL; 75 72 76 fun = find_fun_node(&device_tree, handle);77 if (fun == NULL) 73 fun_node_t *fun = find_fun_node(&device_tree, handle); 74 if (fun == NULL) { 78 75 dev = find_dev_node(&device_tree, handle); 79 else {76 } else { 80 77 fibril_rwlock_read_lock(&device_tree.rwlock); 78 81 79 dev = fun->dev; 82 80 if (dev != NULL) 83 81 dev_add_ref(dev); 82 84 83 fibril_rwlock_read_unlock(&device_tree.rwlock); 85 84 } 86 85 87 86 /* 88 87 * For a valid function to connect to we need a device. The root … … 97 96 goto cleanup; 98 97 } 99 100 if (fun == NULL && !drv_to_parent) {98 99 if (fun == NULL) { 101 100 log_msg(LOG_DEFAULT, LVL_ERROR, NAME ": devman_forward error - cannot " 102 101 "connect to handle %" PRIun ", refers to a device.", … … 106 105 } 107 106 108 driver_t *driver = NULL;109 110 107 fibril_rwlock_read_lock(&device_tree.rwlock); 111 108 112 if (drv_to_parent) { 113 /* Connect to parent function of a device (or device function). */ 114 if (dev->pfun->dev != NULL) 115 driver = dev->pfun->dev->drv; 116 117 fwd_h = dev->pfun->handle; 118 } else { 119 /* Connect to the specified function */ 120 driver = dev->drv; 121 fwd_h = handle; 122 } 109 /* Connect to the specified function */ 110 driver_t *driver = dev->drv; 123 111 124 112 fibril_rwlock_read_unlock(&device_tree.rwlock); … … 130 118 goto cleanup; 131 119 } 132 133 int method;134 if (drv_to_parent)135 method = DRIVER_DRIVER;136 else137 method = DRIVER_CLIENT;138 120 139 121 if (!driver->sess) { … … 143 125 goto cleanup; 144 126 } 145 127 146 128 if (fun != NULL) { 147 129 log_msg(LOG_DEFAULT, LVL_DEBUG, … … 155 137 156 138 async_exch_t *exch = async_exchange_begin(driver->sess); 157 async_forward_fast(iid, exch, method, fwd_h, 0, IPC_FF_NONE);139 async_forward_fast(iid, exch, INTERFACE_DDF_CLIENT, handle, 0, IPC_FF_NONE); 158 140 async_exchange_end(exch); 159 141 … … 166 148 } 167 149 168 /** Function for handling connections from a client forwarded by the location 169 * service to the device manager. */ 170 static void devman_connection_loc(ipc_callid_t iid, ipc_call_t *icall) 171 { 150 static void devman_connection_parent(ipc_callid_t iid, ipc_call_t *icall, 151 void *arg) 152 { 153 devman_handle_t handle = IPC_GET_ARG2(*icall); 154 dev_node_t *dev = NULL; 155 156 fun_node_t *fun = find_fun_node(&device_tree, handle); 157 if (fun == NULL) { 158 dev = find_dev_node(&device_tree, handle); 159 } else { 160 fibril_rwlock_read_lock(&device_tree.rwlock); 161 162 dev = fun->dev; 163 if (dev != NULL) 164 dev_add_ref(dev); 165 166 fibril_rwlock_read_unlock(&device_tree.rwlock); 167 } 168 169 /* 170 * For a valid function to connect to we need a device. The root 171 * function, for example, has no device and cannot be connected to. 172 * This means @c dev needs to be valid regardless whether we are 173 * connecting to a device or to a function. 174 */ 175 if (dev == NULL) { 176 log_msg(LOG_DEFAULT, LVL_ERROR, "IPC forwarding failed - no device or " 177 "function with handle %" PRIun " was found.", handle); 178 async_answer_0(iid, ENOENT); 179 goto cleanup; 180 } 181 182 driver_t *driver = NULL; 183 184 fibril_rwlock_read_lock(&device_tree.rwlock); 185 186 /* Connect to parent function of a device (or device function). */ 187 if (dev->pfun->dev != NULL) 188 driver = dev->pfun->dev->drv; 189 190 devman_handle_t fun_handle = dev->pfun->handle; 191 192 fibril_rwlock_read_unlock(&device_tree.rwlock); 193 194 if (driver == NULL) { 195 log_msg(LOG_DEFAULT, LVL_ERROR, "IPC forwarding refused - " \ 196 "the device %" PRIun " is not in usable state.", handle); 197 async_answer_0(iid, ENOENT); 198 goto cleanup; 199 } 200 201 if (!driver->sess) { 202 log_msg(LOG_DEFAULT, LVL_ERROR, 203 "Could not forward to driver `%s'.", driver->name); 204 async_answer_0(iid, EINVAL); 205 goto cleanup; 206 } 207 208 if (fun != NULL) { 209 log_msg(LOG_DEFAULT, LVL_DEBUG, 210 "Forwarding request for `%s' function to driver `%s'.", 211 fun->pathname, driver->name); 212 } else { 213 log_msg(LOG_DEFAULT, LVL_DEBUG, 214 "Forwarding request for `%s' device to driver `%s'.", 215 dev->pfun->pathname, driver->name); 216 } 217 218 async_exch_t *exch = async_exchange_begin(driver->sess); 219 async_forward_fast(iid, exch, INTERFACE_DDF_DRIVER, fun_handle, 0, IPC_FF_NONE); 220 async_exchange_end(exch); 221 222 cleanup: 223 if (dev != NULL) 224 dev_del_ref(dev); 225 226 if (fun != NULL) 227 fun_del_ref(fun); 228 } 229 230 static void devman_forward(ipc_callid_t iid, ipc_call_t *icall, void *arg) 231 { 232 iface_t iface = IPC_GET_ARG1(*icall); 172 233 service_id_t service_id = IPC_GET_ARG2(*icall); 173 fun_node_t *fun; 174 dev_node_t *dev; 175 devman_handle_t handle; 176 driver_t *driver; 177 178 fun = find_loc_tree_function(&device_tree, service_id); 234 235 fun_node_t *fun = find_loc_tree_function(&device_tree, service_id); 179 236 180 237 fibril_rwlock_read_lock(&device_tree.rwlock); 181 238 182 if ( fun == NULL || fun->dev == NULL || fun->dev->drv == NULL) {183 log_msg(LOG_DEFAULT, LVL_WARN, "devman_ connection_loc(): function "239 if ((fun == NULL) || (fun->dev == NULL) || (fun->dev->drv == NULL)) { 240 log_msg(LOG_DEFAULT, LVL_WARN, "devman_forward(): function " 184 241 "not found.\n"); 185 242 fibril_rwlock_read_unlock(&device_tree.rwlock); … … 188 245 } 189 246 190 dev = fun->dev;191 driver = dev->drv;192 handle = fun->handle;247 dev_node_t *dev = fun->dev; 248 driver_t *driver = dev->drv; 249 devman_handle_t handle = fun->handle; 193 250 194 251 fibril_rwlock_read_unlock(&device_tree.rwlock); 195 252 196 253 async_exch_t *exch = async_exchange_begin(driver->sess); 197 async_forward_fast(iid, exch, DRIVER_CLIENT, handle, 0, 198 IPC_FF_NONE); 254 async_forward_fast(iid, exch, iface, handle, 0, IPC_FF_NONE); 199 255 async_exchange_end(exch); 200 256 201 257 log_msg(LOG_DEFAULT, LVL_DEBUG, 202 "Forwarding locservice request for `%s' function to driver `%s'.",258 "Forwarding service request for `%s' function to driver `%s'.", 203 259 fun->pathname, driver->name); 204 260 205 261 fun_del_ref(fun); 206 }207 208 /** Function for handling connections to device manager. */209 static void devman_connection(ipc_callid_t iid, ipc_call_t *icall, void *arg)210 {211 /* Select port. */212 switch ((sysarg_t) (IPC_GET_ARG1(*icall))) {213 case DEVMAN_DRIVER:214 devman_connection_driver(iid, icall);215 break;216 case DEVMAN_CLIENT:217 devman_connection_client(iid, icall);218 break;219 case DEVMAN_CONNECT_TO_DEVICE:220 /* Connect client to selected device. */221 devman_forward(iid, icall, false);222 break;223 case INTERFACE_DDF_CLIENT:224 /* Someone connected through loc node. */225 devman_connection_loc(iid, icall);226 break;227 case DEVMAN_CONNECT_TO_PARENTS_DEVICE:228 /* Connect client to selected device. */229 devman_forward(iid, icall, true);230 break;231 default:232 /* No such interface */233 async_answer_0(iid, ENOENT);234 }235 262 } 236 263 … … 298 325 async_set_client_data_constructor(devman_client_data_create); 299 326 async_set_client_data_destructor(devman_client_data_destroy); 300 async_set_fallback_port_handler(devman_connection, NULL); 327 328 port_id_t port; 329 rc = async_create_port(INTERFACE_DDF_DRIVER, 330 devman_connection_driver, NULL, &port); 331 if (rc != EOK) 332 return rc; 333 334 rc = async_create_port(INTERFACE_DDF_CLIENT, 335 devman_connection_client, NULL, &port); 336 if (rc != EOK) 337 return rc; 338 339 rc = async_create_port(INTERFACE_DEVMAN_DEVICE, 340 devman_connection_device, NULL, &port); 341 if (rc != EOK) 342 return rc; 343 344 rc = async_create_port(INTERFACE_DEVMAN_PARENT, 345 devman_connection_parent, NULL, &port); 346 if (rc != EOK) 347 return rc; 348 349 async_set_fallback_port_handler(devman_forward, NULL); 301 350 302 351 if (!devman_init()) { -
uspace/srv/fs/cdfs/cdfs.c
r0dd16778 rf9b2cb4c 73 73 } 74 74 75 async_sess_t *vfs_sess = service_connect_blocking( EXCHANGE_SERIALIZE,76 SERVICE_VFS, 0);75 async_sess_t *vfs_sess = service_connect_blocking(SERVICE_VFS, 76 INTERFACE_VFS_DRIVER, 0); 77 77 if (!vfs_sess) { 78 78 printf("%s: Unable to connect to VFS\n", NAME); -
uspace/srv/fs/exfat/exfat.c
r0dd16778 rf9b2cb4c 75 75 goto err; 76 76 77 async_sess_t *vfs_sess = service_connect_blocking( EXCHANGE_SERIALIZE,78 SERVICE_VFS, 0);77 async_sess_t *vfs_sess = service_connect_blocking(SERVICE_VFS, 78 INTERFACE_VFS_DRIVER, 0); 79 79 if (!vfs_sess) { 80 80 printf(NAME ": failed to connect to VFS\n"); -
uspace/srv/fs/ext4fs/ext4fs.c
r0dd16778 rf9b2cb4c 65 65 } 66 66 67 async_sess_t *vfs_sess = service_connect_blocking( EXCHANGE_SERIALIZE,68 SERVICE_VFS, 0);67 async_sess_t *vfs_sess = service_connect_blocking(SERVICE_VFS, 68 INTERFACE_VFS_DRIVER, 0); 69 69 if (!vfs_sess) { 70 70 printf("%s: Failed to connect to VFS\n", NAME); -
uspace/srv/fs/fat/fat.c
r0dd16778 rf9b2cb4c 75 75 goto err; 76 76 77 async_sess_t *vfs_sess = service_connect_blocking( EXCHANGE_SERIALIZE,78 SERVICE_VFS, 0);77 async_sess_t *vfs_sess = service_connect_blocking(SERVICE_VFS, 78 INTERFACE_VFS_DRIVER, 0); 79 79 if (!vfs_sess) { 80 80 printf(NAME ": failed to connect to VFS\n"); -
uspace/srv/fs/locfs/locfs.c
r0dd16778 rf9b2cb4c 77 77 } 78 78 79 async_sess_t *vfs_sess = service_connect_blocking( EXCHANGE_SERIALIZE,80 SERVICE_VFS, 0);79 async_sess_t *vfs_sess = service_connect_blocking(SERVICE_VFS, 80 INTERFACE_VFS_DRIVER, 0); 81 81 if (!vfs_sess) { 82 82 printf("%s: Unable to connect to VFS\n", NAME); -
uspace/srv/fs/locfs/locfs_ops.c
r0dd16778 rf9b2cb4c 264 264 fibril_mutex_unlock(&services_mutex); 265 265 266 async_sess_t *sess = loc_service_connect( 267 EXCHANGE_SERIALIZE, node->service_id, 0);266 async_sess_t *sess = loc_service_connect(node->service_id, 267 INTERFACE_FS, 0); 268 268 269 269 fibril_mutex_lock(&services_mutex); -
uspace/srv/fs/mfs/mfs.c
r0dd16778 rf9b2cb4c 73 73 } 74 74 75 async_sess_t *vfs_sess = service_connect_blocking( EXCHANGE_SERIALIZE,76 SERVICE_VFS, 0);75 async_sess_t *vfs_sess = service_connect_blocking(SERVICE_VFS, 76 INTERFACE_VFS_DRIVER, 0); 77 77 78 78 if (!vfs_sess) { -
uspace/srv/fs/tmpfs/tmpfs.c
r0dd16778 rf9b2cb4c 80 80 } 81 81 82 async_sess_t *vfs_sess = service_connect_blocking( EXCHANGE_SERIALIZE,83 SERVICE_VFS, 0);82 async_sess_t *vfs_sess = service_connect_blocking(SERVICE_VFS, 83 INTERFACE_VFS_DRIVER, 0); 84 84 if (!vfs_sess) { 85 85 printf(NAME ": Unable to connect to VFS\n"); -
uspace/srv/fs/udf/udf.c
r0dd16778 rf9b2cb4c 74 74 75 75 async_sess_t *vfs_sess = 76 service_connect_blocking( EXCHANGE_SERIALIZE, SERVICE_VFS, 0);76 service_connect_blocking(SERVICE_VFS, INTERFACE_VFS_DRIVER, 0); 77 77 if (!vfs_sess) { 78 78 log_msg(LOG_DEFAULT, LVL_FATAL, "Failed to connect to VFS"); -
uspace/srv/hid/compositor/compositor.c
r0dd16778 rf9b2cb4c 896 896 ipc_call_t call; 897 897 ipc_callid_t callid; 898 service_id_t service_id = (service_id_t) IPC_GET_ARG 1(*icall);898 service_id_t service_id = (service_id_t) IPC_GET_ARG2(*icall); 899 899 900 900 /* Allocate resources for new window and register it to the location service. */ … … 1175 1175 async_sess_t *sess; 1176 1176 1177 sess = loc_service_connect( EXCHANGE_SERIALIZE, sid, 0);1177 sess = loc_service_connect(sid, INTERFACE_DDF, 0); 1178 1178 if (sess == NULL) { 1179 1179 printf("%s: Unable to connect to visualizer %s\n", NAME, svc); … … 1182 1182 1183 1183 async_exch_t *exch = async_exchange_begin(sess); 1184 rc = async_connect_to_me(exch, sid, 0, 0, vsl_notifications, NULL); 1184 1185 port_id_t port; 1186 rc = async_create_callback_port(exch, INTERFACE_VISUALIZER_CB, 0, 0, 1187 vsl_notifications, NULL, &port); 1188 1185 1189 async_exchange_end(exch); 1186 1190 … … 2145 2149 } 2146 2150 2147 sess = loc_service_connect( EXCHANGE_ATOMIC, dsid, 0);2151 sess = loc_service_connect(dsid, INTERFACE_INPUT, 0); 2148 2152 if (sess == NULL) { 2149 2153 printf("%s: Unable to connect to input service %s\n", NAME, -
uspace/srv/hid/console/console.c
r0dd16778 rf9b2cb4c 508 508 509 509 for (size_t i = 0; i < CONSOLE_COUNT; i++) { 510 if (consoles[i].dsid == (service_id_t) IPC_GET_ARG 1(*icall)) {510 if (consoles[i].dsid == (service_id_t) IPC_GET_ARG2(*icall)) { 511 511 cons = &consoles[i]; 512 512 break; … … 536 536 } 537 537 538 sess = loc_service_connect( EXCHANGE_ATOMIC, dsid, 0);538 sess = loc_service_connect(dsid, INTERFACE_INPUT, 0); 539 539 if (sess == NULL) { 540 540 printf("%s: Unable to connect to input service %s\n", NAME, … … 561 561 int rc = loc_service_get_id(svc, &dsid, 0); 562 562 if (rc == EOK) { 563 sess = loc_service_connect( EXCHANGE_SERIALIZE, dsid, 0);563 sess = loc_service_connect(dsid, INTERFACE_OUTPUT, 0); 564 564 if (sess == NULL) { 565 565 printf("%s: Unable to connect to output service %s\n", -
uspace/srv/hid/input/ctl/kbdev.c
r0dd16778 rf9b2cb4c 94 94 static int kbdev_ctl_init(kbd_dev_t *kdev) 95 95 { 96 async_sess_t *sess = loc_service_connect( EXCHANGE_SERIALIZE,97 kdev->svc_id, 0);96 async_sess_t *sess = loc_service_connect(kdev->svc_id, 97 INTERFACE_DDF, 0); 98 98 if (sess == NULL) { 99 99 printf("%s: Failed starting session with '%s.'\n", NAME, … … 120 120 } 121 121 122 int rc = async_connect_to_me(exch, 0, 0, 0, kbdev_callback_conn, kbdev); 122 port_id_t port; 123 int rc = async_create_callback_port(exch, INTERFACE_KBD_CB, 0, 0, 124 kbdev_callback_conn, kbdev, &port); 125 123 126 if (rc != EOK) { 124 127 printf("%s: Failed creating callback connection from '%s'.\n", -
uspace/srv/hid/input/input.c
r0dd16778 rf9b2cb4c 745 745 if (irc_service) { 746 746 while (irc_sess == NULL) 747 irc_sess = service_connect_blocking( EXCHANGE_SERIALIZE,748 SERVICE_IRC, 0);747 irc_sess = service_connect_blocking(SERVICE_IRC, 748 INTERFACE_IRC, 0); 749 749 } 750 750 -
uspace/srv/hid/input/port/adb.c
r0dd16778 rf9b2cb4c 69 69 return rc; 70 70 71 dev_sess = loc_service_connect( EXCHANGE_ATOMIC, service_id, 0);71 dev_sess = loc_service_connect(service_id, INTERFACE_DDF, 0); 72 72 if (dev_sess == NULL) { 73 73 printf("%s: Failed to connect to device\n", NAME); … … 82 82 } 83 83 84 rc = async_connect_to_me(exch, 0, 0, 0, kbd_port_events, NULL); 84 port_id_t port; 85 rc = async_create_callback_port(exch, INTERFACE_ADB_CB, 0, 0, 86 kbd_port_events, NULL, &port); 87 85 88 async_exchange_end(exch); 86 89 if (rc != EOK) { -
uspace/srv/hid/input/port/adb_mouse.c
r0dd16778 rf9b2cb4c 84 84 return rc; 85 85 86 dev_sess = loc_service_connect( EXCHANGE_ATOMIC, service_id, 0);86 dev_sess = loc_service_connect(service_id, INTERFACE_DDF, 0); 87 87 if (dev_sess == NULL) { 88 88 printf("%s: Failed to connect to device\n", NAME); … … 98 98 99 99 /* NB: The callback connection is slotted for removal */ 100 rc = async_connect_to_me(exch, 0, 0, 0, mouse_port_events, NULL); 100 port_id_t port; 101 rc = async_create_callback_port(exch, INTERFACE_ADB_CB, 0, 0, 102 mouse_port_events, NULL, &port); 103 101 104 async_exchange_end(exch); 102 105 if (rc != EOK) { -
uspace/srv/hid/input/port/chardev.c
r0dd16778 rf9b2cb4c 84 84 } 85 85 86 dev_sess = loc_service_connect( EXCHANGE_ATOMIC, service_id,86 dev_sess = loc_service_connect(service_id, INTERFACE_DDF, 87 87 IPC_FLAG_BLOCKING); 88 88 if (dev_sess == NULL) { … … 98 98 } 99 99 100 /* NB: The callback connection is slotted for removal */ 101 rc = async_connect_to_me(exch, 0, 0, 0, kbd_port_events, NULL); 100 port_id_t port; 101 rc = async_create_callback_port(exch, INTERFACE_CHAR_CB, 0, 0, 102 kbd_port_events, NULL, &port); 103 102 104 async_exchange_end(exch); 103 105 -
uspace/srv/hid/input/proto/mousedev.c
r0dd16778 rf9b2cb4c 118 118 static int mousedev_proto_init(mouse_dev_t *mdev) 119 119 { 120 async_sess_t *sess = loc_service_connect(EXCHANGE_SERIALIZE, 121 mdev->svc_id, 0); 120 async_sess_t *sess = loc_service_connect(mdev->svc_id, INTERFACE_DDF, 0); 122 121 if (sess == NULL) { 123 122 printf("%s: Failed starting session with '%s'\n", NAME, … … 143 142 } 144 143 145 int rc = async_connect_to_me(exch, 0, 0, 0, mousedev_callback_conn, mousedev); 144 port_id_t port; 145 int rc = async_create_callback_port(exch, INTERFACE_MOUSE_CB, 0, 0, 146 mousedev_callback_conn, mousedev, &port); 147 146 148 async_exchange_end(exch); 147 149 async_hangup(sess); -
uspace/srv/hid/isdv4_tablet/main.c
r0dd16778 rf9b2cb4c 69 69 async_sess_t *sess = 70 70 async_callback_receive(EXCHANGE_SERIALIZE); 71 71 72 fibril_mutex_lock(&client_mutex); 72 if (client_sess == NULL) { 73 client_sess = sess; 74 } 73 74 if (client_sess == NULL) 75 client_sess = sess; 76 75 77 fibril_mutex_unlock(&client_mutex); 76 78 … … 262 264 printf(NAME ": Using serial port %s\n", serial_port_name); 263 265 264 async_sess_t *sess = loc_service_connect( EXCHANGE_SERIALIZE, svc_id,266 async_sess_t *sess = loc_service_connect(svc_id, INTERFACE_DDF, 265 267 IPC_FLAG_BLOCKING); 266 268 if (!sess) { -
uspace/srv/hid/remcons/remcons.c
r0dd16778 rf9b2cb4c 217 217 { 218 218 /* Find the user. */ 219 telnet_user_t *user = telnet_user_get_for_client_connection(IPC_GET_ARG 1(*icall));219 telnet_user_t *user = telnet_user_get_for_client_connection(IPC_GET_ARG2(*icall)); 220 220 if (user == NULL) { 221 221 async_answer_0(iid, ENOENT); -
uspace/srv/hw/bus/cuda_adb/cuda_adb.c
r0dd16778 rf9b2cb4c 214 214 215 215 /* Get the device handle. */ 216 dsid = IPC_GET_ARG 1(*icall);216 dsid = IPC_GET_ARG2(*icall); 217 217 218 218 /* Determine which disk device is the client connecting to. */ -
uspace/srv/locsrv/locsrv.c
r0dd16778 rf9b2cb4c 467 467 } 468 468 469 /* Set the interface, if any. */470 service->forward_interface = IPC_GET_ARG1(*icall);471 472 469 /* Get fqsn */ 473 470 char *fqsn; … … 702 699 * 703 700 */ 704 static void loc_forward(ipc_callid_t callid, ipc_call_t *call )701 static void loc_forward(ipc_callid_t callid, ipc_call_t *call, void *arg) 705 702 { 706 703 fibril_mutex_lock(&services_list_mutex); … … 709 706 * Get ID from request 710 707 */ 708 iface_t iface = IPC_GET_ARG1(*call); 711 709 service_id_t id = IPC_GET_ARG2(*call); 712 710 loc_service_t *svc = loc_service_find_id(id); … … 719 717 720 718 async_exch_t *exch = async_exchange_begin(svc->server->sess); 721 722 if (svc->forward_interface == 0) 723 async_forward_fast(callid, exch, svc->id, 0, 0, IPC_FF_NONE); 724 else 725 async_forward_fast(callid, exch, svc->forward_interface, 726 svc->id, 0, IPC_FF_NONE); 727 719 async_forward_fast(callid, exch, iface, svc->id, 0, IPC_FF_NONE); 728 720 async_exchange_end(exch); 729 721 … … 1376 1368 * 1377 1369 */ 1378 static void loc_connection_supplier(ipc_callid_t iid, ipc_call_t *icall )1370 static void loc_connection_supplier(ipc_callid_t iid, ipc_call_t *icall, void *arg) 1379 1371 { 1380 1372 /* Accept connection */ … … 1434 1426 * 1435 1427 */ 1436 static void loc_connection_consumer(ipc_callid_t iid, ipc_call_t *icall )1428 static void loc_connection_consumer(ipc_callid_t iid, ipc_call_t *icall, void *arg) 1437 1429 { 1438 1430 /* Accept connection */ … … 1501 1493 } 1502 1494 1503 /** Function for handling connections to location service1504 *1505 */1506 static void loc_connection(ipc_callid_t iid, ipc_call_t *icall, void *arg)1507 {1508 /* Select interface */1509 switch ((sysarg_t) (IPC_GET_ARG1(*icall))) {1510 case LOC_PORT_SUPPLIER:1511 loc_connection_supplier(iid, icall);1512 break;1513 case LOC_PORT_CONSUMER:1514 loc_connection_consumer(iid, icall);1515 break;1516 case LOC_CONNECT_TO_SERVICE:1517 /* Connect client to selected service */1518 loc_forward(iid, icall);1519 break;1520 default:1521 /* No such interface */1522 async_answer_0(iid, ENOENT);1523 }1524 }1525 1526 1495 /** 1527 1496 * … … 1536 1505 } 1537 1506 1538 /* Set a handler of incomming connections */ 1539 async_set_fallback_port_handler(loc_connection, NULL); 1540 1541 /* Register location service at naming service */ 1542 int rc = service_register(SERVICE_LOC); 1507 port_id_t port; 1508 int rc = async_create_port(INTERFACE_LOC_SUPPLIER, 1509 loc_connection_supplier, NULL, &port); 1543 1510 if (rc != EOK) 1544 1511 return rc; 1545 1512 1513 rc = async_create_port(INTERFACE_LOC_CONSUMER, 1514 loc_connection_consumer, NULL, &port); 1515 if (rc != EOK) 1516 return rc; 1517 1518 /* Set a handler of incomming connections */ 1519 async_set_fallback_port_handler(loc_forward, NULL); 1520 1521 /* Register location service at naming service */ 1522 rc = service_register(SERVICE_LOC); 1523 if (rc != EOK) 1524 return rc; 1525 1546 1526 printf("%s: Accepting connections\n", NAME); 1547 1527 async_manager(); -
uspace/srv/locsrv/locsrv.h
r0dd16778 rf9b2cb4c 107 107 /** Supplier of this service */ 108 108 loc_server_t *server; 109 110 /** Use this interface when forwarding to server. */111 sysarg_t forward_interface;112 109 } loc_service_t; 113 110 -
uspace/srv/logger/main.c
r0dd16778 rf9b2cb4c 48 48 #include "logger.h" 49 49 50 static void connection_handler(ipc_callid_t iid, ipc_call_t *icall, void *arg) 50 static void connection_handler_control(ipc_callid_t iid, ipc_call_t *icall, 51 void *arg) 51 52 { 52 logger_interface_t iface = IPC_GET_ARG1(*icall); 53 logger_connection_handler_control(iid); 54 } 53 55 54 switch (iface) { 55 case LOGGER_INTERFACE_CONTROL: 56 logger_connection_handler_control(iid); 57 break; 58 case LOGGER_INTERFACE_WRITER: 59 logger_connection_handler_writer(iid); 60 break; 61 default: 62 async_answer_0(iid, EINVAL); 63 break; 64 } 56 static void connection_handler_writer(ipc_callid_t iid, ipc_call_t *icall, 57 void *arg) 58 { 59 logger_connection_handler_writer(iid); 65 60 } 66 61 … … 73 68 parse_level_settings(argv[i]); 74 69 } 75 76 async_set_fallback_port_handler(connection_handler, NULL);77 70 78 int rc = service_register(SERVICE_LOGGER); 71 port_id_t port; 72 int rc = async_create_port(INTERFACE_LOGGER_CONTROL, 73 connection_handler_control, NULL, &port); 74 if (rc != EOK) 75 return rc; 76 77 rc = async_create_port(INTERFACE_LOGGER_WRITER, 78 connection_handler_writer, NULL, &port); 79 if (rc != EOK) 80 return rc; 81 82 rc = service_register(SERVICE_LOGGER); 79 83 if (rc != EOK) { 80 84 printf(NAME ": failed to register: %s.\n", str_error(rc)); -
uspace/srv/net/ethip/ethip.c
r0dd16778 rf9b2cb4c 147 147 service_id_t sid; 148 148 149 sid = (service_id_t) IPC_GET_ARG1(*icall);149 sid = (service_id_t) IPC_GET_ARG2(*icall); 150 150 log_msg(LOG_DEFAULT, LVL_DEBUG, "ethip_client_conn(%u)", (unsigned)sid); 151 151 nic = ethip_nic_find_by_iplink_sid(sid); -
uspace/srv/net/ethip/ethip_nic.c
r0dd16778 rf9b2cb4c 162 162 } 163 163 164 nic->sess = loc_service_connect( EXCHANGE_SERIALIZE, sid, 0);164 nic->sess = loc_service_connect(sid, INTERFACE_DDF, 0); 165 165 if (nic->sess == NULL) { 166 166 log_msg(LOG_DEFAULT, LVL_ERROR, "Failed connecting '%s'", nic->svc_name); -
uspace/srv/net/inetsrv/inet_link.c
r0dd16778 rf9b2cb4c 177 177 } 178 178 179 ilink->sess = loc_service_connect( EXCHANGE_SERIALIZE, sid, 0);179 ilink->sess = loc_service_connect(sid, INTERFACE_IPLINK, 0); 180 180 if (ilink->sess == NULL) { 181 181 log_msg(LOG_DEFAULT, LVL_ERROR, "Failed connecting '%s'", ilink->svc_name); -
uspace/srv/net/inetsrv/inetsrv.c
r0dd16778 rf9b2cb4c 77 77 }; 78 78 79 static void inet_client_conn(ipc_callid_t iid, ipc_call_t *icall, void *arg);80 81 79 static FIBRIL_MUTEX_INITIALIZE(client_list_lock); 82 80 static LIST_INITIALIZE(client_list); 83 81 82 static void inet_default_conn(ipc_callid_t, ipc_call_t *, void *); 83 84 84 static int inet_init(void) 85 85 { 86 86 log_msg(LOG_DEFAULT, LVL_DEBUG, "inet_init()"); 87 87 88 async_set_fallback_port_handler(inet_client_conn, NULL); 89 90 int rc = loc_server_register(NAME); 88 port_id_t port; 89 int rc = async_create_port(INTERFACE_INET, 90 inet_default_conn, NULL, &port); 91 if (rc != EOK) 92 return rc; 93 94 rc = async_create_port(INTERFACE_INETCFG, 95 inet_cfg_conn, NULL, &port); 96 if (rc != EOK) 97 return rc; 98 99 rc = async_create_port(INTERFACE_INETPING, 100 inetping_conn, NULL, &port); 101 if (rc != EOK) 102 return rc; 103 104 rc = loc_server_register(NAME); 91 105 if (rc != EOK) { 92 106 log_msg(LOG_DEFAULT, LVL_ERROR, "Failed registering server (%d).", rc); … … 95 109 96 110 service_id_t sid; 97 rc = loc_service_register_with_iface(SERVICE_NAME_INET, &sid, 98 INET_PORT_DEFAULT); 99 if (rc != EOK) { 100 log_msg(LOG_DEFAULT, LVL_ERROR, "Failed registering service (%d).", rc); 101 return EEXIST; 102 } 103 104 rc = loc_service_register_with_iface(SERVICE_NAME_INETCFG, &sid, 105 INET_PORT_CFG); 106 if (rc != EOK) { 107 log_msg(LOG_DEFAULT, LVL_ERROR, "Failed registering service (%d).", rc); 108 return EEXIST; 109 } 110 111 rc = loc_service_register_with_iface(SERVICE_NAME_INETPING, &sid, 112 INET_PORT_PING); 111 rc = loc_service_register(SERVICE_NAME_INET, &sid); 113 112 if (rc != EOK) { 114 113 log_msg(LOG_DEFAULT, LVL_ERROR, "Failed registering service (%d).", rc); … … 429 428 } 430 429 431 static void inet_client_conn(ipc_callid_t iid, ipc_call_t *icall, void *arg)432 {433 sysarg_t port;434 435 port = IPC_GET_ARG1(*icall);436 437 switch (port) {438 case INET_PORT_DEFAULT:439 inet_default_conn(iid, icall, arg);440 break;441 case INET_PORT_CFG:442 inet_cfg_conn(iid, icall, arg);443 break;444 case INET_PORT_PING:445 inetping_conn(iid, icall, arg);446 break;447 default:448 async_answer_0(iid, ENOTSUP);449 break;450 }451 }452 453 430 static inet_client_t *inet_client_find(uint8_t proto) 454 431 { -
uspace/srv/net/slip/slip.c
r0dd16778 rf9b2cb4c 328 328 * char_dev at the same time. 329 329 */ 330 sess_out = loc_service_connect( EXCHANGE_SERIALIZE, svcid, 0);330 sess_out = loc_service_connect(svcid, INTERFACE_DDF, 0); 331 331 if (!sess_out) { 332 332 log_msg(LOG_DEFAULT, LVL_ERROR, … … 337 337 slip_iplink.arg = sess_out; 338 338 339 sess_in = loc_service_connect( EXCHANGE_SERIALIZE, svcid, 0);339 sess_in = loc_service_connect(svcid, INTERFACE_DDF, 0); 340 340 if (!sess_in) { 341 341 log_msg(LOG_DEFAULT, LVL_ERROR,
Note:
See TracChangeset
for help on using the changeset viewer.
