Fork us on GitHub Follow us on Facebook Follow us on Twitter

Changeset c4aca2c in mainline


Ignore:
Timestamp:
2010-01-24T17:21:01Z (10 years ago)
Author:
Jakub Jermar <jakub@…>
Branches:
master
Children:
ae75e2e3
Parents:
319f4fb
Message:

Add vfs_node_forget(). Beware!

Location:
uspace/srv/vfs
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • uspace/srv/vfs/vfs.h

    r319f4fb rc4aca2c  
    181181extern vfs_node_t *vfs_node_get(vfs_lookup_res_t *);
    182182extern void vfs_node_put(vfs_node_t *);
     183extern void vfs_node_forget(vfs_node_t *);
    183184extern unsigned vfs_nodes_refcount_sum_get(fs_handle_t, dev_handle_t);
    184185
  • uspace/srv/vfs/vfs_node.c

    r319f4fb rc4aca2c  
    137137        if (free_vfs_node)
    138138                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 */
     148void 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);
    139159}
    140160
Note: See TracChangeset for help on using the changeset viewer.