Changeset ebcb05a in mainline for uspace/srv


Ignore:
Timestamp:
2011-04-01T19:00:51Z (14 years ago)
Author:
Jiri Svoboda <jiri@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
969585f, ea53529
Parents:
bdbb6f6
Message:

Logging functions should append newline automatically. Since one has no
choice but to end log message with a newline, there is no need to do it
manually in every invocation.

Location:
uspace/srv/devman
Files:
2 edited

Legend:

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

    rbdbb6f6 rebcb05a  
    148148
    149149        log_msg(LVL_NOTE, "Driver `%s' was added to the list of available "
    150             "drivers.\n", drv->name);
     150            "drivers.", drv->name);
    151151}
    152152
     
    238238bool read_match_ids(const char *conf_path, match_id_list_t *ids)
    239239{
    240         log_msg(LVL_DEBUG, "read_match_ids(conf_path=\"%s\")\n", conf_path);
     240        log_msg(LVL_DEBUG, "read_match_ids(conf_path=\"%s\")", conf_path);
    241241       
    242242        bool suc = false;
     
    248248        fd = open(conf_path, O_RDONLY);
    249249        if (fd < 0) {
    250                 log_msg(LVL_ERROR, "Unable to open `%s' for reading: %s.\n",
     250                log_msg(LVL_ERROR, "Unable to open `%s' for reading: %s.",
    251251                    conf_path, str_error(fd));
    252252                goto cleanup;
     
    257257        lseek(fd, 0, SEEK_SET);
    258258        if (len == 0) {
    259                 log_msg(LVL_ERROR, "Configuration file '%s' is empty.\n",
     259                log_msg(LVL_ERROR, "Configuration file '%s' is empty.",
    260260                    conf_path);
    261261                goto cleanup;
     
    265265        if (buf == NULL) {
    266266                log_msg(LVL_ERROR, "Memory allocation failed when parsing file "
    267                     "'%s'.\n", conf_path);
     267                    "'%s'.", conf_path);
    268268                goto cleanup;
    269269        }
     
    271271        ssize_t read_bytes = safe_read(fd, buf, len);
    272272        if (read_bytes <= 0) {
    273                 log_msg(LVL_ERROR, "Unable to read file '%s'.\n", conf_path);
     273                log_msg(LVL_ERROR, "Unable to read file '%s'.", conf_path);
    274274                goto cleanup;
    275275        }
     
    309309bool get_driver_info(const char *base_path, const char *name, driver_t *drv)
    310310{
    311         log_msg(LVL_DEBUG, "get_driver_info(base_path=\"%s\", name=\"%s\")\n",
     311        log_msg(LVL_DEBUG, "get_driver_info(base_path=\"%s\", name=\"%s\")",
    312312            base_path, name);
    313313       
     
    369369int lookup_available_drivers(driver_list_t *drivers_list, const char *dir_path)
    370370{
    371         log_msg(LVL_DEBUG, "lookup_available_drivers(dir=\"%s\")\n", dir_path);
     371        log_msg(LVL_DEBUG, "lookup_available_drivers(dir=\"%s\")", dir_path);
    372372       
    373373        int drv_cnt = 0;
     
    403403        dev_node_t *dev;
    404404       
    405         log_msg(LVL_DEBUG, "create_root_nodes()\n");
     405        log_msg(LVL_DEBUG, "create_root_nodes()");
    406406       
    407407        fibril_rwlock_write_lock(&tree->rwlock);
     
    488488void attach_driver(dev_node_t *dev, driver_t *drv)
    489489{
    490         log_msg(LVL_DEBUG, "attach_driver(dev=\"%s\",drv=\"%s\")\n",
     490        log_msg(LVL_DEBUG, "attach_driver(dev=\"%s\",drv=\"%s\")",
    491491            dev->pfun->pathname, drv->name);
    492492       
     
    511511        assert(fibril_mutex_is_locked(&drv->driver_mutex));
    512512       
    513         log_msg(LVL_DEBUG, "start_driver(drv=\"%s\")\n", drv->name);
     513        log_msg(LVL_DEBUG, "start_driver(drv=\"%s\")", drv->name);
    514514       
    515515        rc = task_spawnl(NULL, drv->binary_path, drv->binary_path, NULL);
    516516        if (rc != EOK) {
    517                 log_msg(LVL_ERROR, "Spawning driver `%s' (%s) failed: %s.\n",
     517                log_msg(LVL_ERROR, "Spawning driver `%s' (%s) failed: %s.",
    518518                    drv->name, drv->binary_path, str_error(rc));
    519519                return false;
     
    578578        int phone;
    579579
    580         log_msg(LVL_DEBUG, "pass_devices_to_driver(driver=\"%s\")\n",
     580        log_msg(LVL_DEBUG, "pass_devices_to_driver(driver=\"%s\")",
    581581            driver->name);
    582582
     
    646646         * immediately and possibly started here as well.
    647647         */
    648         log_msg(LVL_DEBUG, "Driver `%s' enters running state.\n", driver->name);
     648        log_msg(LVL_DEBUG, "Driver `%s' enters running state.", driver->name);
    649649        driver->state = DRIVER_RUNNING;
    650650
     
    663663void initialize_running_driver(driver_t *driver, dev_tree_t *tree)
    664664{
    665         log_msg(LVL_DEBUG, "initialize_running_driver(driver=\"%s\")\n",
     665        log_msg(LVL_DEBUG, "initialize_running_driver(driver=\"%s\")",
    666666            driver->name);
    667667       
     
    754754         * access any structures that would affect driver_t.
    755755         */
    756         log_msg(LVL_DEBUG, "add_device(drv=\"%s\", dev=\"%s\")\n",
     756        log_msg(LVL_DEBUG, "add_device(drv=\"%s\", dev=\"%s\")",
    757757            drv->name, dev->pfun->name);
    758758       
     
    816816        driver_t *drv = find_best_match_driver(drivers_list, dev);
    817817        if (drv == NULL) {
    818                 log_msg(LVL_ERROR, "No driver found for device `%s'.\n",
     818                log_msg(LVL_ERROR, "No driver found for device `%s'.",
    819819                    dev->pfun->pathname);
    820820                return false;
     
    854854bool init_device_tree(dev_tree_t *tree, driver_list_t *drivers_list)
    855855{
    856         log_msg(LVL_DEBUG, "init_device_tree()\n");
     856        log_msg(LVL_DEBUG, "init_device_tree()");
    857857       
    858858        tree->current_handle = 0;
     
    10331033        fun->pathname = (char *) malloc(pathsize);
    10341034        if (fun->pathname == NULL) {
    1035                 log_msg(LVL_ERROR, "Failed to allocate device path.\n");
     1035                log_msg(LVL_ERROR, "Failed to allocate device path.");
    10361036                return false;
    10371037        }
     
    10641064        assert(fibril_rwlock_is_write_locked(&tree->rwlock));
    10651065       
    1066         log_msg(LVL_DEBUG, "insert_dev_node(dev=%p, pfun=%p [\"%s\"])\n",
     1066        log_msg(LVL_DEBUG, "insert_dev_node(dev=%p, pfun=%p [\"%s\"])",
    10671067            dev, pfun, pfun->pathname);
    10681068
  • uspace/srv/devman/main.c

    rbdbb6f6 rebcb05a  
    7373        driver_t *driver = NULL;
    7474
    75         log_msg(LVL_DEBUG, "devman_driver_register\n");
     75        log_msg(LVL_DEBUG, "devman_driver_register");
    7676       
    7777        iid = async_get_call(&icall);
     
    9090        }
    9191
    92         log_msg(LVL_DEBUG, "The `%s' driver is trying to register.\n",
     92        log_msg(LVL_DEBUG, "The `%s' driver is trying to register.",
    9393            drv_name);
    9494       
     
    9797       
    9898        if (driver == NULL) {
    99                 log_msg(LVL_ERROR, "No driver named `%s' was found.\n", drv_name);
     99                log_msg(LVL_ERROR, "No driver named `%s' was found.", drv_name);
    100100                free(drv_name);
    101101                drv_name = NULL;
     
    108108       
    109109        /* Create connection to the driver. */
    110         log_msg(LVL_DEBUG, "Creating connection to the `%s' driver.\n",
     110        log_msg(LVL_DEBUG, "Creating connection to the `%s' driver.",
    111111            driver->name);
    112112        ipc_call_t call;
     
    122122       
    123123        log_msg(LVL_NOTE,
    124             "The `%s' driver was successfully registered as running.\n",
     124            "The `%s' driver was successfully registered as running.",
    125125            driver->name);
    126126       
     
    147147        if (DEVMAN_ADD_MATCH_ID != IPC_GET_IMETHOD(call)) {
    148148                log_msg(LVL_ERROR,
    149                     "Invalid protocol when trying to receive match id.\n");
     149                    "Invalid protocol when trying to receive match id.");
    150150                async_answer_0(callid, EINVAL);
    151151                delete_match_id(match_id);
     
    154154       
    155155        if (match_id == NULL) {
    156                 log_msg(LVL_ERROR, "Failed to allocate match id.\n");
     156                log_msg(LVL_ERROR, "Failed to allocate match id.");
    157157                async_answer_0(callid, ENOMEM);
    158158                return ENOMEM;
     
    168168        if (rc != EOK) {
    169169                delete_match_id(match_id);
    170                 log_msg(LVL_ERROR, "Failed to receive match id string: %s.\n",
     170                log_msg(LVL_ERROR, "Failed to receive match id string: %s.",
    171171                    str_error(rc));
    172172                return rc;
     
    175175        list_append(&match_id->link, &match_ids->ids);
    176176       
    177         log_msg(LVL_DEBUG, "Received match id `%s', score %d.\n",
     177        log_msg(LVL_DEBUG, "Received match id `%s', score %d.",
    178178            match_id->id, match_id->score);
    179179        return rc;
     
    232232                /* Unknown function type */
    233233                log_msg(LVL_ERROR,
    234                     "Unknown function type %d provided by driver.\n",
     234                    "Unknown function type %d provided by driver.",
    235235                    (int) ftype);
    236236
     
    280280        fibril_rwlock_write_unlock(&tree->rwlock);
    281281       
    282         log_msg(LVL_DEBUG, "devman_add_function(fun=\"%s\")\n", fun->pathname);
     282        log_msg(LVL_DEBUG, "devman_add_function(fun=\"%s\")", fun->pathname);
    283283       
    284284        devman_receive_match_ids(match_count, &fun->match_ids);
     
    362362        devmap_register_class_dev(class_info);
    363363       
    364         log_msg(LVL_NOTE, "Function `%s' added to class `%s' as `%s'.\n",
     364        log_msg(LVL_NOTE, "Function `%s' added to class `%s' as `%s'.",
    365365            fun->pathname, class_name, class_info->dev_name);
    366366
     
    378378       
    379379        initialize_running_driver(driver, &device_tree);
    380         log_msg(LVL_DEBUG, "The `%s` driver was successfully initialized.\n",
     380        log_msg(LVL_DEBUG, "The `%s` driver was successfully initialized.",
    381381            driver->name);
    382382        return 0;
     
    401401        if (fid == 0) {
    402402                log_msg(LVL_ERROR, "Failed to create initialization fibril " \
    403                     "for driver `%s' .\n", driver->name);
     403                    "for driver `%s'.", driver->name);
    404404                return;
    405405        }
     
    537537        if (dev == NULL) {
    538538                log_msg(LVL_ERROR, "IPC forwarding failed - no device or "
    539                     "function with handle %" PRIun " was found.\n", handle);
     539                    "function with handle %" PRIun " was found.", handle);
    540540                async_answer_0(iid, ENOENT);
    541541                return;
     
    544544        if (fun == NULL && !drv_to_parent) {
    545545                log_msg(LVL_ERROR, NAME ": devman_forward error - cannot "
    546                     "connect to handle %" PRIun ", refers to a device.\n",
     546                    "connect to handle %" PRIun ", refers to a device.",
    547547                    handle);
    548548                async_answer_0(iid, ENOENT);
     
    567567        if (driver == NULL) {
    568568                log_msg(LVL_ERROR, "IPC forwarding refused - " \
    569                     "the device %" PRIun " is not in usable state.\n", handle);
     569                    "the device %" PRIun " is not in usable state.", handle);
    570570                async_answer_0(iid, ENOENT);
    571571                return;
     
    580580        if (driver->phone <= 0) {
    581581                log_msg(LVL_ERROR,
    582                     "Could not forward to driver `%s' (phone is %d).\n",
     582                    "Could not forward to driver `%s' (phone is %d).",
    583583                    driver->name, (int) driver->phone);
    584584                async_answer_0(iid, EINVAL);
     
    588588        if (fun != NULL) {
    589589                log_msg(LVL_DEBUG,
    590                     "Forwarding request for `%s' function to driver `%s'.\n",
     590                    "Forwarding request for `%s' function to driver `%s'.",
    591591                    fun->pathname, driver->name);
    592592        } else {
    593593                log_msg(LVL_DEBUG,
    594                     "Forwarding request for `%s' device to driver `%s'.\n",
     594                    "Forwarding request for `%s' device to driver `%s'.",
    595595                    dev->pfun->pathname, driver->name);
    596596        }
     
    626626            IPC_FF_NONE);
    627627        log_msg(LVL_DEBUG,
    628             "Forwarding devmapper request for `%s' function to driver `%s'.\n",
     628            "Forwarding devmapper request for `%s' function to driver `%s'.",
    629629            fun->pathname, dev->drv->name);
    630630}
     
    662662static bool devman_init(void)
    663663{
    664         log_msg(LVL_DEBUG, "devman_init - looking for available drivers.\n");
     664        log_msg(LVL_DEBUG, "devman_init - looking for available drivers.");
    665665       
    666666        /* Initialize list of available drivers. */
     
    668668        if (lookup_available_drivers(&drivers_list,
    669669            DRIVER_DEFAULT_STORE) == 0) {
    670                 log_msg(LVL_FATAL, "no drivers found.");
     670                log_msg(LVL_FATAL, "No drivers found.");
    671671                return false;
    672672        }
    673673
    674         log_msg(LVL_DEBUG, "devman_init - list of drivers has been initialized.\n");
     674        log_msg(LVL_DEBUG, "devman_init - list of drivers has been initialized.");
    675675
    676676        /* Create root device node. */
     
    703703
    704704        if (!devman_init()) {
    705                 log_msg(LVL_ERROR, "Error while initializing service.\n");
     705                log_msg(LVL_ERROR, "Error while initializing service.");
    706706                return -1;
    707707        }
     
    712712        /* Register device manager at naming service. */
    713713        if (service_register(SERVICE_DEVMAN) != EOK) {
    714                 log_msg(LVL_ERROR, "Failed registering as a service.\n");
     714                log_msg(LVL_ERROR, "Failed registering as a service.");
    715715                return -1;
    716716        }
Note: See TracChangeset for help on using the changeset viewer.