Ignore:
File:
1 edited

Legend:

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

    rb72efe8 r9934f7d  
    5757 */
    5858typedef struct {
    59         /** Link to drivers_list */
     59        /** Pointers to previous and next drivers in linked list */
    6060        link_t drivers;
    6161       
    62         /** List of devices controlled by this driver */
    63         list_t devices;
     62        /** Pointer to the linked list of devices controlled by this driver */
     63        link_t devices;
    6464       
    6565        /** Session asociated with this driver */
     
    7777 */
    7878typedef struct {
    79         /** Link to namespaces_list */
     79        /** Pointer to the previous and next device in the list of all namespaces */
    8080        link_t namespaces;
    8181       
     
    9494 */
    9595typedef struct {
    96         /** Link to global list of devices (devices_list) */
     96        /** Pointer to the previous and next device in the list of all devices */
    9797        link_t devices;
    98         /** Link to driver list of devices (devmap_driver_t.devices) */
     98        /** Pointer to the previous and next device in the list of devices
     99            owned by one driver */
    99100        link_t driver_devices;
    100101        /** Unique device identifier */
     
    224225static devmap_namespace_t *devmap_namespace_find_name(const char *name)
    225226{
     227        link_t *item;
     228       
    226229        assert(fibril_mutex_is_locked(&devices_list_mutex));
    227230       
    228         list_foreach(namespaces_list, item) {
     231        for (item = namespaces_list.next; item != &namespaces_list; item = item->next) {
    229232                devmap_namespace_t *namespace =
    230233                    list_get_instance(item, devmap_namespace_t, namespaces);
     
    243246static devmap_namespace_t *devmap_namespace_find_handle(devmap_handle_t handle)
    244247{
     248        link_t *item;
     249       
    245250        assert(fibril_mutex_is_locked(&devices_list_mutex));
    246251       
    247         list_foreach(namespaces_list, item) {
     252        for (item = namespaces_list.next; item != &namespaces_list; item = item->next) {
    248253                devmap_namespace_t *namespace =
    249254                    list_get_instance(item, devmap_namespace_t, namespaces);
     
    259264    const char *name)
    260265{
     266        link_t *item;
     267       
    261268        assert(fibril_mutex_is_locked(&devices_list_mutex));
    262269       
    263         list_foreach(devices_list, item) {
     270        for (item = devices_list.next; item != &devices_list; item = item->next) {
    264271                devmap_device_t *device =
    265272                    list_get_instance(item, devmap_device_t, devices);
     
    279286static devmap_device_t *devmap_device_find_handle(devmap_handle_t handle)
    280287{
     288        link_t *item;
     289       
    281290        assert(fibril_mutex_is_locked(&devices_list_mutex));
    282291       
    283         list_foreach(devices_list, item) {
     292        for (item = devices_list.next; item != &devices_list; item = item->next) {
    284293                devmap_device_t *device =
    285294                    list_get_instance(item, devmap_device_t, devices);
     
    464473        fibril_mutex_lock(&driver->devices_mutex);
    465474       
    466         while (!list_empty(&driver->devices)) {
    467                 devmap_device_t *device = list_get_instance(
    468                     list_first(&driver->devices), devmap_device_t,
    469                     driver_devices);
     475        while (!list_empty(&(driver->devices))) {
     476                devmap_device_t *device = list_get_instance(driver->devices.next,
     477                    devmap_device_t, driver_devices);
    470478                devmap_device_unregister_core(device);
    471479        }
     
    807815        }
    808816       
     817        link_t *item;
    809818        size_t pos = 0;
    810         list_foreach(namespaces_list, item) {
     819        for (item = namespaces_list.next; item != &namespaces_list;
     820            item = item->next) {
    811821                devmap_namespace_t *namespace =
    812822                    list_get_instance(item, devmap_namespace_t, namespaces);
     
    871881        }
    872882       
     883        link_t *item;
    873884        size_t pos = 0;
    874         list_foreach(devices_list, item) {
     885        for (item = devices_list.next; item != &devices_list; item = item->next) {
    875886                devmap_device_t *device =
    876887                    list_get_instance(item, devmap_device_t, devices);
Note: See TracChangeset for help on using the changeset viewer.