Changes between Version 7 and Version 8 of FSDesign


Ignore:
Timestamp:
2009-07-23T19:26:55Z (15 years ago)
Author:
Jakub Jermář
Comment:

Legend:

Unmodified
Added
Removed
Modified
  • FSDesign

    v7 v8  
    6565adds a reference to an existing one. VFS nodes are organized in a hash table with
    6666the VFS triplet as a search key.
     67
     68The following example illustrates how the VFS server obtains the VFS node in the
     69implementation of the unlink operation:
     70
     71{{{
     72        int rc;
     73        int lflag = ...;
     74        char *path = ...;    /* file path */
     75        ...
     76        vfs_lookup_res_t lr;
     77        rc = vfs_lookup_internal(path, lflag | L_UNLINK, &lr, NULL);
     78        if (rc != EOK) {
     79             /* handle error */
     80             ...
     81        }
     82   
     83        vfs_node_t *node = vfs_node_get(&lr);
     84        /* now we have a reference to the node and work with it */
     85        ...
     86        vfs_node_put(node);
     87}}}
     88
     89The example is simplified and does not show all the details (e.g. it omits all synchronization), but it shows the main idea. Note the trailing ''vfs_node_put()'' function which drops a reference to a VFS node. If the last reference is dropped from a node, ''vfs_node_put()'' removes it from the hash table and cleans it up.