Index: trunk/kernel/fs/vfs.c
===================================================================
--- trunk/kernel/fs/vfs.c	(revision 625)
+++ trunk/kernel/fs/vfs.c	(revision 626)
@@ -423,4 +423,45 @@
 }  // end vfs_inode_load_all_pages()
 
+/////////////////////////////////////////
+void vfs_inode_display( xptr_t inode_xp )
+{
+    assert( (inode_xp != XPTR_NULL), "inode pointer is NULL");
+
+    char  name[CONFIG_VFS_MAX_NAME_LENGTH];
+
+    vfs_inode_get_name( inode_xp , name );
+
+    cxy_t         inode_cxy = GET_CXY( inode_xp );
+    vfs_inode_t * inode_ptr = GET_PTR( inode_xp );
+
+    vfs_inode_type_t type    = hal_remote_l32( XPTR( inode_cxy , &inode_ptr->type ) );
+    uint32_t         attr    = hal_remote_l32( XPTR( inode_cxy , &inode_ptr->attr ) );
+    uint32_t         size    = hal_remote_l32( XPTR( inode_cxy , &inode_ptr->size ) );
+    uint32_t         parents = hal_remote_l32( XPTR( inode_cxy , &inode_ptr->links ) );
+    mapper_t       * mapper  = hal_remote_lpt( XPTR( inode_cxy , &inode_ptr->mapper ) );
+    void           * extend  = hal_remote_lpt( XPTR( inode_cxy , &inode_ptr->extend ) );
+
+    printk("\n**** inode <%s>\n"
+           " - type    = %s\n"
+           " - attr    = %x\n"
+           " - size    = %d\n"
+           " - parents = %d\n"
+           " - cxy     = %x\n"
+           " - inode   = %x\n"
+           " - mapper  = %x\n"
+           " - extend  = %x\n",
+           name,
+           vfs_inode_type_str( type ),
+           attr,
+           size,
+           parents,
+           inode_cxy,
+           inode_ptr,
+           mapper,
+           extend );
+
+}  // end vfs_inode_display()
+
+
 ////////////////////////////////////////////////////////////////////////////////////////////
 //          VFS dentry descriptor related functions
@@ -737,5 +778,5 @@
 cycle = (uint32_t)hal_get_cycles();
 if( DEBUG_VFS_OPEN < cycle )
-printk("\n[%s] thread[%x,%x] exit for <%s> / fdid %d / cluster %x / cycle %d\n",
+printk("\n[%s] thread[%x,%x] exit for <%s> / fdid %d / cxy %x / cycle %d\n",
 __FUNCTION__, process->pid, this->trdid, path, file_id, GET_CXY( file_xp ), cycle );
 #endif
@@ -773,4 +814,21 @@
 // check inode type
 assert( (inode_type == INODE_TYPE_FILE), "bad inode type" );
+
+#if DEBUG_VFS_USER_MOVE
+char          name[CONFIG_VFS_MAX_NAME_LENGTH];
+uint32_t      cycle      = (uint32_t)hal_get_cycles();
+thread_t    * this       = CURRENT_THREAD;
+vfs_inode_t * inode      = hal_remote_lpt( XPTR( file_cxy , &file_ptr->inode ) );
+vfs_inode_get_name( XPTR( file_cxy , inode ) , name );
+if( cycle > DEBUG_VFS_USER_MOVE )
+{
+    if( to_buffer ) 
+    printk("\n[%s] thread[%x,%x] enter / %d bytes / mapper(%s) -> buffer(%x) / cycle %d\n",
+    __FUNCTION__ , this->process->pid, this->trdid, size, name, buffer, cycle );
+    else            
+    printk("\n[%s] thread[%x,%x] enter / %d bytes / buffer(%x) -> mapper(%s) / cycle %d\n",
+    __FUNCTION__ , this->process->pid, this->trdid, size, buffer, name, cycle );
+}
+#endif
 
     // get mapper pointer and file offset from file descriptor
@@ -794,17 +852,13 @@
 
 #if DEBUG_VFS_USER_MOVE
-char          name[CONFIG_VFS_MAX_NAME_LENGTH];
-uint32_t      cycle      = (uint32_t)hal_get_cycles();
-thread_t    * this       = CURRENT_THREAD;
-vfs_inode_t * inode      = hal_remote_lpt( XPTR( file_cxy , &file_ptr->inode ) );
-vfs_inode_get_name( XPTR( file_cxy , inode ) , name );
+cycle = (uint32_t)hal_get_cycles();
 if( cycle > DEBUG_VFS_USER_MOVE )
 {
     if( to_buffer ) 
-    printk("\n[%s] thread[%x,%x] moves %d bytes from <%s> mapper to buffer (%x) / cycle %d\n",
-    __FUNCTION__ , this->process->pid, this->trdid, size, name, buffer );
+    printk("\n[%s] thread[%x,%x] exit / %d bytes / mapper(%s) -> buffer(%x) / cycle %d\n",
+    __FUNCTION__ , this->process->pid, this->trdid, size, name, buffer, cycle );
     else            
-    printk("\n[%s] thread[%x,%x] moves %d bytes from buffer (%x) to <%s> mapper / cycle %d\n",
-    __FUNCTION__ , this->process->pid, this->trdid, size, buffer, name );
+    printk("\n[%s] thread[%x,%x] exit / %d bytes / buffer(%x) -> mapper(%s) / cycle %d\n",
+    __FUNCTION__ , this->process->pid, this->trdid, size, buffer, name, cycle );
 }
 #endif
@@ -1794,7 +1848,4 @@
             xptr_t inode_children_xp = XPTR( inode_cxy , &inode_ptr->children.items );
 
-printk("\n@@@ in %s : children_xp = (%x,%x)\n",
-__FUNCTION__, inode_cxy, &inode_ptr->children.items ); 
-
             // get target inode number of children 
             inode_children = hal_remote_l32( inode_children_xp );
@@ -2166,5 +2217,5 @@
 
     // display inode
-    nolock_printk("%s<%s> : %s / extd %d / %d bytes / dirty %d / cxy %x / inode %x / mapper %x\n",
+    nolock_printk("%s<%s> : %s / extd %x / %d bytes / dirty %d / cxy %x / inode %x / mapper %x\n",
     indent_str[indent], name, vfs_inode_type_str( inode_type ), (uint32_t)inode_extd,
     inode_size, inode_dirty, inode_cxy, inode_ptr, mapper_ptr );
@@ -2301,5 +2352,6 @@
 // This static function is used by the vfs_lookup() function.
 // It takes an extended pointer on a remote parent directory inode, a directory 
-// entry name, and returns an extended pointer on the child inode. 
+// entry name, and and scan the XHTAB associated to the parent inode to find the
+// searched dentry. It does NOT modify the inode tree in case of miss.
 // It can be used by any thread running in any cluster.
 //////////////////////////////////////////////////////////////////////////////////////////
@@ -2424,5 +2476,5 @@
     bool_t             create;       // searched inode must be created if not found
     bool_t             excl;         // searched inode must not exist
-    bool_t             par;          // searched inode is the parent
+    bool_t             parent;       // searched inode is the parent
     thread_t         * this;         // pointer on calling thread descriptor
     process_t        * process;      // pointer on calling process descriptor
@@ -2449,5 +2501,5 @@
     create = (lookup_mode & VFS_LOOKUP_CREATE) == VFS_LOOKUP_CREATE;
     excl   = (lookup_mode & VFS_LOOKUP_EXCL)   == VFS_LOOKUP_EXCL;
-    par    = (lookup_mode & VFS_LOOKUP_PARENT) == VFS_LOOKUP_PARENT;
+    parent = (lookup_mode & VFS_LOOKUP_PARENT) == VFS_LOOKUP_PARENT;
 
     // initialise loop variables
@@ -2499,9 +2551,8 @@
         child_cxy  = GET_CXY( child_xp );
 
-        // analyse found & last, depending on lookup_mode
         if( found == false )                              // not found in Inode Tree 
         {
             // when a inode is not found in the Inode Tree:
-            // - if (last and par) the Inode Tree is not modified
+            // - if (last and parent) the Inode Tree is not modified
             // - else we speculatively introduce a new (dentry/inode) in inode tree,
             //        and scan the parent directory mapper to initialise it.
@@ -2514,5 +2565,5 @@
             //         - if the child is a directory, the child mapper is loaded from device
 
-            if( last && par )   //  does nothing
+            if( last && parent )   //  does nothing
             {
 
@@ -2577,5 +2628,7 @@
                 }
 
-                if ( error )   // child not found in parent mapper
+                // when the missing dentry is not in the parent mapper,
+                // it is a new dentry that must be registered in parent directory mapper
+                if ( error )
                 {
                     if ( last && create )  // add a brand new dentry in parent directory
@@ -2594,7 +2647,10 @@
 #if (DEBUG_VFS_LOOKUP & 1)
 if( DEBUG_VFS_LOOKUP < cycle )
-printk("\n[%s] thread[%x,%x] child <%s> not found in parent mapper => create it\n",
+printk("\n[%s] thread[%x,%x] child <%s> not found in parent mapper => created it\n",
 __FUNCTION__, process->pid, this->trdid, name );
-#endif
+vfs_inode_display( child_xp );
+#endif
+
+
                     }
                     else                   // not last or not create => error
@@ -2687,5 +2743,5 @@
         if ( last )           // last inode in path  => return relevant info
         {
-            if ( par )  // return parent inode and child name
+            if ( parent )  // return parent inode and child name
             {
 
@@ -2757,6 +2813,7 @@
     vfs_inode_t  * child_ptr  = GET_PTR( child_xp );
 
-    // 1. allocate one free cluster to child inode
-    // depending on the child inode FS type
+    // 1. allocate one free cluster in file system to child inode,
+    // and update the File Allocation Table in both the TAF mapper and IOC device.
+    // It depends on the child inode FS type.
     vfs_ctx_t * ctx = hal_remote_lpt( XPTR( child_cxy , &child_ptr->ctx ) );
 
@@ -2772,9 +2829,9 @@
 #if( DEBUG_VFS_NEW_DENTRY_INIT & 1)
 if( DEBUG_VFS_NEW_DENTRY_INIT < cycle )
-printk("\n[%s] thread[%x,%x] allocated FAT cluster %x to <%s>\n",
+printk("\n[%s] thread[%x,%x] allocated FS cluster %x to <%s>\n",
 __FUNCTION__ , this->process->pid, this->trdid, cluster, child_name );
 #endif
 
-    // 2. update the child inode descriptor
+    // 2. update the child inode descriptor size and extend
     child_type = hal_remote_l32( XPTR( child_cxy , &child_ptr->type ) );
     child_size = (child_type == INODE_TYPE_DIR) ? 4096 : 0;
@@ -3301,5 +3358,5 @@
 #endif
 
-    // register new_dentry in parent_inode xhtab of children
+    // 4. register new_dentry in parent_inode xhtab of children
     children_xhtab_xp = XPTR( parent_cxy , &parent_inode_ptr->children );
     children_entry_xp = XPTR( parent_cxy , &new_dentry_ptr->children );
@@ -3313,5 +3370,5 @@
 #endif
 
-    // update "parent" and "child_xp" fields in new_dentry
+    // 5. update "parent" and "child_xp" fields in new_dentry
     hal_remote_s64( XPTR( parent_cxy , &new_dentry_ptr->child_xp ) , new_inode_xp );
     hal_remote_spt( XPTR( parent_cxy , &new_dentry_ptr->parent ) , parent_inode_ptr );
