Subversion Repositories HelenOS

Compare Revisions

Ignore whitespace Rev 2687 → Rev 2688

/trunk/uspace/lib/libc/include/rwlock.h
48,10 → 48,10
rwlock_t rwlock = FUTEX_INITIALIZER
 
#define rwlock_initialize(rwlock) futex_initialize((rwlock), 1)
#define rwlock_reader_lock(rwlock) futex_down((rwlock))
#define rwlock_writer_lock(rwlock) futex_down((rwlock))
#define rwlock_reader_unlock(rwlock) futex_up((rwlock))
#define rwlock_writer_unlock(rwlock) futex_up((rwlock))
#define rwlock_read_lock(rwlock) futex_down((rwlock))
#define rwlock_write_lock(rwlock) futex_down((rwlock))
#define rwlock_read_unlock(rwlock) futex_up((rwlock))
#define rwlock_write_unlock(rwlock) futex_up((rwlock))
 
#endif
 
/trunk/uspace/srv/vfs/vfs_open.c
93,7 → 93,7
* find/create-and-lock the VFS node corresponding to the looked-up
* triplet.
*/
rwlock_reader_lock(&namespace_rwlock);
rwlock_read_lock(&namespace_rwlock);
 
/*
* The path is now populated and we can call vfs_lookup_internal().
102,7 → 102,7
size_t size;
rc = vfs_lookup_internal(path, len, &triplet, &size, NULL);
if (rc) {
rwlock_reader_unlock(&namespace_rwlock);
rwlock_read_unlock(&namespace_rwlock);
ipc_answer_0(rid, rc);
free(path);
return;
114,7 → 114,7
free(path);
 
vfs_node_t *node = vfs_node_get(&triplet, size);
rwlock_reader_unlock(&namespace_rwlock);
rwlock_read_unlock(&namespace_rwlock);
 
/*
* Get ourselves a file descriptor and the corresponding vfs_file_t
/trunk/uspace/srv/vfs/vfs_mount.c
185,13 → 185,13
/*
* We already have the root FS.
*/
rwlock_writer_lock(&namespace_rwlock);
rwlock_write_lock(&namespace_rwlock);
rc = vfs_lookup_internal(buf, size, &mp, &mpsz, NULL);
if (rc != EOK) {
/*
* The lookup failed for some reason.
*/
rwlock_writer_unlock(&namespace_rwlock);
rwlock_write_unlock(&namespace_rwlock);
futex_up(&rootfs_futex);
vfs_node_put(mr_node); /* failed -> drop reference */
free(buf);
200,7 → 200,7
}
mp_node = vfs_node_get(&mp, mpsz);
if (!mp_node) {
rwlock_writer_unlock(&namespace_rwlock);
rwlock_write_unlock(&namespace_rwlock);
futex_up(&rootfs_futex);
vfs_node_put(mr_node); /* failed -> drop reference */
free(buf);
212,7 → 212,7
* It will be dropped upon the corresponding VFS_UNMOUNT.
* This prevents the mount point from being deleted.
*/
rwlock_writer_unlock(&namespace_rwlock);
rwlock_write_unlock(&namespace_rwlock);
} else {
/*
* We still don't have the root file system mounted.
/trunk/uspace/srv/vfs/vfs_rdwr.c
93,9 → 93,9
* the same time.
*/
if (read)
rwlock_reader_lock(&file->node->contents_rwlock);
rwlock_read_lock(&file->node->contents_rwlock);
else
rwlock_writer_lock(&file->node->contents_rwlock);
rwlock_write_lock(&file->node->contents_rwlock);
 
int fs_phone = vfs_grab_phone(file->node->fs_handle);
128,11 → 128,11
* Unlock the VFS node.
*/
if (read)
rwlock_reader_unlock(&file->node->contents_rwlock);
rwlock_read_unlock(&file->node->contents_rwlock);
else {
/* Update the cached version of node's size. */
file->node->size = IPC_GET_ARG2(answer);
rwlock_writer_unlock(&file->node->contents_rwlock);
rwlock_write_unlock(&file->node->contents_rwlock);
}
 
/*
196,9 → 196,9
return;
}
if (whence == SEEK_END) {
rwlock_reader_lock(&file->node->contents_rwlock);
rwlock_read_lock(&file->node->contents_rwlock);
size_t size = file->node->size;
rwlock_reader_unlock(&file->node->contents_rwlock);
rwlock_read_unlock(&file->node->contents_rwlock);
if (size + off < size) {
futex_up(&file->lock);
ipc_answer_0(rid, EOVERFLOW);