Changeset a1b7e80 in mainline for uspace/srv/devman/devman.h


Ignore:
Timestamp:
2011-09-02T16:54:18Z (13 years ago)
Author:
Jiri Svoboda <jiri@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
f480d7e
Parents:
7a72ce1a (diff), 224c0e7 (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 basic infrastructure for anticipated device removal from
lp:~jsvoboda/helenos/devrem

File:
1 edited

Legend:

Unmodified
Added
Removed
  • uspace/srv/devman/devman.h

    r7a72ce1a ra1b7e80  
    118118} driver_list_t;
    119119
    120 /** The state of the device. */
     120/** Device state */
    121121typedef enum {
    122122        DEVICE_NOT_INITIALIZED = 0,
    123123        DEVICE_USABLE,
    124124        DEVICE_NOT_PRESENT,
    125         DEVICE_INVALID
     125        DEVICE_INVALID,
     126        /** Device node has been removed from the tree */
     127        DEVICE_REMOVED
    126128} device_state_t;
    127129
    128130/** Device node in the device tree. */
    129131struct dev_node {
     132        /** Reference count */
     133        atomic_t refcnt;
     134       
    130135        /** The global unique identifier of the device. */
    131136        devman_handle_t handle;
     
    154159};
    155160
     161/** Function state */
     162typedef enum {
     163        FUN_INIT = 0,
     164        FUN_OFF_LINE,
     165        FUN_ON_LINE,
     166        /** Function node has been removed from the tree */
     167        FUN_REMOVED
     168} fun_state_t;
     169
    156170/** Function node in the device tree. */
    157171struct fun_node {
     172        /** Reference count */
     173        atomic_t refcnt;
     174        /** State */
     175        fun_state_t state;
     176       
    158177        /** The global unique identifier of the function */
    159178        devman_handle_t handle;
     
    239258
    240259extern void add_driver(driver_list_t *, driver_t *);
    241 extern void attach_driver(dev_node_t *, driver_t *);
     260extern void attach_driver(dev_tree_t *, dev_node_t *, driver_t *);
     261extern void detach_driver(dev_tree_t *, dev_node_t *);
    242262extern void add_device(driver_t *, dev_node_t *, dev_tree_t *);
    243263extern bool start_driver(driver_t *);
     264extern int driver_dev_remove(dev_tree_t *, dev_node_t *);
     265extern int driver_fun_online(dev_tree_t *, fun_node_t *);
     266extern int driver_fun_offline(dev_tree_t *, fun_node_t *);
    244267
    245268extern driver_t *find_driver(driver_list_t *, const char *);
     
    254277extern dev_node_t *create_dev_node(void);
    255278extern void delete_dev_node(dev_node_t *node);
     279extern void dev_add_ref(dev_node_t *);
     280extern void dev_del_ref(dev_node_t *);
    256281extern dev_node_t *find_dev_node_no_lock(dev_tree_t *tree,
    257282    devman_handle_t handle);
     
    263288extern fun_node_t *create_fun_node(void);
    264289extern void delete_fun_node(fun_node_t *);
     290extern void fun_add_ref(fun_node_t *);
     291extern void fun_del_ref(fun_node_t *);
    265292extern fun_node_t *find_fun_node_no_lock(dev_tree_t *tree,
    266293    devman_handle_t handle);
    267294extern fun_node_t *find_fun_node(dev_tree_t *tree, devman_handle_t handle);
    268295extern fun_node_t *find_fun_node_by_path(dev_tree_t *, char *);
    269 extern fun_node_t *find_fun_node_in_device(dev_node_t *, const char *);
     296extern fun_node_t *find_fun_node_in_device(dev_tree_t *tree, dev_node_t *,
     297    const char *);
    270298
    271299/* Device tree */
     
    274302extern bool create_root_nodes(dev_tree_t *);
    275303extern bool insert_dev_node(dev_tree_t *, dev_node_t *, fun_node_t *);
     304extern void remove_dev_node(dev_tree_t *, dev_node_t *);
    276305extern bool insert_fun_node(dev_tree_t *, fun_node_t *, char *, dev_node_t *);
    277306extern void remove_fun_node(dev_tree_t *, fun_node_t *);
Note: See TracChangeset for help on using the changeset viewer.