Changeset 084ff99 in mainline for uspace/srv/devman/devman.h
- Timestamp:
- 2010-03-14T09:14:50Z (15 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- 7707954
- Parents:
- 67ba309
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/srv/devman/devman.h
r67ba309 r084ff99 41 41 #include <ipc/ipc.h> 42 42 #include <fibril_synch.h> 43 #include <atomic.h> 43 44 44 45 #include "util.h" … … 115 116 /** Representation of a node in the device tree.*/ 116 117 struct node { 118 /** The global unique identifier of the device.*/ 119 long handle; 117 120 /** The node of the parent device. */ 118 121 node_t *parent; … … 137 140 /** Root device node. */ 138 141 node_t *root_node; 142 atomic_t current_handle; 139 143 } dev_tree_t; 140 144 … … 191 195 void add_driver(driver_list_t *drivers_list, driver_t *drv); 192 196 void attach_driver(node_t *node, driver_t *drv); 193 void add_device( driver_t *drv, node_t *node);197 void add_device(int phone, driver_t *drv, node_t *node); 194 198 bool start_driver(driver_t *drv); 195 199 … … 230 234 231 235 // Device nodes 232 node_t * create_root_node();233 236 234 237 static inline node_t * create_dev_node() … … 238 241 memset(res, 0, sizeof(node_t)); 239 242 } 243 244 list_initialize(&res->children); 245 list_initialize(&res->match_ids.ids); 246 240 247 return res; 241 248 } 242 249 243 static inline void init_dev_node(node_t *node, node_t *parent) 244 { 245 assert(NULL != node); 250 static inline void insert_dev_node(dev_tree_t *tree, node_t *node, node_t *parent) 251 { 252 assert(NULL != node && NULL != tree); 253 254 node->handle = atomic_postinc(&tree->current_handle); 246 255 247 256 node->parent = parent; 248 257 if (NULL != parent) { 258 fibril_mutex_lock(&parent->children_mutex); 249 259 list_append(&node->sibling, &parent->children); 260 fibril_mutex_unlock(&parent->children_mutex); 250 261 } 251 252 list_initialize(&node->children);253 254 list_initialize(&node->match_ids.ids);255 262 } 256 263 … … 259 266 260 267 bool init_device_tree(dev_tree_t *tree, driver_list_t *drivers_list); 268 bool create_root_node(dev_tree_t *tree); 261 269 262 270
Note:
See TracChangeset
for help on using the changeset viewer.