Changeset 4687a26c in mainline for uspace/lib/net/include/adt/module_map.h
- Timestamp:
- 2010-11-02T18:29:01Z (14 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- 4f35b9ff
- Parents:
- 76e1121f (diff), 28f4adb (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. - File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/lib/net/include/adt/module_map.h
r76e1121f r4687a26c 27 27 */ 28 28 29 /** @addtogroup net30 * 29 /** @addtogroup libnet 30 * @{ 31 31 */ 32 32 33 33 /** @file 34 * 34 * Character string to module map. 35 35 */ 36 36 37 #ifndef __NET_MODULES_MAP_H__38 #define __NET_MODULES_MAP_H__37 #ifndef LIBNET_MODULES_MAP_H_ 38 #define LIBNET_MODULES_MAP_H_ 39 39 40 40 #include <task.h> 41 42 41 #include <ipc/services.h> 43 44 #include <net_modules.h> 45 42 #include <net/modules.h> 46 43 #include <adt/generic_char_map.h> 47 44 48 45 /** Type definition of the module structure. 49 * 46 * @see module_struct 50 47 */ 51 typedef struct module_struct 48 typedef struct module_struct module_t; 52 49 53 50 /** Type definition of the module structure pointer. 54 * 51 * @see module_struct 55 52 */ 56 typedef module_t * 53 typedef module_t *module_ref; 57 54 58 55 /** Module map. 59 * 60 * 56 * Sorted by module names. 57 * @see generic_char_map.h 61 58 */ 62 59 GENERIC_CHAR_MAP_DECLARE(modules, module_t) 63 60 64 /** Module structure. 65 */ 66 struct module_struct{ 67 /** Module task identifier if running. 68 */ 61 /** Module structure. */ 62 struct module_struct { 63 /** Module task identifier if running. */ 69 64 task_id_t task_id; 70 /** Module service identifier. 71 */ 65 /** Module service identifier. */ 72 66 services_t service; 73 /** Module phone if running and connected. 74 */ 67 /** Module phone if running and connected. */ 75 68 int phone; 76 /** Usage counter. 77 */ 69 /** Usage counter. */ 78 70 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; 88 77 }; 89 78 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); 79 extern int add_module(module_ref *, modules_ref, const char *, const char *, 80 services_t, task_id_t, connect_module_t *); 81 extern module_ref get_running_module(modules_ref, char *); 82 extern task_id_t spawn(const char *); 119 83 120 84 #endif
Note:
See TracChangeset
for help on using the changeset viewer.