Changeset f17667a in mainline for uspace/srv/vfs/vfs_node.c
- Timestamp:
- 2008-02-17T13:32:53Z (17 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- 2616965d
- Parents:
- b5553a2
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/srv/vfs/vfs_node.c
rb5553a2 rf17667a 44 44 #include <libadt/hash_table.h> 45 45 #include <assert.h> 46 #include <async.h> 47 #include <errno.h> 46 48 47 49 /** Futex protecting the VFS node hash table. */ … … 102 104 void vfs_node_delref(vfs_node_t *node) 103 105 { 106 bool free_vfs_node = false; 107 bool free_fs_node = false; 108 104 109 futex_down(&nodes_futex); 105 110 if (node->refcnt-- == 1) { 111 /* 112 * We are dropping the last reference to this node. 113 * Remove it from the VFS node hash table. 114 */ 106 115 unsigned long key[] = { 107 116 [KEY_FS_HANDLE] = node->fs_handle, … … 110 119 }; 111 120 hash_table_remove(&nodes, key, 3); 121 free_vfs_node = true; 122 if (!node->lnkcnt) 123 free_fs_node = true; 112 124 } 113 125 futex_up(&nodes_futex); 126 127 if (free_fs_node) { 128 /* 129 * The node is not visible in the file system namespace. 130 * Free up its resources. 131 */ 132 int phone = vfs_grab_phone(node->fs_handle); 133 ipcarg_t rc; 134 rc = async_req_2_0(phone, VFS_FREE, (ipcarg_t)node->dev_handle, 135 (ipcarg_t)node->index); 136 assert(rc == EOK); 137 vfs_release_phone(phone); 138 } 139 if (free_vfs_node) 140 free(node); 114 141 } 115 142 … … 197 224 void nodes_remove_callback(link_t *item) 198 225 { 199 vfs_node_t *node = hash_table_get_instance(item, vfs_node_t, nh_link);200 free(node);201 226 } 202 227
Note:
See TracChangeset
for help on using the changeset viewer.