Rev 2679 | Rev 2687 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed
| Rev 2679 | Rev 2680 | ||
|---|---|---|---|
| Line 38... | Line 38... | ||
| 38 | #include "vfs.h" |
38 | #include "vfs.h" |
| 39 | #include <stdlib.h> |
39 | #include <stdlib.h> |
| 40 | #include <string.h> |
40 | #include <string.h> |
| 41 | #include <atomic.h> |
41 | #include <atomic.h> |
| 42 | #include <futex.h> |
42 | #include <futex.h> |
| - | 43 | #include <rwlock.h> |
|
| 43 | #include <libadt/hash_table.h> |
44 | #include <libadt/hash_table.h> |
| 44 | 45 | ||
| 45 | /** Futex protecting the VFS node hash table. */ |
46 | /** Futex protecting the VFS node hash table. */ |
| 46 | atomic_t nodes_futex = FUTEX_INITIALIZER; |
47 | atomic_t nodes_futex = FUTEX_INITIALIZER; |
| 47 | 48 | ||
| Line 144... | Line 145... | ||
| 144 | memset(node, 0, sizeof(vfs_node_t)); |
145 | memset(node, 0, sizeof(vfs_node_t)); |
| 145 | node->fs_handle = triplet->fs_handle; |
146 | node->fs_handle = triplet->fs_handle; |
| 146 | node->dev_handle = triplet->fs_handle; |
147 | node->dev_handle = triplet->fs_handle; |
| 147 | node->index = triplet->index; |
148 | node->index = triplet->index; |
| 148 | link_initialize(&node->nh_link); |
149 | link_initialize(&node->nh_link); |
| 149 | futex_initialize(&node->contents_futex, 1); |
150 | rwlock_initialize(&node->contents_rwlock); |
| 150 | hash_table_insert(&nodes, key, &node->nh_link); |
151 | hash_table_insert(&nodes, key, &node->nh_link); |
| 151 | } else { |
152 | } else { |
| 152 | node = hash_table_get_instance(tmp, vfs_node_t, nh_link); |
153 | node = hash_table_get_instance(tmp, vfs_node_t, nh_link); |
| 153 | } |
154 | } |
| 154 | _vfs_node_addref(node); |
155 | _vfs_node_addref(node); |