Changeset 63a3276 in mainline for uspace/srv/devman


Ignore:
Timestamp:
2019-08-06T19:20:35Z (6 years ago)
Author:
Matthieu Riolo <matthieu.riolo@…>
Children:
3f05ef7
Parents:
72c8f77
git-author:
Michal Koutný <xm.koutny+hos@…> (2015-06-17 23:02:03)
git-committer:
Matthieu Riolo <matthieu.riolo@…> (2019-08-06 19:20:35)
Message:

sysman: Instrumented locsrv for autostart

  • also refactored unit name derivation in other brokers
  • exposee creation is not used in unit's lifecycle (failed assertion)

Conflicts:

uspace/lib/c/generic/loc.c
uspace/srv/devman/driver.c
uspace/srv/devman/drv_conn.c
uspace/srv/hid/compositor/compositor.c
uspace/srv/locsrv/locsrv.c
uspace/srv/vfs/vfs.h
uspace/srv/vfs/vfs_ops.c
uspace/srv/vfs/vfs_register.c

Location:
uspace/srv/devman
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • uspace/srv/devman/driver.c

    r72c8f77 r63a3276  
    186186
    187187        return drv_cnt;
     188}
     189
     190/** Get name of unit that represents the driver
     191 *
     192 * @param[in]  drv
     193 * @param[out] unit_name_ptr  should be free'd after use, not touched on fail
     194 *
     195 * @return     EOK on success
     196 * @return     ENOMEM
     197 */
     198errno_t driver_unit_name(driver_t *drv, char **unit_name_ptr)
     199{
     200        char *unit_name = NULL;
     201        asprintf(&unit_name, "%s%c%s", drv->name, UNIT_NAME_SEPARATOR,
     202            UNIT_SVC_TYPE_NAME);
     203
     204        if (unit_name == NULL) {
     205                return ENOMEM;
     206        } else {
     207                *unit_name_ptr = unit_name;
     208                return EOK;
     209        }
    188210}
    189211
     
    320342
    321343        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) {
     344        if (driver_unit_name(drv, &unit_name) != EOK) {
    325345                return false;
    326346        }
     
    333353        int flags = 0;
    334354        rc = sysman_unit_start(unit_name, flags);
     355        free(unit_name);
    335356
    336357        if (rc != EOK) {
     
    338359                    "Request to start driver `%s' failed: %s.",
    339360                    drv->name, str_error(rc));
    340                 free(unit_name);
    341361                return false;
    342362        }
    343363
    344364        drv->state = DRIVER_STARTING;
    345         free(unit_name);
    346365        return true;
    347366}
  • uspace/srv/devman/driver.h

    r72c8f77 r63a3276  
    4242extern bool get_driver_info(const char *, const char *, driver_t *);
    4343extern int lookup_available_drivers(driver_list_t *, const char *);
     44extern int driver_unit_name(driver_t *, char **);
    4445
    4546extern driver_t *find_best_match_driver(driver_list_t *, dev_node_t *);
  • uspace/srv/devman/drv_conn.c

    r72c8f77 r63a3276  
    3636
    3737#include <assert.h>
     38#include <async.h>
     39#include <errno.h>
     40#include <fibril_synch.h>
     41#include <io/log.h>
     42#include <ipc/devman.h>
     43#include <ipc/driver.h>
    3844#include <ipc/services.h>
     45#include <loc.h>
    3946#include <ns.h>
    40 #include <async.h>
     47#include <stdbool.h>
    4148#include <stdio.h>
    42 #include <errno.h>
    43 #include <str_error.h>
    44 #include <stdbool.h>
    45 #include <fibril_synch.h>
    4649#include <stdlib.h>
    4750#include <str.h>
    48 #include <io/log.h>
    49 #include <ipc/devman.h>
    50 #include <loc.h>
     51#include <str_error.h>
     52#include <sysman/broker.h>
    5153
    5254#include "client_conn.h"
     
    6769        driver_t *driver = NULL;
    6870        char *drv_name = NULL;
     71        char *unit_name = NULL;
    6972
    7073        log_msg(LOG_DEFAULT, LVL_DEBUG, "devman_driver_register");
     
    104107        }
    105108
     109        /* Notify sysman about started driver */
     110        rc = driver_unit_name(driver, &unit_name);
     111        if (rc != EOK) {
     112                fibril_mutex_unlock(&driver->driver_mutex);
     113                async_answer_0(callid, rc);
     114                return NULL;
     115        }
     116        sysman_main_exposee_added(unit_name, call->in_task_id);
     117        free(unit_name);
     118       
    106119        switch (driver->state) {
    107120        case DRIVER_NOT_STARTED:
Note: See TracChangeset for help on using the changeset viewer.