Changeset 9413c0d in mainline for uspace/srv/vfs/vfs_rdwr.c


Ignore:
Timestamp:
2008-01-06T12:50:51Z (16 years ago)
Author:
Jakub Jermar <jakub@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
b3c38750
Parents:
f57f8ea
Message:

Add basic rwlock API for uspace so that VFS can be designed/implemented using
this API. So far, the implementation of this API merely wraps futexes into
rwlocks. Real rwlocks are wanted by ticket #54.

Using the new rwlock API, replace the VFS node content futex with an rwlock.
Lock the contents rwlock as reader on reads and as writer on writes.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • uspace/srv/vfs/vfs_rdwr.c

    rf57f8ea r9413c0d  
    4040#include <async.h>
    4141#include <errno.h>
    42 #include <futex.h>
     42#include <rwlock.h>
    4343
    4444static void vfs_rdwr(ipc_callid_t rid, ipc_call_t *request, bool read)
     
    8686         * the same time.
    8787         */
    88         futex_down(&file->node->contents_futex);
     88        if (read)
     89                rwlock_reader_lock(&file->node->contents_rwlock);
     90        else
     91                rwlock_writer_lock(&file->node->contents_rwlock);
    8992
    9093        int fs_phone = vfs_grab_phone(file->node->fs_handle);   
     
    118121         * Unlock the VFS node.
    119122         */
    120         futex_up(&file->node->contents_futex);
     123        if (read)
     124                rwlock_reader_unlock(&file->node->contents_rwlock);
     125        else
     126                rwlock_writer_unlock(&file->node->contents_rwlock);
    121127
    122128        /*
Note: See TracChangeset for help on using the changeset viewer.