Index: trunk/kernel/fs/vfs.h
===================================================================
--- trunk/kernel/fs/vfs.h	(revision 602)
+++ trunk/kernel/fs/vfs.h	(revision 610)
@@ -69,9 +69,9 @@
  *****************************************************************************************/
 
-#define VFS_LOOKUP_DIR 	    0x01     /* the searched inode is a directory                */
+#define VFS_LOOKUP_DIR 	    0x01     /* the searched inode must be a directory           */
 #define VFS_LOOKUP_OPEN		0x02     /* the search is for an open/opendir                */
 #define VFS_LOOKUP_PARENT	0x04     /* return the parent inode (not the inode itself)   */
 #define VFS_LOOKUP_CREATE   0x10     /* file must be created if missing                  */
-#define VFS_LOOKUP_EXCL     0x20     /* file cannot previously exist                     */    
+#define VFS_LOOKUP_EXCL     0x20     /* file cannot previously exist                     */
 
 /******************************************************************************************
@@ -117,15 +117,18 @@
 /******************************************************************************************
  * This structure define a VFS inode.
- * It contains an extended pointer on the parent dentry, and (for directory only)
- * an hash table (xhtab) registering all children dentries.
- * The <parent> inode is unique for a directory (no hard links for directories). 
- * For a file, the parent field points to the first dentry who created this inode.
+ * An inode has several children dentries (if it is a directory), an can have several
+ * parents dentries (if it hass several aliases links):
+ * - The "parents" field is the root of the xlist of parents dentries, and the "links"
+ *   fiels define the number of aliases parent dentries. only a FILE inode can have
+ *   several parents (no hard links for directories). 
+ * - The "children" field is an embedded xhtab containing pointers on all local children
+ *   dentries. This set of children is empty for a FILE inode.
  * Synchronisation:
- * - the main_lock (remote_busylock) is used during the inode tree traversal,
- *   or for inode modification (add/remove children).
- * - the data_lock (remote_rwlock) is used during read/write accesses to the data
- *   stored in the mapper. 
- * - the mapper lock (remote rwlock) is only used during the radix tree traversal 
- *   to return the relevant page for read/write.
+ * - the main_lock (remote_rwlock) is used during the inode tree traversal,
+ *   or for inode modification (add/remove children in xhtab).
+ * - the size_lock (remote_rwlock) is used during read/write accesses to the size
+ *   field in the mapper. 
+ * - access to the data stored in the associated mapper use the mapper remote_rwlock 
+ *   protecting radix tree traversal and modifications.
  *****************************************************************************************/
 
@@ -158,20 +161,18 @@
 {
 	struct vfs_ctx_s * ctx;              /*! local pointer on FS context                 */
-    uint32_t           gc;               /*! generation counter                          */
 	uint32_t           inum;             /*! inode identifier (unique in file system)    */
 	uint32_t           attr;             /*! inode attributes (see above)                */
 	vfs_inode_type_t   type;             /*! inode type (see above)                      */
 	uint32_t           size;             /*! number of bytes                             */
-	uint32_t           links;            /*! number of alias dentry                      */
 	uint32_t           uid;              /*! user owner identifier                       */
 	uint32_t           gid;              /*! group owner identifier                      */
     uint32_t           rights;           /*! access rights                               */
-	uint32_t	       refcount;         /*! reference counter (all pointers)            */
-	xptr_t             parent_xp;        /*! extended pointer on parent dentry           */
+	xlist_entry_t      parents;          /*! root of list of parents dentries            */
+	uint32_t           links;            /*! number of parent dentries (hard links)      */
 	xhtab_t            children;         /*! embedded xhtab of children dentries         */
-	remote_rwlock_t    data_lock;        /*! protect read/write to data and to size      */
-	remote_busylock_t  main_lock;        /*! protect inode tree traversal and modifs     */
-	list_entry_t       list;             /*! member of set of inodes in same cluster     */
-	xlist_entry_t      wait_root;        /*! root of threads waiting on this inode       */
+	remote_rwlock_t    size_lock;        /*! protect read/write to size                  */
+	remote_rwlock_t    main_lock;        /*! protect inode tree traversal and modifs     */
+//  list_entry_t       list;             /*! member of set of inodes in same cluster     */
+//  list_entry_t       wait_root;        /*! root of threads waiting on this inode       */
 	struct mapper_s  * mapper;           /*! associated file cache                       */
 	void             * extend;           /*! fs_type_specific inode extension            */
@@ -183,5 +184,5 @@
 #define VFS_ISUID	   0x0004000
 #define VFS_ISGID	   0x0002000
-#define VFS_ISVTX	   0x0001000
+define VFS_ISVTX	   0x0001000
 
 #define VFS_IRWXU      0x0000700
@@ -203,6 +204,8 @@
  * This structure defines a directory entry.
  * A dentry contains the name of a remote file/dir, an extended pointer on the 
- * inode representing this file/dir, and a local pointer on the inode representing 
+ * inode representing this file/dir, a local pointer on the inode representing 
  * the parent directory.
+ * A dentry can be member of the set of children of a given directory inode (xhtab).
+ * A dentry can be member of the set of parents  of a given inode (xlist).
  *****************************************************************************************/
 
@@ -212,8 +215,8 @@
 	char                 name[CONFIG_VFS_MAX_NAME_LENGTH];
 	uint32_t             length;         /*! name length (bytes)                         */
-	uint32_t             refcount;       /*! reference counter (all pointers)            */
     struct vfs_inode_s * parent;         /*! local pointer on parent inode               */
     xptr_t               child_xp;       /*! extended pointer on child inode             */
-    xlist_entry_t        list;           /*! member of list of dentries with same key    */
+    xlist_entry_t        children;       /*! member of set of children dentries          */
+    xlist_entry_t        parents;        /*! member of set of parent dentries            */
 	void               * extend;         /*! FS specific extension                       */
 }
@@ -301,5 +304,4 @@
 
 
-
 /******************************************************************************************
  *        These low-level functions access / modify a VFS inode descriptor
@@ -314,9 +316,7 @@
  * This function allocates memory from local cluster for an inode descriptor and the 
  * associated mapper. It initialise these descriptors from arguments values. 
- * The parent dentry must have been previously created.
  * If the client thread is not running in the cluster containing this inode,
  * it must use the rpc_vfs_inode_create_client() function.
  ******************************************************************************************
- * @ dentry_xp  : extended pointer on associated dentry (in parent inode cluster).
  * @ fs_type    : file system type.
  * @ inode_type : inode type.
@@ -328,6 +328,5 @@
  * @ return 0 if success / return ENOMEM or EINVAL if error.
  *****************************************************************************************/
-error_t vfs_inode_create( xptr_t            dentry_xp,
-                          vfs_fs_type_t     fs_type,
+error_t vfs_inode_create( vfs_fs_type_t     fs_type,
                           vfs_inode_type_t  inode_type,
                           uint32_t          attr,
@@ -340,6 +339,5 @@
  * This function releases memory allocated to an inode descriptor, including
  * all memory allocated to the mapper (both mapper descriptor and radix tree).
- * The mapper should not contain any dirty page (shold be synchronized before deletion),
- * and the inode refcount must be zero.
+ * The mapper should not contain any dirty page (should be synchronized before deletion).
  * It must be executed by a thread running in the cluster containing the inode.
  * Use the rpc_vfs_inode_destroy_client() function if required.
@@ -348,11 +346,4 @@
  *****************************************************************************************/
 void vfs_inode_destroy( vfs_inode_t *  inode );  
-
-/****************************************************************************************** 
- * This function atomically increment/decrement the inode refcount.
- * It can be called by any thread running in any cluster.
- *****************************************************************************************/
-void vfs_inode_remote_up( xptr_t  inode_xp );
-void vfs_inode_remote_down( xptr_t  inode_xp );
 
 /****************************************************************************************** 
@@ -423,5 +414,4 @@
  * This function allocates memory from local cluster for a dentry descriptor, 
  * initialises it from  arguments values, and returns the extended pointer on dentry.
- * The inode field is not initialized, because the inode does not exist yet.
  * If the client thread is not running in the target cluster for this inode,
  * it must use the rpc_dentry_create_client() function.
@@ -429,5 +419,4 @@
  * @ fs_type    : file system type.
  * @ name       : directory entry file/dir name.
- * @ parent     : local pointer on parent inode.
  * @ dentry_xp  : [out] buffer for extended pointer on created dentry.
  * @ return 0 if success / return ENOMEM or EINVAL if error.
@@ -435,10 +424,9 @@
 error_t vfs_dentry_create( vfs_fs_type_t   fs_type,
                            char          * name,
-                           vfs_inode_t   * parent,
                            xptr_t        * dentry_xp );
  
 /****************************************************************************************** 
- * This function releases memory allocated to a dentry descriptor.
- * The dentry refcount must be zero. 
+ * This function removes the dentry from the parent inode xhtab, and releases the memory
+ * allocated to the dentry descriptor.
  * It must be executed by a thread running in the cluster containing the dentry.
  * Use the rpc_vfs_dentry_destroy_client() function if required.
@@ -447,11 +435,4 @@
  *****************************************************************************************/
 void vfs_dentry_destroy( vfs_dentry_t *  dentry );  
-
-/****************************************************************************************** 
- * These functions atomically increment/decrement the dentry refcount.
- * It can be called by any thread running in any cluster.
- *****************************************************************************************/
-void vfs_dentry_remote_up( xptr_t dentry_xp );
-void vfs_dentry_remote_down( xptr_t dentry_xp );
 
 
@@ -496,51 +477,73 @@
 
 /******************************************************************************************
- *        These functions access / modify the distributed VFS Inode Treee
- *****************************************************************************************/
-
-/****************************************************************************************** 
- * This function returns in a kernel buffer allocated by the caller function,
- * the pathname of a file/dir identified by an extended pointer on the inode. 
+ *        These functions access / modify the distributed VFS Inode Tree
+ *****************************************************************************************/
+
+/****************************************************************************************** 
+ * This function returns in a kernel <buffer> allocated by the caller function,
+ * the pathname of a file/dir identified by the <inode_xp> argument. 
  * It traverse the Inode Tree from the target node to the root.
  * It can be called by any thread running in any cluster.
- ******************************************************************************************
- * @ inode_xp    : pointer on inode descriptor.
- * @ buffer      : kernel buffer for pathname (must be allocated by caller).
- * @ size        : max number of characters in buffer.
+ * As this buffer if filled in "reverse order" (i.e. from the target inode to the root),
+ * the pathname is stored in the higher part of the buffer. 
+ * A pointer on the first character of the pathname is returned in <first> buffer.
+ *
+ * WARNING : This function takes & releases the remote_rwlock protecting the Inode Tree.
+ ******************************************************************************************
+ * @ inode_xp    : [in]  extended pointer on target inode descriptor.
+ * @ buffer      : [in]  kernel buffer for pathname (allocated by caller).
+ * @ first       : [out] pointer on first character in buffer.
+ * @ max_size    : [in]  max number of characters in buffer.
  * @ return 0 if success / return EINVAL if buffer too small.
  *****************************************************************************************/
 error_t vfs_get_path( xptr_t    inode_xp,
                       char    * buffer,
+                      char   ** first,
                       uint32_t  max_size );
 
 /******************************************************************************************
- * This function takes a pathname (absolute or relative to cwd) and returns an extended 
- * pointer on the associated inode.
+ * This function traverses the the Inode Tree, from inode identified by the <root_xp> 
+ * argument, and returns in <inode_xp> the inode identified by the < pathname> argument. 
+ * It can be called by a thread running in any cluster.
+ * It supports the following flags that define the lookup modes :
+ * - VFS_LOOKUP_DIR    : the searched inode must be a directory 
+ * - VFS_LOOKUP_OPEN   : the search is for an open/opendir
+ * - VFS_LOOKUP_PARENT : return the parent inode (not the inode itself) 
+ * - VFS_LOOKUP_CREATE : file/directory must be created if missing on IOC 
+ * - VFS_LOOKUP_EXCL   : file cannot previously exist
+ * As the inode Tree is a cache, the search policy is the following :
  * - If a given directory name in the path is not found in the inode tree, it try to load
  *   the missing dentry/inode couple, from informations found in the parent directory.
- * - If this directory entry does not exist on device, it returns an error.
- * - If the the file identified by the pathname does not exist on device but the
- *   flag CREATE is set, the inode is created.
- * - If the the file identified by the pathname exist on device but both flags EXCL
+ * - If this directory entry does not exist on IOC, it returns an error.
+ * - If the the file identified by the pathname does not exist on IOC but the
+ *   flag CREATE is set, the inode is created. It returns an error otherwise.
+ * - If the the file identified by the pathname exist on device, but both flags EXCL
  *   and CREATE are set, an error is returned.
- ******************************************************************************************
- * @ cwd_xp      : extended pointer on current directory (for relative path).
- * @ pathname    : path in kernel space (can be relative or absolute).
- * @ lookup_mode : flags defining the working mode (defined above in this file).
+ * - If the PARENT flag is set, it returns in <inode_xp> an extended pointer on the parent
+ *   inode, and copies in <last_name> buffer a string containing the last name in path.
+ *
+ * WARNING : The remote_rwlock protecting the Inode Tree must be taken by the caller. 
+ *
+ * TODO the access rights are not checked yet.
+ ******************************************************************************************
+ * @ root_xp     : [in]  extended pointer on root inode (can be root of a subtree). 
+ * @ pathname    : [in]  path (can be relative or absolute).
+ * @ lookup_mode : [in]  flags defining the searching mode.
  * @ inode_xp    : [out] buffer for extended pointer on searched inode.
+ * @ last_name   : [out] pointer on buffer for last name in path.
  * @ return 0 if success / ENOENT if inode not found , EACCES if permisson denied,
- *                         EAGAIN if a new complete lookup must be made
- *****************************************************************************************/
-error_t vfs_lookup( xptr_t             cwd_xp,
+ *****************************************************************************************/
+error_t vfs_lookup( xptr_t             root_xp,
                     char             * pathname,
                     uint32_t           lookup_mode,
-					xptr_t           * inode_xp );
+					xptr_t           * inode_xp,
+                    char             * last_name );
 
 /******************************************************************************************
  * This function creates a new couple dentry/inode, and insert it in the Inode-Tree.
+ * Only the distributed Inode Tree is modified: it does NOT modify the parent mapper, 
+ * and does NOT update the FS on IOC device.
  * It can be executed by any thread running in any cluster (can be different from both
- * the child cluster and the parent cluster), as it uses RPCs if required.
- * Only the distributed Inode Tree is modified: Even for a new file, this function
- * does NOT modify the parent mapper, and does NOT update the FS on IOC device.
+ * the child cluster and the parent cluster).
  * 
  * [Implementation]
@@ -563,6 +566,6 @@
  * @ return 0 if success / -1 if dentry or inode cannot be created.
  *****************************************************************************************/
-error_t vfs_add_child_in_parent( cxy_t              child_inodecxy,
-                                 vfs_inode_type_t   chilg_inode_type,
+error_t vfs_add_child_in_parent( cxy_t              child_inode_cxy,
+                                 vfs_inode_type_t   child_inode_type,
                                  vfs_fs_type_t      fs_type,
                                  xptr_t             parent_inode_xp,
@@ -572,12 +575,18 @@
 
 /******************************************************************************************
- * This function removes a couple dentry/inode from the Inode-Tree.
- * Both the inode and dentry references counters must be 1.
+ * This function removes a remote dentry from the Inode-Tree.
+ * - It removes the dentry from the parent inode xhtab ("children" field), and from the
+ *   child inode xlist ("parents" field).
+ * - It releases the memory allocated to the dentry descriptor.
+ * - If the number of parents of the child inode is one, it also releases the memory
+ *   allocated to the child inode.
+ * Only the Inode Tree is modified: it does NOT modify the parent mapper, 
+ * and does NOT update the FS on IOC device.
  * It can be executed by any thread running in any cluster (can be different from both
- * the inode cluster and the dentry cluster), as it uses RPCs if required.
- ******************************************************************************************
- * @ child_xp   : extended pointer on removed inode.
- *****************************************************************************************/
-void vfs_remove_child_from_parent( xptr_t inode_xp );
+ * the inode cluster and the dentry cluster).
+ ******************************************************************************************
+ * @ dentry_xp   : extended pointer on removed dentry.
+ *****************************************************************************************/
+void vfs_remove_child_from_parent( xptr_t dentry_xp );
 
 /******************************************************************************************
@@ -599,6 +608,6 @@
  *****************************************************************************************/
 error_t vfs_new_child_init( xptr_t   parent_xp,
-                         xptr_t   dentry_xp,
-                         xptr_t   child_xp );
+                            xptr_t   dentry_xp,
+                            xptr_t   child_xp );
 
 /******************************************************************************************
@@ -661,16 +670,19 @@
 /****************************************************************************************** 
  * This function allocates a vfs_file_t structure in the cluster containing the inode
- * associated to the file identified by the <cwd_xp> & <path> arguments.
+ * identified by the <root_xp> & <path> arguments.
  * It initializes it, register it in the reference process fd_array identified by the
- * <process> argument, and returns both the extended pointer on the file descriptor,
- * and the allocated index in the fd_array. 
+ * <process_xp> argument, and returns both the extended pointer on the file descriptor,
+ * and the allocated index in the <file_xp> and <file_id> buffers. 
  * The pathname can be relative to current directory or absolute.
- * If the inode does not exist in the inode cache, it try to find the file on the mounted
+ * If the inode does not exist in the inode cache, it try to find the file on the IOC
  * device, and creates an inode on a pseudo randomly selected cluster if found.
  * It the requested file does not exist on device, it creates a new inode if the
  * O_CREAT flag is set, and return an error otherwise. 
+ *
+ * WARNING : this function takes & releases the remote_rwlock protecting the Inode Tree.
  ****************************************************************************************** 
- * @ process     : local pointer on local process descriptor copy.
+ * @ root_xp     : extended pointer on path root inode.
  * @ path        : file pathname (absolute or relative to current directory).
+ * @ process_xp  : extended pointer on client reference process.
  * @ flags       : defined in vfs_file_t structure.
  * @ mode        : access rights (as defined by chmod).
@@ -679,6 +691,7 @@
  * @ return 0 if success / return non-zero if error.
  *****************************************************************************************/
-error_t vfs_open( struct process_s * process,
+error_t vfs_open( xptr_t             root_xp,
 		          char             * path,
+                  xptr_t             process_xp,
 		          uint32_t           flags,
                   uint32_t           mode,
@@ -721,43 +734,76 @@
 /****************************************************************************************** 
  * This function is called by the kernel to create in the file system a new directory 
- * entry identified by the <cwd_xp> & <path_1>, linked to the node identified by the
- * <cwd_xp> & <path_2> arguments.  It can be any type of node.
- * If the link is successful, the link count of the target node is incremented.
- * <path_1> and <path_2> share equal access rights to the underlying object.
+ * identified by the <root_xp> & <path> arguments, with the access permission defined
+ * by the <rights> argument. All nodes in the path - but the last -  must exist.
+ *
+ * WARNING : this function takes & releases the remote_rwlock protecting the Inode Tree.
+ ******************************************************************************************
+ * @ root_xp : extended pointer on path root inode (any inode in Inode Tree).
+ * @ path    : pathname (absolute or relative to current directory).
+ * @ rights  : access rights.
+ * @ returns 0 if success / -1 if error.
+ *****************************************************************************************/
+error_t vfs_mkdir( xptr_t   root_xp,
+                   char   * path,
+                   uint32_t rights );
+
+/****************************************************************************************** 
+ * This function is called by the kernel to create in the file system a new directory 
+ * entry identified by the <new_root_xp> & <new_path> arguments, to be linked to an
+ * existing inode, identified by the  <old_root_xp> & <old_path> arguments.
+ * If the link is successful, the link count of the target inode is incremented.
+ * The <new_path> and <old_path> share equal access rights to the underlying inode.
  * Both the IOC device and the Inode Tree are modified. 
- ******************************************************************************************
- * @ cwd_xp   : extended pointer on current working directory file descriptor.
- * @ path_1   : new pathname (absolute or relative to current directory).
- * @ path_1   : existing pathname (absolute or relative to current directory).
+ $
+ * TODO This function should handle any type of node, but the current implementation
+ * handles only the FILE and DIR types.
+ *
+ * WARNING : this function takes & releases the remote_rwlock protecting the Inode Tree.
+ ******************************************************************************************
+ * @ old_root_xp : extended pointer on old path root inode (any inode in Inode Tree).
+ * @ old_path    : old pathname (absolute or relative to current directory).
+ * @ nld_root_xp : extended pointer on new path root inode (any inode in Inode Tree).
+ * @ new_path    : new pathname (absolute or relative to current directory).
  * @ returns 0 if success / -1 if error.
  *****************************************************************************************/
-error_t vfs_link( xptr_t   cwd_xp,
-                  char   * path_1,
-                  char   * path_2 );
+error_t vfs_link( xptr_t   old_root_xp,
+                  char   * old_path,
+                  xptr_t   new_root_xp,
+                  char   * new_path );
 
 /****************************************************************************************** 
  * This function is called by the kernel to remove from the file system a directory entry
- * identified by the  <cwd_xp> & <path> arguments. The target node can be any type of node.
- * The link count of the target node is decremented. If the removed link is the last,
- * the target node is deleted.
+ * identified by the  <root_xp> & <path> arguments.
+ * The link count of the target node is decremented.
+ * If the removed link is the last, the target inode is deleted.
  * Both the IOC device and the Inode Tree are modified. 
- ******************************************************************************************
- * @ cwd_xp   : extended pointer on the current working directory file descriptor.
+ *
+ * TODO This function should handle any type of node, but the current implementation
+ * handles only only the FILE and DIR types.
+ *
+ * WARNING : this function takes & releases the remote_rwlock protecting the Inode Tree.
+ ******************************************************************************************
+ * @ root_xp  : extended pointer on root inode (can be any inode in Inode Tree).
  * @ path     : pathname (absolute or relative to current directory).
  * @ returns 0 if success / -1 if error.
  *****************************************************************************************/
-error_t vfs_unlink( xptr_t   cwd_xp,
+error_t vfs_unlink( xptr_t   root_xp,
                     char   * path );
 
 /****************************************************************************************** 
- * This function returns, in the structure pointed by the <st> pointer,
- * various informations on the inode identified by the <inode_xp> argument.
- * TODO : only partially implemented yet...
- ******************************************************************************************
- * @ inode_xp   : extended pointer on the remote inode.
+ * This function returns, in the structure pointed by the <st> pointer, various
+ * informations on the inode identified by the <root_inode_xp> and <patname> arguments.
+ *
+ * TODO : only partially implemented yet (only size and inum fields).
+ *
+ * WARNING : this function takes & releases the remote_rwlock protecting the Inode Tree.
+ ******************************************************************************************
+ * @ root_xp    : extended pointer on path root inode (any inode in Inode Tree)
+ * @ pathname   : pathname to target inode.
  * @ st         : local pointer on the stat structure in kernel space.
  * @ returns 0 if success / -1 if error.
  *****************************************************************************************/
-error_t vfs_stat( xptr_t        inode_xp,
+error_t vfs_stat( xptr_t        root_xp,
+                  char        * pathname,
                   struct stat * st );
 
@@ -775,38 +821,37 @@
 
 /****************************************************************************************** 
- * This function  creates a new inode and associated dentry  for the directory defined
- * by the <cwd_xp> & <path> arguments.
+ * This function  creates a new directory as defined by the <root_xp> & <path> arguments.
  * TODO not implemented yet...
  ******************************************************************************************
- * @ cwd_xp   : extended pointer on the current working directory file descriptor.
- * @ path     : pathname (absolute or relative to current directory).                     
+ * @ root_xp  : extended pointer on the path root directory.
+ * @ path     : pathname (absolute or relative to CWD).                     
  * @ mode     : access rights (as defined by chmod)
  * @ returns 0 if success / -1 if error.
  *****************************************************************************************/
-error_t vfs_mkdir( xptr_t     cwd_xp,
+error_t vfs_mkdir( xptr_t     root_xp,
                    char     * path,
                    uint32_t   mode );
 
 /****************************************************************************************** 
- * This function makes the directory identified by <cwd_xp / path> arguments to become
- * the working directory for the calling process.
+ * This function makes the directory identified by the <root_xp and <path> arguments 
+ * to become the working directory for the calling process.
  ****************************************************************************************** 
- * @ cwd_xp      : extended pointer on current directory file descriptor (relative path).
- * @ path        : file pathname (absolute or relative to current directory).
+ * @ root_xp  : extended pointer on the path root directory.
+ * @ path     : pathname (absolute or relative to CWD).
  * return 0 if success / -1 if error.
  *****************************************************************************************/
-error_t vfs_chdir( xptr_t   cwd_xp,
+error_t vfs_chdir( xptr_t   root_xp,
                    char   * path );
 
 /****************************************************************************************** 
- * This function change the access rigths for the file identified by the <cwd_xp / path>
- * arguments. The new access rights are defined by the <mode> argument value.
+ * This function change the access rigths for the file/directory identified by the 
+ * <root_xp> and <path> arguments as defined by the <mode> argument value.
  ****************************************************************************************** 
- * @ cwd_xp      : extended pointer on current directory file descriptor (relative path).
- * @ path        : file pathname (absolute or relative to current directory).
- * @ mode        : access rights new value.
+ * @ root_xp  : extended pointer on the path root directory.
+ * @ path     : pathname (absolute or relative to CWD).
+ * @ mode     : access rights
  * return 0 if success / -1 if error.
  *****************************************************************************************/
-error_t vfs_chmod( xptr_t        cwd_xp,
+error_t vfs_chmod( xptr_t        root_xp,
                    char        * path,
                    uint32_t      mode );
@@ -816,9 +861,9 @@
  * TODO not implemented yet                                                          
  ****************************************************************************************** 
- * @ path        : FIFO pathname (absolute or relative to current directory).
- * @ cwd_xp      : extended pointer on the current working directory file descriptor.
- * @ mode        : access rights new value.
- *****************************************************************************************/
-error_t vfs_mkfifo( xptr_t       cwd_xp,
+ * @ root_xp  : extended pointer on the path root directory.
+ * @ path     : pathname (absolute or relative to CWD).
+ * @ mode     : access rights new value.
+ *****************************************************************************************/
+error_t vfs_mkfifo( xptr_t       root_xp,
                     char       * path,
                     uint32_t     mode );
@@ -905,24 +950,27 @@
 
 /*****************************************************************************************
- * This function updates the FS on the IOC device for the FAT itself.
- * It scan all clusters registered in the FAT mapper, and copies to device 
- * each page marked as dirty.
+ * This function updates the FS defined by the <fs_type> argument on the IOC device
+ * for the FAT itself. It scan all clusters registered in the FAT mapper, and copies 
+ * to device each page marked as dirty.
  *
  * Depending on the file system type, it calls the relevant, FS specific function.
  * It can be called by a thread running in any cluster.
  *****************************************************************************************
+ * @ fs_type   : specific file system type.
  * @ return 0 if success / return EIO if failure during device access.
  ****************************************************************************************/
-error_t vfs_fs_sync_fat( void );
+error_t vfs_fs_sync_fat( vfs_fs_type_t fs_type );
 
 /*****************************************************************************************
- * This function updates the free clusters info on the IOC device. 
+ * This function updates the free clusters info on the IOC device for the FS defined
+ * by the <fs_type> argument. 
  *
  * Depending on the file system type, it calls the relevant, FS specific function.
  * It can be called by a thread running in any cluster.
  *****************************************************************************************
+ * @ fs_type   : specific file system type.
  * @ return 0 if success / return EIO if failure during device access.
  ****************************************************************************************/
-error_t vfs_fs_sync_free_info( void );
+error_t vfs_fs_sync_free_info( vfs_fs_type_t fs_type );
 
 /******************************************************************************************
