Changeset 9413c0d in mainline
- Timestamp:
- 2008-01-06T12:50:51Z (17 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- b3c38750
- Parents:
- f57f8ea
- Location:
- uspace
- Files:
-
- 1 added
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/srv/vfs/vfs.h
rf57f8ea r9413c0d 37 37 #include <libadt/list.h> 38 38 #include <atomic.h> 39 #include <rwlock.h> 39 40 #include <sys/types.h> 40 41 #include <bool.h> … … 136 137 link_t nh_link; /**< Node hash-table link. */ 137 138 138 /** Holding this futexprevents modifications of the node's contents. */139 atomic_t contents_ futex;139 /** Holding this rwlock prevents modifications of the node's contents. */ 140 atomic_t contents_rwlock; 140 141 } vfs_node_t; 141 142 -
uspace/srv/vfs/vfs_node.c
rf57f8ea r9413c0d 41 41 #include <atomic.h> 42 42 #include <futex.h> 43 #include <rwlock.h> 43 44 #include <libadt/hash_table.h> 44 45 … … 147 148 node->index = triplet->index; 148 149 link_initialize(&node->nh_link); 149 futex_initialize(&node->contents_futex, 1);150 rwlock_initialize(&node->contents_rwlock); 150 151 hash_table_insert(&nodes, key, &node->nh_link); 151 152 } else { -
uspace/srv/vfs/vfs_rdwr.c
rf57f8ea r9413c0d 40 40 #include <async.h> 41 41 #include <errno.h> 42 #include < futex.h>42 #include <rwlock.h> 43 43 44 44 static void vfs_rdwr(ipc_callid_t rid, ipc_call_t *request, bool read) … … 86 86 * the same time. 87 87 */ 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); 89 92 90 93 int fs_phone = vfs_grab_phone(file->node->fs_handle); … … 118 121 * Unlock the VFS node. 119 122 */ 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); 121 127 122 128 /*
Note:
See TracChangeset
for help on using the changeset viewer.