Changeset e55741e in mainline
- Timestamp:
- 2019-08-06T18:25:27Z (6 years ago)
- Children:
- c1b2084
- Parents:
- 4224ef7
- git-author:
- Michal Koutný <xm.koutny+hos@…> (2015-05-19 16:34:53)
- git-committer:
- Matthieu Riolo <matthieu.riolo@…> (2019-08-06 18:25:27)
- Location:
- uspace
- Files:
-
- 43 added
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/srv/devman/Makefile
r4224ef7 re55741e 29 29 30 30 USPACE_PREFIX = ../.. 31 LIBS = $(LIBSYSMAN_PREFIX)/libsysman.a 32 EXTRA_CFLAGS += -I$(LIBSYSMAN_PREFIX)/include 31 33 BINARY = devman 32 34 STATIC_NEEDED = y -
uspace/srv/devman/devman.h
r4224ef7 re55741e 78 78 /** Name of the device driver. */ 79 79 char *name; 80 /** Path to the driver's binary. */81 char *binary_path;82 80 /** List of device ids for device-to-driver matching. */ 83 81 match_id_list_t match_ids; -
uspace/srv/devman/driver.c
r4224ef7 re55741e 34 34 #include <dirent.h> 35 35 #include <errno.h> 36 #include <fcntl.h> 36 37 #include <io/log.h> 37 38 #include <vfs/vfs.h> 38 39 #include <loc.h> 40 #include <stdio.h> 39 41 #include <str_error.h> 40 #include <stdio.h> 42 #include <sys/stat.h> 43 #include <sysman/ctl.h> 41 44 #include <task.h> 42 45 … … 139 142 str_cpy(drv->name, name_size, name); 140 143 141 /* Initialize path with driver's binary. */142 drv->binary_path = get_abs_path(base_path, name, "");143 if (drv->binary_path == NULL)144 goto cleanup;145 146 /* Check whether the driver's binary exists. */147 vfs_stat_t s;148 if (vfs_stat_path(drv->binary_path, &s) != EOK) {149 log_msg(LOG_DEFAULT, LVL_ERROR, "Driver not found at path `%s'.",150 drv->binary_path);151 goto cleanup;152 }153 154 144 suc = true; 155 145 156 146 cleanup: 157 147 if (!suc) { 158 free(drv->binary_path);159 148 free(drv->name); 160 149 /* Set the driver structure to the default state. */ … … 271 260 * 272 261 * @param tree Device tree 273 * @param nodeThe device's node in the device tree.262 * @param dev The device's node in the device tree. 274 263 * @param drv The driver. 275 264 */ … … 330 319 log_msg(LOG_DEFAULT, LVL_DEBUG, "start_driver(drv=\"%s\")", drv->name); 331 320 332 rc = task_spawnl(NULL, NULL, drv->binary_path, drv->binary_path, NULL); 321 char *unit_name = NULL; 322 asprintf(&unit_name, "%s%c%s", drv->name, UNIT_NAME_SEPARATOR, 323 UNIT_SVC_TYPE_NAME); 324 if (unit_name == NULL) { 325 return false; 326 } 327 328 /* 329 * Non-blocking asynchronous request to start a driver 330 * FIXME See note about sysman_unit_start non-blocking (asynchronous) 331 * API 332 */ 333 int flags = 0; 334 rc = sysman_unit_start(unit_name, flags); 335 333 336 if (rc != EOK) { 334 log_msg(LOG_DEFAULT, LVL_ERROR, "Spawning driver `%s' (%s) failed: %s.", 335 drv->name, drv->binary_path, str_error(rc)); 337 log_msg(LOG_DEFAULT, LVL_ERROR, 338 "Request to start driver `%s' failed: %s.", 339 drv->name, str_error(rc)); 340 free(unit_name); 336 341 return false; 337 342 } 338 343 339 344 drv->state = DRIVER_STARTING; 345 free(unit_name); 340 346 return true; 341 347 } … … 547 553 548 554 free(drv->name); 549 free(drv->binary_path);550 555 551 556 clean_match_ids(&drv->match_ids); … … 568 573 /** Find suitable driver for a device and assign the driver to it. 569 574 * 570 * @param nodeThe device node of the device in the device tree.575 * @param dev The device node of the device in the device tree. 571 576 * @param drivers_list The list of available drivers. 572 577 * @return True if the suitable driver is found and … … 627 632 * 628 633 * @param drv The driver's structure. 629 * @param nodeThe device's node in the device tree.634 * @param dev The device's node in the device tree. 630 635 */ 631 636 void add_device(driver_t *drv, dev_node_t *dev, dev_tree_t *tree)
Note:
See TracChangeset
for help on using the changeset viewer.