Changeset 19f24fd in mainline for uspace/srv/vfs/vfs_node.c
- Timestamp:
- 2010-02-05T22:25:52Z (15 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- dafa2d04
- Parents:
- 83349b03 (diff), d42976c (diff)
Note: this is a merge changeset, the changes displayed below correspond to the merge itself.
Use the(diff)
links above to see all the changes relative to each parent. - File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/srv/vfs/vfs_node.c
r83349b03 r19f24fd 137 137 if (free_vfs_node) 138 138 free(node); 139 } 140 141 /** Forget node. 142 * 143 * This function will remove the node from the node hash table and deallocate 144 * its memory, regardless of the node's reference count. 145 * 146 * @param node Node to be forgotten. 147 */ 148 void vfs_node_forget(vfs_node_t *node) 149 { 150 fibril_mutex_lock(&nodes_mutex); 151 unsigned long key[] = { 152 [KEY_FS_HANDLE] = node->fs_handle, 153 [KEY_DEV_HANDLE] = node->dev_handle, 154 [KEY_INDEX] = node->index 155 }; 156 hash_table_remove(&nodes, key, 3); 157 fibril_mutex_unlock(&nodes_mutex); 158 free(node); 139 159 } 140 160 … … 231 251 } 232 252 253 struct refcnt_data { 254 /** Sum of all reference counts for this file system instance. */ 255 unsigned refcnt; 256 fs_handle_t fs_handle; 257 dev_handle_t dev_handle; 258 }; 259 260 static void refcnt_visitor(link_t *item, void *arg) 261 { 262 vfs_node_t *node = hash_table_get_instance(item, vfs_node_t, nh_link); 263 struct refcnt_data *rd = (void *) arg; 264 265 if ((node->fs_handle == rd->fs_handle) && 266 (node->dev_handle == rd->dev_handle)) 267 rd->refcnt += node->refcnt; 268 } 269 270 unsigned 271 vfs_nodes_refcount_sum_get(fs_handle_t fs_handle, dev_handle_t dev_handle) 272 { 273 struct refcnt_data rd = { 274 .refcnt = 0, 275 .fs_handle = fs_handle, 276 .dev_handle = dev_handle 277 }; 278 279 fibril_mutex_lock(&nodes_mutex); 280 hash_table_apply(&nodes, refcnt_visitor, &rd); 281 fibril_mutex_unlock(&nodes_mutex); 282 283 return rd.refcnt; 284 } 285 233 286 /** 234 287 * @}
Note:
See TracChangeset
for help on using the changeset viewer.