Changeset 07b39338 in mainline for uspace/srv/devman/devman.h
- Timestamp:
- 2011-08-20T18:21:49Z (14 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- 6ab014d
- Parents:
- 0cf27ee (diff), f00af83 (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/srv/devman/devman.h
r0cf27ee r07b39338 1 1 /* 2 2 * Copyright (c) 2010 Lenka Trochtova 3 * Copyright (c) 2011 Jiri Svoboda 3 4 * All rights reserved. 4 5 * … … 53 54 #define DEVICE_BUCKETS 256 54 55 55 #define LOC_CLASS_NAMESPACE "class"56 56 #define LOC_DEVICE_NAMESPACE "devices" 57 57 #define LOC_SEPARATOR '\\' … … 155 155 /** Name of the function, assigned by the device driver */ 156 156 char *name; 157 /** Function type */ 158 fun_type_t ftype; 157 159 158 160 /** Full path and name of the device in device hierarchy */ … … 170 172 match_id_list_t match_ids; 171 173 172 /** List of device classes to which this device function belongs. */173 list_t classes;174 174 /** Service ID if the device function is registered with loc. */ 175 175 service_id_t service_id; … … 214 214 } dev_tree_t; 215 215 216 typedef struct dev_class {217 /** The name of the class. */218 const char *name;219 220 /**221 * Pointer to the previous and next class in the list of registered222 * classes.223 */224 link_t link;225 226 /**227 * List of dev_class_info structures - one for each device registered by228 * this class.229 */230 list_t devices;231 232 /**233 * Default base name for the device within the class, might be overrided234 * by the driver.235 */236 const char *base_dev_name;237 238 /** Unique numerical identifier of the newly added device. */239 size_t curr_dev_idx;240 /** Synchronize access to the list of devices in this class. */241 fibril_mutex_t mutex;242 } dev_class_t;243 244 /**245 * Provides n-to-m mapping between function nodes and classes - each function246 * can register in an arbitrary number of classes and each class can contain247 * an arbitrary number of device functions.248 */249 typedef struct dev_class_info {250 /** The class. */251 dev_class_t *dev_class;252 /** The device. */253 fun_node_t *fun;254 255 /**256 * Pointer to the previous and next class info in the list of devices257 * registered by the class.258 */259 link_t link;260 261 /**262 * Pointer to the previous and next class info in the list of classes263 * by which the device is registered.264 */265 link_t dev_classes;266 267 /** The name of the device function within the class. */268 char *dev_name;269 /** Service ID in the class namespace. */270 service_id_t service_id;271 272 /**273 * Link to hash table of services registered with location service using274 * their class names.275 */276 link_t loc_link;277 } dev_class_info_t;278 279 /** The list of device classes. */280 typedef struct class_list {281 /** List of classes. */282 list_t classes;283 284 /**285 * Hash table of services registered with location service using their286 * class name, indexed by service IDs.287 */288 hash_table_t loc_functions;289 290 /** Fibril mutex for list of classes. */291 fibril_rwlock_t rwlock;292 } class_list_t;293 294 216 /* Match ids and scores */ 295 217 … … 313 235 extern void add_driver(driver_list_t *, driver_t *); 314 236 extern void attach_driver(dev_node_t *, driver_t *); 315 extern void add_device( async_sess_t *,driver_t *, dev_node_t *, dev_tree_t *);237 extern void add_device(driver_t *, dev_node_t *, dev_tree_t *); 316 238 extern bool start_driver(driver_t *); 317 239 … … 331 253 extern dev_node_t *find_dev_node(dev_tree_t *tree, devman_handle_t handle); 332 254 extern dev_node_t *find_dev_function(dev_node_t *, const char *); 255 extern int dev_get_functions(dev_tree_t *tree, dev_node_t *, devman_handle_t *, 256 size_t, size_t *); 333 257 334 258 extern fun_node_t *create_fun_node(void); … … 339 263 extern fun_node_t *find_fun_node_by_path(dev_tree_t *, char *); 340 264 extern fun_node_t *find_fun_node_in_device(dev_node_t *, const char *); 341 extern fun_node_t *find_fun_node_by_class(class_list_t *, const char *, const char *);342 265 343 266 /* Device tree */ … … 347 270 extern bool insert_dev_node(dev_tree_t *, dev_node_t *, fun_node_t *); 348 271 extern bool insert_fun_node(dev_tree_t *, fun_node_t *, char *, dev_node_t *); 349 350 /* Device classes */ 351 352 extern dev_class_t *create_dev_class(void); 353 extern dev_class_info_t *create_dev_class_info(void); 354 extern size_t get_new_class_dev_idx(dev_class_t *); 355 extern char *create_dev_name_for_class(dev_class_t *, const char *); 356 extern dev_class_info_t *add_function_to_class(fun_node_t *, dev_class_t *, 357 const char *); 358 359 extern void init_class_list(class_list_t *); 360 361 extern dev_class_t *get_dev_class(class_list_t *, char *); 362 extern dev_class_t *find_dev_class_no_lock(class_list_t *, const char *); 363 extern dev_class_info_t *find_dev_in_class(dev_class_t *, const char *); 364 extern void add_dev_class_no_lock(class_list_t *, dev_class_t *); 272 extern void remove_fun_node(dev_tree_t *, fun_node_t *); 365 273 366 274 /* Loc services */ … … 369 277 370 278 extern fun_node_t *find_loc_tree_function(dev_tree_t *, service_id_t); 371 extern fun_node_t *find_loc_class_function(class_list_t *, service_id_t); 372 373 extern void class_add_loc_function(class_list_t *, dev_class_info_t *); 279 374 280 extern void tree_add_loc_function(dev_tree_t *, fun_node_t *); 375 281
Note:
See TracChangeset
for help on using the changeset viewer.