Changes in uspace/srv/devman/devman.h [3e6a98c5:e5556e4a] in mainline
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/srv/devman/devman.h
r3e6a98c5 re5556e4a 35 35 #define DEVMAN_H_ 36 36 37 #include <assert.h>38 37 #include <stdbool.h> 39 #include <dirent.h>40 #include <str.h>41 38 #include <adt/list.h> 42 39 #include <adt/hash_table.h> … … 51 48 #define NAME "devman" 52 49 53 #define MATCH_EXT ".ma"54 55 50 #define LOC_DEVICE_NAMESPACE "devices" 56 51 #define LOC_SEPARATOR '\\' … … 67 62 } client_t; 68 63 69 typedef enum {70 /** Driver has not been started. */71 DRIVER_NOT_STARTED = 0,72 73 /**74 * Driver has been started, but has not registered as running and ready75 * to receive requests.76 */77 DRIVER_STARTING,78 79 /** Driver is running and prepared to serve incomming requests. */80 DRIVER_RUNNING81 } driver_state_t;82 83 64 /** Representation of device driver. */ 84 65 typedef struct driver { 85 66 /** Pointers to previous and next drivers in a linked list. */ 86 67 link_t drivers; 68 /** Handle */ 69 devman_handle_t handle; 87 70 88 71 /** … … 90 73 * and prepared to receive requests. 91 74 */ 92 int state;75 driver_state_t state; 93 76 94 77 /** Session asociated with this driver. */ … … 115 98 /** Fibril mutex for list of drivers. */ 116 99 fibril_mutex_t drivers_mutex; 100 /** Next free handle */ 101 devman_handle_t next_handle; 117 102 } driver_list_t; 118 103 … … 238 223 } dev_tree_t; 239 224 240 /* Match ids and scores */241 242 extern int get_match_score(driver_t *, dev_node_t *);243 244 extern bool parse_match_ids(char *, match_id_list_t *);245 extern bool read_match_ids(const char *, match_id_list_t *);246 extern char *read_match_id(char **);247 extern char *read_id(const char **);248 249 /* Drivers */250 251 extern void init_driver_list(driver_list_t *);252 extern driver_t *create_driver(void);253 extern bool get_driver_info(const char *, const char *, driver_t *);254 extern int lookup_available_drivers(driver_list_t *, const char *);255 256 extern driver_t *find_best_match_driver(driver_list_t *, dev_node_t *);257 extern bool assign_driver(dev_node_t *, driver_list_t *, dev_tree_t *);258 259 extern void add_driver(driver_list_t *, driver_t *);260 extern void attach_driver(dev_tree_t *, dev_node_t *, driver_t *);261 extern void detach_driver(dev_tree_t *, dev_node_t *);262 extern void add_device(driver_t *, dev_node_t *, dev_tree_t *);263 extern bool start_driver(driver_t *);264 extern int driver_dev_remove(dev_tree_t *, dev_node_t *);265 extern int driver_dev_gone(dev_tree_t *, dev_node_t *);266 extern int driver_fun_online(dev_tree_t *, fun_node_t *);267 extern int driver_fun_offline(dev_tree_t *, fun_node_t *);268 269 extern driver_t *find_driver(driver_list_t *, const char *);270 extern void initialize_running_driver(driver_t *, dev_tree_t *);271 272 extern void init_driver(driver_t *);273 extern void clean_driver(driver_t *);274 extern void delete_driver(driver_t *);275 276 /* Device nodes */277 278 extern dev_node_t *create_dev_node(void);279 extern void delete_dev_node(dev_node_t *node);280 extern void dev_add_ref(dev_node_t *);281 extern void dev_del_ref(dev_node_t *);282 283 extern dev_node_t *find_dev_node_no_lock(dev_tree_t *tree,284 devman_handle_t handle);285 extern dev_node_t *find_dev_node(dev_tree_t *tree, devman_handle_t handle);286 extern dev_node_t *find_dev_function(dev_node_t *, const char *);287 extern int dev_get_functions(dev_tree_t *tree, dev_node_t *, devman_handle_t *,288 size_t, size_t *);289 290 extern fun_node_t *create_fun_node(void);291 extern void delete_fun_node(fun_node_t *);292 extern void fun_add_ref(fun_node_t *);293 extern void fun_del_ref(fun_node_t *);294 extern void fun_busy_lock(fun_node_t *);295 extern void fun_busy_unlock(fun_node_t *);296 extern fun_node_t *find_fun_node_no_lock(dev_tree_t *tree,297 devman_handle_t handle);298 extern fun_node_t *find_fun_node(dev_tree_t *tree, devman_handle_t handle);299 extern fun_node_t *find_fun_node_by_path(dev_tree_t *, char *);300 extern fun_node_t *find_fun_node_in_device(dev_tree_t *tree, dev_node_t *,301 const char *);302 303 /* Device tree */304 305 extern bool init_device_tree(dev_tree_t *, driver_list_t *);306 extern bool create_root_nodes(dev_tree_t *);307 extern bool insert_dev_node(dev_tree_t *, dev_node_t *, fun_node_t *);308 extern void remove_dev_node(dev_tree_t *, dev_node_t *);309 extern bool insert_fun_node(dev_tree_t *, fun_node_t *, char *, dev_node_t *);310 extern void remove_fun_node(dev_tree_t *, fun_node_t *);311 312 /* Loc services */313 314 extern void loc_register_tree_function(fun_node_t *, dev_tree_t *);315 316 extern fun_node_t *find_loc_tree_function(dev_tree_t *, service_id_t);317 318 extern void tree_add_loc_function(dev_tree_t *, fun_node_t *);319 320 225 #endif 321 226
Note:
See TracChangeset
for help on using the changeset viewer.