Changeset e2a6b72 in mainline for uspace/lib/c/include/ipc/logger.h


Ignore:
Timestamp:
2012-10-15T16:28:58Z (13 years ago)
Author:
Jan Vesely <jano.vesely@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
b3ab8f7
Parents:
7eb49f4 (diff), c4c2406 (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 and io improvements.

File:
1 moved

Legend:

Unmodified
Added
Removed
  • uspace/lib/c/include/ipc/logger.h

    r7eb49f4 re2a6b72  
    11/*
    2  * Copyright (c) 2006 Jakub Jermar
    3  * Copyright (c) 2011 Radim Vansa
     2 * Copyright (c) 2012 Vojtech Horky
    43 * All rights reserved.
    54 *
     
    3130 * @{
    3231 */
    33 /** @file
    34  */
    3532
    36 #ifndef LIBC_HASH_SET_H_
    37 #define LIBC_HASH_SET_H_
     33#ifndef LIBC_IPC_LOGGER_H_
     34#define LIBC_IPC_LOGGER_H_
    3835
    39 #include <adt/list.h>
    40 #include <unistd.h>
     36#include <ipc/common.h>
    4137
    42 #define HASH_SET_MIN_SIZE  8
     38typedef enum {
     39        /** Set (global) default displayed logging level.
     40         *
     41         * Arguments: new log level.
     42         * Returns: error code
     43         */
     44        LOGGER_CONTROL_SET_DEFAULT_LEVEL = IPC_FIRST_USER_METHOD,
     45        /** Set displayed level for given log.
     46         *
     47         * Arguments: new log level.
     48         * Returns: error code
     49         * Followed by: string with full log name.
     50         */
     51        LOGGER_CONTROL_SET_LOG_LEVEL
     52} logger_control_request_t;
    4353
    44 typedef unsigned long (*hash_set_hash)(const link_t *);
    45 typedef int (*hash_set_equals)(const link_t *, const link_t *);
     54typedef enum {
     55        /** Create new log.
     56         *
     57         * Arguments: parent log id (0 for top-level log).
     58         * Returns: error code, log id
     59         * Followed by: string with log name.
     60         */
     61        LOGGER_WRITER_CREATE_LOG = IPC_FIRST_USER_METHOD,
     62        /** Write a message to a given log.
     63         *
     64         * Arguments: log id, message severity level (log_level_t)
     65         * Returns: error code
     66         * Followed by: string with the message.
     67         */
     68        LOGGER_WRITER_MESSAGE
     69} logger_writer_request_t;
    4670
    47 /** Hash table structure. */
    48 typedef struct {
    49         list_t *table;
    50        
    51         /** Current table size */
    52         size_t size;
    53        
    54         /**
    55          * Current number of entries. If count > size,
    56          * the table is rehashed into table with double
    57          * size. If (4 * count < size) && (size > min_size),
    58          * the table is rehashed into table with half the size.
    59          */
    60         size_t count;
    61        
    62         /** Hash function */
    63         hash_set_hash hash;
    64        
    65         /** Hash table item equals function */
    66         hash_set_equals equals;
    67 } hash_set_t;
    68 
    69 extern int hash_set_init(hash_set_t *, hash_set_hash, hash_set_equals, size_t);
    70 extern int hash_set_insert(hash_set_t *, link_t *);
    71 extern link_t *hash_set_find(hash_set_t *, const link_t *);
    72 extern int hash_set_contains(const hash_set_t *, const link_t *);
    73 extern size_t hash_set_count(const hash_set_t *);
    74 extern link_t *hash_set_remove(hash_set_t *, const link_t *);
    75 extern void hash_set_remove_selected(hash_set_t *,
    76     int (*)(link_t *, void *), void *);
    77 extern void hash_set_destroy(hash_set_t *);
    78 extern void hash_set_apply(hash_set_t *, void (*)(link_t *, void *), void *);
    79 extern void hash_set_clear(hash_set_t *, void (*)(link_t *, void *), void *);
     71typedef enum {
     72        /** Interface for controlling logger behavior. */
     73        LOGGER_INTERFACE_CONTROL,
     74        /** Interface for servers writing to the log. */
     75        LOGGER_INTERFACE_WRITER
     76} logger_interface_t;
    8077
    8178#endif
Note: See TracChangeset for help on using the changeset viewer.