Ignore:
File:
1 edited

Legend:

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

    r01b87dc5 r47a7174f  
    4646#include <str.h>
    4747#include <ipc/devmap.h>
    48 #include <assert.h>
    4948
    5049#define NAME          "devmap"
     
    209208}
    210209
    211 /** Find namespace with given name. */
     210/** Find namespace with given name.
     211 *
     212 * The devices_list_mutex should be already held when
     213 * calling this function.
     214 *
     215 */
    212216static devmap_namespace_t *devmap_namespace_find_name(const char *name)
    213217{
    214218        link_t *item;
    215        
    216         assert(fibril_mutex_is_locked(&devices_list_mutex));
    217        
    218219        for (item = namespaces_list.next; item != &namespaces_list; item = item->next) {
    219220                devmap_namespace_t *namespace =
     
    228229/** Find namespace with given handle.
    229230 *
     231 * The devices_list_mutex should be already held when
     232 * calling this function.
     233 *
    230234 * @todo: use hash table
    231235 *
     
    234238{
    235239        link_t *item;
    236        
    237         assert(fibril_mutex_is_locked(&devices_list_mutex));
    238        
    239240        for (item = namespaces_list.next; item != &namespaces_list; item = item->next) {
    240241                devmap_namespace_t *namespace =
     
    247248}
    248249
    249 /** Find device with given name. */
     250/** Find device with given name.
     251 *
     252 * The devices_list_mutex should be already held when
     253 * calling this function.
     254 *
     255 */
    250256static devmap_device_t *devmap_device_find_name(const char *ns_name,
    251257    const char *name)
    252258{
    253259        link_t *item;
    254        
    255         assert(fibril_mutex_is_locked(&devices_list_mutex));
    256        
    257260        for (item = devices_list.next; item != &devices_list; item = item->next) {
    258261                devmap_device_t *device =
     
    268271/** Find device with given handle.
    269272 *
     273 * The devices_list_mutex should be already held when
     274 * calling this function.
     275 *
    270276 * @todo: use hash table
    271277 *
     
    274280{
    275281        link_t *item;
    276        
    277         assert(fibril_mutex_is_locked(&devices_list_mutex));
    278        
    279282        for (item = devices_list.next; item != &devices_list; item = item->next) {
    280283                devmap_device_t *device =
     
    287290}
    288291
    289 /** Create a namespace (if not already present). */
     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 */
    290298static devmap_namespace_t *devmap_namespace_create(const char *ns_name)
    291299{
    292         devmap_namespace_t *namespace;
    293        
    294         assert(fibril_mutex_is_locked(&devices_list_mutex));
    295        
    296         namespace = devmap_namespace_find_name(ns_name);
     300        devmap_namespace_t *namespace = devmap_namespace_find_name(ns_name);
    297301        if (namespace != NULL)
    298302                return namespace;
     
    319323}
    320324
    321 /** Destroy a namespace (if it is no longer needed). */
     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 */
    322331static void devmap_namespace_destroy(devmap_namespace_t *namespace)
    323332{
    324         assert(fibril_mutex_is_locked(&devices_list_mutex));
    325 
    326333        if (namespace->refcnt == 0) {
    327334                list_remove(&(namespace->namespaces));
     
    332339}
    333340
    334 /** Increase namespace reference count by including device. */
     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 */
    335347static void devmap_namespace_addref(devmap_namespace_t *namespace,
    336348    devmap_device_t *device)
    337349{
    338         assert(fibril_mutex_is_locked(&devices_list_mutex));
    339 
    340350        device->namespace = namespace;
    341351        namespace->refcnt++;
    342352}
    343353
    344 /** Decrease namespace reference count. */
     354/** Decrease namespace reference count
     355 *
     356 * The devices_list_mutex should be already held when
     357 * calling this function.
     358 *
     359 */
    345360static void devmap_namespace_delref(devmap_namespace_t *namespace)
    346361{
    347         assert(fibril_mutex_is_locked(&devices_list_mutex));
    348 
    349362        namespace->refcnt--;
    350363        devmap_namespace_destroy(namespace);
    351364}
    352365
    353 /** Unregister device and free it. */
     366/** Unregister device and free it
     367 *
     368 * The devices_list_mutex should be already held when
     369 * calling this function.
     370 *
     371 */
    354372static void devmap_device_unregister_core(devmap_device_t *device)
    355373{
    356         assert(fibril_mutex_is_locked(&devices_list_mutex));
    357 
    358374        devmap_namespace_delref(device->namespace);
    359375        list_remove(&(device->devices));
     
    607623       
    608624        if (dev->forward_interface == 0) {
     625                /* The IPC_GET_ARG3(*icall) would be always zero,
     626                 * wouldn't it? So why to pass it at all?
     627                 */
    609628                ipc_forward_fast(callid, dev->driver->phone,
    610629                    dev->handle, 0, 0,
Note: See TracChangeset for help on using the changeset viewer.