Changes in / [969585f:8e7d724] in mainline


Ignore:
Files:
1 added
6 deleted
24 edited

Legend:

Unmodified
Added
Removed
  • HelenOS.config

    r969585f r8e7d724  
    528528! [PLATFORM=sparc64&MACHINE=generic] CONFIG_AOUT_ISOFS_B (y)
    529529
    530 % Run devman on startup
    531 ! CONFIG_START_DEVMAN (y)
    532 
    533 % Launch (devman) test drivers
    534 ! [CONFIG_START_DEVMAN=y&CONFIG_DEBUG=y] CONFIG_TEST_DRIVERS (y/n)
    535 
    536530% Load disk drivers on startup
    537531! CONFIG_START_BD (n/y)
     
    555549! [CONFIG_STRIP_BINARIES!=y] CONFIG_LINE_DEBUG (n/y)
    556550
     551% Launch (devman) test drivers
     552! [CONFIG_DEBUG=y] CONFIG_TEST_DRIVERS (n/y)
     553
    557554% Start virtual USB host controller
    558555! CONFIG_RUN_VIRTUAL_USB_HC (n/y)
     
    563560% Run devman in kconsole (not recommended)
    564561! CONFIG_DEVMAN_EARLY_LAUNCH (n/y)
     562
  • uspace/app/bdsh/cmds/modules/ls/ls.c

    r969585f r8e7d724  
    3838#include <dirent.h>
    3939#include <fcntl.h>
    40 #include <getopt.h>
    4140#include <sys/types.h>
    4241#include <sys/stat.h>
    4342#include <str.h>
    44 #include <sort.h>
    4543
    4644#include "errors.h"
     
    4846#include "util.h"
    4947#include "entry.h"
     48#include "ls.h"
    5049#include "cmds.h"
    51 
    52 /* Various values that can be returned by ls_scope() */
    53 #define LS_BOGUS 0
    54 #define LS_FILE  1
    55 #define LS_DIR   2
    56 
    57 /** Structure to represent a directory entry.
    58  *
    59  * Useful to keep together important information
    60  * for sorting directory entries.
    61  */
    62 struct dir_elem_t {
    63         char *name;
    64         struct stat s;
    65 };
    6650
    6751static const char *cmdname = "ls";
    6852
    69 static struct option const long_options[] = {
    70         { "help", no_argument, 0, 'h' },
    71         { "unsort", no_argument, 0, 'u' },
    72         { 0, 0, 0, 0 }
    73 };
     53static void ls_scan_dir(const char *d, DIR *dirp)
     54{
     55        struct dirent *dp;
     56        char *buff;
    7457
    75 /** Print an entry.
    76  *
    77  * ls_print currently does nothing more than print the entry.
    78  * In the future, we will likely pass the absolute path, and
     58        if (! dirp)
     59                return;
     60
     61        buff = (char *)malloc(PATH_MAX);
     62        if (NULL == buff) {
     63                cli_error(CL_ENOMEM, "ls: failed to scan %s", d);
     64                return;
     65        }
     66
     67        while ((dp = readdir(dirp))) {
     68                memset(buff, 0, sizeof(buff));
     69                /* Don't worry if inserting a double slash, this will be fixed by
     70                 * absolutize() later with subsequent calls to open() or readdir() */
     71                snprintf(buff, PATH_MAX - 1, "%s/%s", d, dp->d_name);
     72                ls_print(dp->d_name, buff);
     73        }
     74
     75        free(buff);
     76
     77        return;
     78}
     79
     80/* ls_print currently does nothing more than print the entry.
     81 * in the future, we will likely pass the absolute path, and
    7982 * some sort of ls_options structure that controls how each
    8083 * entry is printed and what is printed about it.
    8184 *
    82  * Now we just print basic DOS style lists.
    83  *
    84  * @param de            Directory element.
    85  */
    86 static void ls_print(struct dir_elem_t *de)
     85 * Now we just print basic DOS style lists */
     86
     87static void ls_print(const char *name, const char *pathname)
    8788{
    88         if (de->s.is_file)
    89                 printf("%-40s\t%llu\n", de->name, (long long) de->s.size);
    90         else if (de->s.is_directory)
    91                 printf("%-40s\t<dir>\n", de->name);
    92         else
    93                 printf("%-40s\n", de->name);
    94 }
     89        struct stat s;
     90        int rc;
    9591
    96 
    97 /** Compare 2 directory elements.
    98  *
    99  * It compares 2 elements of a directory : a file is considered
    100  * as bigger than a directory, and if they have the same type,
    101  * they are compared alphabetically.
    102  *
    103  * @param a             Pointer to the structure of the first element.
    104  * @param b             Pointer to the structure of the second element.
    105  * @param arg           Pointer for an other and optionnal argument.
    106  *
    107  * @return              -1 if a < b, 1 otherwise.
    108  */
    109 static int ls_cmp(void *a, void *b, void *arg)
    110 {
    111         struct dir_elem_t *da = a;
    112         struct dir_elem_t *db = b;
    113        
    114         if ((da->s.is_directory && db->s.is_file) ||
    115             ((da->s.is_directory == db->s.is_directory) &&
    116             str_cmp(da->name, db->name) < 0))
    117                 return -1;
    118         else
    119                 return 1;
    120 }
    121 
    122 /** Scan a directory.
    123  *
    124  * Scan the content of a directory and print it.
    125  *
    126  * @param d             Name of the directory.
    127  * @param dirp  Directory stream.
    128  * @param sort  1 if the output must be sorted,
    129  *                              0 otherwise.
    130  */
    131 static void ls_scan_dir(const char *d, DIR *dirp, int sort)
    132 {
    133         int alloc_blocks = 20;
    134         int i;
    135         int nbdirs = 0;
    136         int rc;
    137         int len;
    138         char *buff;
    139         struct dir_elem_t *tmp;
    140         struct dir_elem_t *tosort;
    141         struct dirent *dp;
    142        
    143         if (!dirp)
    144                 return;
    145 
    146         buff = (char *) malloc(PATH_MAX);
    147         if (!buff) {
    148                 cli_error(CL_ENOMEM, "ls: failed to scan %s", d);
     92        rc = stat(pathname, &s);
     93        if (rc != 0) {
     94                /* Odd chance it was deleted from the time readdir() found it */
     95                printf("ls: skipping bogus node %s\n", pathname);
     96                printf("rc=%d\n", rc);
    14997                return;
    15098        }
    15199       
    152         tosort = (struct dir_elem_t *) malloc(alloc_blocks * sizeof(*tosort));
    153         if (!tosort) {
    154                 cli_error(CL_ENOMEM, "ls: failed to scan %s", d);
    155                 free(buff);
    156                 return;
    157         }
    158        
    159         while ((dp = readdir(dirp))) {
    160                 if (nbdirs + 1 > alloc_blocks) {
    161                         alloc_blocks += alloc_blocks;
    162                        
    163                         tmp = (struct dir_elem_t *) realloc(tosort,
    164                             alloc_blocks * sizeof(struct dir_elem_t));
    165                         if (!tmp) {
    166                                 cli_error(CL_ENOMEM, "ls: failed to scan %s", d);
    167                                 goto out;
    168                         }
    169                         tosort = tmp;
    170                 }
    171                
    172                 /* fill the name field */
    173                 tosort[nbdirs].name = (char *) malloc(str_length(dp->d_name) + 1);
    174                 if (!tosort[nbdirs].name) {
    175                         cli_error(CL_ENOMEM, "ls: failed to scan %s", d);
    176                         goto out;
    177                 }
    178                
    179                 str_cpy(tosort[nbdirs].name, str_length(dp->d_name) + 1, dp->d_name);
    180                 len = snprintf(buff, PATH_MAX - 1, "%s/%s", d, tosort[nbdirs].name);
    181                 buff[len] = '\0';
     100        if (s.is_file)
     101                printf("%-40s\t%llu\n", name, (long long) s.size);
     102        else if (s.is_directory)
     103                printf("%-40s\t<dir>\n", name);
     104        else
     105                printf("%-40s\n", name);
    182106
    183                 rc = stat(buff, &tosort[nbdirs++].s);
    184                 if (rc != 0) {
    185                         printf("ls: skipping bogus node %s\n", buff);
    186                         printf("rc=%d\n", rc);
    187                         goto out;
    188                 }
    189         }
    190        
    191         if (sort) {
    192                 if (!qsort(&tosort[0], nbdirs, sizeof(struct dir_elem_t),
    193                     ls_cmp, NULL)) {
    194                         printf("Sorting error.\n");
    195                 }
    196         }
    197        
    198         for (i = 0; i < nbdirs; i++)
    199                 ls_print(&tosort[i]);
    200        
    201 out:
    202         for(i = 0; i < nbdirs; i++)
    203                 free(tosort[i].name);
    204         free(tosort);
    205         free(buff);
     107        return;
    206108}
    207109
     
    212114        } else {
    213115                help_cmd_ls(HELP_SHORT);
    214                 printf(
    215                 "Usage:  %s [options] [path]\n"
    216                 "If not path is given, the current working directory is used.\n"
    217                 "Options:\n"
    218                 "  -h, --help       A short option summary\n"
    219                 "  -u, --unsort     Do not sort directory entries\n",
    220                 cmdname);
     116                printf("  `%s' [path], if no path is given the current "
     117                                "working directory is used.\n", cmdname);
    221118        }
    222119
     
    227124{
    228125        unsigned int argc;
    229         struct dir_elem_t de;
     126        struct stat s;
     127        char *buff;
    230128        DIR *dirp;
    231         int c, opt_ind;
    232         int sort = 1;
    233129
    234130        argc = cli_count_args(argv);
    235        
    236         for (c = 0, optind = 0, opt_ind = 0; c != -1;) {
    237                 c = getopt_long(argc, argv, "hu", long_options, &opt_ind);
    238                 switch (c) {
    239                 case 'h':
    240                         help_cmd_ls(HELP_LONG);
    241                         return CMD_SUCCESS;
    242                 case 'u':
    243                         sort = 0;
    244                         break;
    245                 }
    246         }
    247        
    248         argc -= optind;
    249        
    250         de.name = (char *) malloc(PATH_MAX);
    251         if (!de.name) {
     131
     132        buff = (char *) malloc(PATH_MAX);
     133        if (NULL == buff) {
    252134                cli_error(CL_ENOMEM, "%s: ", cmdname);
    253135                return CMD_FAILURE;
    254136        }
    255         memset(de.name, 0, sizeof(PATH_MAX));
    256        
    257         if (argc == 0)
    258                 getcwd(de.name, PATH_MAX);
     137        memset(buff, 0, sizeof(buff));
     138
     139        if (argc == 1)
     140                getcwd(buff, PATH_MAX);
    259141        else
    260                 str_cpy(de.name, PATH_MAX, argv[optind]);
    261        
    262         if (stat(de.name, &de.s)) {
    263                 cli_error(CL_ENOENT, de.name);
    264                 free(de.name);
     142                str_cpy(buff, PATH_MAX, argv[1]);
     143
     144        if (stat(buff, &s)) {
     145                cli_error(CL_ENOENT, buff);
     146                free(buff);
    265147                return CMD_FAILURE;
    266148        }
    267149
    268         if (de.s.is_file) {
    269                 ls_print(&de);
     150        if (s.is_file) {
     151                ls_print(buff, buff);
    270152        } else {
    271                 dirp = opendir(de.name);
     153                dirp = opendir(buff);
    272154                if (!dirp) {
    273155                        /* May have been deleted between scoping it and opening it */
    274                         cli_error(CL_EFAIL, "Could not stat %s", de.name);
    275                         free(de.name);
     156                        cli_error(CL_EFAIL, "Could not stat %s", buff);
     157                        free(buff);
    276158                        return CMD_FAILURE;
    277159                }
    278                 ls_scan_dir(de.name, dirp, sort);
     160                ls_scan_dir(buff, dirp);
    279161                closedir(dirp);
    280162        }
    281163
    282         free(de.name);
     164        free(buff);
    283165
    284166        return CMD_SUCCESS;
  • uspace/app/init/init.c

    r969585f r8e7d724  
    314314        getterm("term/vc6", "/app/klog", false);
    315315
    316 #ifdef CONFIG_START_DEVMAN
    317 
    318316#ifdef CONFIG_DEVMAN_EARLY_LAUNCH
    319317        spawn("/srv/devman");
     
    322320#endif
    323321
    324 #endif
    325 
    326322        return 0;
    327323}
  • uspace/app/tester/Makefile

    r969585f r8e7d724  
    5454        mm/malloc1.c \
    5555        mm/mapping1.c \
    56         devs/devman1.c \
    5756        hw/misc/virtchar1.c \
    5857        hw/serial/serial1.c
  • uspace/app/tester/tester.c

    r969585f r8e7d724  
    6666#include "adt/usbaddrkeep.def"
    6767#include "hw/misc/virtchar1.def"
    68 #include "devs/devman1.def"
    6968        {NULL, NULL, NULL, false}
    7069};
  • uspace/app/tester/tester.h

    r969585f r8e7d724  
    8282extern const char *test_usbaddrkeep(void);
    8383extern const char *test_virtchar1(void);
    84 extern const char *test_devman1(void);
    8584
    8685extern test_t tests[];
  • uspace/drv/isa/isa.c

    r969585f r8e7d724  
    5353
    5454#include <ddf/driver.h>
    55 #include <ddf/log.h>
    5655#include <ops/hw_res.h>
    5756
     
    135134        fd = open(conf_path, O_RDONLY);
    136135        if (fd < 0) {
    137                 ddf_msg(LVL_ERROR, "Unable to open %s", conf_path);
     136                printf(NAME ": unable to open %s\n", conf_path);
    138137                goto cleanup;
    139138        }
     
    142141
    143142        len = lseek(fd, 0, SEEK_END);
    144         lseek(fd, 0, SEEK_SET);
     143        lseek(fd, 0, SEEK_SET); 
    145144        if (len == 0) {
    146                 ddf_msg(LVL_ERROR, "Configuration file '%s' is empty.",
    147                     conf_path);
     145                printf(NAME ": fun_conf_read error: configuration file '%s' "
     146                    "is empty.\n", conf_path);
    148147                goto cleanup;
    149148        }
     
    151150        buf = malloc(len + 1);
    152151        if (buf == NULL) {
    153                 ddf_msg(LVL_ERROR, "Memory allocation failed.");
     152                printf(NAME ": fun_conf_read error: memory allocation failed.\n");
    154153                goto cleanup;
    155154        }
    156155
    157156        if (0 >= read(fd, buf, len)) {
    158                 ddf_msg(LVL_ERROR, "Unable to read file '%s'.", conf_path);
     157                printf(NAME ": fun_conf_read error: unable to read file '%s'.\n",
     158                    conf_path);
    159159                goto cleanup;
    160160        }
     
    252252                fun->hw_resources.count++;
    253253
    254                 ddf_msg(LVL_NOTE, "Added irq 0x%x to function %s", irq,
     254                printf(NAME ": added irq 0x%x to function %s\n", irq,
    255255                    fun->fnode->name);
    256256        }
     
    270270                fun->hw_resources.count++;
    271271
    272                 ddf_msg(LVL_NOTE, "Added io range (addr=0x%x, size=0x%x) to "
    273                     "function %s", (unsigned int) addr, (unsigned int) len,
     272                printf(NAME ": added io range (addr=0x%x, size=0x%x) to "
     273                    "function %s\n", (unsigned int) addr, (unsigned int) len,
    274274                    fun->fnode->name);
    275275        }
     
    331331        score = (int)strtol(val, &end, 10);
    332332        if (val == end) {
    333                 ddf_msg(LVL_ERROR, "Cannot read match score for function "
    334                     "%s.", fun->fnode->name);
     333                printf(NAME " : error - could not read match score for "
     334                    "function %s.\n", fun->fnode->name);
    335335                return;
    336336        }
     
    339339        get_match_id(&id, val);
    340340        if (id == NULL) {
    341                 ddf_msg(LVL_ERROR, "Cannot read match ID for function %s.",
    342                     fun->fnode->name);
     341                printf(NAME " : error - could not read match id for "
     342                    "function %s.\n", fun->fnode->name);
    343343                return;
    344344        }
    345345
    346         ddf_msg(LVL_DEBUG, "Adding match id '%s' with score %d to "
    347             "function %s", id, score, fun->fnode->name);
     346        printf(NAME ": adding match id '%s' with score %d to function %s\n", id,
     347            score, fun->fnode->name);
    348348
    349349        rc = ddf_fun_add_match_id(fun->fnode, id, score);
    350         if (rc != EOK) {
    351                 ddf_msg(LVL_ERROR, "Failed adding match ID: %s",
    352                     str_error(rc));
    353         }
     350        if (rc != EOK)
     351                printf(NAME ": error adding match ID: %s\n", str_error(rc));
    354352}
    355353
     
    377375        if (!prop_parse(fun, line, "io_range", &fun_parse_io_range) &&
    378376            !prop_parse(fun, line, "irq", &fun_parse_irq) &&
    379             !prop_parse(fun, line, "match", &fun_parse_match_id)) {
    380 
    381                 ddf_msg(LVL_ERROR, "Undefined device property at line '%s'",
    382                     line);
     377            !prop_parse(fun, line, "match", &fun_parse_match_id))
     378        {
     379            printf(NAME " error undefined device property at line '%s'\n",
     380                line);
    383381        }
    384382}
     
    441439        fun->fnode->ops = &isa_fun_ops;
    442440
    443         ddf_msg(LVL_DEBUG, "Binding function %s.", fun->fnode->name);
     441        printf(NAME ": Binding function %s.\n", fun->fnode->name);
    444442
    445443        /* XXX Handle error */
     
    469467static int isa_add_device(ddf_dev_t *dev)
    470468{
    471         ddf_msg(LVL_DEBUG, "isa_add_device, device handle = %d",
     469        printf(NAME ": isa_add_device, device handle = %d\n",
    472470            (int) dev->handle);
    473471
    474472        /* Make the bus device more visible. Does not do anything. */
    475         ddf_msg(LVL_DEBUG, "Adding a 'ctl' function");
     473        printf(NAME ": adding a 'ctl' function\n");
    476474
    477475        ddf_fun_t *ctl = ddf_fun_create(dev, fun_exposed, "ctl");
    478476        if (ctl == NULL) {
    479                 ddf_msg(LVL_ERROR, "Failed creating control function.");
     477                printf(NAME ": Error creating control function.\n");
    480478                return EXDEV;
    481479        }
    482480
    483481        if (ddf_fun_bind(ctl) != EOK) {
    484                 ddf_msg(LVL_ERROR, "Failed binding control function.");
     482                printf(NAME ": Error binding control function.\n");
    485483                return EXDEV;
    486484        }
     
    488486        /* Add functions as specified in the configuration file. */
    489487        isa_functions_add(dev);
    490         ddf_msg(LVL_NOTE, "Finished enumerating legacy functions");
     488        printf(NAME ": finished the enumeration of legacy functions\n");
    491489
    492490        return EOK;
     
    495493static void isa_init()
    496494{
    497         ddf_log_init(NAME, LVL_ERROR);
    498495        isa_fun_ops.interfaces[HW_RES_DEV_IFACE] = &isa_fun_hw_res_ops;
    499496}
  • uspace/drv/ns8250/ns8250.c

    r969585f r8e7d724  
    5555#include <ddf/driver.h>
    5656#include <ddf/interrupt.h>
    57 #include <ddf/log.h>
    5857#include <ops/char_dev.h>
    5958
     
    276275static bool ns8250_pio_enable(ns8250_t *ns)
    277276{
    278         ddf_msg(LVL_DEBUG, "ns8250_pio_enable %s", ns->dev->name);
     277        printf(NAME ": ns8250_pio_enable %s\n", ns->dev->name);
    279278       
    280279        /* Gain control over port's registers. */
    281280        if (pio_enable((void *)(uintptr_t) ns->io_addr, REG_COUNT,
    282281            (void **) &ns->port)) {
    283                 ddf_msg(LVL_ERROR, "Cannot map the port %#" PRIx32
    284                     " for device %s.", ns->io_addr, ns->dev->name);
     282                printf(NAME ": error - cannot gain the port %#" PRIx32 " for device "
     283                    "%s.\n", ns->io_addr, ns->dev->name);
    285284                return false;
    286285        }
     
    296295static bool ns8250_dev_probe(ns8250_t *ns)
    297296{
    298         ddf_msg(LVL_DEBUG, "ns8250_dev_probe %s", ns->dev->name);
     297        printf(NAME ": ns8250_dev_probe %s\n", ns->dev->name);
    299298       
    300299        ioport8_t *port_addr = ns->port;
     
    314313        pio_write_8(port_addr + 4, olddata);
    315314       
    316         if (!res) {
    317                 ddf_msg(LVL_DEBUG, "Device %s is not present.",
    318                     ns->dev->name);
    319         }
     315        if (!res)
     316                printf(NAME ": device %s is not present.\n", ns->dev->name);
    320317       
    321318        return res;
     
    329326static int ns8250_dev_initialize(ns8250_t *ns)
    330327{
    331         ddf_msg(LVL_DEBUG, "ns8250_dev_initialize %s", ns->dev->name);
     328        printf(NAME ": ns8250_dev_initialize %s\n", ns->dev->name);
    332329       
    333330        int ret = EOK;
     
    340337            IPC_FLAG_BLOCKING);
    341338        if (ns->dev->parent_phone < 0) {
    342                 ddf_msg(LVL_ERROR, "Failed to connect to parent driver of "
    343                     "device %s.", ns->dev->name);
     339                printf(NAME ": failed to connect to the parent driver of the "
     340                    "device %s.\n", ns->dev->name);
    344341                ret = ns->dev->parent_phone;
    345342                goto failed;
     
    349346        ret = hw_res_get_resource_list(ns->dev->parent_phone, &hw_resources);
    350347        if (ret != EOK) {
    351                 ddf_msg(LVL_ERROR, "Failed to get HW resources for device "
    352                     "%s.", ns->dev->name);
     348                printf(NAME ": failed to get hw resources for the device "
     349                    "%s.\n", ns->dev->name);
    353350                goto failed;
    354351        }
     
    365362                        ns->irq = res->res.interrupt.irq;
    366363                        irq = true;
    367                         ddf_msg(LVL_NOTE, "Device %s was asigned irq = 0x%x.",
     364                        printf(NAME ": the %s device was asigned irq = 0x%x.\n",
    368365                            ns->dev->name, ns->irq);
    369366                        break;
     
    372369                        ns->io_addr = res->res.io_range.address;
    373370                        if (res->res.io_range.size < REG_COUNT) {
    374                                 ddf_msg(LVL_ERROR, "I/O range assigned to "
    375                                     "device %s is too small.", ns->dev->name);
     371                                printf(NAME ": i/o range assigned to the device "
     372                                    "%s is too small.\n", ns->dev->name);
    376373                                ret = ELIMIT;
    377374                                goto failed;
    378375                        }
    379376                        ioport = true;
    380                         ddf_msg(LVL_NOTE, "Device %s was asigned I/O address = "
    381                             "0x%x.", ns->dev->name, ns->io_addr);
    382                         break;
     377                        printf(NAME ": the %s device was asigned i/o address = "
     378                            "0x%x.\n", ns->dev->name, ns->io_addr);
     379                        break;
    383380                       
    384381                default:
     
    388385       
    389386        if (!irq || !ioport) {
    390                 ddf_msg(LVL_ERROR, "Missing HW resource(s) for device %s.",
     387                printf(NAME ": missing hw resource(s) for the device %s.\n",
    391388                    ns->dev->name);
    392389                ret = ENOENT;
     
    473470       
    474471        if (baud_rate < 50 || MAX_BAUD_RATE % baud_rate != 0) {
    475                 ddf_msg(LVL_ERROR, "Invalid baud rate %d requested.",
    476                     baud_rate);
     472                printf(NAME ": error - somebody tried to set invalid baud rate "
     473                    "%d\n", baud_rate);
    477474                return EINVAL;
    478475        }
     
    657654                        if (ns->client_connected) {
    658655                                if (!buf_push_back(&ns->input_buffer, val)) {
    659                                         ddf_msg(LVL_WARN, "Buffer overflow on "
    660                                             "%s.", ns->dev->name);
     656                                        printf(NAME ": buffer overflow on "
     657                                            "%s.\n", ns->dev->name);
    661658                                } else {
    662                                         ddf_msg(LVL_DEBUG2, "Character %c saved "
    663                                             "to the buffer of %s.",
     659                                        printf(NAME ": the character %c saved "
     660                                            "to the buffer of %s.\n",
    664661                                            val, ns->dev->name);
    665662                                }
     
    717714        int rc;
    718715       
    719         ddf_msg(LVL_DEBUG, "ns8250_add_device %s (handle = %d)",
     716        printf(NAME ": ns8250_add_device %s (handle = %d)\n",
    720717            dev->name, (int) dev->handle);
    721718       
     
    752749        /* Register interrupt handler. */
    753750        if (ns8250_register_interrupt_handler(ns) != EOK) {
    754                 ddf_msg(LVL_ERROR, "Failed to register interrupt handler.");
     751                printf(NAME ": failed to register interrupt handler.\n");
    755752                rc = EADDRNOTAVAIL;
    756753                goto fail;
     
    760757        rc = ns8250_interrupt_enable(ns);
    761758        if (rc != EOK) {
    762                 ddf_msg(LVL_ERROR, "Failed to enable the interrupt. Error code = "
    763                     "%d.", rc);
     759                printf(NAME ": failed to enable the interrupt. Error code = "
     760                    "%d.\n", rc);
    764761                goto fail;
    765762        }
     
    767764        fun = ddf_fun_create(dev, fun_exposed, "a");
    768765        if (fun == NULL) {
    769                 ddf_msg(LVL_ERROR, "Failed creating function.");
     766                printf(NAME ": error creating function.\n");
    770767                goto fail;
    771768        }
     
    775772        rc = ddf_fun_bind(fun);
    776773        if (rc != EOK) {
    777                 ddf_msg(LVL_ERROR, "Failed binding function.");
     774                printf(NAME ": error binding function.\n");
    778775                goto fail;
    779776        }
     
    783780        ddf_fun_add_to_class(fun, "serial");
    784781       
    785         ddf_msg(LVL_NOTE, "Device %s successfully initialized.",
     782        printf(NAME ": the %s device has been successfully initialized.\n",
    786783            dev->name);
    787784       
     
    865862        fibril_mutex_unlock(&data->mutex);
    866863       
    867         ddf_msg(LVL_DEBUG, "ns8250_get_props: baud rate %d, parity 0x%x, word "
    868             "length %d, stop bits %d", *baud_rate, *parity, *word_length,
     864        printf(NAME ": ns8250_get_props: baud rate %d, parity 0x%x, word "
     865            "length %d, stop bits %d\n", *baud_rate, *parity, *word_length,
    869866            *stop_bits);
    870867}
     
    882879    unsigned int parity, unsigned int word_length, unsigned int stop_bits)
    883880{
    884         ddf_msg(LVL_DEBUG, "ns8250_set_props: baud rate %d, parity 0x%x, word "
    885             "length %d, stop bits %d", baud_rate, parity, word_length,
     881        printf(NAME ": ns8250_set_props: baud rate %d, parity 0x%x, word "
     882            "length %d, stop bits %d\n", baud_rate, parity, word_length,
    886883            stop_bits);
    887884       
     
    943940static void ns8250_init(void)
    944941{
    945         ddf_log_init(NAME, LVL_ERROR);
    946        
    947942        ns8250_dev_ops.open = &ns8250_open;
    948943        ns8250_dev_ops.close = &ns8250_close;
  • uspace/drv/pciintel/pci.c

    r969585f r8e7d724  
    4848
    4949#include <ddf/driver.h>
    50 #include <ddf/log.h>
    5150#include <devman.h>
    5251#include <ipc/devman.h>
     
    326325
    327326        if (match_id_str == NULL) {
    328                 ddf_msg(LVL_ERROR, "Out of memory creating match ID.");
     327                printf(NAME ": out of memory creating match ID.\n");
    329328                return;
    330329        }
     
    332331        rc = ddf_fun_add_match_id(fun->fnode, match_id_str, 90);
    333332        if (rc != EOK) {
    334                 ddf_msg(LVL_ERROR, "Failed adding match ID: %s",
     333                printf(NAME ": error adding match ID: %s\n",
    335334                    str_error(rc));
    336335        }
     
    429428       
    430429        if (range_addr != 0) {
    431                 ddf_msg(LVL_DEBUG, "Function %s : address = %" PRIx64
    432                     ", size = %x", fun->fnode->name, range_addr,
    433                     (unsigned int) range_size);
     430                printf(NAME ": function %s : ", fun->fnode->name);
     431                printf("address = %" PRIx64, range_addr);
     432                printf(", size = %x\n", (unsigned int) range_size);
    434433        }
    435434       
     
    456455        hw_res_list->count++;
    457456       
    458         ddf_msg(LVL_NOTE, "Function %s uses irq %x.", fun->fnode->name, irq);
     457        printf(NAME ": function %s uses irq %x.\n", fun->fnode->name, irq);
    459458}
    460459
     
    512511                        char *fun_name = pci_fun_create_name(fun);
    513512                        if (fun_name == NULL) {
    514                                 ddf_msg(LVL_ERROR, "Out of memory.");
     513                                printf(NAME ": out of memory.\n");
    515514                                return;
    516515                        }
     
    518517                        fnode = ddf_fun_create(bus->dnode, fun_inner, fun_name);
    519518                        if (fnode == NULL) {
    520                                 ddf_msg(LVL_ERROR, "Failed creating function.");
     519                                printf(NAME ": error creating function.\n");
    521520                                return;
    522521                        }
     
    532531                        fnode->driver_data = fun;
    533532                       
    534                         ddf_msg(LVL_DEBUG, "Adding new function %s.",
     533                        printf(NAME ": adding new function %s.\n",
    535534                            fnode->name);
    536535                       
     
    549548                                child_bus = pci_conf_read_8(fun,
    550549                                    PCI_BRIDGE_SEC_BUS_NUM);
    551                                 ddf_msg(LVL_DEBUG, "Device is pci-to-pci "
    552                                     "bridge, secondary bus number = %d.",
    553                                     bus_num);
     550                                printf(NAME ": device is pci-to-pci bridge, "
     551                                    "secondary bus number = %d.\n", bus_num);
    554552                                if (child_bus > bus_num)
    555553                                        pci_bus_scan(bus, child_bus);
     
    573571        int rc;
    574572       
    575         ddf_msg(LVL_DEBUG, "pci_add_device");
     573        printf(NAME ": pci_add_device\n");
    576574        dnode->parent_phone = -1;
    577575       
    578576        bus = pci_bus_new();
    579577        if (bus == NULL) {
    580                 ddf_msg(LVL_ERROR, "pci_add_device allocation failed.");
     578                printf(NAME ": pci_add_device allocation failed.\n");
    581579                rc = ENOMEM;
    582580                goto fail;
     
    588586            IPC_FLAG_BLOCKING);
    589587        if (dnode->parent_phone < 0) {
    590                 ddf_msg(LVL_ERROR, "pci_add_device failed to connect to the "
    591                     "parent's driver.");
     588                printf(NAME ": pci_add_device failed to connect to the "
     589                    "parent's driver.\n");
    592590                rc = dnode->parent_phone;
    593591                goto fail;
     
    598596        rc = hw_res_get_resource_list(dnode->parent_phone, &hw_resources);
    599597        if (rc != EOK) {
    600                 ddf_msg(LVL_ERROR, "pci_add_device failed to get hw resources "
    601                     "for the device.");
     598                printf(NAME ": pci_add_device failed to get hw resources for "
     599                    "the device.\n");
    602600                goto fail;
    603601        }
    604602        got_res = true;
    605603       
    606         ddf_msg(LVL_DEBUG, "conf_addr = %" PRIx64 ".",
     604        printf(NAME ": conf_addr = %" PRIx64 ".\n",
    607605            hw_resources.resources[0].res.io_range.address);
    608606       
     
    616614        if (pio_enable((void *)(uintptr_t)bus->conf_io_addr, 8,
    617615            &bus->conf_addr_port)) {
    618                 ddf_msg(LVL_ERROR, "Failed to enable configuration ports.");
     616                printf(NAME ": failed to enable configuration ports.\n");
    619617                rc = EADDRNOTAVAIL;
    620618                goto fail;
     
    623621       
    624622        /* Make the bus device more visible. It has no use yet. */
    625         ddf_msg(LVL_DEBUG, "Adding a 'ctl' function");
     623        printf(NAME ": adding a 'ctl' function\n");
    626624       
    627625        ctl = ddf_fun_create(bus->dnode, fun_exposed, "ctl");
    628626        if (ctl == NULL) {
    629                 ddf_msg(LVL_ERROR, "Failed creating control function.");
     627                printf(NAME ": error creating control function.\n");
    630628                rc = ENOMEM;
    631629                goto fail;
     
    634632        rc = ddf_fun_bind(ctl);
    635633        if (rc != EOK) {
    636                 ddf_msg(LVL_ERROR, "Failed binding control function.");
     634                printf(NAME ": error binding control function.\n");
    637635                goto fail;
    638636        }
    639637       
    640638        /* Enumerate functions. */
    641         ddf_msg(LVL_DEBUG, "Scanning the bus");
     639        printf(NAME ": scanning the bus\n");
    642640        pci_bus_scan(bus, 0);
    643641       
     
    661659static void pciintel_init(void)
    662660{
    663         ddf_log_init(NAME, LVL_ERROR);
    664661        pci_fun_ops.interfaces[HW_RES_DEV_IFACE] = &pciintel_hw_res_ops;
    665662        pci_fun_ops.interfaces[PCI_DEV_IFACE] = &pci_dev_ops;
     
    741738int main(int argc, char *argv[])
    742739{
    743         printf(NAME ": HelenOS PCI bus driver (Intel method 1).\n");
     740        printf(NAME ": HelenOS pci bus driver (intel method 1).\n");
    744741        pciintel_init();
    745742        return ddf_driver_main(&pci_driver);
  • uspace/drv/root/root.c

    r969585f r8e7d724  
    5252
    5353#include <ddf/driver.h>
    54 #include <ddf/log.h>
    5554#include <devman.h>
    5655#include <ipc/devman.h>
     
    9089        int rc;
    9190
    92         ddf_msg(LVL_DEBUG, "Adding new function for virtual devices. "
    93             "Function node is `%s' (%d %s)", name,
     91        printf(NAME ": adding new function for virtual devices.\n");
     92        printf(NAME ":   function node is `%s' (%d %s)\n", name,
    9493            VIRTUAL_FUN_MATCH_SCORE, VIRTUAL_FUN_MATCH_ID);
    9594
    9695        fun = ddf_fun_create(dev, fun_inner, name);
    9796        if (fun == NULL) {
    98                 ddf_msg(LVL_ERROR, "Failed creating function %s", name);
     97                printf(NAME ": error creating function %s\n", name);
    9998                return ENOMEM;
    10099        }
     
    103102            VIRTUAL_FUN_MATCH_SCORE);
    104103        if (rc != EOK) {
    105                 ddf_msg(LVL_ERROR, "Failed adding match IDs to function %s",
    106                     name);
     104                printf(NAME ": error adding match IDs to function %s\n", name);
    107105                ddf_fun_destroy(fun);
    108106                return rc;
     
    111109        rc = ddf_fun_bind(fun);
    112110        if (rc != EOK) {
    113                 ddf_msg(LVL_ERROR, "Failed binding function %s: %s", name,
     111                printf(NAME ": error binding function %s: %s\n", name,
    114112                    str_error(rc));
    115113                ddf_fun_destroy(fun);
     
    138136        platform = sysinfo_get_data("platform", &platform_size);
    139137        if (platform == NULL) {
    140                 ddf_msg(LVL_ERROR, "Failed to obtain platform name.");
     138                printf(NAME ": Failed to obtain platform name.\n");
    141139                return ENOENT;
    142140        }
     
    145143        platform = realloc(platform, platform_size + 1);
    146144        if (platform == NULL) {
    147                 ddf_msg(LVL_ERROR, "Memory allocation failed.");
     145                printf(NAME ": Memory allocation failed.\n");
    148146                return ENOMEM;
    149147        }
     
    153151        /* Construct match ID. */
    154152        if (asprintf(&match_id, PLATFORM_FUN_MATCH_ID_FMT, platform) == -1) {
    155                 ddf_msg(LVL_ERROR, "Memory allocation failed.");
     153                printf(NAME ": Memory allocation failed.\n");
    156154                return ENOMEM;
    157155        }
    158156
    159157        /* Add function. */
    160         ddf_msg(LVL_DEBUG, "Adding platform function. Function node is `%s' "
    161             " (%d %s)", PLATFORM_FUN_NAME, PLATFORM_FUN_MATCH_SCORE,
    162             match_id);
     158        printf(NAME ": adding platform function\n");
     159        printf(NAME ":   function node is `%s' (%d %s)\n", PLATFORM_FUN_NAME,
     160            PLATFORM_FUN_MATCH_SCORE, match_id);
    163161
    164162        fun = ddf_fun_create(dev, fun_inner, name);
    165163        if (fun == NULL) {
    166                 ddf_msg(LVL_ERROR, "Error creating function %s", name);
     164                printf(NAME ": error creating function %s\n", name);
    167165                return ENOMEM;
    168166        }
     
    170168        rc = ddf_fun_add_match_id(fun, match_id, PLATFORM_FUN_MATCH_SCORE);
    171169        if (rc != EOK) {
    172                 ddf_msg(LVL_ERROR, "Failed adding match IDs to function %s",
    173                     name);
     170                printf(NAME ": error adding match IDs to function %s\n", name);
    174171                ddf_fun_destroy(fun);
    175172                return rc;
     
    178175        rc = ddf_fun_bind(fun);
    179176        if (rc != EOK) {
    180                 ddf_msg(LVL_ERROR, "Failed binding function %s: %s", name,
     177                printf(NAME ": error binding function %s: %s\n", name,
    181178                    str_error(rc));
    182179                ddf_fun_destroy(fun);
     
    194191static int root_add_device(ddf_dev_t *dev)
    195192{
    196         ddf_msg(LVL_DEBUG, "root_add_device, device handle=%" PRIun,
     193        printf(NAME ": root_add_device, device handle=%" PRIun "\n",
    197194            dev->handle);
    198195
     
    207204        int res = add_platform_fun(dev);
    208205        if (EOK != res)
    209                 ddf_msg(LVL_ERROR, "Failed adding child device for platform.");
     206                printf(NAME ": failed to add child device for platform.\n");
    210207
    211208        return res;
     
    215212{
    216213        printf(NAME ": HelenOS root device driver\n");
    217 
    218         ddf_log_init(NAME, LVL_ERROR);
    219214        return ddf_driver_main(&root_driver);
    220215}
  • uspace/drv/rootpc/rootpc.c

    r969585f r8e7d724  
    4747
    4848#include <ddf/driver.h>
    49 #include <ddf/log.h>
    5049#include <devman.h>
    5150#include <ipc/devman.h>
     
    120119    rootpc_fun_t *fun)
    121120{
    122         ddf_msg(LVL_DEBUG, "Adding new function '%s'.", name);
     121        printf(NAME ": adding new function '%s'.\n", name);
    123122       
    124123        ddf_fun_t *fnode = NULL;
     
    146145        /* Register function. */
    147146        if (ddf_fun_bind(fnode) != EOK) {
    148                 ddf_msg(LVL_ERROR, "Failed binding function %s.", name);
     147                printf(NAME ": error binding function %s.\n", name);
    149148                goto failure;
    150149        }
     
    159158                ddf_fun_destroy(fnode);
    160159       
    161         ddf_msg(LVL_ERROR, "Failed adding function '%s'.", name);
     160        printf(NAME ": failed to add function '%s'.\n", name);
    162161       
    163162        return false;
     
    177176static int rootpc_add_device(ddf_dev_t *dev)
    178177{
    179         ddf_msg(LVL_DEBUG, "rootpc_add_device, device handle = %d",
     178        printf(NAME ": rootpc_add_device, device handle = %d\n",
    180179            (int)dev->handle);
    181180       
    182181        /* Register functions. */
    183182        if (!rootpc_add_functions(dev)) {
    184                 ddf_msg(LVL_ERROR, "Failed to add functions for PC platform.");
     183                printf(NAME ": failed to add functions for PC platform.\n");
    185184        }
    186185       
     
    190189static void root_pc_init(void)
    191190{
    192         ddf_log_init(NAME, LVL_ERROR);
    193191        rootpc_fun_ops.interfaces[HW_RES_DEV_IFACE] = &fun_hw_res_ops;
    194192}
  • uspace/drv/rootvirt/rootvirt.c

    r969585f r8e7d724  
    4040#include <str_error.h>
    4141#include <ddf/driver.h>
    42 #include <ddf/log.h>
    4342
    4443#define NAME "rootvirt"
     
    8483        int rc;
    8584
    86         ddf_msg(LVL_DEBUG, "Registering function `%s' (match \"%s\")",
     85        printf(NAME ": registering function `%s' (match \"%s\")\n",
    8786            vfun->name, vfun->match_id);
    8887
    8988        fun = ddf_fun_create(vdev, fun_inner, vfun->name);
    9089        if (fun == NULL) {
    91                 ddf_msg(LVL_ERROR, "Failed creating function %s", vfun->name);
     90                printf(NAME ": error creating function %s\n", vfun->name);
    9291                return ENOMEM;
    9392        }
     
    9594        rc = ddf_fun_add_match_id(fun, vfun->match_id, 10);
    9695        if (rc != EOK) {
    97                 ddf_msg(LVL_ERROR, "Failed adding match IDs to function %s",
     96                printf(NAME ": error adding match IDs to function %s\n",
    9897                    vfun->name);
    9998                ddf_fun_destroy(fun);
     
    103102        rc = ddf_fun_bind(fun);
    104103        if (rc != EOK) {
    105                 ddf_msg(LVL_ERROR, "Failed binding function %s: %s",
    106                     vfun->name, str_error(rc));
     104                printf(NAME ": error binding function %s: %s\n", vfun->name,
     105                    str_error(rc));
    107106                ddf_fun_destroy(fun);
    108107                return rc;
    109108        }
    110109
    111         ddf_msg(LVL_NOTE, "Registered child device `%s'", vfun->name);
     110        printf(NAME ": registered child device `%s'\n", vfun->name);
    112111        return EOK;
    113112}
     
    125124        }
    126125
    127         ddf_msg(LVL_DEBUG, "add_device(handle=%d)", (int)dev->handle);
     126        printf(NAME ": add_device(handle=%d)\n", (int)dev->handle);
    128127
    129128        /*
     
    143142{
    144143        printf(NAME ": HelenOS virtual devices root driver\n");
    145 
    146         ddf_log_init(NAME, LVL_ERROR);
    147144        return ddf_driver_main(&rootvirt_driver);
    148145}
  • uspace/drv/test1/test1.c

    r969585f r8e7d724  
    3535#include <str_error.h>
    3636#include <ddf/driver.h>
    37 #include <ddf/log.h>
    3837
    3938#include "test1.h"
     
    5958 */
    6059static int register_fun_verbose(ddf_dev_t *parent, const char *message,
    61     const char *name, const char *match_id, int match_score,
    62     int expected_rc)
     60    const char *name, const char *match_id, int match_score)
    6361{
    64         ddf_fun_t *fun = NULL;
     62        ddf_fun_t *fun;
    6563        int rc;
    6664
    67         ddf_msg(LVL_DEBUG, "Registering function `%s': %s.", name, message);
     65        printf(NAME ": registering function `%s': %s.\n", name, message);
    6866
    6967        fun = ddf_fun_create(parent, fun_inner, name);
    7068        if (fun == NULL) {
    71                 ddf_msg(LVL_ERROR, "Failed creating function %s", name);
    72                 rc = ENOMEM;
    73                 goto leave;
     69                printf(NAME ": error creating function %s\n", name);
     70                return ENOMEM;
    7471        }
    7572
    76         rc = ddf_fun_add_match_id(fun, str_dup(match_id), match_score);
     73        rc = ddf_fun_add_match_id(fun, match_id, match_score);
    7774        if (rc != EOK) {
    78                 ddf_msg(LVL_ERROR, "Failed adding match IDs to function %s",
    79                     name);
    80                 goto leave;
     75                printf(NAME ": error adding match IDs to function %s\n", name);
     76                ddf_fun_destroy(fun);
     77                return rc;
    8178        }
    8279
    8380        rc = ddf_fun_bind(fun);
    8481        if (rc != EOK) {
    85                 ddf_msg(LVL_ERROR, "Failed binding function %s: %s", name,
     82                printf(NAME ": error binding function %s: %s\n", name,
    8683                    str_error(rc));
    87                 goto leave;
     84                ddf_fun_destroy(fun);
     85                return rc;
    8886        }
    8987
    90         ddf_msg(LVL_NOTE, "Registered child device `%s'", name);
    91         rc = EOK;
    92 
    93 leave:
    94         if (rc != expected_rc) {
    95                 fprintf(stderr,
    96                     NAME ": Unexpected error registering function `%s'.\n"
    97                     NAME ":     Expected \"%s\" but got \"%s\".\n",
    98                     name, str_error(expected_rc), str_error(rc));
    99         }
    100 
    101         if ((rc != EOK) && (fun != NULL)) {
    102                 ddf_fun_destroy(fun);
    103         }
    104 
    105         return rc;
     88        printf(NAME ": registered child device `%s'\n", name);
     89        return EOK;
    10690}
    10791
     
    128112        int rc;
    129113
    130         ddf_msg(LVL_DEBUG, "add_device(name=\"%s\", handle=%d)",
     114        printf(NAME ": add_device(name=\"%s\", handle=%d)\n",
    131115            dev->name, (int) dev->handle);
    132116
    133117        fun_a = ddf_fun_create(dev, fun_exposed, "a");
    134118        if (fun_a == NULL) {
    135                 ddf_msg(LVL_ERROR, "Failed creating function 'a'.");
     119                printf(NAME ": error creating function 'a'.\n");
    136120                return ENOMEM;
    137121        }
     
    139123        rc = ddf_fun_bind(fun_a);
    140124        if (rc != EOK) {
    141                 ddf_msg(LVL_ERROR, "Failed binding function 'a'.");
     125                printf(NAME ": error binding function 'a'.\n");
    142126                return rc;
    143127        }
     
    149133                ddf_fun_add_to_class(fun_a, "virt-null");
    150134        } else if (str_cmp(dev->name, "test1") == 0) {
    151                 (void) register_fun_verbose(dev,
    152                     "cloning myself ;-)", "clone",
    153                     "virtual&test1", 10, EOK);
    154                 (void) register_fun_verbose(dev,
    155                     "cloning myself twice ;-)", "clone",
    156                     "virtual&test1", 10, EEXISTS);
     135                (void) register_fun_verbose(dev, "cloning myself ;-)", "clone",
     136                    "virtual&test1", 10);
    157137        } else if (str_cmp(dev->name, "clone") == 0) {
    158                 (void) register_fun_verbose(dev,
    159                     "run by the same task", "child",
    160                     "virtual&test1&child", 10, EOK);
     138                (void) register_fun_verbose(dev, "run by the same task", "child",
     139                    "virtual&test1&child", 10);
    161140        }
    162141
    163         ddf_msg(LVL_DEBUG, "Device `%s' accepted.", dev->name);
     142        printf(NAME ": device `%s' accepted.\n", dev->name);
    164143
    165144        return EOK;
     
    169148{
    170149        printf(NAME ": HelenOS test1 virtual device driver\n");
    171         ddf_log_init(NAME, LVL_ERROR);
    172150        return ddf_driver_main(&test1_driver);
    173151}
  • uspace/drv/test2/test2.c

    r969585f r8e7d724  
    3636#include <str_error.h>
    3737#include <ddf/driver.h>
    38 #include <ddf/log.h>
    3938
    4039#define NAME "test2"
     
    6564        int rc;
    6665
    67         ddf_msg(LVL_DEBUG, "Registering function `%s': %s.", name, message);
     66        printf(NAME ": registering function `%s': %s.\n", name, message);
    6867
    6968        fun = ddf_fun_create(parent, fun_inner, name);
    7069        if (fun == NULL) {
    71                 ddf_msg(LVL_ERROR, "Failed creating function %s", name);
     70                printf(NAME ": error creating function %s\n", name);
    7271                return ENOMEM;
    7372        }
     
    7574        rc = ddf_fun_add_match_id(fun, match_id, match_score);
    7675        if (rc != EOK) {
    77                 ddf_msg(LVL_ERROR, "Failed adding match IDs to function %s",
    78                     name);
     76                printf(NAME ": error adding match IDs to function %s\n", name);
    7977                ddf_fun_destroy(fun);
    8078                return rc;
     
    8381        rc = ddf_fun_bind(fun);
    8482        if (rc != EOK) {
    85                 ddf_msg(LVL_ERROR, "Failed binding function %s: %s", name,
     83                printf(NAME ": error binding function %s: %s\n", name,
    8684                    str_error(rc));
    8785                ddf_fun_destroy(fun);
     
    8987        }
    9088
    91         ddf_msg(LVL_NOTE, "Registered child device `%s'", name);
     89        printf(NAME ": registered child device `%s'\n", name);
    9290        return EOK;
    9391}
     
    113111        fun_a = ddf_fun_create(dev, fun_exposed, "a");
    114112        if (fun_a == NULL) {
    115                 ddf_msg(LVL_ERROR, "Failed creating function 'a'.");
     113                printf(NAME ": error creating function 'a'.\n");
    116114                return ENOMEM;
    117115        }
     
    119117        rc = ddf_fun_bind(fun_a);
    120118        if (rc != EOK) {
    121                 ddf_msg(LVL_ERROR, "Failed binding function 'a'.");
     119                printf(NAME ": error binding function 'a'.\n");
    122120                return rc;
    123121        }
     
    130128static int test2_add_device(ddf_dev_t *dev)
    131129{
    132         ddf_msg(LVL_DEBUG, "test2_add_device(name=\"%s\", handle=%d)",
     130        printf(NAME ": test2_add_device(name=\"%s\", handle=%d)\n",
    133131            dev->name, (int) dev->handle);
    134132
     
    136134                fid_t postpone = fibril_create(postponed_birth, dev);
    137135                if (postpone == 0) {
    138                         ddf_msg(LVL_ERROR, "fibril_create() failed.");
     136                        printf(NAME ": fibril_create() error\n");
    139137                        return ENOMEM;
    140138                }
     
    151149{
    152150        printf(NAME ": HelenOS test2 virtual device driver\n");
    153         ddf_log_init(NAME, LVL_ERROR);
    154151        return ddf_driver_main(&test2_driver);
    155152}
  • uspace/lib/c/Makefile

    r969585f r8e7d724  
    7777        generic/io/io.c \
    7878        generic/io/printf.c \
    79         generic/io/log.c \
    8079        generic/io/klog.c \
    8180        generic/io/snprintf.c \
  • uspace/lib/c/generic/devman.c

    r969585f r8e7d724  
    147147                ret = devman_send_match_id(phone, match_id);
    148148                if (ret != EOK) {
     149                        printf("Driver failed to send match id, error %d\n",
     150                            ret);
    149151                        return ret;
    150152                }
     
    193195        }
    194196       
    195         int match_ids_rc = devman_send_match_ids(phone, match_ids);
     197        devman_send_match_ids(phone, match_ids);
    196198       
    197199        async_wait_for(req, &retval);
     
    199201        async_serialize_end();
    200202       
    201         /* Prefer the answer to DEVMAN_ADD_FUNCTION in case of errors. */
    202         if ((match_ids_rc != EOK) && (retval == EOK)) {
    203                 retval = match_ids_rc;
    204         }
    205 
    206203        if (retval == EOK)
    207204                fun_handle = (int) IPC_GET_ARG1(answer);
     
    329326}
    330327
    331 int devman_device_get_handle_by_class(const char *classname,
    332     const char *devname, devman_handle_t *handle, unsigned int flags)
    333 {
    334         int phone = devman_get_phone(DEVMAN_CLIENT, flags);
    335 
    336         if (phone < 0)
    337                 return phone;
    338 
    339         async_serialize_start();
    340 
    341         ipc_call_t answer;
    342         aid_t req = async_send_1(phone, DEVMAN_DEVICE_GET_HANDLE_BY_CLASS,
    343             flags, &answer);
    344 
    345         sysarg_t retval = async_data_write_start(phone, classname,
    346             str_size(classname));
    347         if (retval != EOK) {
    348                 async_wait_for(req, NULL);
    349                 async_serialize_end();
    350                 return retval;
    351         }
    352         retval = async_data_write_start(phone, devname,
    353             str_size(devname));
    354         if (retval != EOK) {
    355                 async_wait_for(req, NULL);
    356                 async_serialize_end();
    357                 return retval;
    358         }
    359 
    360         async_wait_for(req, &retval);
    361 
    362         async_serialize_end();
    363 
    364         if (retval != EOK) {
    365                 if (handle != NULL)
    366                         *handle = (devman_handle_t) -1;
    367                 return retval;
    368         }
    369 
    370         if (handle != NULL)
    371                 *handle = (devman_handle_t) IPC_GET_ARG1(answer);
    372 
    373         return retval;
    374 }
    375 
    376328
    377329/** @}
  • uspace/lib/c/include/devman.h

    r969585f r8e7d724  
    5353extern int devman_device_get_handle(const char *, devman_handle_t *,
    5454    unsigned int);
    55 extern int devman_device_get_handle_by_class(const char *, const char *,
    56     devman_handle_t *, unsigned int);
    5755
    5856extern int devman_add_device_to_class(devman_handle_t, const char *);
  • uspace/lib/c/include/ipc/devman.h

    r969585f r8e7d724  
    148148
    149149typedef enum {
    150         DEVMAN_DEVICE_GET_HANDLE = IPC_FIRST_USER_METHOD,
    151         DEVMAN_DEVICE_GET_HANDLE_BY_CLASS
     150        DEVMAN_DEVICE_GET_HANDLE = IPC_FIRST_USER_METHOD
    152151} client_to_devman_t;
    153152
  • uspace/lib/drv/Makefile

    r969585f r8e7d724  
    3636        generic/dev_iface.c \
    3737        generic/remote_char_dev.c \
    38         generic/log.c \
    3938        generic/remote_hw_res.c \
    4039        generic/remote_usb.c \
  • uspace/lib/drv/generic/driver.c

    r969585f r8e7d724  
    273273       
    274274        res = driver->driver_ops->add_device(dev);
    275         if (res != EOK)
     275        if (res == EOK) {
     276                printf("%s: new device with handle=%" PRIun " was added.\n",
     277                    driver->name, dev_handle);
     278        } else {
     279                printf("%s: failed to add a new device with handle = %" PRIun ".\n",
     280                    driver->name, dev_handle);
    276281                delete_device(dev);
     282        }
    277283       
    278284        async_answer_0(iid, res);
  • uspace/srv/devman/devman.c

    r969585f r8e7d724  
    3434#include <fcntl.h>
    3535#include <sys/stat.h>
    36 #include <io/log.h>
    3736#include <ipc/driver.h>
    3837#include <ipc/devman.h>
     
    147146        fibril_mutex_unlock(&drivers_list->drivers_mutex);
    148147
    149         log_msg(LVL_NOTE, "Driver `%s' was added to the list of available "
    150             "drivers.", drv->name);
     148        printf(NAME": the '%s' driver was added to the list of available "
     149            "drivers.\n", drv->name);
     150
     151        printf(NAME ": match ids:");
     152        link_t *cur;
     153        for (cur = drv->match_ids.ids.next; cur != &drv->match_ids.ids; cur = cur->next) {
     154                match_id_t *match_id = list_get_instance(cur, match_id_t, link);
     155                printf(" %d:%s", match_id->score, match_id->id);
     156        }
     157        printf("\n");
    151158}
    152159
     
    238245bool read_match_ids(const char *conf_path, match_id_list_t *ids)
    239246{
    240         log_msg(LVL_DEBUG, "read_match_ids(conf_path=\"%s\")", conf_path);
     247        printf(NAME ": read_match_ids conf_path = %s.\n", conf_path);
    241248       
    242249        bool suc = false;
     
    248255        fd = open(conf_path, O_RDONLY);
    249256        if (fd < 0) {
    250                 log_msg(LVL_ERROR, "Unable to open `%s' for reading: %s.",
    251                     conf_path, str_error(fd));
     257                printf(NAME ": unable to open %s\n", conf_path);
    252258                goto cleanup;
    253259        }
     
    257263        lseek(fd, 0, SEEK_SET);
    258264        if (len == 0) {
    259                 log_msg(LVL_ERROR, "Configuration file '%s' is empty.",
    260                     conf_path);
     265                printf(NAME ": configuration file '%s' is empty.\n", conf_path);
    261266                goto cleanup;
    262267        }
     
    264269        buf = malloc(len + 1);
    265270        if (buf == NULL) {
    266                 log_msg(LVL_ERROR, "Memory allocation failed when parsing file "
    267                     "'%s'.", conf_path);
     271                printf(NAME ": memory allocation failed when parsing file "
     272                    "'%s'.\n", conf_path);
    268273                goto cleanup;
    269274        }
     
    271276        ssize_t read_bytes = safe_read(fd, buf, len);
    272277        if (read_bytes <= 0) {
    273                 log_msg(LVL_ERROR, "Unable to read file '%s'.", conf_path);
     278                printf(NAME ": unable to read file '%s'.\n", conf_path);
    274279                goto cleanup;
    275280        }
     
    309314bool get_driver_info(const char *base_path, const char *name, driver_t *drv)
    310315{
    311         log_msg(LVL_DEBUG, "get_driver_info(base_path=\"%s\", name=\"%s\")",
     316        printf(NAME ": get_driver_info base_path = %s, name = %s.\n",
    312317            base_path, name);
    313318       
     
    341346        struct stat s;
    342347        if (stat(drv->binary_path, &s) == ENOENT) { /* FIXME!! */
    343                 log_msg(LVL_ERROR, "Driver not found at path `%s'.",
    344                     drv->binary_path);
     348                printf(NAME ": driver not found at path %s.", drv->binary_path);
    345349                goto cleanup;
    346350        }
     
    369373int lookup_available_drivers(driver_list_t *drivers_list, const char *dir_path)
    370374{
    371         log_msg(LVL_DEBUG, "lookup_available_drivers(dir=\"%s\")", dir_path);
     375        printf(NAME ": lookup_available_drivers, dir = %s \n", dir_path);
    372376       
    373377        int drv_cnt = 0;
     
    403407        dev_node_t *dev;
    404408       
    405         log_msg(LVL_DEBUG, "create_root_nodes()");
     409        printf(NAME ": create_root_nodes\n");
    406410       
    407411        fibril_rwlock_write_lock(&tree->rwlock);
     
    488492void attach_driver(dev_node_t *dev, driver_t *drv)
    489493{
    490         log_msg(LVL_DEBUG, "attach_driver(dev=\"%s\",drv=\"%s\")",
    491             dev->pfun->pathname, drv->name);
     494        printf(NAME ": attach_driver %s to device %s\n",
     495            drv->name, dev->pfun->pathname);
    492496       
    493497        fibril_mutex_lock(&drv->driver_mutex);
     
    511515        assert(fibril_mutex_is_locked(&drv->driver_mutex));
    512516       
    513         log_msg(LVL_DEBUG, "start_driver(drv=\"%s\")", drv->name);
     517        printf(NAME ": start_driver '%s'\n", drv->name);
    514518       
    515519        rc = task_spawnl(NULL, drv->binary_path, drv->binary_path, NULL);
    516520        if (rc != EOK) {
    517                 log_msg(LVL_ERROR, "Spawning driver `%s' (%s) failed: %s.",
    518                     drv->name, drv->binary_path, str_error(rc));
     521                printf(NAME ": error spawning %s (%s)\n",
     522                    drv->name, str_error(rc));
    519523                return false;
    520524        }
     
    578582        int phone;
    579583
    580         log_msg(LVL_DEBUG, "pass_devices_to_driver(driver=\"%s\")",
    581             driver->name);
     584        printf(NAME ": pass_devices_to_driver(`%s')\n", driver->name);
    582585
    583586        fibril_mutex_lock(&driver->driver_mutex);
     
    646649         * immediately and possibly started here as well.
    647650         */
    648         log_msg(LVL_DEBUG, "Driver `%s' enters running state.", driver->name);
     651        printf(NAME ": driver %s goes into running state.\n", driver->name);
    649652        driver->state = DRIVER_RUNNING;
    650653
     
    663666void initialize_running_driver(driver_t *driver, dev_tree_t *tree)
    664667{
    665         log_msg(LVL_DEBUG, "initialize_running_driver(driver=\"%s\")",
    666             driver->name);
     668        printf(NAME ": initialize_running_driver (`%s')\n", driver->name);
    667669       
    668670        /*
     
    754756         * access any structures that would affect driver_t.
    755757         */
    756         log_msg(LVL_DEBUG, "add_device(drv=\"%s\", dev=\"%s\")",
    757             drv->name, dev->pfun->name);
     758        printf(NAME ": add_device (driver `%s', device `%s')\n", drv->name,
     759            dev->pfun->name);
    758760       
    759761        sysarg_t rc;
     
    816818        driver_t *drv = find_best_match_driver(drivers_list, dev);
    817819        if (drv == NULL) {
    818                 log_msg(LVL_ERROR, "No driver found for device `%s'.",
     820                printf(NAME ": no driver found for device '%s'.\n",
    819821                    dev->pfun->pathname);
    820822                return false;
     
    854856bool init_device_tree(dev_tree_t *tree, driver_list_t *drivers_list)
    855857{
    856         log_msg(LVL_DEBUG, "init_device_tree()");
     858        printf(NAME ": init_device_tree.\n");
    857859       
    858860        tree->current_handle = 0;
     
    10331035        fun->pathname = (char *) malloc(pathsize);
    10341036        if (fun->pathname == NULL) {
    1035                 log_msg(LVL_ERROR, "Failed to allocate device path.");
     1037                printf(NAME ": failed to allocate device path.\n");
    10361038                return false;
    10371039        }
     
    10641066        assert(fibril_rwlock_is_write_locked(&tree->rwlock));
    10651067       
    1066         log_msg(LVL_DEBUG, "insert_dev_node(dev=%p, pfun=%p [\"%s\"])",
    1067             dev, pfun, pfun->pathname);
    1068 
    10691068        /* Add the node to the handle-to-node map. */
    10701069        dev->handle = ++tree->current_handle;
     
    10731072
    10741073        /* Add the node to the list of its parent's children. */
     1074        printf("insert_dev_node: dev=%p, dev->pfun := %p\n", dev, pfun);
    10751075        dev->pfun = pfun;
    10761076        pfun->child = dev;
     
    11731173}
    11741174
    1175 /** Find function with a specified name belonging to given device.
    1176  *
    1177  * Device tree rwlock should be held at least for reading.
    1178  *
    1179  * @param dev Device the function belongs to.
    1180  * @param name Function name (not path).
    1181  * @return Function node.
    1182  * @retval NULL No function with given name.
    1183  */
    1184 fun_node_t *find_fun_node_in_device(dev_node_t *dev, const char *name)
    1185 {
    1186         assert(dev != NULL);
    1187         assert(name != NULL);
    1188 
    1189         fun_node_t *fun;
    1190         link_t *link;
    1191 
    1192         for (link = dev->functions.next;
    1193             link != &dev->functions;
    1194             link = link->next) {
    1195                 fun = list_get_instance(link, fun_node_t, dev_functions);
    1196 
    1197                 if (str_cmp(name, fun->name) == 0)
    1198                         return fun;
    1199         }
    1200 
    1201         return NULL;
    1202 }
    1203 
    1204 /** Find function node by its class name and index. */
    1205 fun_node_t *find_fun_node_by_class(class_list_t *class_list,
    1206     const char *class_name, const char *dev_name)
    1207 {
    1208         assert(class_list != NULL);
    1209         assert(class_name != NULL);
    1210         assert(dev_name != NULL);
    1211 
    1212         fibril_rwlock_read_lock(&class_list->rwlock);
    1213 
    1214         dev_class_t *cl = find_dev_class_no_lock(class_list, class_name);
    1215         if (cl == NULL) {
    1216                 fibril_rwlock_read_unlock(&class_list->rwlock);
    1217                 return NULL;
    1218         }
    1219 
    1220         dev_class_info_t *dev = find_dev_in_class(cl, dev_name);
    1221         if (dev == NULL) {
    1222                 fibril_rwlock_read_unlock(&class_list->rwlock);
    1223                 return NULL;
    1224         }
    1225 
    1226         fun_node_t *fun = dev->fun;
    1227 
    1228         fibril_rwlock_read_unlock(&class_list->rwlock);
    1229 
    1230         return fun;
    1231 }
    1232 
    1233 
    12341175/** Find child function node with a specified name.
    12351176 *
     
    12421183fun_node_t *find_node_child(fun_node_t *pfun, const char *name)
    12431184{
    1244         return find_fun_node_in_device(pfun->child, name);
     1185        fun_node_t *fun;
     1186        link_t *link;
     1187       
     1188        link = pfun->child->functions.next;
     1189       
     1190        while (link != &pfun->child->functions) {
     1191                fun = list_get_instance(link, fun_node_t, dev_functions);
     1192               
     1193                if (str_cmp(name, fun->name) == 0)
     1194                        return fun;
     1195               
     1196                link = link->next;
     1197        }
     1198       
     1199        return NULL;
    12451200}
    12461201
     
    14041359}
    14051360
    1406 dev_class_info_t *find_dev_in_class(dev_class_t *dev_class, const char *dev_name)
    1407 {
    1408         assert(dev_class != NULL);
    1409         assert(dev_name != NULL);
    1410 
    1411         link_t *link;
    1412         for (link = dev_class->devices.next;
    1413             link != &dev_class->devices;
    1414             link = link->next) {
    1415                 dev_class_info_t *dev = list_get_instance(link,
    1416                     dev_class_info_t, link);
    1417 
    1418                 if (str_cmp(dev->dev_name, dev_name) == 0) {
    1419                         return dev;
    1420                 }
    1421         }
    1422 
    1423         return NULL;
    1424 }
    1425 
    14261361void init_class_list(class_list_t *class_list)
    14271362{
  • uspace/srv/devman/devman.h

    r969585f r8e7d724  
    338338extern fun_node_t *find_fun_node(dev_tree_t *tree, devman_handle_t handle);
    339339extern fun_node_t *find_fun_node_by_path(dev_tree_t *, char *);
    340 extern fun_node_t *find_fun_node_in_device(dev_node_t *, const char *);
    341 extern fun_node_t *find_fun_node_by_class(class_list_t *, const char *, const char *);
    342340
    343341/* Device tree */
     
    361359extern dev_class_t *get_dev_class(class_list_t *, char *);
    362360extern dev_class_t *find_dev_class_no_lock(class_list_t *, const char *);
    363 extern dev_class_info_t *find_dev_in_class(dev_class_t *, const char *);
    364361extern void add_dev_class_no_lock(class_list_t *, dev_class_t *);
    365362
  • uspace/srv/devman/main.c

    r969585f r8e7d724  
    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");
     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.",
     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.", 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.",
    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.",
     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.");
     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.");
     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.",
    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.",
     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.",
    235                     (int) ftype);
     230                printf(NAME ": Error, unknown function type provided by driver!\n");
    236231
    237232                fibril_rwlock_write_unlock(&tree->rwlock);
     
    248243        }
    249244       
    250         /* Check that function with same name is not there already. */
    251         if (find_fun_node_in_device(pdev, fun_name) != NULL) {
    252                 fibril_rwlock_write_unlock(&tree->rwlock);
    253                 async_answer_0(callid, EEXISTS);
    254                 printf(NAME ": Warning, driver tried to register `%s' twice.\n",
    255                     fun_name);
    256                 free(fun_name);
    257                 return;
    258         }
    259 
    260245        fun_node_t *fun = create_fun_node();
    261246        if (!insert_fun_node(&device_tree, fun, fun_name, pdev)) {
     
    280265        fibril_rwlock_write_unlock(&tree->rwlock);
    281266       
    282         log_msg(LVL_DEBUG, "devman_add_function(fun=\"%s\")", fun->pathname);
     267        printf(NAME ": devman_add_function %s\n", fun->pathname);
    283268       
    284269        devman_receive_match_ids(match_count, &fun->match_ids);
     
    362347        devmap_register_class_dev(class_info);
    363348       
    364         log_msg(LVL_NOTE, "Function `%s' added to class `%s' as `%s'.",
    365             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);
    366351
    367352        async_answer_0(callid, EOK);
     
    378363       
    379364        initialize_running_driver(driver, &device_tree);
    380         log_msg(LVL_DEBUG, "The `%s` driver was successfully initialized.",
     365        printf(NAME ": the %s driver was successfully initialized. \n",
    381366            driver->name);
    382367        return 0;
     
    400385        fid_t fid = fibril_create(init_running_drv, driver);
    401386        if (fid == 0) {
    402                 log_msg(LVL_ERROR, "Failed to create initialization fibril " \
    403                     "for driver `%s'.", driver->name);
     387                printf(NAME ": Error creating fibril for the initialization of "
     388                    "the newly registered running driver.\n");
    404389                return;
    405390        }
     
    453438}
    454439
    455 /** Find handle for the device instance identified by device class name. */
    456 static void devman_function_get_handle_by_class(ipc_callid_t iid,
    457     ipc_call_t *icall)
    458 {
    459         char *classname;
    460         char *devname;
    461 
    462         int rc = async_data_write_accept((void **) &classname, true, 0, 0, 0, 0);
    463         if (rc != EOK) {
    464                 async_answer_0(iid, rc);
    465                 return;
    466         }
    467         rc = async_data_write_accept((void **) &devname, true, 0, 0, 0, 0);
    468         if (rc != EOK) {
    469                 free(classname);
    470                 async_answer_0(iid, rc);
    471                 return;
    472         }
    473 
    474 
    475         fun_node_t *fun = find_fun_node_by_class(&class_list,
    476             classname, devname);
    477 
    478         free(classname);
    479         free(devname);
    480 
    481         if (fun == NULL) {
    482                 async_answer_0(iid, ENOENT);
    483                 return;
    484         }
    485 
    486         async_answer_1(iid, EOK, fun->handle);
    487 }
    488 
    489440
    490441/** Function for handling connections from a client to the device manager. */
     
    506457                        devman_function_get_handle(callid, &call);
    507458                        break;
    508                 case DEVMAN_DEVICE_GET_HANDLE_BY_CLASS:
    509                         devman_function_get_handle_by_class(callid, &call);
    510                         break;
    511459                default:
    512460                        async_answer_0(callid, ENOENT);
     
    536484         */
    537485        if (dev == NULL) {
    538                 log_msg(LVL_ERROR, "IPC forwarding failed - no device or "
    539                     "function with handle %" PRIun " was found.", handle);
     486                printf(NAME ": devman_forward error - no device or function with "
     487                    "handle %" PRIun " was found.\n", handle);
    540488                async_answer_0(iid, ENOENT);
    541489                return;
     
    543491
    544492        if (fun == NULL && !drv_to_parent) {
    545                 log_msg(LVL_ERROR, NAME ": devman_forward error - cannot "
    546                     "connect to handle %" PRIun ", refers to a device.",
    547                     handle);
     493                printf(NAME ": devman_forward error - cannot connect to "
     494                    "handle %" PRIun ", refers to a device.\n", handle);
    548495                async_answer_0(iid, ENOENT);
    549496                return;
     
    566513       
    567514        if (driver == NULL) {
    568                 log_msg(LVL_ERROR, "IPC forwarding refused - " \
    569                     "the device %" PRIun "(%s) is not in usable state.",
     515                printf(NAME ": devman_forward error - the device %" PRIun \
     516                    " (%s) is not in usable state.\n",
    570517                    handle, dev->pfun->pathname);
    571518                async_answer_0(iid, ENOENT);
     
    580527       
    581528        if (driver->phone <= 0) {
    582                 log_msg(LVL_ERROR,
    583                     "Could not forward to driver `%s' (phone is %d).",
    584                     driver->name, (int) driver->phone);
     529                printf(NAME ": devman_forward: cound not forward to driver %s ",
     530                    driver->name);
     531                printf("the driver's phone is %" PRIun ").\n", driver->phone);
    585532                async_answer_0(iid, EINVAL);
    586533                return;
     
    588535
    589536        if (fun != NULL) {
    590                 log_msg(LVL_DEBUG,
    591                     "Forwarding request for `%s' function to driver `%s'.",
    592                     fun->pathname, driver->name);
     537                printf(NAME ": devman_forward: forward connection to function %s to "
     538                    "driver %s.\n", fun->pathname, driver->name);
    593539        } else {
    594                 log_msg(LVL_DEBUG,
    595                     "Forwarding request for `%s' device to driver `%s'.",
    596                     dev->pfun->pathname, driver->name);
     540                printf(NAME ": devman_forward: forward connection to device %s to "
     541                    "driver %s.\n", dev->pfun->pathname, driver->name);
    597542        }
    598543
     
    626571        async_forward_fast(iid, dev->drv->phone, DRIVER_CLIENT, fun->handle, 0,
    627572            IPC_FF_NONE);
    628         log_msg(LVL_DEBUG,
    629             "Forwarding devmapper request for `%s' function to driver `%s'.",
    630             fun->pathname, dev->drv->name);
     573        printf(NAME ": devman_connection_devmapper: forwarded connection to "
     574            "device %s to driver %s.\n", fun->pathname, dev->drv->name);
    631575}
    632576
     
    663607static bool devman_init(void)
    664608{
    665         log_msg(LVL_DEBUG, "devman_init - looking for available drivers.");
     609        printf(NAME ": devman_init - looking for available drivers.\n");
    666610       
    667611        /* Initialize list of available drivers. */
     
    669613        if (lookup_available_drivers(&drivers_list,
    670614            DRIVER_DEFAULT_STORE) == 0) {
    671                 log_msg(LVL_FATAL, "No drivers found.");
     615                printf(NAME " no drivers found.");
    672616                return false;
    673617        }
    674618
    675         log_msg(LVL_DEBUG, "devman_init - list of drivers has been initialized.");
     619        printf(NAME ": devman_init  - list of drivers has been initialized.\n");
    676620
    677621        /* Create root device node. */
    678622        if (!init_device_tree(&device_tree, &drivers_list)) {
    679                 log_msg(LVL_FATAL, "Failed to initialize device tree.");
     623                printf(NAME " failed to initialize device tree.");
    680624                return false;
    681625        }
     
    698642        printf(NAME ": HelenOS Device Manager\n");
    699643
    700         if (log_init(NAME, LVL_ERROR) != EOK) {
    701                 printf(NAME ": Error initializing logging subsystem.\n");
    702                 return -1;
    703         }
    704 
    705644        if (!devman_init()) {
    706                 log_msg(LVL_ERROR, "Error while initializing service.");
     645                printf(NAME ": Error while initializing service\n");
    707646                return -1;
    708647        }
     
    712651
    713652        /* Register device manager at naming service. */
    714         if (service_register(SERVICE_DEVMAN) != EOK) {
    715                 log_msg(LVL_ERROR, "Failed registering as a service.");
     653        if (service_register(SERVICE_DEVMAN) != EOK)
    716654                return -1;
    717         }
    718 
    719         printf(NAME ": Accepting connections.\n");
     655
     656        printf(NAME ": Accepting connections\n");
    720657        async_manager();
    721658
  • uspace/srv/devmap/devmap.c

    r969585f r8e7d724  
    551551        if (devmap_device_find_name(namespace->name, device->name) != NULL) {
    552552                printf("%s: Device '%s/%s' already registered\n", NAME,
    553                     namespace->name, device->name);
     553                    device->namespace->name, device->name);
    554554                devmap_namespace_destroy(namespace);
    555555                fibril_mutex_unlock(&devices_list_mutex);
Note: See TracChangeset for help on using the changeset viewer.