Changeset 319f4fb in mainline
- Timestamp:
- 2010-01-24T16:05:59Z (15 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- c4aca2c
- Parents:
- 203a090
- Location:
- uspace/srv/vfs
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/srv/vfs/vfs.h
r203a090 r319f4fb 181 181 extern vfs_node_t *vfs_node_get(vfs_lookup_res_t *); 182 182 extern void vfs_node_put(vfs_node_t *); 183 extern unsigned vfs_nodes_refcount_sum_get(fs_handle_t, dev_handle_t); 184 183 185 184 186 #define MAX_OPEN_FILES 128 -
uspace/srv/vfs/vfs_node.c
r203a090 r319f4fb 231 231 } 232 232 233 struct refcnt_data { 234 /** Sum of all reference counts for this file system instance. */ 235 unsigned refcnt; 236 fs_handle_t fs_handle; 237 dev_handle_t dev_handle; 238 }; 239 240 static void refcnt_visitor(link_t *item, void *arg) 241 { 242 vfs_node_t *node = hash_table_get_instance(item, vfs_node_t, nh_link); 243 struct refcnt_data *rd = (void *) arg; 244 245 if ((node->fs_handle == rd->fs_handle) && 246 (node->dev_handle == rd->dev_handle)) 247 rd->refcnt += node->refcnt; 248 } 249 250 unsigned 251 vfs_nodes_refcount_sum_get(fs_handle_t fs_handle, dev_handle_t dev_handle) 252 { 253 struct refcnt_data rd = { 254 .refcnt = 0, 255 .fs_handle = fs_handle, 256 .dev_handle = dev_handle 257 }; 258 259 fibril_mutex_lock(&nodes_mutex); 260 hash_table_apply(&nodes, refcnt_visitor, &rd); 261 fibril_mutex_unlock(&nodes_mutex); 262 263 return rd.refcnt; 264 } 265 233 266 /** 234 267 * @}
Note:
See TracChangeset
for help on using the changeset viewer.