Fork us on GitHub Follow us on Facebook Follow us on Twitter

Changeset 5f7d96e in mainline for uspace/srv/devmap/devmap.c


Ignore:
Timestamp:
2010-12-27T18:18:03Z (11 years ago)
Author:
Matus Dekanek <smekideki@…>
Branches:
lfn, master
Children:
43c3937
Parents:
e080332 (diff), e84d65a (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 from development

File:
1 edited

Legend:

Unmodified
Added
Removed
  • uspace/srv/devmap/devmap.c

    re080332 r5f7d96e  
    4646#include <str.h>
    4747#include <ipc/devmap.h>
     48#include <assert.h>
    4849
    4950#define NAME          "devmap"
     
    208209}
    209210
    210 /** Find namespace with given name.
    211  *
    212  * The devices_list_mutex should be already held when
    213  * calling this function.
    214  *
    215  */
     211/** Find namespace with given name. */
    216212static devmap_namespace_t *devmap_namespace_find_name(const char *name)
    217213{
    218214        link_t *item;
     215       
     216        assert(fibril_mutex_is_locked(&devices_list_mutex));
     217       
    219218        for (item = namespaces_list.next; item != &namespaces_list; item = item->next) {
    220219                devmap_namespace_t *namespace =
     
    229228/** Find namespace with given handle.
    230229 *
    231  * The devices_list_mutex should be already held when
    232  * calling this function.
    233  *
    234230 * @todo: use hash table
    235231 *
     
    238234{
    239235        link_t *item;
     236       
     237        assert(fibril_mutex_is_locked(&devices_list_mutex));
     238       
    240239        for (item = namespaces_list.next; item != &namespaces_list; item = item->next) {
    241240                devmap_namespace_t *namespace =
     
    248247}
    249248
    250 /** Find device with given name.
    251  *
    252  * The devices_list_mutex should be already held when
    253  * calling this function.
    254  *
    255  */
     249/** Find device with given name. */
    256250static devmap_device_t *devmap_device_find_name(const char *ns_name,
    257251    const char *name)
    258252{
    259253        link_t *item;
     254       
     255        assert(fibril_mutex_is_locked(&devices_list_mutex));
     256       
    260257        for (item = devices_list.next; item != &devices_list; item = item->next) {
    261258                devmap_device_t *device =
     
    271268/** Find device with given handle.
    272269 *
    273  * The devices_list_mutex should be already held when
    274  * calling this function.
    275  *
    276270 * @todo: use hash table
    277271 *
     
    280274{
    281275        link_t *item;
     276       
     277        assert(fibril_mutex_is_locked(&devices_list_mutex));
     278       
    282279        for (item = devices_list.next; item != &devices_list; item = item->next) {
    283280                devmap_device_t *device =
     
    290287}
    291288
    292 /** Create a namespace (if not already present)
    293  *
    294  * The devices_list_mutex should be already held when
    295  * calling this function.
    296  *
    297  */
     289/** Create a namespace (if not already present). */
    298290static devmap_namespace_t *devmap_namespace_create(const char *ns_name)
    299291{
    300         devmap_namespace_t *namespace = devmap_namespace_find_name(ns_name);
     292        devmap_namespace_t *namespace;
     293       
     294        assert(fibril_mutex_is_locked(&devices_list_mutex));
     295       
     296        namespace = devmap_namespace_find_name(ns_name);
    301297        if (namespace != NULL)
    302298                return namespace;
     
    323319}
    324320
    325 /** Destroy a namespace (if it is no longer needed)
    326  *
    327  * The devices_list_mutex should be already held when
    328  * calling this function.
    329  *
    330  */
     321/** Destroy a namespace (if it is no longer needed). */
    331322static void devmap_namespace_destroy(devmap_namespace_t *namespace)
    332323{
     324        assert(fibril_mutex_is_locked(&devices_list_mutex));
     325
    333326        if (namespace->refcnt == 0) {
    334327                list_remove(&(namespace->namespaces));
     
    339332}
    340333
    341 /** Increase namespace reference count by including device
    342  *
    343  * The devices_list_mutex should be already held when
    344  * calling this function.
    345  *
    346  */
     334/** Increase namespace reference count by including device. */
    347335static void devmap_namespace_addref(devmap_namespace_t *namespace,
    348336    devmap_device_t *device)
    349337{
     338        assert(fibril_mutex_is_locked(&devices_list_mutex));
     339
    350340        device->namespace = namespace;
    351341        namespace->refcnt++;
    352342}
    353343
    354 /** Decrease namespace reference count
    355  *
    356  * The devices_list_mutex should be already held when
    357  * calling this function.
    358  *
    359  */
     344/** Decrease namespace reference count. */
    360345static void devmap_namespace_delref(devmap_namespace_t *namespace)
    361346{
     347        assert(fibril_mutex_is_locked(&devices_list_mutex));
     348
    362349        namespace->refcnt--;
    363350        devmap_namespace_destroy(namespace);
    364351}
    365352
    366 /** Unregister device and free it
    367  *
    368  * The devices_list_mutex should be already held when
    369  * calling this function.
    370  *
    371  */
     353/** Unregister device and free it. */
    372354static void devmap_device_unregister_core(devmap_device_t *device)
    373355{
     356        assert(fibril_mutex_is_locked(&devices_list_mutex));
     357
    374358        devmap_namespace_delref(device->namespace);
    375359        list_remove(&(device->devices));
Note: See TracChangeset for help on using the changeset viewer.