Ignore:
File:
1 edited

Legend:

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

    r9b415c9 r0418050  
    4343#include <stdio.h>
    4444#include <errno.h>
    45 #include <str_error.h>
    4645#include <bool.h>
    4746#include <fibril_synch.h>
     
    5251#include <sys/stat.h>
    5352#include <ctype.h>
    54 #include <io/log.h>
    5553#include <ipc/devman.h>
    5654#include <ipc/driver.h>
     
    7371        driver_t *driver = NULL;
    7472
    75         log_msg(LVL_DEBUG, "devman_driver_register\n");
     73        printf(NAME ": devman_driver_register \n");
    7674       
    7775        iid = async_get_call(&icall);
     
    9088        }
    9189
    92         log_msg(LVL_DEBUG, "The `%s' driver is trying to register.\n",
     90        printf(NAME ": the %s driver is trying to register by the service.\n",
    9391            drv_name);
    9492       
     
    9795       
    9896        if (driver == NULL) {
    99                 log_msg(LVL_ERROR, "No driver named `%s' was found.\n", drv_name);
     97                printf(NAME ": no driver named %s was found.\n", drv_name);
    10098                free(drv_name);
    10199                drv_name = NULL;
     
    108106       
    109107        /* Create connection to the driver. */
    110         log_msg(LVL_DEBUG, "Creating connection to the `%s' driver.\n",
    111             driver->name);
     108        printf(NAME ":  creating connection to the %s driver.\n", driver->name);
    112109        ipc_call_t call;
    113110        ipc_callid_t callid = async_get_call(&call);
     
    121118        set_driver_phone(driver, IPC_GET_ARG5(call));
    122119       
    123         log_msg(LVL_NOTE,
    124             "The `%s' driver was successfully registered as running.\n",
     120        printf(NAME ": the %s driver was successfully registered as running.\n",
    125121            driver->name);
    126122       
     
    146142        callid = async_get_call(&call);
    147143        if (DEVMAN_ADD_MATCH_ID != IPC_GET_IMETHOD(call)) {
    148                 log_msg(LVL_ERROR,
    149                     "Invalid protocol when trying to receive match id.\n");
     144                printf(NAME ": ERROR: devman_receive_match_id - invalid "
     145                    "protocol.\n");
    150146                async_answer_0(callid, EINVAL);
    151147                delete_match_id(match_id);
     
    154150       
    155151        if (match_id == NULL) {
    156                 log_msg(LVL_ERROR, "Failed to allocate match id.\n");
     152                printf(NAME ": ERROR: devman_receive_match_id - failed to "
     153                    "allocate match id.\n");
    157154                async_answer_0(callid, ENOMEM);
    158155                return ENOMEM;
     
    168165        if (rc != EOK) {
    169166                delete_match_id(match_id);
    170                 log_msg(LVL_ERROR, "Failed to receive match id string: %s.\n",
    171                     str_error(rc));
     167                printf(NAME ": devman_receive_match_id - failed to receive "
     168                    "match id string.\n");
    172169                return rc;
    173170        }
     
    175172        list_append(&match_id->link, &match_ids->ids);
    176173       
    177         log_msg(LVL_DEBUG, "Received match id `%s', score %d.\n",
     174        printf(NAME ": received match id '%s', score = %d \n",
    178175            match_id->id, match_id->score);
    179176        return rc;
     
    231228        if (ftype != fun_inner && ftype != fun_exposed) {
    232229                /* Unknown function type */
    233                 log_msg(LVL_ERROR,
    234                     "Unknown function type %d provided by driver.\n",
    235                     (int) ftype);
     230                printf(NAME ": Error, unknown function type provided by driver!\n");
    236231
    237232                fibril_rwlock_write_unlock(&tree->rwlock);
     
    270265        fibril_rwlock_write_unlock(&tree->rwlock);
    271266       
    272         log_msg(LVL_DEBUG, "devman_add_function(fun=\"%s\")\n", fun->pathname);
     267        printf(NAME ": devman_add_function %s\n", fun->pathname);
    273268       
    274269        devman_receive_match_ids(match_count, &fun->match_ids);
     
    352347        devmap_register_class_dev(class_info);
    353348       
    354         log_msg(LVL_NOTE, "Function `%s' added to class `%s' as `%s'.\n",
    355             fun->pathname, class_name, class_info->dev_name);
     349        printf(NAME ": function'%s' added to class '%s', class name '%s' was "
     350            "asigned to it\n", fun->pathname, class_name, class_info->dev_name);
    356351
    357352        async_answer_0(callid, EOK);
     
    368363       
    369364        initialize_running_driver(driver, &device_tree);
    370         log_msg(LVL_DEBUG, "The `%s` driver was successfully initialized.\n",
     365        printf(NAME ": the %s driver was successfully initialized. \n",
    371366            driver->name);
    372367        return 0;
     
    390385        fid_t fid = fibril_create(init_running_drv, driver);
    391386        if (fid == 0) {
    392                 log_msg(LVL_ERROR, "Failed to create initialization fibril " \
    393                     "for driver `%s' .\n", driver->name);
     387                printf(NAME ": Error creating fibril for the initialization of "
     388                    "the newly registered running driver.\n");
    394389                return;
    395390        }
     
    489484         */
    490485        if (dev == NULL) {
    491                 log_msg(LVL_ERROR, "IPC forwarding failed - no device or "
    492                     "function with handle %" PRIun " was found.\n", handle);
     486                printf(NAME ": devman_forward error - no device or function with "
     487                    "handle %" PRIun " was found.\n", handle);
    493488                async_answer_0(iid, ENOENT);
    494489                return;
     
    496491
    497492        if (fun == NULL && !drv_to_parent) {
    498                 log_msg(LVL_ERROR, NAME ": devman_forward error - cannot "
    499                     "connect to handle %" PRIun ", refers to a device.\n",
    500                     handle);
     493                printf(NAME ": devman_forward error - cannot connect to "
     494                    "handle %" PRIun ", refers to a device.\n", handle);
    501495                async_answer_0(iid, ENOENT);
    502496                return;
     
    519513       
    520514        if (driver == NULL) {
    521                 log_msg(LVL_ERROR, "IPC forwarding refused - " \
    522                     "the device %" PRIun " is not in usable state.\n", handle);
     515                printf(NAME ": devman_forward error - the device is not in %" PRIun
     516                    " usable state.\n", handle);
    523517                async_answer_0(iid, ENOENT);
    524518                return;
     
    532526       
    533527        if (driver->phone <= 0) {
    534                 log_msg(LVL_ERROR,
    535                     "Could not forward to driver `%s' (phone is %d).\n",
    536                     driver->name, (int) driver->phone);
     528                printf(NAME ": devman_forward: cound not forward to driver %s ",
     529                    driver->name);
     530                printf("the driver's phone is %" PRIun ").\n", driver->phone);
    537531                async_answer_0(iid, EINVAL);
    538532                return;
     
    540534
    541535        if (fun != NULL) {
    542                 log_msg(LVL_DEBUG,
    543                     "Forwarding request for `%s' function to driver `%s'.\n",
    544                     fun->pathname, driver->name);
     536                printf(NAME ": devman_forward: forward connection to function %s to "
     537                    "driver %s.\n", fun->pathname, driver->name);
    545538        } else {
    546                 log_msg(LVL_DEBUG,
    547                     "Forwarding request for `%s' device to driver `%s'.\n",
    548                     dev->pfun->pathname, driver->name);
     539                printf(NAME ": devman_forward: forward connection to device %s to "
     540                    "driver %s.\n", dev->pfun->pathname, driver->name);
    549541        }
    550542
     
    578570        async_forward_fast(iid, dev->drv->phone, DRIVER_CLIENT, fun->handle, 0,
    579571            IPC_FF_NONE);
    580         log_msg(LVL_DEBUG,
    581             "Forwarding devmapper request for `%s' function to driver `%s'.\n",
    582             fun->pathname, dev->drv->name);
     572        printf(NAME ": devman_connection_devmapper: forwarded connection to "
     573            "device %s to driver %s.\n", fun->pathname, dev->drv->name);
    583574}
    584575
     
    615606static bool devman_init(void)
    616607{
    617         log_msg(LVL_DEBUG, "devman_init - looking for available drivers.\n");
     608        printf(NAME ": devman_init - looking for available drivers.\n");
    618609       
    619610        /* Initialize list of available drivers. */
     
    621612        if (lookup_available_drivers(&drivers_list,
    622613            DRIVER_DEFAULT_STORE) == 0) {
    623                 log_msg(LVL_FATAL, "no drivers found.");
     614                printf(NAME " no drivers found.");
    624615                return false;
    625616        }
    626617
    627         log_msg(LVL_DEBUG, "devman_init - list of drivers has been initialized.\n");
     618        printf(NAME ": devman_init - list of drivers has been initialized.\n");
    628619
    629620        /* Create root device node. */
    630621        if (!init_device_tree(&device_tree, &drivers_list)) {
    631                 log_msg(LVL_FATAL, "Failed to initialize device tree.");
     622                printf(NAME " failed to initialize device tree.");
    632623                return false;
    633624        }
     
    650641        printf(NAME ": HelenOS Device Manager\n");
    651642
    652         if (log_init(NAME, LVL_ERROR) != EOK) {
    653                 printf(NAME ": Error initializing logging subsystem.\n");
    654                 return -1;
    655         }
    656 
    657643        if (!devman_init()) {
    658                 log_msg(LVL_ERROR, "Error while initializing service.\n");
     644                printf(NAME ": Error while initializing service\n");
    659645                return -1;
    660646        }
     
    664650
    665651        /* Register device manager at naming service. */
    666         if (service_register(SERVICE_DEVMAN) != EOK) {
    667                 log_msg(LVL_ERROR, "Failed registering as a service.\n");
     652        if (service_register(SERVICE_DEVMAN) != EOK)
    668653                return -1;
    669         }
    670 
    671         printf(NAME ": Accepting connections.\n");
     654
     655        printf(NAME ": Accepting connections\n");
    672656        async_manager();
    673657
Note: See TracChangeset for help on using the changeset viewer.