Changeset a1a101d in mainline for uspace/srv/devman


Ignore:
Timestamp:
2012-08-17T16:58:51Z (13 years ago)
Author:
Vojtech Horky <vojtechhorky@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
bc0ccab
Parents:
920d0fc
Message:

Get rid of log_log_msg()

All calls to log_msg(LVL_*) were rewritten to
log_msg(LOG_DEFAULT, LVL_*).

Location:
uspace/srv/devman
Files:
2 edited

Legend:

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

    r920d0fc ra1a101d  
    151151        fibril_mutex_unlock(&drivers_list->drivers_mutex);
    152152
    153         log_msg(LVL_NOTE, "Driver `%s' was added to the list of available "
     153        log_msg(LOG_DEFAULT, LVL_NOTE, "Driver `%s' was added to the list of available "
    154154            "drivers.", drv->name);
    155155}
     
    242242bool read_match_ids(const char *conf_path, match_id_list_t *ids)
    243243{
    244         log_msg(LVL_DEBUG, "read_match_ids(conf_path=\"%s\")", conf_path);
     244        log_msg(LOG_DEFAULT, LVL_DEBUG, "read_match_ids(conf_path=\"%s\")", conf_path);
    245245       
    246246        bool suc = false;
     
    252252        fd = open(conf_path, O_RDONLY);
    253253        if (fd < 0) {
    254                 log_msg(LVL_ERROR, "Unable to open `%s' for reading: %s.",
     254                log_msg(LOG_DEFAULT, LVL_ERROR, "Unable to open `%s' for reading: %s.",
    255255                    conf_path, str_error(fd));
    256256                goto cleanup;
     
    261261        lseek(fd, 0, SEEK_SET);
    262262        if (len == 0) {
    263                 log_msg(LVL_ERROR, "Configuration file '%s' is empty.",
     263                log_msg(LOG_DEFAULT, LVL_ERROR, "Configuration file '%s' is empty.",
    264264                    conf_path);
    265265                goto cleanup;
     
    268268        buf = malloc(len + 1);
    269269        if (buf == NULL) {
    270                 log_msg(LVL_ERROR, "Memory allocation failed when parsing file "
     270                log_msg(LOG_DEFAULT, LVL_ERROR, "Memory allocation failed when parsing file "
    271271                    "'%s'.", conf_path);
    272272                goto cleanup;
     
    275275        ssize_t read_bytes = read_all(fd, buf, len);
    276276        if (read_bytes <= 0) {
    277                 log_msg(LVL_ERROR, "Unable to read file '%s' (%zd).", conf_path,
     277                log_msg(LOG_DEFAULT, LVL_ERROR, "Unable to read file '%s' (%zd).", conf_path,
    278278                    read_bytes);
    279279                goto cleanup;
     
    314314bool get_driver_info(const char *base_path, const char *name, driver_t *drv)
    315315{
    316         log_msg(LVL_DEBUG, "get_driver_info(base_path=\"%s\", name=\"%s\")",
     316        log_msg(LOG_DEFAULT, LVL_DEBUG, "get_driver_info(base_path=\"%s\", name=\"%s\")",
    317317            base_path, name);
    318318       
     
    346346        struct stat s;
    347347        if (stat(drv->binary_path, &s) == ENOENT) { /* FIXME!! */
    348                 log_msg(LVL_ERROR, "Driver not found at path `%s'.",
     348                log_msg(LOG_DEFAULT, LVL_ERROR, "Driver not found at path `%s'.",
    349349                    drv->binary_path);
    350350                goto cleanup;
     
    374374int lookup_available_drivers(driver_list_t *drivers_list, const char *dir_path)
    375375{
    376         log_msg(LVL_DEBUG, "lookup_available_drivers(dir=\"%s\")", dir_path);
     376        log_msg(LOG_DEFAULT, LVL_DEBUG, "lookup_available_drivers(dir=\"%s\")", dir_path);
    377377       
    378378        int drv_cnt = 0;
     
    408408        dev_node_t *dev;
    409409       
    410         log_msg(LVL_DEBUG, "create_root_nodes()");
     410        log_msg(LOG_DEFAULT, LVL_DEBUG, "create_root_nodes()");
    411411       
    412412        fibril_rwlock_write_lock(&tree->rwlock);
     
    495495void attach_driver(dev_tree_t *tree, dev_node_t *dev, driver_t *drv)
    496496{
    497         log_msg(LVL_DEBUG, "attach_driver(dev=\"%s\",drv=\"%s\")",
     497        log_msg(LOG_DEFAULT, LVL_DEBUG, "attach_driver(dev=\"%s\",drv=\"%s\")",
    498498            dev->pfun->pathname, drv->name);
    499499       
     
    520520        assert(drv != NULL);
    521521       
    522         log_msg(LVL_DEBUG, "detach_driver(dev=\"%s\",drv=\"%s\")",
     522        log_msg(LOG_DEFAULT, LVL_DEBUG, "detach_driver(dev=\"%s\",drv=\"%s\")",
    523523            dev->pfun->pathname, drv->name);
    524524       
     
    545545        assert(fibril_mutex_is_locked(&drv->driver_mutex));
    546546       
    547         log_msg(LVL_DEBUG, "start_driver(drv=\"%s\")", drv->name);
     547        log_msg(LOG_DEFAULT, LVL_DEBUG, "start_driver(drv=\"%s\")", drv->name);
    548548       
    549549        rc = task_spawnl(NULL, drv->binary_path, drv->binary_path, NULL);
    550550        if (rc != EOK) {
    551                 log_msg(LVL_ERROR, "Spawning driver `%s' (%s) failed: %s.",
     551                log_msg(LOG_DEFAULT, LVL_ERROR, "Spawning driver `%s' (%s) failed: %s.",
    552552                    drv->name, drv->binary_path, str_error(rc));
    553553                return false;
     
    594594        link_t *link;
    595595
    596         log_msg(LVL_DEBUG, "pass_devices_to_driver(driver=\"%s\")",
     596        log_msg(LOG_DEFAULT, LVL_DEBUG, "pass_devices_to_driver(driver=\"%s\")",
    597597            driver->name);
    598598
     
    614614                }
    615615
    616                 log_msg(LVL_DEBUG, "pass_devices_to_driver: dev->refcnt=%d\n",
     616                log_msg(LOG_DEFAULT, LVL_DEBUG, "pass_devices_to_driver: dev->refcnt=%d\n",
    617617                    (int)atomic_get(&dev->refcnt));
    618618                dev_add_ref(dev);
     
    650650         * immediately and possibly started here as well.
    651651         */
    652         log_msg(LVL_DEBUG, "Driver `%s' enters running state.", driver->name);
     652        log_msg(LOG_DEFAULT, LVL_DEBUG, "Driver `%s' enters running state.", driver->name);
    653653        driver->state = DRIVER_RUNNING;
    654654
     
    667667void initialize_running_driver(driver_t *driver, dev_tree_t *tree)
    668668{
    669         log_msg(LVL_DEBUG, "initialize_running_driver(driver=\"%s\")",
     669        log_msg(LOG_DEFAULT, LVL_DEBUG, "initialize_running_driver(driver=\"%s\")",
    670670            driver->name);
    671671       
     
    761761         * access any structures that would affect driver_t.
    762762         */
    763         log_msg(LVL_DEBUG, "add_device(drv=\"%s\", dev=\"%s\")",
     763        log_msg(LOG_DEFAULT, LVL_DEBUG, "add_device(drv=\"%s\", dev=\"%s\")",
    764764            drv->name, dev->pfun->name);
    765765       
     
    827827        driver_t *drv = find_best_match_driver(drivers_list, dev);
    828828        if (drv == NULL) {
    829                 log_msg(LVL_ERROR, "No driver found for device `%s'.",
     829                log_msg(LOG_DEFAULT, LVL_ERROR, "No driver found for device `%s'.",
    830830                    dev->pfun->pathname);
    831831                return false;
     
    867867        assert(dev != NULL);
    868868       
    869         log_msg(LVL_DEBUG, "driver_dev_remove(%p)", dev);
     869        log_msg(LOG_DEFAULT, LVL_DEBUG, "driver_dev_remove(%p)", dev);
    870870       
    871871        fibril_rwlock_read_lock(&tree->rwlock);
     
    890890        assert(dev != NULL);
    891891       
    892         log_msg(LVL_DEBUG, "driver_dev_gone(%p)", dev);
     892        log_msg(LOG_DEFAULT, LVL_DEBUG, "driver_dev_gone(%p)", dev);
    893893       
    894894        fibril_rwlock_read_lock(&tree->rwlock);
     
    911911        devman_handle_t handle;
    912912       
    913         log_msg(LVL_DEBUG, "driver_fun_online(%p)", fun);
     913        log_msg(LOG_DEFAULT, LVL_DEBUG, "driver_fun_online(%p)", fun);
    914914
    915915        fibril_rwlock_read_lock(&tree->rwlock);
     
    939939        devman_handle_t handle;
    940940       
    941         log_msg(LVL_DEBUG, "driver_fun_offline(%p)", fun);
     941        log_msg(LOG_DEFAULT, LVL_DEBUG, "driver_fun_offline(%p)", fun);
    942942
    943943        fibril_rwlock_read_lock(&tree->rwlock);
     
    970970bool init_device_tree(dev_tree_t *tree, driver_list_t *drivers_list)
    971971{
    972         log_msg(LVL_DEBUG, "init_device_tree()");
     972        log_msg(LOG_DEFAULT, LVL_DEBUG, "init_device_tree()");
    973973       
    974974        tree->current_handle = 0;
     
    12611261        fun->pathname = (char *) malloc(pathsize);
    12621262        if (fun->pathname == NULL) {
    1263                 log_msg(LVL_ERROR, "Failed to allocate device path.");
     1263                log_msg(LOG_DEFAULT, LVL_ERROR, "Failed to allocate device path.");
    12641264                return false;
    12651265        }
     
    12891289        assert(fibril_rwlock_is_write_locked(&tree->rwlock));
    12901290       
    1291         log_msg(LVL_DEBUG, "insert_dev_node(dev=%p, pfun=%p [\"%s\"])",
     1291        log_msg(LOG_DEFAULT, LVL_DEBUG, "insert_dev_node(dev=%p, pfun=%p [\"%s\"])",
    12921292            dev, pfun, pfun->pathname);
    12931293
     
    13131313        assert(fibril_rwlock_is_write_locked(&tree->rwlock));
    13141314       
    1315         log_msg(LVL_DEBUG, "remove_dev_node(dev=%p)", dev);
     1315        log_msg(LOG_DEFAULT, LVL_DEBUG, "remove_dev_node(dev=%p)", dev);
    13161316       
    13171317        /* Remove node from the handle-to-node map. */
  • uspace/srv/devman/main.c

    r920d0fc ra1a101d  
    7373        char *drv_name = NULL;
    7474
    75         log_msg(LVL_DEBUG, "devman_driver_register");
     75        log_msg(LOG_DEFAULT, LVL_DEBUG, "devman_driver_register");
    7676       
    7777        /* Get driver name. */
     
    8282        }
    8383
    84         log_msg(LVL_DEBUG, "The `%s' driver is trying to register.",
     84        log_msg(LOG_DEFAULT, LVL_DEBUG, "The `%s' driver is trying to register.",
    8585            drv_name);
    8686       
     
    8888        driver = find_driver(&drivers_list, drv_name);
    8989        if (driver == NULL) {
    90                 log_msg(LVL_ERROR, "No driver named `%s' was found.", drv_name);
     90                log_msg(LOG_DEFAULT, LVL_ERROR, "No driver named `%s' was found.", drv_name);
    9191                free(drv_name);
    9292                drv_name = NULL;
     
    102102        if (driver->sess) {
    103103                /* We already have a connection to the driver. */
    104                 log_msg(LVL_ERROR, "Driver '%s' already started.\n",
     104                log_msg(LOG_DEFAULT, LVL_ERROR, "Driver '%s' already started.\n",
    105105                    driver->name);
    106106                fibril_mutex_unlock(&driver->driver_mutex);
     
    112112        case DRIVER_NOT_STARTED:
    113113                /* Somebody started the driver manually. */
    114                 log_msg(LVL_NOTE, "Driver '%s' started manually.\n",
     114                log_msg(LOG_DEFAULT, LVL_NOTE, "Driver '%s' started manually.\n",
    115115                    driver->name);
    116116                driver->state = DRIVER_STARTING;
     
    125125       
    126126        /* Create connection to the driver. */
    127         log_msg(LVL_DEBUG, "Creating connection to the `%s' driver.",
     127        log_msg(LOG_DEFAULT, LVL_DEBUG, "Creating connection to the `%s' driver.",
    128128            driver->name);
    129129        driver->sess = async_callback_receive(EXCHANGE_PARALLEL);
     
    136136        async_sess_args_set(driver->sess, DRIVER_DEVMAN, 0, 0);
    137137       
    138         log_msg(LVL_NOTE,
     138        log_msg(LOG_DEFAULT, LVL_NOTE,
    139139            "The `%s' driver was successfully registered as running.",
    140140            driver->name);
     
    147147        fid_t fid = fibril_create(init_running_drv, driver);
    148148        if (fid == 0) {
    149                 log_msg(LVL_ERROR, "Failed to create initialization fibril " \
     149                log_msg(LOG_DEFAULT, LVL_ERROR, "Failed to create initialization fibril " \
    150150                    "for driver `%s'.", driver->name);
    151151                fibril_mutex_unlock(&driver->driver_mutex);
     
    176176        callid = async_get_call(&call);
    177177        if (DEVMAN_ADD_MATCH_ID != IPC_GET_IMETHOD(call)) {
    178                 log_msg(LVL_ERROR,
     178                log_msg(LOG_DEFAULT, LVL_ERROR,
    179179                    "Invalid protocol when trying to receive match id.");
    180180                async_answer_0(callid, EINVAL);
     
    184184       
    185185        if (match_id == NULL) {
    186                 log_msg(LVL_ERROR, "Failed to allocate match id.");
     186                log_msg(LOG_DEFAULT, LVL_ERROR, "Failed to allocate match id.");
    187187                async_answer_0(callid, ENOMEM);
    188188                return ENOMEM;
     
    198198        if (rc != EOK) {
    199199                delete_match_id(match_id);
    200                 log_msg(LVL_ERROR, "Failed to receive match id string: %s.",
     200                log_msg(LOG_DEFAULT, LVL_ERROR, "Failed to receive match id string: %s.",
    201201                    str_error(rc));
    202202                return rc;
     
    205205        list_append(&match_id->link, &match_ids->ids);
    206206       
    207         log_msg(LVL_DEBUG, "Received match id `%s', score %d.",
     207        log_msg(LOG_DEFAULT, LVL_DEBUG, "Received match id `%s', score %d.",
    208208            match_id->id, match_id->score);
    209209        return rc;
     
    248248        if (fun->state == FUN_ON_LINE) {
    249249                fibril_rwlock_write_unlock(&device_tree.rwlock);
    250                 log_msg(LVL_WARN, "Function %s is already on line.",
     250                log_msg(LOG_DEFAULT, LVL_WARN, "Function %s is already on line.",
    251251                    fun->pathname);
    252252                return EOK;
     
    264264        }
    265265       
    266         log_msg(LVL_DEBUG, "devman_add_function(fun=\"%s\")", fun->pathname);
     266        log_msg(LOG_DEFAULT, LVL_DEBUG, "devman_add_function(fun=\"%s\")", fun->pathname);
    267267       
    268268        if (fun->ftype == fun_inner) {
     
    282282                fid_t assign_fibril = fibril_create(assign_driver_fibril, dev);
    283283                if (assign_fibril == 0) {
    284                         log_msg(LVL_ERROR, "Failed to create fibril for "
     284                        log_msg(LOG_DEFAULT, LVL_ERROR, "Failed to create fibril for "
    285285                            "assigning driver.");
    286286                        /* XXX Cleanup */
     
    305305        if (fun->state == FUN_OFF_LINE) {
    306306                fibril_rwlock_write_unlock(&device_tree.rwlock);
    307                 log_msg(LVL_WARN, "Function %s is already off line.",
     307                log_msg(LOG_DEFAULT, LVL_WARN, "Function %s is already off line.",
    308308                    fun->pathname);
    309309                return EOK;
     
    311311       
    312312        if (fun->ftype == fun_inner) {
    313                 log_msg(LVL_DEBUG, "Offlining inner function %s.",
     313                log_msg(LOG_DEFAULT, LVL_DEBUG, "Offlining inner function %s.",
    314314                    fun->pathname);
    315315               
     
    359359                if (rc != EOK) {
    360360                        fibril_rwlock_write_unlock(&device_tree.rwlock);
    361                         log_msg(LVL_ERROR, "Failed unregistering tree service.");
     361                        log_msg(LOG_DEFAULT, LVL_ERROR, "Failed unregistering tree service.");
    362362                        return EIO;
    363363                }
     
    391391        if (ftype != fun_inner && ftype != fun_exposed) {
    392392                /* Unknown function type */
    393                 log_msg(LVL_ERROR,
     393                log_msg(LOG_DEFAULT, LVL_ERROR,
    394394                    "Unknown function type %d provided by driver.",
    395395                    (int) ftype);
     
    507507        if (rc == EOK) {
    508508                loc_service_add_to_cat(fun->service_id, cat_id);
    509                 log_msg(LVL_NOTE, "Function `%s' added to category `%s'.",
     509                log_msg(LOG_DEFAULT, LVL_NOTE, "Function `%s' added to category `%s'.",
    510510                    fun->pathname, cat_name);
    511511        } else {
    512                 log_msg(LVL_ERROR, "Failed adding function `%s' to category "
     512                log_msg(LOG_DEFAULT, LVL_ERROR, "Failed adding function `%s' to category "
    513513                    "`%s'.", fun->pathname, cat_name);
    514514        }
     
    529529        int rc;
    530530       
    531         log_msg(LVL_DEBUG, "devman_drv_fun_online()");
     531        log_msg(LOG_DEFAULT, LVL_DEBUG, "devman_drv_fun_online()");
    532532       
    533533        fun = find_fun_node(&device_tree, IPC_GET_ARG1(*icall));
     
    620620        fibril_rwlock_write_lock(&tree->rwlock);
    621621       
    622         log_msg(LVL_DEBUG, "devman_remove_function(fun='%s')", fun->pathname);
     622        log_msg(LOG_DEFAULT, LVL_DEBUG, "devman_remove_function(fun='%s')", fun->pathname);
    623623       
    624624        /* Check function state */
     
    653653                        /* Verify that driver succeeded and removed all functions */
    654654                        if (gone_rc != EOK || !list_empty(&dev->functions)) {
    655                                 log_msg(LVL_ERROR, "Driver did not remove "
     655                                log_msg(LOG_DEFAULT, LVL_ERROR, "Driver did not remove "
    656656                                    "functions for device that is gone. "
    657657                                    "Device node is now defunct.");
     
    692692                        rc = loc_service_unregister(fun->service_id);
    693693                        if (rc != EOK) {
    694                                 log_msg(LVL_ERROR, "Failed unregistering tree "
     694                                log_msg(LOG_DEFAULT, LVL_ERROR, "Failed unregistering tree "
    695695                                    "service.");
    696696                                fibril_rwlock_write_unlock(&tree->rwlock);
     
    712712        fun_del_ref(fun);
    713713       
    714         log_msg(LVL_DEBUG, "devman_remove_function() succeeded.");
     714        log_msg(LOG_DEFAULT, LVL_DEBUG, "devman_remove_function() succeeded.");
    715715        async_answer_0(callid, EOK);
    716716}
     
    726726       
    727727        initialize_running_driver(driver, &device_tree);
    728         log_msg(LVL_DEBUG, "The `%s` driver was successfully initialized.",
     728        log_msg(LOG_DEFAULT, LVL_DEBUG, "The `%s` driver was successfully initialized.",
    729729            driver->name);
    730730        return 0;
     
    742742        client = async_get_client_data();
    743743        if (client == NULL) {
    744                 log_msg(LVL_ERROR, "Failed to allocate client data.");
     744                log_msg(LOG_DEFAULT, LVL_ERROR, "Failed to allocate client data.");
    745745                return;
    746746        }
     
    12291229         */
    12301230        if (dev == NULL) {
    1231                 log_msg(LVL_ERROR, "IPC forwarding failed - no device or "
     1231                log_msg(LOG_DEFAULT, LVL_ERROR, "IPC forwarding failed - no device or "
    12321232                    "function with handle %" PRIun " was found.", handle);
    12331233                async_answer_0(iid, ENOENT);
     
    12361236
    12371237        if (fun == NULL && !drv_to_parent) {
    1238                 log_msg(LVL_ERROR, NAME ": devman_forward error - cannot "
     1238                log_msg(LOG_DEFAULT, LVL_ERROR, NAME ": devman_forward error - cannot "
    12391239                    "connect to handle %" PRIun ", refers to a device.",
    12401240                    handle);
     
    12641264       
    12651265        if (driver == NULL) {
    1266                 log_msg(LVL_ERROR, "IPC forwarding refused - " \
     1266                log_msg(LOG_DEFAULT, LVL_ERROR, "IPC forwarding refused - " \
    12671267                    "the device %" PRIun " is not in usable state.", handle);
    12681268                async_answer_0(iid, ENOENT);
     
    12771277       
    12781278        if (!driver->sess) {
    1279                 log_msg(LVL_ERROR,
     1279                log_msg(LOG_DEFAULT, LVL_ERROR,
    12801280                    "Could not forward to driver `%s'.", driver->name);
    12811281                async_answer_0(iid, EINVAL);
     
    12841284
    12851285        if (fun != NULL) {
    1286                 log_msg(LVL_DEBUG,
     1286                log_msg(LOG_DEFAULT, LVL_DEBUG,
    12871287                    "Forwarding request for `%s' function to driver `%s'.",
    12881288                    fun->pathname, driver->name);
    12891289        } else {
    1290                 log_msg(LVL_DEBUG,
     1290                log_msg(LOG_DEFAULT, LVL_DEBUG,
    12911291                    "Forwarding request for `%s' device to driver `%s'.",
    12921292                    dev->pfun->pathname, driver->name);
     
    13201320       
    13211321        if (fun == NULL || fun->dev == NULL || fun->dev->drv == NULL) {
    1322                 log_msg(LVL_WARN, "devman_connection_loc(): function "
     1322                log_msg(LOG_DEFAULT, LVL_WARN, "devman_connection_loc(): function "
    13231323                    "not found.\n");
    13241324                fibril_rwlock_read_unlock(&device_tree.rwlock);
     
    13381338        async_exchange_end(exch);
    13391339       
    1340         log_msg(LVL_DEBUG,
     1340        log_msg(LOG_DEFAULT, LVL_DEBUG,
    13411341            "Forwarding loc service request for `%s' function to driver `%s'.",
    13421342            fun->pathname, driver->name);
     
    13941394static bool devman_init(void)
    13951395{
    1396         log_msg(LVL_DEBUG, "devman_init - looking for available drivers.");
     1396        log_msg(LOG_DEFAULT, LVL_DEBUG, "devman_init - looking for available drivers.");
    13971397       
    13981398        /* Initialize list of available drivers. */
     
    14001400        if (lookup_available_drivers(&drivers_list,
    14011401            DRIVER_DEFAULT_STORE) == 0) {
    1402                 log_msg(LVL_FATAL, "No drivers found.");
     1402                log_msg(LOG_DEFAULT, LVL_FATAL, "No drivers found.");
    14031403                return false;
    14041404        }
    14051405       
    1406         log_msg(LVL_DEBUG, "devman_init - list of drivers has been initialized.");
     1406        log_msg(LOG_DEFAULT, LVL_DEBUG, "devman_init - list of drivers has been initialized.");
    14071407       
    14081408        /* Create root device node. */
    14091409        if (!init_device_tree(&device_tree, &drivers_list)) {
    1410                 log_msg(LVL_FATAL, "Failed to initialize device tree.");
     1410                log_msg(LOG_DEFAULT, LVL_FATAL, "Failed to initialize device tree.");
    14111411                return false;
    14121412        }
     
    14401440       
    14411441        if (!devman_init()) {
    1442                 log_msg(LVL_ERROR, "Error while initializing service.");
     1442                log_msg(LOG_DEFAULT, LVL_ERROR, "Error while initializing service.");
    14431443                return -1;
    14441444        }
     
    14471447        rc = service_register(SERVICE_DEVMAN);
    14481448        if (rc != EOK) {
    1449                 log_msg(LVL_ERROR, "Failed registering as a service.");
     1449                log_msg(LOG_DEFAULT, LVL_ERROR, "Failed registering as a service.");
    14501450                return rc;
    14511451        }
Note: See TracChangeset for help on using the changeset viewer.