Changeset 33c2952 in mainline for uspace/srv/devman/devman.c


Ignore:
Timestamp:
2012-11-07T21:00:02Z (14 years ago)
Author:
Adam Hraska <adam.hraska+hos@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/fix-logger-deadlock, topic/msim-upgrade, topic/simplify-dev-export
Children:
dcb0751
Parents:
fc89e32 (diff), 94795812 (diff)
Note: this is a merge changeset, the changes displayed below correspond to the merge itself.
Use the (diff) links above to see all the changes relative to each parent.
Message:

Merged with mainline.

File:
1 edited

Legend:

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

    rfc89e32 r33c2952  
    122122        .key_hash = handle_key_hash,
    123123        .key_equal = devman_devices_key_equal,
    124         .equal = 0,
    125         .remove_callback = 0
     124        .equal = NULL,
     125        .remove_callback = NULL
    126126};
    127127
     
    130130        .key_hash = handle_key_hash,
    131131        .key_equal = devman_functions_key_equal,
    132         .equal = 0,
    133         .remove_callback = 0
     132        .equal = NULL,
     133        .remove_callback = NULL
    134134};
    135135
     
    138138        .key_hash = service_id_key_hash,
    139139        .key_equal = loc_functions_key_equal,
    140         .equal = 0,
    141         .remove_callback = 0
     140        .equal = NULL,
     141        .remove_callback = NULL
    142142};
    143143
     
    179179        fibril_mutex_unlock(&drivers_list->drivers_mutex);
    180180
    181         log_msg(LVL_NOTE, "Driver `%s' was added to the list of available "
     181        log_msg(LOG_DEFAULT, LVL_NOTE, "Driver `%s' was added to the list of available "
    182182            "drivers.", drv->name);
    183183}
     
    270270bool read_match_ids(const char *conf_path, match_id_list_t *ids)
    271271{
    272         log_msg(LVL_DEBUG, "read_match_ids(conf_path=\"%s\")", conf_path);
     272        log_msg(LOG_DEFAULT, LVL_DEBUG, "read_match_ids(conf_path=\"%s\")", conf_path);
    273273       
    274274        bool suc = false;
     
    280280        fd = open(conf_path, O_RDONLY);
    281281        if (fd < 0) {
    282                 log_msg(LVL_ERROR, "Unable to open `%s' for reading: %s.",
     282                log_msg(LOG_DEFAULT, LVL_ERROR, "Unable to open `%s' for reading: %s.",
    283283                    conf_path, str_error(fd));
    284284                goto cleanup;
     
    289289        lseek(fd, 0, SEEK_SET);
    290290        if (len == 0) {
    291                 log_msg(LVL_ERROR, "Configuration file '%s' is empty.",
     291                log_msg(LOG_DEFAULT, LVL_ERROR, "Configuration file '%s' is empty.",
    292292                    conf_path);
    293293                goto cleanup;
     
    296296        buf = malloc(len + 1);
    297297        if (buf == NULL) {
    298                 log_msg(LVL_ERROR, "Memory allocation failed when parsing file "
     298                log_msg(LOG_DEFAULT, LVL_ERROR, "Memory allocation failed when parsing file "
    299299                    "'%s'.", conf_path);
    300300                goto cleanup;
     
    303303        ssize_t read_bytes = read_all(fd, buf, len);
    304304        if (read_bytes <= 0) {
    305                 log_msg(LVL_ERROR, "Unable to read file '%s' (%zd).", conf_path,
     305                log_msg(LOG_DEFAULT, LVL_ERROR, "Unable to read file '%s' (%zd).", conf_path,
    306306                    read_bytes);
    307307                goto cleanup;
     
    342342bool get_driver_info(const char *base_path, const char *name, driver_t *drv)
    343343{
    344         log_msg(LVL_DEBUG, "get_driver_info(base_path=\"%s\", name=\"%s\")",
     344        log_msg(LOG_DEFAULT, LVL_DEBUG, "get_driver_info(base_path=\"%s\", name=\"%s\")",
    345345            base_path, name);
    346346       
     
    374374        struct stat s;
    375375        if (stat(drv->binary_path, &s) == ENOENT) { /* FIXME!! */
    376                 log_msg(LVL_ERROR, "Driver not found at path `%s'.",
     376                log_msg(LOG_DEFAULT, LVL_ERROR, "Driver not found at path `%s'.",
    377377                    drv->binary_path);
    378378                goto cleanup;
     
    402402int lookup_available_drivers(driver_list_t *drivers_list, const char *dir_path)
    403403{
    404         log_msg(LVL_DEBUG, "lookup_available_drivers(dir=\"%s\")", dir_path);
     404        log_msg(LOG_DEFAULT, LVL_DEBUG, "lookup_available_drivers(dir=\"%s\")", dir_path);
    405405       
    406406        int drv_cnt = 0;
     
    436436        dev_node_t *dev;
    437437       
    438         log_msg(LVL_DEBUG, "create_root_nodes()");
     438        log_msg(LOG_DEFAULT, LVL_DEBUG, "create_root_nodes()");
    439439       
    440440        fibril_rwlock_write_lock(&tree->rwlock);
     
    523523void attach_driver(dev_tree_t *tree, dev_node_t *dev, driver_t *drv)
    524524{
    525         log_msg(LVL_DEBUG, "attach_driver(dev=\"%s\",drv=\"%s\")",
     525        log_msg(LOG_DEFAULT, LVL_DEBUG, "attach_driver(dev=\"%s\",drv=\"%s\")",
    526526            dev->pfun->pathname, drv->name);
    527527       
     
    548548        assert(drv != NULL);
    549549       
    550         log_msg(LVL_DEBUG, "detach_driver(dev=\"%s\",drv=\"%s\")",
     550        log_msg(LOG_DEFAULT, LVL_DEBUG, "detach_driver(dev=\"%s\",drv=\"%s\")",
    551551            dev->pfun->pathname, drv->name);
    552552       
     
    573573        assert(fibril_mutex_is_locked(&drv->driver_mutex));
    574574       
    575         log_msg(LVL_DEBUG, "start_driver(drv=\"%s\")", drv->name);
     575        log_msg(LOG_DEFAULT, LVL_DEBUG, "start_driver(drv=\"%s\")", drv->name);
    576576       
    577577        rc = task_spawnl(NULL, drv->binary_path, drv->binary_path, NULL);
    578578        if (rc != EOK) {
    579                 log_msg(LVL_ERROR, "Spawning driver `%s' (%s) failed: %s.",
     579                log_msg(LOG_DEFAULT, LVL_ERROR, "Spawning driver `%s' (%s) failed: %s.",
    580580                    drv->name, drv->binary_path, str_error(rc));
    581581                return false;
     
    622622        link_t *link;
    623623
    624         log_msg(LVL_DEBUG, "pass_devices_to_driver(driver=\"%s\")",
     624        log_msg(LOG_DEFAULT, LVL_DEBUG, "pass_devices_to_driver(driver=\"%s\")",
    625625            driver->name);
    626626
     
    642642                }
    643643
    644                 log_msg(LVL_DEBUG, "pass_devices_to_driver: dev->refcnt=%d\n",
     644                log_msg(LOG_DEFAULT, LVL_DEBUG, "pass_devices_to_driver: dev->refcnt=%d\n",
    645645                    (int)atomic_get(&dev->refcnt));
    646646                dev_add_ref(dev);
     
    678678         * immediately and possibly started here as well.
    679679         */
    680         log_msg(LVL_DEBUG, "Driver `%s' enters running state.", driver->name);
     680        log_msg(LOG_DEFAULT, LVL_DEBUG, "Driver `%s' enters running state.", driver->name);
    681681        driver->state = DRIVER_RUNNING;
    682682
     
    695695void initialize_running_driver(driver_t *driver, dev_tree_t *tree)
    696696{
    697         log_msg(LVL_DEBUG, "initialize_running_driver(driver=\"%s\")",
     697        log_msg(LOG_DEFAULT, LVL_DEBUG, "initialize_running_driver(driver=\"%s\")",
    698698            driver->name);
    699699       
     
    789789         * access any structures that would affect driver_t.
    790790         */
    791         log_msg(LVL_DEBUG, "add_device(drv=\"%s\", dev=\"%s\")",
     791        log_msg(LOG_DEFAULT, LVL_DEBUG, "add_device(drv=\"%s\", dev=\"%s\")",
    792792            drv->name, dev->pfun->name);
    793793       
     
    855855        driver_t *drv = find_best_match_driver(drivers_list, dev);
    856856        if (drv == NULL) {
    857                 log_msg(LVL_ERROR, "No driver found for device `%s'.",
     857                log_msg(LOG_DEFAULT, LVL_ERROR, "No driver found for device `%s'.",
    858858                    dev->pfun->pathname);
    859859                return false;
     
    895895        assert(dev != NULL);
    896896       
    897         log_msg(LVL_DEBUG, "driver_dev_remove(%p)", dev);
     897        log_msg(LOG_DEFAULT, LVL_DEBUG, "driver_dev_remove(%p)", dev);
    898898       
    899899        fibril_rwlock_read_lock(&tree->rwlock);
     
    918918        assert(dev != NULL);
    919919       
    920         log_msg(LVL_DEBUG, "driver_dev_gone(%p)", dev);
     920        log_msg(LOG_DEFAULT, LVL_DEBUG, "driver_dev_gone(%p)", dev);
    921921       
    922922        fibril_rwlock_read_lock(&tree->rwlock);
     
    939939        devman_handle_t handle;
    940940       
    941         log_msg(LVL_DEBUG, "driver_fun_online(%p)", fun);
     941        log_msg(LOG_DEFAULT, LVL_DEBUG, "driver_fun_online(%p)", fun);
    942942
    943943        fibril_rwlock_read_lock(&tree->rwlock);
     
    967967        devman_handle_t handle;
    968968       
    969         log_msg(LVL_DEBUG, "driver_fun_offline(%p)", fun);
     969        log_msg(LOG_DEFAULT, LVL_DEBUG, "driver_fun_offline(%p)", fun);
    970970
    971971        fibril_rwlock_read_lock(&tree->rwlock);
     
    998998bool init_device_tree(dev_tree_t *tree, driver_list_t *drivers_list)
    999999{
    1000         log_msg(LVL_DEBUG, "init_device_tree()");
     1000        log_msg(LOG_DEFAULT, LVL_DEBUG, "init_device_tree()");
    10011001       
    10021002        tree->current_handle = 0;
     
    12781278        fun->pathname = (char *) malloc(pathsize);
    12791279        if (fun->pathname == NULL) {
    1280                 log_msg(LVL_ERROR, "Failed to allocate device path.");
     1280                log_msg(LOG_DEFAULT, LVL_ERROR, "Failed to allocate device path.");
    12811281                return false;
    12821282        }
     
    13061306        assert(fibril_rwlock_is_write_locked(&tree->rwlock));
    13071307       
    1308         log_msg(LVL_DEBUG, "insert_dev_node(dev=%p, pfun=%p [\"%s\"])",
     1308        log_msg(LOG_DEFAULT, LVL_DEBUG, "insert_dev_node(dev=%p, pfun=%p [\"%s\"])",
    13091309            dev, pfun, pfun->pathname);
    13101310
     
    13291329        assert(fibril_rwlock_is_write_locked(&tree->rwlock));
    13301330       
    1331         log_msg(LVL_DEBUG, "remove_dev_node(dev=%p)", dev);
     1331        log_msg(LOG_DEFAULT, LVL_DEBUG, "remove_dev_node(dev=%p)", dev);
    13321332       
    13331333        /* Remove node from the handle-to-node map. */
Note: See TracChangeset for help on using the changeset viewer.