[e2b9a993] | 1 | /*
|
---|
| 2 | * Copyright (c) 2010 Lenka Trochtova
|
---|
| 3 | * All rights reserved.
|
---|
| 4 | *
|
---|
| 5 | * Redistribution and use in source and binary forms, with or without
|
---|
| 6 | * modification, are permitted provided that the following conditions
|
---|
| 7 | * are met:
|
---|
| 8 | *
|
---|
| 9 | * - Redistributions of source code must retain the above copyright
|
---|
| 10 | * notice, this list of conditions and the following disclaimer.
|
---|
| 11 | * - Redistributions in binary form must reproduce the above copyright
|
---|
| 12 | * notice, this list of conditions and the following disclaimer in the
|
---|
| 13 | * documentation and/or other materials provided with the distribution.
|
---|
| 14 | * - The name of the author may not be used to endorse or promote products
|
---|
| 15 | * derived from this software without specific prior written permission.
|
---|
| 16 | *
|
---|
| 17 | * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
|
---|
| 18 | * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
|
---|
| 19 | * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
|
---|
| 20 | * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
|
---|
| 21 | * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
|
---|
| 22 | * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
---|
| 23 | * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
---|
| 24 | * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
---|
| 25 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
|
---|
| 26 | * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
---|
| 27 | */
|
---|
| 28 |
|
---|
| 29 | /**
|
---|
| 30 | * @defgroup devman Device manager.
|
---|
| 31 | * @brief HelenOS device manager.
|
---|
| 32 | * @{
|
---|
| 33 | */
|
---|
| 34 |
|
---|
| 35 | /** @file
|
---|
| 36 | */
|
---|
| 37 |
|
---|
[7e752b2] | 38 | #include <inttypes.h>
|
---|
[e2b9a993] | 39 | #include <assert.h>
|
---|
| 40 | #include <ipc/services.h>
|
---|
[79ae36dd] | 41 | #include <ns.h>
|
---|
[e2b9a993] | 42 | #include <async.h>
|
---|
| 43 | #include <stdio.h>
|
---|
| 44 | #include <errno.h>
|
---|
[9b415c9] | 45 | #include <str_error.h>
|
---|
[e2b9a993] | 46 | #include <bool.h>
|
---|
| 47 | #include <fibril_synch.h>
|
---|
| 48 | #include <stdlib.h>
|
---|
[c47e1a8] | 49 | #include <str.h>
|
---|
[e2b9a993] | 50 | #include <dirent.h>
|
---|
| 51 | #include <fcntl.h>
|
---|
| 52 | #include <sys/stat.h>
|
---|
| 53 | #include <ctype.h>
|
---|
[9b415c9] | 54 | #include <io/log.h>
|
---|
[e2b9a993] | 55 | #include <ipc/devman.h>
|
---|
[5cd136ab] | 56 | #include <ipc/driver.h>
|
---|
[d347b53] | 57 | #include <thread.h>
|
---|
[15f3c3f] | 58 | #include <loc.h>
|
---|
[e2b9a993] | 59 |
|
---|
| 60 | #include "devman.h"
|
---|
| 61 |
|
---|
[a79d88d] | 62 | #define DRIVER_DEFAULT_STORE "/drv"
|
---|
[e2b9a993] | 63 |
|
---|
[0c3666d] | 64 | static driver_list_t drivers_list;
|
---|
[e2b9a993] | 65 | static dev_tree_t device_tree;
|
---|
[692c40cb] | 66 | static class_list_t class_list;
|
---|
[e2b9a993] | 67 |
|
---|
[38b3baf] | 68 | /** Register running driver. */
|
---|
| 69 | static driver_t *devman_driver_register(void)
|
---|
| 70 | {
|
---|
[729fa2d6] | 71 | ipc_call_t icall;
|
---|
[c6c389ed] | 72 | ipc_callid_t iid;
|
---|
[729fa2d6] | 73 | driver_t *driver = NULL;
|
---|
[c6c389ed] | 74 |
|
---|
[ebcb05a] | 75 | log_msg(LVL_DEBUG, "devman_driver_register");
|
---|
[729fa2d6] | 76 |
|
---|
[c6c389ed] | 77 | iid = async_get_call(&icall);
|
---|
[228e490] | 78 | if (IPC_GET_IMETHOD(icall) != DEVMAN_DRIVER_REGISTER) {
|
---|
[ffa2c8ef] | 79 | async_answer_0(iid, EREFUSED);
|
---|
[729fa2d6] | 80 | return NULL;
|
---|
| 81 | }
|
---|
| 82 |
|
---|
[92413de] | 83 | char *drv_name = NULL;
|
---|
[729fa2d6] | 84 |
|
---|
[38b3baf] | 85 | /* Get driver name. */
|
---|
| 86 | int rc = async_data_write_accept((void **) &drv_name, true, 0, 0, 0, 0);
|
---|
[729fa2d6] | 87 | if (rc != EOK) {
|
---|
[ffa2c8ef] | 88 | async_answer_0(iid, rc);
|
---|
[729fa2d6] | 89 | return NULL;
|
---|
| 90 | }
|
---|
[c6c389ed] | 91 |
|
---|
[ebcb05a] | 92 | log_msg(LVL_DEBUG, "The `%s' driver is trying to register.",
|
---|
[38b3baf] | 93 | drv_name);
|
---|
[729fa2d6] | 94 |
|
---|
[38b3baf] | 95 | /* Find driver structure. */
|
---|
[729fa2d6] | 96 | driver = find_driver(&drivers_list, drv_name);
|
---|
[c6c389ed] | 97 | if (driver == NULL) {
|
---|
[ebcb05a] | 98 | log_msg(LVL_ERROR, "No driver named `%s' was found.", drv_name);
|
---|
[04c7003f] | 99 | free(drv_name);
|
---|
| 100 | drv_name = NULL;
|
---|
[ffa2c8ef] | 101 | async_answer_0(iid, ENOENT);
|
---|
[729fa2d6] | 102 | return NULL;
|
---|
| 103 | }
|
---|
| 104 |
|
---|
[04c7003f] | 105 | free(drv_name);
|
---|
| 106 | drv_name = NULL;
|
---|
| 107 |
|
---|
[3ad7b1c] | 108 | fibril_mutex_lock(&driver->driver_mutex);
|
---|
| 109 |
|
---|
[79ae36dd] | 110 | if (driver->sess) {
|
---|
[3ad7b1c] | 111 | /* We already have a connection to the driver. */
|
---|
| 112 | log_msg(LVL_ERROR, "Driver '%s' already started.\n",
|
---|
| 113 | driver->name);
|
---|
| 114 | fibril_mutex_unlock(&driver->driver_mutex);
|
---|
| 115 | async_answer_0(iid, EEXISTS);
|
---|
| 116 | return NULL;
|
---|
| 117 | }
|
---|
| 118 |
|
---|
| 119 | switch (driver->state) {
|
---|
| 120 | case DRIVER_NOT_STARTED:
|
---|
| 121 | /* Somebody started the driver manually. */
|
---|
| 122 | log_msg(LVL_NOTE, "Driver '%s' started manually.\n",
|
---|
| 123 | driver->name);
|
---|
| 124 | driver->state = DRIVER_STARTING;
|
---|
| 125 | break;
|
---|
| 126 | case DRIVER_STARTING:
|
---|
| 127 | /* The expected case */
|
---|
| 128 | break;
|
---|
| 129 | case DRIVER_RUNNING:
|
---|
[79ae36dd] | 130 | /* Should not happen since we do not have a connected session */
|
---|
[3ad7b1c] | 131 | assert(false);
|
---|
| 132 | }
|
---|
| 133 |
|
---|
[38b3baf] | 134 | /* Create connection to the driver. */
|
---|
[ebcb05a] | 135 | log_msg(LVL_DEBUG, "Creating connection to the `%s' driver.",
|
---|
[9b415c9] | 136 | driver->name);
|
---|
[79ae36dd] | 137 | driver->sess = async_callback_receive(EXCHANGE_SERIALIZE);
|
---|
| 138 | if (!driver->sess) {
|
---|
[3ad7b1c] | 139 | fibril_mutex_unlock(&driver->driver_mutex);
|
---|
[ffa2c8ef] | 140 | async_answer_0(iid, ENOTSUP);
|
---|
[729fa2d6] | 141 | return NULL;
|
---|
| 142 | }
|
---|
| 143 |
|
---|
[3ad7b1c] | 144 | fibril_mutex_unlock(&driver->driver_mutex);
|
---|
[729fa2d6] | 145 |
|
---|
[79ae36dd] | 146 | log_msg(LVL_NOTE,
|
---|
[ebcb05a] | 147 | "The `%s' driver was successfully registered as running.",
|
---|
[38b3baf] | 148 | driver->name);
|
---|
[729fa2d6] | 149 |
|
---|
[ffa2c8ef] | 150 | async_answer_0(iid, EOK);
|
---|
[729fa2d6] | 151 |
|
---|
| 152 | return driver;
|
---|
| 153 | }
|
---|
[e2b9a993] | 154 |
|
---|
[38b3baf] | 155 | /** Receive device match ID from the device's parent driver and add it to the
|
---|
| 156 | * list of devices match ids.
|
---|
| 157 | *
|
---|
| 158 | * @param match_ids The list of the device's match ids.
|
---|
| 159 | * @return Zero on success, negative error code otherwise.
|
---|
[3843ecb] | 160 | */
|
---|
[38b3baf] | 161 | static int devman_receive_match_id(match_id_list_t *match_ids)
|
---|
| 162 | {
|
---|
[66babbd] | 163 | match_id_t *match_id = create_match_id();
|
---|
| 164 | ipc_callid_t callid;
|
---|
| 165 | ipc_call_t call;
|
---|
| 166 | int rc = 0;
|
---|
| 167 |
|
---|
| 168 | callid = async_get_call(&call);
|
---|
[228e490] | 169 | if (DEVMAN_ADD_MATCH_ID != IPC_GET_IMETHOD(call)) {
|
---|
[9b415c9] | 170 | log_msg(LVL_ERROR,
|
---|
[ebcb05a] | 171 | "Invalid protocol when trying to receive match id.");
|
---|
[ffa2c8ef] | 172 | async_answer_0(callid, EINVAL);
|
---|
[66babbd] | 173 | delete_match_id(match_id);
|
---|
| 174 | return EINVAL;
|
---|
| 175 | }
|
---|
| 176 |
|
---|
[c6c389ed] | 177 | if (match_id == NULL) {
|
---|
[ebcb05a] | 178 | log_msg(LVL_ERROR, "Failed to allocate match id.");
|
---|
[ffa2c8ef] | 179 | async_answer_0(callid, ENOMEM);
|
---|
[66babbd] | 180 | return ENOMEM;
|
---|
| 181 | }
|
---|
| 182 |
|
---|
[ffa2c8ef] | 183 | async_answer_0(callid, EOK);
|
---|
[2480e19] | 184 |
|
---|
[66babbd] | 185 | match_id->score = IPC_GET_ARG1(call);
|
---|
| 186 |
|
---|
[c47e1a8] | 187 | char *match_id_str;
|
---|
[38b3baf] | 188 | rc = async_data_write_accept((void **) &match_id_str, true, 0, 0, 0, 0);
|
---|
[c47e1a8] | 189 | match_id->id = match_id_str;
|
---|
[c6c389ed] | 190 | if (rc != EOK) {
|
---|
[66babbd] | 191 | delete_match_id(match_id);
|
---|
[ebcb05a] | 192 | log_msg(LVL_ERROR, "Failed to receive match id string: %s.",
|
---|
[9b415c9] | 193 | str_error(rc));
|
---|
[66babbd] | 194 | return rc;
|
---|
| 195 | }
|
---|
| 196 |
|
---|
| 197 | list_append(&match_id->link, &match_ids->ids);
|
---|
[a087f2e] | 198 |
|
---|
[ebcb05a] | 199 | log_msg(LVL_DEBUG, "Received match id `%s', score %d.",
|
---|
[38b3baf] | 200 | match_id->id, match_id->score);
|
---|
[66babbd] | 201 | return rc;
|
---|
| 202 | }
|
---|
| 203 |
|
---|
[38b3baf] | 204 | /** Receive device match IDs from the device's parent driver and add them to the
|
---|
| 205 | * list of devices match ids.
|
---|
| 206 | *
|
---|
| 207 | * @param match_count The number of device's match ids to be received.
|
---|
| 208 | * @param match_ids The list of the device's match ids.
|
---|
| 209 | * @return Zero on success, negative error code otherwise.
|
---|
[3843ecb] | 210 | */
|
---|
[96b02eb9] | 211 | static int devman_receive_match_ids(sysarg_t match_count,
|
---|
[c6c389ed] | 212 | match_id_list_t *match_ids)
|
---|
[38b3baf] | 213 | {
|
---|
[66babbd] | 214 | int ret = EOK;
|
---|
[5cd136ab] | 215 | size_t i;
|
---|
[38b3baf] | 216 |
|
---|
[66babbd] | 217 | for (i = 0; i < match_count; i++) {
|
---|
[38b3baf] | 218 | if (EOK != (ret = devman_receive_match_id(match_ids)))
|
---|
[66babbd] | 219 | return ret;
|
---|
| 220 | }
|
---|
| 221 | return ret;
|
---|
| 222 | }
|
---|
| 223 |
|
---|
[398c4d7] | 224 | static int assign_driver_fibril(void *arg)
|
---|
| 225 | {
|
---|
[ba38f72c] | 226 | dev_node_t *dev_node = (dev_node_t *) arg;
|
---|
| 227 | assign_driver(dev_node, &drivers_list, &device_tree);
|
---|
[398c4d7] | 228 | return EOK;
|
---|
| 229 | }
|
---|
| 230 |
|
---|
[8b1e15ac] | 231 | /** Handle function registration.
|
---|
[38b3baf] | 232 | *
|
---|
[3843ecb] | 233 | * Child devices are registered by their parent's device driver.
|
---|
| 234 | */
|
---|
[8b1e15ac] | 235 | static void devman_add_function(ipc_callid_t callid, ipc_call_t *call)
|
---|
[bda60d9] | 236 | {
|
---|
[8b1e15ac] | 237 | fun_type_t ftype = (fun_type_t) IPC_GET_ARG1(*call);
|
---|
| 238 | devman_handle_t dev_handle = IPC_GET_ARG2(*call);
|
---|
| 239 | sysarg_t match_count = IPC_GET_ARG3(*call);
|
---|
[957cfa58] | 240 | dev_tree_t *tree = &device_tree;
|
---|
[66babbd] | 241 |
|
---|
[957cfa58] | 242 | fibril_rwlock_write_lock(&tree->rwlock);
|
---|
[8b1e15ac] | 243 |
|
---|
| 244 | dev_node_t *dev = NULL;
|
---|
| 245 | dev_node_t *pdev = find_dev_node_no_lock(&device_tree, dev_handle);
|
---|
[d347b53] | 246 |
|
---|
[ba38f72c] | 247 | if (pdev == NULL) {
|
---|
[957cfa58] | 248 | fibril_rwlock_write_unlock(&tree->rwlock);
|
---|
[ffa2c8ef] | 249 | async_answer_0(callid, ENOENT);
|
---|
[d347b53] | 250 | return;
|
---|
[c6c389ed] | 251 | }
|
---|
[d347b53] | 252 |
|
---|
[8b1e15ac] | 253 | if (ftype != fun_inner && ftype != fun_exposed) {
|
---|
| 254 | /* Unknown function type */
|
---|
[9b415c9] | 255 | log_msg(LVL_ERROR,
|
---|
[ebcb05a] | 256 | "Unknown function type %d provided by driver.",
|
---|
[9b415c9] | 257 | (int) ftype);
|
---|
[8b1e15ac] | 258 |
|
---|
| 259 | fibril_rwlock_write_unlock(&tree->rwlock);
|
---|
| 260 | async_answer_0(callid, EINVAL);
|
---|
| 261 | return;
|
---|
| 262 | }
|
---|
| 263 |
|
---|
[ba38f72c] | 264 | char *fun_name = NULL;
|
---|
| 265 | int rc = async_data_write_accept((void **)&fun_name, true, 0, 0, 0, 0);
|
---|
[c6c389ed] | 266 | if (rc != EOK) {
|
---|
[957cfa58] | 267 | fibril_rwlock_write_unlock(&tree->rwlock);
|
---|
[ffa2c8ef] | 268 | async_answer_0(callid, rc);
|
---|
[d347b53] | 269 | return;
|
---|
| 270 | }
|
---|
| 271 |
|
---|
[0876062] | 272 | /* Check that function with same name is not there already. */
|
---|
| 273 | if (find_fun_node_in_device(pdev, fun_name) != NULL) {
|
---|
| 274 | fibril_rwlock_write_unlock(&tree->rwlock);
|
---|
| 275 | async_answer_0(callid, EEXISTS);
|
---|
| 276 | printf(NAME ": Warning, driver tried to register `%s' twice.\n",
|
---|
| 277 | fun_name);
|
---|
| 278 | free(fun_name);
|
---|
| 279 | return;
|
---|
| 280 | }
|
---|
| 281 |
|
---|
[ba38f72c] | 282 | fun_node_t *fun = create_fun_node();
|
---|
| 283 | if (!insert_fun_node(&device_tree, fun, fun_name, pdev)) {
|
---|
[957cfa58] | 284 | fibril_rwlock_write_unlock(&tree->rwlock);
|
---|
[ba38f72c] | 285 | delete_fun_node(fun);
|
---|
[ffa2c8ef] | 286 | async_answer_0(callid, ENOMEM);
|
---|
[d347b53] | 287 | return;
|
---|
[c6c389ed] | 288 | }
|
---|
| 289 |
|
---|
[8b1e15ac] | 290 | if (ftype == fun_inner) {
|
---|
| 291 | dev = create_dev_node();
|
---|
| 292 | if (dev == NULL) {
|
---|
| 293 | fibril_rwlock_write_unlock(&tree->rwlock);
|
---|
| 294 | delete_fun_node(fun);
|
---|
| 295 | async_answer_0(callid, ENOMEM);
|
---|
| 296 | return;
|
---|
| 297 | }
|
---|
[ba38f72c] | 298 |
|
---|
[8b1e15ac] | 299 | insert_dev_node(tree, dev, fun);
|
---|
[ba38f72c] | 300 | }
|
---|
| 301 |
|
---|
[957cfa58] | 302 | fibril_rwlock_write_unlock(&tree->rwlock);
|
---|
[d347b53] | 303 |
|
---|
[ebcb05a] | 304 | log_msg(LVL_DEBUG, "devman_add_function(fun=\"%s\")", fun->pathname);
|
---|
[2480e19] | 305 |
|
---|
[ba38f72c] | 306 | devman_receive_match_ids(match_count, &fun->match_ids);
|
---|
[398c4d7] | 307 |
|
---|
[8b1e15ac] | 308 | if (ftype == fun_inner) {
|
---|
| 309 | assert(dev != NULL);
|
---|
[398c4d7] | 310 | /*
|
---|
[8b1e15ac] | 311 | * Try to find a suitable driver and assign it to the device. We do
|
---|
| 312 | * not want to block the current fibril that is used for processing
|
---|
| 313 | * incoming calls: we will launch a separate fibril to handle the
|
---|
| 314 | * driver assigning. That is because assign_driver can actually include
|
---|
| 315 | * task spawning which could take some time.
|
---|
[398c4d7] | 316 | */
|
---|
[8b1e15ac] | 317 | fid_t assign_fibril = fibril_create(assign_driver_fibril, dev);
|
---|
| 318 | if (assign_fibril == 0) {
|
---|
| 319 | /*
|
---|
| 320 | * Fallback in case we are out of memory.
|
---|
| 321 | * Probably not needed as we will die soon anyway ;-).
|
---|
| 322 | */
|
---|
| 323 | (void) assign_driver_fibril(fun);
|
---|
| 324 | } else {
|
---|
| 325 | fibril_add_ready(assign_fibril);
|
---|
| 326 | }
|
---|
[398c4d7] | 327 | } else {
|
---|
[15f3c3f] | 328 | loc_register_tree_function(fun, tree);
|
---|
[398c4d7] | 329 | }
|
---|
[8b1e15ac] | 330 |
|
---|
[38b3baf] | 331 | /* Return device handle to parent's driver. */
|
---|
[ba38f72c] | 332 | async_answer_1(callid, EOK, fun->handle);
|
---|
[d347b53] | 333 | }
|
---|
| 334 |
|
---|
[15f3c3f] | 335 | static void loc_register_class_dev(dev_class_info_t *cli)
|
---|
[ce89036b] | 336 | {
|
---|
[15f3c3f] | 337 | /* Create loc path and name for the service. */
|
---|
| 338 | char *loc_pathname = NULL;
|
---|
[c6c389ed] | 339 |
|
---|
[15f3c3f] | 340 | asprintf(&loc_pathname, "%s/%s%c%s", LOC_CLASS_NAMESPACE,
|
---|
| 341 | cli->dev_class->name, LOC_SEPARATOR, cli->dev_name);
|
---|
| 342 | if (loc_pathname == NULL)
|
---|
[ce89036b] | 343 | return;
|
---|
| 344 |
|
---|
[38b3baf] | 345 | /*
|
---|
[15f3c3f] | 346 | * Register the device with location service and remember its
|
---|
| 347 | * service ID.
|
---|
[38b3baf] | 348 | */
|
---|
[15f3c3f] | 349 | loc_service_register_with_iface(loc_pathname,
|
---|
| 350 | &cli->service_id, DEVMAN_CONNECT_FROM_LOC);
|
---|
[ce89036b] | 351 |
|
---|
[38b3baf] | 352 | /*
|
---|
[15f3c3f] | 353 | * Add device to the hash map of class devices registered with
|
---|
| 354 | * location service.
|
---|
[38b3baf] | 355 | */
|
---|
[15f3c3f] | 356 | class_add_loc_function(&class_list, cli);
|
---|
[a32defa] | 357 |
|
---|
[15f3c3f] | 358 | free(loc_pathname);
|
---|
[ce89036b] | 359 | }
|
---|
| 360 |
|
---|
[ba38f72c] | 361 | static void devman_add_function_to_class(ipc_callid_t callid, ipc_call_t *call)
|
---|
[ce89036b] | 362 | {
|
---|
[0b5a4131] | 363 | devman_handle_t handle = IPC_GET_ARG1(*call);
|
---|
[cc574511] | 364 | category_id_t cat_id;
|
---|
| 365 | int rc;
|
---|
[692c40cb] | 366 |
|
---|
[38b3baf] | 367 | /* Get class name. */
|
---|
[692c40cb] | 368 | char *class_name;
|
---|
[cc574511] | 369 | rc = async_data_write_accept((void **) &class_name, true,
|
---|
[38b3baf] | 370 | 0, 0, 0, 0);
|
---|
[692c40cb] | 371 | if (rc != EOK) {
|
---|
[ffa2c8ef] | 372 | async_answer_0(callid, rc);
|
---|
[692c40cb] | 373 | return;
|
---|
| 374 | }
|
---|
| 375 |
|
---|
[ba38f72c] | 376 | fun_node_t *fun = find_fun_node(&device_tree, handle);
|
---|
| 377 | if (fun == NULL) {
|
---|
[ffa2c8ef] | 378 | async_answer_0(callid, ENOENT);
|
---|
[692c40cb] | 379 | return;
|
---|
| 380 | }
|
---|
| 381 |
|
---|
| 382 | dev_class_t *cl = get_dev_class(&class_list, class_name);
|
---|
[ba38f72c] | 383 | dev_class_info_t *class_info = add_function_to_class(fun, cl, NULL);
|
---|
[692c40cb] | 384 |
|
---|
[15f3c3f] | 385 | /* Register the device's class alias with location service. */
|
---|
| 386 | loc_register_class_dev(class_info);
|
---|
[692c40cb] | 387 |
|
---|
[cc574511] | 388 | rc = loc_category_get_id(class_name, &cat_id, IPC_FLAG_BLOCKING);
|
---|
| 389 | if (rc == EOK) {
|
---|
| 390 | loc_service_add_to_cat(fun->service_id, cat_id);
|
---|
| 391 | } else {
|
---|
| 392 | log_msg(LVL_ERROR, "Failed adding function `%s' to category "
|
---|
| 393 | "`%s'.", fun->pathname, class_name);
|
---|
| 394 | }
|
---|
| 395 |
|
---|
[ebcb05a] | 396 | log_msg(LVL_NOTE, "Function `%s' added to class `%s' as `%s'.",
|
---|
[9b415c9] | 397 | fun->pathname, class_name, class_info->dev_name);
|
---|
[398c4d7] | 398 |
|
---|
[ffa2c8ef] | 399 | async_answer_0(callid, EOK);
|
---|
[692c40cb] | 400 | }
|
---|
| 401 |
|
---|
[38b3baf] | 402 | /** Initialize driver which has registered itself as running and ready.
|
---|
| 403 | *
|
---|
| 404 | * The initialization is done in a separate fibril to avoid deadlocks (if the
|
---|
| 405 | * driver needed to be served by devman during the driver's initialization).
|
---|
[3843ecb] | 406 | */
|
---|
[d347b53] | 407 | static int init_running_drv(void *drv)
|
---|
| 408 | {
|
---|
[38b3baf] | 409 | driver_t *driver = (driver_t *) drv;
|
---|
| 410 |
|
---|
| 411 | initialize_running_driver(driver, &device_tree);
|
---|
[ebcb05a] | 412 | log_msg(LVL_DEBUG, "The `%s` driver was successfully initialized.",
|
---|
[38b3baf] | 413 | driver->name);
|
---|
[d347b53] | 414 | return 0;
|
---|
[bda60d9] | 415 | }
|
---|
| 416 |
|
---|
[38b3baf] | 417 | /** Function for handling connections from a driver to the device manager. */
|
---|
[924c75e1] | 418 | static void devman_connection_driver(ipc_callid_t iid, ipc_call_t *icall)
|
---|
[38b3baf] | 419 | {
|
---|
| 420 | /* Accept the connection. */
|
---|
[ffa2c8ef] | 421 | async_answer_0(iid, EOK);
|
---|
[e2b9a993] | 422 |
|
---|
[729fa2d6] | 423 | driver_t *driver = devman_driver_register();
|
---|
[c6c389ed] | 424 | if (driver == NULL)
|
---|
[729fa2d6] | 425 | return;
|
---|
[d347b53] | 426 |
|
---|
[38b3baf] | 427 | /*
|
---|
| 428 | * Initialize the driver as running (e.g. pass assigned devices to it)
|
---|
| 429 | * in a separate fibril; the separate fibril is used to enable the
|
---|
| 430 | * driver to use devman service during the driver's initialization.
|
---|
| 431 | */
|
---|
[d347b53] | 432 | fid_t fid = fibril_create(init_running_drv, driver);
|
---|
| 433 | if (fid == 0) {
|
---|
[9b415c9] | 434 | log_msg(LVL_ERROR, "Failed to create initialization fibril " \
|
---|
[ebcb05a] | 435 | "for driver `%s'.", driver->name);
|
---|
[3843ecb] | 436 | return;
|
---|
[d347b53] | 437 | }
|
---|
| 438 | fibril_add_ready(fid);
|
---|
| 439 |
|
---|
[79ae36dd] | 440 | while (true) {
|
---|
| 441 | ipc_call_t call;
|
---|
| 442 | ipc_callid_t callid = async_get_call(&call);
|
---|
| 443 |
|
---|
| 444 | if (!IPC_GET_IMETHOD(call))
|
---|
| 445 | break;
|
---|
[e2b9a993] | 446 |
|
---|
[228e490] | 447 | switch (IPC_GET_IMETHOD(call)) {
|
---|
[8b1e15ac] | 448 | case DEVMAN_ADD_FUNCTION:
|
---|
| 449 | devman_add_function(callid, &call);
|
---|
[e2b9a993] | 450 | break;
|
---|
[692c40cb] | 451 | case DEVMAN_ADD_DEVICE_TO_CLASS:
|
---|
[ba38f72c] | 452 | devman_add_function_to_class(callid, &call);
|
---|
[692c40cb] | 453 | break;
|
---|
[e2b9a993] | 454 | default:
|
---|
[ffa2c8ef] | 455 | async_answer_0(callid, EINVAL);
|
---|
[e2b9a993] | 456 | break;
|
---|
| 457 | }
|
---|
| 458 | }
|
---|
| 459 | }
|
---|
| 460 |
|
---|
[38b3baf] | 461 | /** Find handle for the device instance identified by the device's path in the
|
---|
| 462 | * device tree. */
|
---|
[ba38f72c] | 463 | static void devman_function_get_handle(ipc_callid_t iid, ipc_call_t *icall)
|
---|
[f658458] | 464 | {
|
---|
[38b3baf] | 465 | char *pathname;
|
---|
| 466 |
|
---|
| 467 | int rc = async_data_write_accept((void **) &pathname, true, 0, 0, 0, 0);
|
---|
[f658458] | 468 | if (rc != EOK) {
|
---|
[ffa2c8ef] | 469 | async_answer_0(iid, rc);
|
---|
[f658458] | 470 | return;
|
---|
| 471 | }
|
---|
| 472 |
|
---|
[8b1e15ac] | 473 | fun_node_t *fun = find_fun_node_by_path(&device_tree, pathname);
|
---|
[f658458] | 474 |
|
---|
| 475 | free(pathname);
|
---|
| 476 |
|
---|
[ba38f72c] | 477 | if (fun == NULL) {
|
---|
[ffa2c8ef] | 478 | async_answer_0(iid, ENOENT);
|
---|
[f658458] | 479 | return;
|
---|
| 480 | }
|
---|
[8b1e15ac] | 481 |
|
---|
[ba38f72c] | 482 | async_answer_1(iid, EOK, fun->handle);
|
---|
[f658458] | 483 | }
|
---|
| 484 |
|
---|
[fc8c2b6] | 485 | /** Find handle for the device instance identified by device class name. */
|
---|
| 486 | static void devman_function_get_handle_by_class(ipc_callid_t iid,
|
---|
| 487 | ipc_call_t *icall)
|
---|
| 488 | {
|
---|
| 489 | char *classname;
|
---|
| 490 | char *devname;
|
---|
| 491 |
|
---|
| 492 | int rc = async_data_write_accept((void **) &classname, true, 0, 0, 0, 0);
|
---|
| 493 | if (rc != EOK) {
|
---|
| 494 | async_answer_0(iid, rc);
|
---|
| 495 | return;
|
---|
| 496 | }
|
---|
| 497 | rc = async_data_write_accept((void **) &devname, true, 0, 0, 0, 0);
|
---|
| 498 | if (rc != EOK) {
|
---|
| 499 | free(classname);
|
---|
| 500 | async_answer_0(iid, rc);
|
---|
| 501 | return;
|
---|
| 502 | }
|
---|
| 503 |
|
---|
| 504 |
|
---|
| 505 | fun_node_t *fun = find_fun_node_by_class(&class_list,
|
---|
| 506 | classname, devname);
|
---|
| 507 |
|
---|
| 508 | free(classname);
|
---|
| 509 | free(devname);
|
---|
| 510 |
|
---|
| 511 | if (fun == NULL) {
|
---|
| 512 | async_answer_0(iid, ENOENT);
|
---|
| 513 | return;
|
---|
| 514 | }
|
---|
| 515 |
|
---|
| 516 | async_answer_1(iid, EOK, fun->handle);
|
---|
| 517 | }
|
---|
| 518 |
|
---|
[431d6d6] | 519 | /** Find device path by its handle. */
|
---|
| 520 | static void devman_get_device_path_by_handle(ipc_callid_t iid,
|
---|
| 521 | ipc_call_t *icall)
|
---|
| 522 | {
|
---|
| 523 | devman_handle_t handle = IPC_GET_ARG1(*icall);
|
---|
| 524 |
|
---|
| 525 | fun_node_t *fun = find_fun_node(&device_tree, handle);
|
---|
| 526 | if (fun == NULL) {
|
---|
| 527 | async_answer_0(iid, ENOMEM);
|
---|
| 528 | return;
|
---|
| 529 | }
|
---|
| 530 |
|
---|
| 531 | ipc_callid_t data_callid;
|
---|
| 532 | size_t data_len;
|
---|
| 533 | if (!async_data_read_receive(&data_callid, &data_len)) {
|
---|
| 534 | async_answer_0(iid, EINVAL);
|
---|
| 535 | return;
|
---|
| 536 | }
|
---|
| 537 |
|
---|
| 538 | void *buffer = malloc(data_len);
|
---|
| 539 | if (buffer == NULL) {
|
---|
| 540 | async_answer_0(data_callid, ENOMEM);
|
---|
| 541 | async_answer_0(iid, ENOMEM);
|
---|
| 542 | return;
|
---|
| 543 | }
|
---|
| 544 |
|
---|
| 545 | size_t sent_length = str_size(fun->pathname);
|
---|
| 546 | if (sent_length > data_len) {
|
---|
| 547 | sent_length = data_len;
|
---|
| 548 | }
|
---|
| 549 |
|
---|
| 550 | async_data_read_finalize(data_callid, fun->pathname, sent_length);
|
---|
| 551 | async_answer_0(iid, EOK);
|
---|
| 552 |
|
---|
| 553 | free(buffer);
|
---|
| 554 | }
|
---|
| 555 |
|
---|
[f658458] | 556 |
|
---|
[38b3baf] | 557 | /** Function for handling connections from a client to the device manager. */
|
---|
[f658458] | 558 | static void devman_connection_client(ipc_callid_t iid, ipc_call_t *icall)
|
---|
| 559 | {
|
---|
[38b3baf] | 560 | /* Accept connection. */
|
---|
[ffa2c8ef] | 561 | async_answer_0(iid, EOK);
|
---|
[f658458] | 562 |
|
---|
[79ae36dd] | 563 | while (true) {
|
---|
[f658458] | 564 | ipc_call_t call;
|
---|
| 565 | ipc_callid_t callid = async_get_call(&call);
|
---|
| 566 |
|
---|
[79ae36dd] | 567 | if (!IPC_GET_IMETHOD(call))
|
---|
| 568 | break;
|
---|
| 569 |
|
---|
[228e490] | 570 | switch (IPC_GET_IMETHOD(call)) {
|
---|
[f658458] | 571 | case DEVMAN_DEVICE_GET_HANDLE:
|
---|
[ba38f72c] | 572 | devman_function_get_handle(callid, &call);
|
---|
[f658458] | 573 | break;
|
---|
[fc8c2b6] | 574 | case DEVMAN_DEVICE_GET_HANDLE_BY_CLASS:
|
---|
| 575 | devman_function_get_handle_by_class(callid, &call);
|
---|
| 576 | break;
|
---|
[431d6d6] | 577 | case DEVMAN_DEVICE_GET_DEVICE_PATH:
|
---|
| 578 | devman_get_device_path_by_handle(callid, &call);
|
---|
| 579 | break;
|
---|
[f658458] | 580 | default:
|
---|
[ffa2c8ef] | 581 | async_answer_0(callid, ENOENT);
|
---|
[f658458] | 582 | }
|
---|
[c6c389ed] | 583 | }
|
---|
[f658458] | 584 | }
|
---|
| 585 |
|
---|
[c6c389ed] | 586 | static void devman_forward(ipc_callid_t iid, ipc_call_t *icall,
|
---|
| 587 | bool drv_to_parent)
|
---|
[38b3baf] | 588 | {
|
---|
[0b5a4131] | 589 | devman_handle_t handle = IPC_GET_ARG2(*icall);
|
---|
[8b1e15ac] | 590 | devman_handle_t fwd_h;
|
---|
| 591 | fun_node_t *fun = NULL;
|
---|
| 592 | dev_node_t *dev = NULL;
|
---|
[9a66bc2e] | 593 |
|
---|
[8b1e15ac] | 594 | fun = find_fun_node(&device_tree, handle);
|
---|
| 595 | if (fun == NULL)
|
---|
| 596 | dev = find_dev_node(&device_tree, handle);
|
---|
| 597 | else
|
---|
| 598 | dev = fun->dev;
|
---|
| 599 |
|
---|
[0418050] | 600 | /*
|
---|
| 601 | * For a valid function to connect to we need a device. The root
|
---|
| 602 | * function, for example, has no device and cannot be connected to.
|
---|
| 603 | * This means @c dev needs to be valid regardless whether we are
|
---|
| 604 | * connecting to a device or to a function.
|
---|
| 605 | */
|
---|
| 606 | if (dev == NULL) {
|
---|
[9b415c9] | 607 | log_msg(LVL_ERROR, "IPC forwarding failed - no device or "
|
---|
[ebcb05a] | 608 | "function with handle %" PRIun " was found.", handle);
|
---|
[ffa2c8ef] | 609 | async_answer_0(iid, ENOENT);
|
---|
[5cd136ab] | 610 | return;
|
---|
| 611 | }
|
---|
[8b1e15ac] | 612 |
|
---|
| 613 | if (fun == NULL && !drv_to_parent) {
|
---|
[9b415c9] | 614 | log_msg(LVL_ERROR, NAME ": devman_forward error - cannot "
|
---|
[ebcb05a] | 615 | "connect to handle %" PRIun ", refers to a device.",
|
---|
[9b415c9] | 616 | handle);
|
---|
[ffa2c8ef] | 617 | async_answer_0(iid, ENOENT);
|
---|
[5cd136ab] | 618 | return;
|
---|
| 619 | }
|
---|
| 620 |
|
---|
| 621 | driver_t *driver = NULL;
|
---|
| 622 |
|
---|
| 623 | if (drv_to_parent) {
|
---|
[8b1e15ac] | 624 | /* Connect to parent function of a device (or device function). */
|
---|
| 625 | if (dev->pfun->dev != NULL)
|
---|
| 626 | driver = dev->pfun->dev->drv;
|
---|
| 627 | fwd_h = dev->pfun->handle;
|
---|
[c6c389ed] | 628 | } else if (dev->state == DEVICE_USABLE) {
|
---|
[8b1e15ac] | 629 | /* Connect to the specified function */
|
---|
[38b3baf] | 630 | driver = dev->drv;
|
---|
[c6c389ed] | 631 | assert(driver != NULL);
|
---|
[8b1e15ac] | 632 |
|
---|
| 633 | fwd_h = handle;
|
---|
[5cd136ab] | 634 | }
|
---|
| 635 |
|
---|
[c6c389ed] | 636 | if (driver == NULL) {
|
---|
[9b415c9] | 637 | log_msg(LVL_ERROR, "IPC forwarding refused - " \
|
---|
[79ae36dd] | 638 | "the device %" PRIun " is not in usable state.", handle);
|
---|
[ffa2c8ef] | 639 | async_answer_0(iid, ENOENT);
|
---|
[38b3baf] | 640 | return;
|
---|
[5cd136ab] | 641 | }
|
---|
| 642 |
|
---|
[38b3baf] | 643 | int method;
|
---|
| 644 | if (drv_to_parent)
|
---|
[5cd136ab] | 645 | method = DRIVER_DRIVER;
|
---|
[38b3baf] | 646 | else
|
---|
[5cd136ab] | 647 | method = DRIVER_CLIENT;
|
---|
| 648 |
|
---|
[79ae36dd] | 649 | if (!driver->sess) {
|
---|
| 650 | log_msg(LVL_ERROR,
|
---|
| 651 | "Could not forward to driver `%s'.", driver->name);
|
---|
[ffa2c8ef] | 652 | async_answer_0(iid, EINVAL);
|
---|
[9a66bc2e] | 653 | return;
|
---|
| 654 | }
|
---|
[c6c389ed] | 655 |
|
---|
[8b1e15ac] | 656 | if (fun != NULL) {
|
---|
[9b415c9] | 657 | log_msg(LVL_DEBUG,
|
---|
[ebcb05a] | 658 | "Forwarding request for `%s' function to driver `%s'.",
|
---|
[9b415c9] | 659 | fun->pathname, driver->name);
|
---|
[8b1e15ac] | 660 | } else {
|
---|
[9b415c9] | 661 | log_msg(LVL_DEBUG,
|
---|
[ebcb05a] | 662 | "Forwarding request for `%s' device to driver `%s'.",
|
---|
[9b415c9] | 663 | dev->pfun->pathname, driver->name);
|
---|
[8b1e15ac] | 664 | }
|
---|
[79ae36dd] | 665 |
|
---|
| 666 | async_exch_t *exch = async_exchange_begin(driver->sess);
|
---|
| 667 | async_forward_fast(iid, exch, method, fwd_h, 0, IPC_FF_NONE);
|
---|
| 668 | async_exchange_end(exch);
|
---|
[5cd136ab] | 669 | }
|
---|
| 670 |
|
---|
[15f3c3f] | 671 | /** Function for handling connections from a client forwarded by the location
|
---|
| 672 | * service to the device manager. */
|
---|
| 673 | static void devman_connection_loc(ipc_callid_t iid, ipc_call_t *icall)
|
---|
[ce89036b] | 674 | {
|
---|
[15f3c3f] | 675 | service_id_t service_id = IPC_GET_ARG2(*icall);
|
---|
[ba38f72c] | 676 | fun_node_t *fun;
|
---|
| 677 | dev_node_t *dev;
|
---|
[c6c389ed] | 678 |
|
---|
[15f3c3f] | 679 | fun = find_loc_tree_function(&device_tree, service_id);
|
---|
[ba38f72c] | 680 | if (fun == NULL)
|
---|
[15f3c3f] | 681 | fun = find_loc_class_function(&class_list, service_id);
|
---|
[ce89036b] | 682 |
|
---|
[ba38f72c] | 683 | if (fun == NULL || fun->dev->drv == NULL) {
|
---|
[ffa2c8ef] | 684 | async_answer_0(iid, ENOENT);
|
---|
[ce89036b] | 685 | return;
|
---|
| 686 | }
|
---|
| 687 |
|
---|
[ba38f72c] | 688 | dev = fun->dev;
|
---|
| 689 |
|
---|
[79ae36dd] | 690 | if ((dev->state != DEVICE_USABLE) || (!dev->drv->sess)) {
|
---|
[ffa2c8ef] | 691 | async_answer_0(iid, EINVAL);
|
---|
[ce89036b] | 692 | return;
|
---|
| 693 | }
|
---|
| 694 |
|
---|
[79ae36dd] | 695 | async_exch_t *exch = async_exchange_begin(dev->drv->sess);
|
---|
| 696 | async_forward_fast(iid, exch, DRIVER_CLIENT, fun->handle, 0,
|
---|
[38b3baf] | 697 | IPC_FF_NONE);
|
---|
[79ae36dd] | 698 | async_exchange_end(exch);
|
---|
| 699 |
|
---|
| 700 | log_msg(LVL_DEBUG,
|
---|
[15f3c3f] | 701 | "Forwarding loc service request for `%s' function to driver `%s'.",
|
---|
[9b415c9] | 702 | fun->pathname, dev->drv->name);
|
---|
[ce89036b] | 703 | }
|
---|
| 704 |
|
---|
[38b3baf] | 705 | /** Function for handling connections to device manager. */
|
---|
[9934f7d] | 706 | static void devman_connection(ipc_callid_t iid, ipc_call_t *icall, void *arg)
|
---|
[38b3baf] | 707 | {
|
---|
| 708 | /* Select interface. */
|
---|
[96b02eb9] | 709 | switch ((sysarg_t) (IPC_GET_ARG1(*icall))) {
|
---|
[924c75e1] | 710 | case DEVMAN_DRIVER:
|
---|
| 711 | devman_connection_driver(iid, icall);
|
---|
| 712 | break;
|
---|
[f658458] | 713 | case DEVMAN_CLIENT:
|
---|
| 714 | devman_connection_client(iid, icall);
|
---|
| 715 | break;
|
---|
[924c75e1] | 716 | case DEVMAN_CONNECT_TO_DEVICE:
|
---|
[38b3baf] | 717 | /* Connect client to selected device. */
|
---|
[5cd136ab] | 718 | devman_forward(iid, icall, false);
|
---|
| 719 | break;
|
---|
[15f3c3f] | 720 | case DEVMAN_CONNECT_FROM_LOC:
|
---|
| 721 | /* Someone connected through loc node. */
|
---|
| 722 | devman_connection_loc(iid, icall);
|
---|
[47a7174f] | 723 | break;
|
---|
[5cd136ab] | 724 | case DEVMAN_CONNECT_TO_PARENTS_DEVICE:
|
---|
[38b3baf] | 725 | /* Connect client to selected device. */
|
---|
[5cd136ab] | 726 | devman_forward(iid, icall, true);
|
---|
[38b3baf] | 727 | break;
|
---|
[924c75e1] | 728 | default:
|
---|
| 729 | /* No such interface */
|
---|
[ffa2c8ef] | 730 | async_answer_0(iid, ENOENT);
|
---|
[924c75e1] | 731 | }
|
---|
| 732 | }
|
---|
| 733 |
|
---|
[38b3baf] | 734 | /** Initialize device manager internal structures. */
|
---|
| 735 | static bool devman_init(void)
|
---|
[e2b9a993] | 736 | {
|
---|
[ebcb05a] | 737 | log_msg(LVL_DEBUG, "devman_init - looking for available drivers.");
|
---|
[08d9c4e6] | 738 |
|
---|
[38b3baf] | 739 | /* Initialize list of available drivers. */
|
---|
[0c3666d] | 740 | init_driver_list(&drivers_list);
|
---|
[c6c389ed] | 741 | if (lookup_available_drivers(&drivers_list,
|
---|
| 742 | DRIVER_DEFAULT_STORE) == 0) {
|
---|
[ebcb05a] | 743 | log_msg(LVL_FATAL, "No drivers found.");
|
---|
[e2b9a993] | 744 | return false;
|
---|
| 745 | }
|
---|
[c6c389ed] | 746 |
|
---|
[ebcb05a] | 747 | log_msg(LVL_DEBUG, "devman_init - list of drivers has been initialized.");
|
---|
[e2b9a993] | 748 |
|
---|
[38b3baf] | 749 | /* Create root device node. */
|
---|
[e2b9a993] | 750 | if (!init_device_tree(&device_tree, &drivers_list)) {
|
---|
[9b415c9] | 751 | log_msg(LVL_FATAL, "Failed to initialize device tree.");
|
---|
[38b3baf] | 752 | return false;
|
---|
[e2b9a993] | 753 | }
|
---|
| 754 |
|
---|
[692c40cb] | 755 | init_class_list(&class_list);
|
---|
| 756 |
|
---|
[38b3baf] | 757 | /*
|
---|
[15f3c3f] | 758 | * !!! devman_connection ... as the device manager is not a real loc
|
---|
[38b3baf] | 759 | * driver (it uses a completely different ipc protocol than an ordinary
|
---|
[15f3c3f] | 760 | * loc driver) forwarding a connection from client to the devman by
|
---|
| 761 | * location service would not work.
|
---|
[38b3baf] | 762 | */
|
---|
[15f3c3f] | 763 | loc_server_register(NAME, devman_connection);
|
---|
[ce89036b] | 764 |
|
---|
[e2b9a993] | 765 | return true;
|
---|
| 766 | }
|
---|
| 767 |
|
---|
| 768 | int main(int argc, char *argv[])
|
---|
| 769 | {
|
---|
| 770 | printf(NAME ": HelenOS Device Manager\n");
|
---|
| 771 |
|
---|
[cc574511] | 772 | if (log_init(NAME, LVL_WARN) != EOK) {
|
---|
[9b415c9] | 773 | printf(NAME ": Error initializing logging subsystem.\n");
|
---|
| 774 | return -1;
|
---|
| 775 | }
|
---|
| 776 |
|
---|
[e2b9a993] | 777 | if (!devman_init()) {
|
---|
[ebcb05a] | 778 | log_msg(LVL_ERROR, "Error while initializing service.");
|
---|
[e2b9a993] | 779 | return -1;
|
---|
| 780 | }
|
---|
| 781 |
|
---|
[38b3baf] | 782 | /* Set a handler of incomming connections. */
|
---|
[e2b9a993] | 783 | async_set_client_connection(devman_connection);
|
---|
| 784 |
|
---|
[38b3baf] | 785 | /* Register device manager at naming service. */
|
---|
[9b415c9] | 786 | if (service_register(SERVICE_DEVMAN) != EOK) {
|
---|
[ebcb05a] | 787 | log_msg(LVL_ERROR, "Failed registering as a service.");
|
---|
[e2b9a993] | 788 | return -1;
|
---|
[9b415c9] | 789 | }
|
---|
[e2b9a993] | 790 |
|
---|
[9b415c9] | 791 | printf(NAME ": Accepting connections.\n");
|
---|
[79ae36dd] | 792 | task_retval(0);
|
---|
[e2b9a993] | 793 | async_manager();
|
---|
| 794 |
|
---|
[38b3baf] | 795 | /* Never reached. */
|
---|
[e2b9a993] | 796 | return 0;
|
---|
| 797 | }
|
---|
[c16cf62] | 798 |
|
---|
| 799 | /** @}
|
---|
[38b3baf] | 800 | */
|
---|