Index: trunk/kernel/fs/vfs.h
===================================================================
--- trunk/kernel/fs/vfs.h	(revision 614)
+++ trunk/kernel/fs/vfs.h	(revision 623)
@@ -108,5 +108,5 @@
 /******************************************************************************************
  * This structure define a VFS inode.
- * An inode has several children dentries (if it is a directory), an can have several
+ * An inode can have 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"
@@ -166,6 +166,4 @@
 	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            */
@@ -195,5 +193,5 @@
 
 /******************************************************************************************
- * This structure defines a directory entry.
+ Rpt* 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, a local pointer on the inode representing 
@@ -321,5 +319,4 @@
  *****************************************************************************************/
 error_t vfs_inode_create( vfs_fs_type_t     fs_type,
-                          vfs_inode_type_t  inode_type,
                           uint32_t          attr,
                           uint32_t          rights,
@@ -349,12 +346,13 @@
 
 /****************************************************************************************** 
- * This function set the <size> of a file/dir to a remote inode,
- * taking the remote_rwlock protecting <size> in WRITE_MODE.
+ * This function updates the "size" field of a remote inode identified by <inode_xp>.
+ * It takes the rwlock protecting the file size in WRITE_MODE, and set the "size" field
+ * when the current size is smaller than the requested <size> argument. 
  *****************************************************************************************
  * @ inode_xp  : extended pointer on the remote inode.
- * @ size      : value to be written.
- *****************************************************************************************/
-void vfs_inode_set_size( xptr_t   inode_xp,
-                         uint32_t size );
+ * @ size      : requested size value.
+ *****************************************************************************************/
+void vfs_inode_update_size( xptr_t   inode_xp,
+                            uint32_t size );
 
 /****************************************************************************************** 
@@ -451,7 +449,5 @@
  * This function releases memory allocated to a local file descriptor.
  * It must be executed by a thread running in the cluster containing the inode,
- * and the file refcount must be zero.
- * If the client thread is not running in the owner cluster, it must use the
- * rpc_vfs_file_destroy_client() function.
+ * and the file refcount must be zero. Use the RPC_VFS_FILE_DESTROY if required.
  ****************************************************************************************** 
  * @ file  : local pointer on file descriptor.
@@ -465,4 +461,15 @@
 void vfs_file_count_up  ( xptr_t   file_xp );
 void vfs_file_count_down( xptr_t   file_xp );
+
+/****************************************************************************************** 
+ * This debug function copies the name of a the file identified by <file_xp>
+ * argument to a local buffer identified by the <name> argument.
+ * The local buffer size must be at least CONFIG_VFS_MAX_NAME_LENGTH. 
+ *****************************************************************************************
+ * @ file_xp  : extended pointer on the remote inode.
+ * @ name     : local buffer pointer.
+ *****************************************************************************************/
+void vfs_file_get_name( xptr_t inode_xp,
+                        char * name );
 
 
@@ -537,4 +544,5 @@
  * Only the distributed Inode Tree is modified: it does NOT modify the parent mapper, 
  * and does NOT update the FS on IOC device.
+ * It set the inode type to the default INODE_TYPE_FILE value
  * It can be executed by any thread running in any cluster (can be different from both
  * the child cluster and the parent cluster).
@@ -552,5 +560,4 @@
  ******************************************************************************************
  * @ child_inode_cxy  : [in]  target cluster for child inode.
- * @ child_inode_type : [in]  child inode type
  * @ fs_type          : [in]  child inode FS type.
  * @ parent_inode_xp  : [in]  extended pointer on parent inode.
@@ -561,5 +568,4 @@
  *****************************************************************************************/
 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,
@@ -729,12 +735,17 @@
 /****************************************************************************************** 
  * This function close the - non-replicated - file descriptor identified by the <file_xp>
- * and <file_id> arguments.
- * 1) All entries in the fd_array copies are directly reset by the calling thread,
+ * and <file_id> arguments. The <file_id> is required to reset the fd_array[] slot.
+ * It can be called by a thread running in any cluster, and executes the following actions:
+ * 1) It access the block device to updates all dirty pages from the mapper associated 
+ *    to the file, and removes these pages from the dirty list, using an RPC if required.
+ * 2) It updates the file size in all parent directory mapper(s), and update the modified
+ *    pages on the block device, using RPCs if required.
+ * 3) All entries in the fd_array copies are directly reset by the calling thread,
  *    using remote accesses. 
- * 2) The memory allocated to file descriptor in cluster containing the inode is released.
- *    It requires a RPC if cluster containing the file descriptor is remote.
- ******************************************************************************************
- * @ file_xp     : extended pointer on the file descriptor in owner cluster.
- * @ file_id     : file descriptor index in fd_array.
+ * 4) The memory allocated to file descriptor in cluster containing the inode is released,
+ *    using an RPC if cluster containing the file descriptor is remote.
+ ******************************************************************************************
+ * @ file_xp     : extended pointer on the file descriptor.
+ * @ file_id     : file descriptor index in fd_array[].
  * @ returns 0 if success / -1 if error.
  *****************************************************************************************/
@@ -877,5 +888,5 @@
 /******************************************************************************************
  * This function makes the I/O operation to move one page identified by the <page_xp>
- * argument to/from the IOC device from/to the mapper, as defined by <cmd_type>.
+ * argument to/from the IOC device from/to the mapper, as defined by the <cmd_type>.
  * Depending on the file system type, it calls the proper, FS specific function.
  * It is used in case of MISS on the mapper, or when a dirty page in the mapper must
@@ -918,6 +929,7 @@
  * Finally, it synchronously updates the parent directory on IOC device.
  *
+ * Depending on the file system type, it calls the relevant, FS specific function.
  * It must be executed by a thread running in the cluster containing the parent directory.
- * It can be the RPC_VFS_VS_REMOVE_DENTRY. This function does NOT take any lock.
+ * It can be the RPC_VFS_FS_REMOVE_DENTRY. This function does NOT take any lock.
  ******************************************************************************************
  * @ parent  : local pointer on parent (directory) inode.
@@ -933,5 +945,5 @@
  * and updates both the child inode descriptor, identified by the <child_xp> argument,
  * and the associated dentry descriptor :
- * - It set the "size", and "extend" fields in inode descriptor.
+ * - It set the "size", "type", and "extend" fields in inode descriptor.
  * - It set the "extend" field in dentry descriptor.
  * It is called by the vfs_lookup() function in case of miss.
@@ -939,14 +951,34 @@
  * Depending on the file system type, it calls the relevant, FS specific function.
  * It must be called by a thread running in the cluster containing the parent inode.
- * This function does NOT take any lock.
+ * It can be the RPC_VFS_FS_NEW_DENTRY. This function does NOT take any lock.
  ******************************************************************************************
  * @ parent    : local pointer on parent inode (directory).
  * @ name      : child name.
  * @ child_xp  : extended pointer on remote child inode (file or directory)
- * @ return 0 if success / return ENOENT if not found.
- *****************************************************************************************/
-error_t vfs_fs_get_dentry( vfs_inode_t * parent,
+ * @ return 0 if success / return -1 if dentry not found.
+ *****************************************************************************************/
+error_t vfs_fs_new_dentry( vfs_inode_t * parent,
                            char        * name,
                            xptr_t        child_xp );
+
+/******************************************************************************************
+ * This function scan the mapper of an an existing inode directory, identified by
+ * the <inode> argument, to find a directory entry identified by the <dentry> argument,
+ * and update the size for this directory entry in mapper, as defined by <size>.
+ * The searched "name" is defined in the <dentry> argument, that must be in the same 
+ * cluster as the parent inode. It is called by the vfs_close() function.
+ *
+ * Depending on the file system type, it calls the relevant, FS specific function.
+ * It must be called by a thread running in the cluster containing the parent inode.
+ * It can be the RPC_VFS_FS_UPDATE_DENTRY. This function does NOT take any lock.
+ ******************************************************************************************
+ * @ parent    : local pointer on parent inode (directory).
+ * @ dentry    : local pointer on dentry.
+ * @ size      : new size value (bytes).
+ * @ return 0 if success / return ENOENT if not found.
+ *****************************************************************************************/
+error_t vfs_fs_update_dentry( vfs_inode_t  * inode,
+                              vfs_dentry_t * dentry,
+                              uint32_t       size );
 
 /******************************************************************************************
