Ignore:
Timestamp:
2010-10-16T17:16:30Z (14 years ago)
Author:
Jakub Jermar <jakub@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
668f8cbf, e0e568ff, f14291b
Parents:
ef689ef0 (diff), c62ae1d6 (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 from lp:~jakub/helenos/net.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • uspace/lib/net/include/adt/module_map.h

    ref689ef0 ra7a85d16  
    2727 */
    2828
    29 /** @addtogroup net
    30  *  @{
     29/** @addtogroup libnet
     30 * @{
    3131 */
    3232
    3333/** @file
    34  *  Character string to module map.
     34 * Character string to module map.
    3535 */
    3636
    37 #ifndef __NET_MODULES_MAP_H__
    38 #define __NET_MODULES_MAP_H__
     37#ifndef LIBNET_MODULES_MAP_H_
     38#define LIBNET_MODULES_MAP_H_
    3939
    4040#include <task.h>
    41 
    4241#include <ipc/services.h>
    43 
    4442#include <net/modules.h>
    45 
    4643#include <adt/generic_char_map.h>
    4744
    4845/** Type definition of the module structure.
    49  *  @see module_struct
     46 * @see module_struct
    5047 */
    51 typedef struct module_struct    module_t;
     48typedef struct module_struct module_t;
    5249
    5350/** Type definition of the module structure pointer.
    54  *  @see module_struct
     51 * @see module_struct
    5552 */
    56 typedef module_t *                              module_ref;
     53typedef module_t *module_ref;
    5754
    5855/** Module map.
    59  *  Sorted by module names.
    60  *  @see generic_char_map.h
     56 * Sorted by module names.
     57 * @see generic_char_map.h
    6158 */
    6259GENERIC_CHAR_MAP_DECLARE(modules, module_t)
    6360
    64 /** Module structure.
    65  */
    66 struct  module_struct{
    67         /** Module task identifier if running.
    68          */
     61/** Module structure. */
     62struct module_struct {
     63        /** Module task identifier if running. */
    6964        task_id_t task_id;
    70         /** Module service identifier.
    71          */
     65        /** Module service identifier. */
    7266        services_t service;
    73         /** Module phone if running and connected.
    74          */
     67        /** Module phone if running and connected. */
    7568        int phone;
    76         /** Usage counter.
    77          */
     69        /** Usage counter. */
    7870        int usage;
    79         /** Module name.
    80          */
    81         const char * name;
    82         /** Module full path filename.
    83          */
    84         const char * filename;
    85         /** Connecting function.
    86          */
    87         connect_module_t * connect_module;
     71        /** Module name. */
     72        const char *name;
     73        /** Module full path filename. */
     74        const char *filename;
     75        /** Connecting function. */
     76        connect_module_t *connect_module;
    8877};
    8978
    90 /** Adds module to the module map.
    91  *  @param[out] module The module structure added.
    92  *  @param[in] modules The module map.
    93  *  @param[in] name The module name.
    94  *  @param[in] filename The full path filename.
    95  *  @param[in] service The module service.
    96  *  @param[in] task_id The module current task identifier. Zero (0) means not running.
    97  *  @param[in] connect_module The module connecting function.
    98  *  @returns EOK on success.
    99  *  @returns ENOMEM if there is not enough memory left.
    100  */
    101 int add_module(module_ref * module, modules_ref modules, const char * name, const char * filename, services_t service, task_id_t task_id, connect_module_t * connect_module);
    102 
    103 /** Searches and returns the specified module.
    104  *  If the module is not running, the module filaname is spawned.
    105  *  If the module is not connected, the connect_function is called.
    106  *  @param[in] modules The module map.
    107  *  @param[in] name The module name.
    108  *  @returns The running module found. It does not have to be connected.
    109  *  @returns NULL if there is no such module.
    110  */
    111 module_ref get_running_module(modules_ref modules, char * name);
    112 
    113 /** Starts the given module.
    114  *  @param[in] fname The module full or relative path filename.
    115  *  @returns The new module task identifier on success.
    116  *  @returns 0 if there is no such module.
    117  */
    118 task_id_t spawn(const char * fname);
     79extern int add_module(module_ref *, modules_ref, const char *, const char *,
     80    services_t, task_id_t, connect_module_t *);
     81extern module_ref get_running_module(modules_ref, char *);
     82extern task_id_t spawn(const char *);
    11983
    12084#endif
Note: See TracChangeset for help on using the changeset viewer.