Changeset 694ca93f in mainline for uspace/lib/drv/generic/log.c


Ignore:
Timestamp:
2011-05-01T19:34:26Z (13 years ago)
Author:
Martin Sucha <sucha14@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
0e26444
Parents:
1ff896e (diff), 042fbe0 (diff)
Note: this is a merge changeset, the changes displayed below correspond to the merge itself.
Use the (diff) links above to see all the changes relative to each parent.
Message:

Merge mainline changes

File:
1 moved

Legend:

Unmodified
Added
Removed
  • uspace/lib/drv/generic/log.c

    r1ff896e r694ca93f  
    11/*
    2  * Copyright (c) 2007 Jan Hudecek
    3  * Copyright (c) 2008 Martin Decky
     2 * Copyright (c) 2011 Jiri Svoboda
    43 * All rights reserved.
    54 *
     
    2827 */
    2928
    30 /** @addtogroup genericproc
     29/** @addtogroup libdrv
    3130 * @{
    3231 */
    33 /** @file tasklet.c
    34  *  @brief Tasklet implementation
     32
     33#include <io/log.h>
     34#include <stdarg.h>
     35
     36#include <ddf/log.h>
     37
     38/** Initialize the logging system.
     39 *
     40 * @param drv_name      Driver name, will be printed as part of message
     41 * @param level         Minimum message level to print
    3542 */
    36 
    37 #include <proc/tasklet.h>
    38 #include <synch/spinlock.h>
    39 #include <mm/slab.h>
    40 #include <config.h>
    41 
    42 /** Spinlock protecting list of tasklets */
    43 SPINLOCK_INITIALIZE(tasklet_lock);
    44 
    45 /** Array of tasklet lists for every CPU */
    46 tasklet_descriptor_t **tasklet_list;
    47 
    48 void tasklet_init(void)
     43int ddf_log_init(const char *drv_name, log_level_t level)
    4944{
    50         unsigned int i;
    51        
    52         tasklet_list = malloc(sizeof(tasklet_descriptor_t *) * config.cpu_count, 0);
    53         if (!tasklet_list)
    54                 panic("Error initializing tasklets.");
    55        
    56         for (i = 0; i < config.cpu_count; i++)
    57                 tasklet_list[i] = NULL;
    58        
    59         spinlock_initialize(&tasklet_lock, "tasklet_lock");
     45        return log_init(drv_name, level);
    6046}
    6147
     48/** Log a driver message.
     49 *
     50 * @param level         Message verbosity level. Message is only printed
     51 *                      if verbosity is less than or equal to current
     52 *                      reporting level.
     53 * @param fmt           Format string (no trailing newline)
     54 */
     55void ddf_msg(log_level_t level, const char *fmt, ...)
     56{
     57        va_list args;
     58
     59        va_start(args, fmt);
     60        log_msgv(level, fmt, args);
     61        va_end(args);
     62}
    6263
    6364/** @}
Note: See TracChangeset for help on using the changeset viewer.