Index: trunk/kernel/fs/vfs.c
===================================================================
--- trunk/kernel/fs/vfs.c	(revision 657)
+++ trunk/kernel/fs/vfs.c	(revision 673)
@@ -2,6 +2,6 @@
  * vfs.c - Virtual File System implementation.
  *
- * Author  Mohamed Lamine Karaoui (2015)
- *         Alain Greiner (2016,2017,2018,2019,2020)
+ * Author  Mohamed Lamine Karaoui (2014,2015)
+ *         Alain Greiner          (2016,2017,2018,2019,2020)
  *
  * Copyright (c) UPMC Sorbonne Universites
@@ -38,4 +38,5 @@
 #include <thread.h>
 #include <chdev.h>
+#include <pipe.h>
 #include <process.h>
 #include <cluster.h>
@@ -155,16 +156,16 @@
 //////////////////////////////////////////////////////////////////////////////////////////
 
-const char * vfs_inode_type_str( vfs_inode_type_t type )
+const char * vfs_inode_type_str( vfs_file_type_t type )
 {
     switch ( type ) 
     {
-        case INODE_TYPE_FILE: return "FILE";
-        case INODE_TYPE_DIR:  return "DIR ";
-        case INODE_TYPE_FIFO: return "FIFO";
-        case INODE_TYPE_PIPE: return "PIPE";
-        case INODE_TYPE_SOCK: return "SOCK";
-        case INODE_TYPE_DEV:  return "DEV ";
-        case INODE_TYPE_BLK:  return "BLK ";
-        case INODE_TYPE_SYML: return "SYML";
+        case FILE_TYPE_REG: return "FILE";
+        case FILE_TYPE_DIR:  return "DIR ";
+        case FILE_TYPE_FIFO: return "FIFO";
+        case FILE_TYPE_PIPE: return "PIPE";
+        case FILE_TYPE_SOCK: return "SOCK";
+        case FILE_TYPE_DEV:  return "DEV ";
+        case FILE_TYPE_BLK:  return "BLK ";
+        case FILE_TYPE_SYML: return "SYML";
         default:              return "undefined";
     }
@@ -188,4 +189,9 @@
     error_t            error;
 
+#if DEBUG_VFS_INODE_CREATE || DEBUG_VFS_ERROR
+uint32_t       cycle      = (uint32_t)hal_get_cycles();
+thread_t *     this       = CURRENT_THREAD;
+#endif
+
     // check fs type and get pointer on context
     if     ( fs_type == FS_TYPE_FATFS ) ctx = &fs_context[FS_TYPE_FATFS];
@@ -194,10 +200,15 @@
     else
     {
-        printk("\n[ERROR] in %s : illegal FS type\n", __FUNCTION__ );
+
+#if DEBUG_VFS_ERROR
+if( DEBUG_VFS_ERROR < cycle )
+printk("\n[ERROR] in %s : thread[%x,%x] / illegal FS type\n",
+__FUNCTION__ , this->process->pid , this->trdid );
+#endif
         return -1;
     }
 
 // check inode descriptor contained in one page
-assert( (sizeof(vfs_inode_t) <= CONFIG_PPM_PAGE_SIZE),
+assert( __FUNCTION__, (sizeof(vfs_inode_t) <= CONFIG_PPM_PAGE_SIZE),
 "inode descriptor must fit in one page" );
 
@@ -207,5 +218,10 @@
     if( error )
     {
-        printk("\n[ERROR] in %s : cannot allocate inum\n", __FUNCTION__ );
+
+#if DEBUG_VFS_ERROR
+if( DEBUG_VFS_ERROR < cycle )
+printk("\n[ERROR] in %s : thread[%x,%x] cannot allocate inum\n",
+__FUNCTION__ , this->process->pid , this->trdid );
+#endif
         return -1;
     }
@@ -216,5 +232,10 @@
     if( mapper_xp == XPTR_NULL )
     {
-        printk("\n[ERROR] in %s : cannot allocate mapper\n", __FUNCTION__ );
+
+#if DEBUG_VFS_ERROR
+if( DEBUG_VFS_ERROR < cycle )
+printk("\n[ERROR] in %s : thread[%x,%x] cannot allocate mapper\n",
+__FUNCTION__ , this->process->pid , this->trdid );
+#endif
         vfs_ctx_inum_release( XPTR( cxy , ctx ) , inum );
         return -1;
@@ -232,5 +253,10 @@
     if( inode_ptr == NULL )
     {
-        printk("\n[ERROR] in %s : cannot allocate inode descriptor\n", __FUNCTION__ );
+
+#if DEBUG_VFS_ERROR
+if( DEBUG_VFS_ERROR < cycle )
+printk("\n[ERROR] in %s : thread[%x,%x] cannot allocate inode\n",
+__FUNCTION__ , this->process->pid , this->trdidi );
+#endif
         vfs_ctx_inum_release( XPTR( cxy , ctx ) , inum );
         mapper_destroy( mapper_xp );
@@ -242,5 +268,5 @@
  
     // initialize inode descriptor
-    hal_remote_s32( XPTR( cxy , &inode_ptr->type   ) , INODE_TYPE_FILE );  // default value
+    hal_remote_s32( XPTR( cxy , &inode_ptr->type   ) , FILE_TYPE_REG );  // default value
     hal_remote_s32( XPTR( cxy , &inode_ptr->inum   ) , inum );  
     hal_remote_s32( XPTR( cxy , &inode_ptr->attr   ) , attr );  
@@ -269,6 +295,4 @@
 
 #if DEBUG_VFS_INODE_CREATE
-uint32_t       cycle      = (uint32_t)hal_get_cycles();
-thread_t *     this       = CURRENT_THREAD;
 if( DEBUG_VFS_INODE_CREATE < cycle )
 printk("\n[%s] thread[%x,%x] created inode (%x,%x) / ctx %x / fs_type %d / cycle %d\n",
@@ -287,6 +311,9 @@
     cxy_t         inode_cxy = GET_CXY( inode_xp );
 
+    // get local pointer on mapper
+    mapper_t    * mapper_ptr = hal_remote_lpt( XPTR( inode_cxy , &inode_ptr->mapper ));
+
     // release memory allocated for mapper
-    mapper_destroy( XPTR( inode_cxy , &inode_ptr->mapper ) );
+    mapper_destroy( XPTR( inode_cxy , mapper_ptr ) );
 
     // release memory allocated for inode descriptor
@@ -458,5 +485,5 @@
 void vfs_inode_display( xptr_t inode_xp )
 {
-    assert( (inode_xp != XPTR_NULL), "inode pointer is NULL");
+    assert( __FUNCTION__, (inode_xp != XPTR_NULL), "inode pointer is NULL");
 
     char  name[CONFIG_VFS_MAX_NAME_LENGTH];
@@ -468,5 +495,5 @@
     vfs_inode_t * inode_ptr = GET_PTR( inode_xp );
 
-    vfs_inode_type_t type    = hal_remote_l32( XPTR( inode_cxy , &inode_ptr->type ) );
+    vfs_file_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 ) );
@@ -511,7 +538,10 @@
     vfs_dentry_t   * dentry_ptr;     // dentry descriptor (to be allocated)
 
-#if DEBUG_VFS_DENTRY_CREATE
+#if DEBUG_VFS_DENTRY_CREATE || DEBUG_VFS_ERROR
 thread_t * this  = CURRENT_THREAD;
 uint32_t   cycle = (uint32_t)hal_get_cycles();
+#endif
+
+#if DEBUG_VFS_DENTRY_CREATE
 if( DEBUG_VFS_DENTRY_CREATE < cycle )
 printk("\n[%s] thread[%x,%x] enters for <%s> /  fs_type %x / cycle %d\n",
@@ -525,5 +555,10 @@
     else 
     {
-        printk("\n[ERROR] in %s undefined fs_type %d\n", __FUNCTION__, fs_type );
+
+#if DEBUG_VFS_ERROR
+if( DEBUG_VFS_ERROR < cycle )
+printk("\n[ERROR] in %s : thread[%x,%x] / undefined fs_type %d\n",
+__FUNCTION__ , this->process->pid, this->trdid, fs_type );
+#endif
         return -1;
     }
@@ -542,6 +577,10 @@
     if( dentry_ptr == NULL ) 
     {
-        printk("\n[ERROR] in %s : cannot allocate dentry descriptor\n",
-        __FUNCTION__ );
+
+#if DEBUG_VFS_ERROR
+if( DEBUG_VFS_ERROR < cycle )
+printk("\n[ERROR] in %s : thread[%x,%x] cannot allocate dentry descriptor\n",
+__FUNCTION__ , this->process->pid, this->trdid );
+#endif
         return -1;
     }
@@ -594,9 +633,10 @@
                          xptr_t   * file_xp )
 {
-    vfs_file_t  * file_ptr;
-	kmem_req_t    req;
-    uint32_t      type;
-    mapper_t    * mapper;
-    vfs_ctx_t   * ctx;
+    vfs_file_t   * file_ptr;
+	kmem_req_t     req;
+    uint32_t       type;
+    mapper_t     * mapper;
+    pipe_t       * pipe;
+    vfs_ctx_t    * ctx;
 
     // get inode cluster and local pointer
@@ -607,5 +647,5 @@
 thread_t * this = CURRENT_THREAD;
 uint32_t cycle = (uint32_t)hal_get_cycles();
-if( DEBUG_VFS_OPEN < cycle )
+if( DEBUG_VFS_FILE_CREATE < cycle )
 printk("\n[%s] thread[%x,%x] enter for inode (%x,%x) / cycle %d\n",
 __FUNCTION__, this->process->pid, this->trdid, inode_cxy, inode_ptr, cycle );
@@ -620,17 +660,18 @@
     if( file_ptr == NULL ) return -1;
 
-    // get type, ctx and mapper from inode descriptor
+    // get type, ctx, mapper, and buffer from inode descriptor
     type   = hal_remote_l32( XPTR( inode_cxy , &inode_ptr->type ) );
     ctx    = hal_remote_lpt( XPTR( inode_cxy , &inode_ptr->ctx ) );
     mapper = hal_remote_lpt( XPTR( inode_cxy , &inode_ptr->mapper ) );
+    pipe   = hal_remote_lpt( XPTR( inode_cxy , &inode_ptr->pipe ) );
 
     // initializes new file descriptor
     hal_remote_s32( XPTR( inode_cxy , &file_ptr->type     ) , type );
     hal_remote_s32( XPTR( inode_cxy , &file_ptr->attr     ) , attr );
+    hal_remote_spt( XPTR( inode_cxy , &file_ptr->ctx      ) , ctx );
     hal_remote_s32( XPTR( inode_cxy , &file_ptr->offset   ) , 0 );
-    hal_remote_s32( XPTR( inode_cxy , &file_ptr->refcount ) , 1 );
     hal_remote_spt( XPTR( inode_cxy , &file_ptr->inode    ) , inode_ptr );
-    hal_remote_spt( XPTR( inode_cxy , &file_ptr->ctx      ) , ctx );
     hal_remote_spt( XPTR( inode_cxy , &file_ptr->mapper   ) , mapper );
+    hal_remote_spt( XPTR( inode_cxy , &file_ptr->pipe     ) , pipe );
 
     remote_rwlock_init( XPTR( inode_cxy , &file_ptr->lock ), LOCK_VFS_FILE );
@@ -639,8 +680,18 @@
 
 #if DEBUG_VFS_FILE_CREATE
-cycle = (uint32_t)hal_get_cycles();
-if( DEBUG_VFS_OPEN < cycle )
-printk("\n[%s] thread[%x,%x] created file (%x,%x) %x\n",
-__FUNCTION__, this->process->pid, this->trdid, inode_cxy, file_ptr, cycle );
+if( (DEBUG_VFS_FILE_CREATE < cycle) && (type == FILE_TYPE_REG))
+{
+    char name[CONFIG_VFS_MAX_NAME_LENGTH];
+    vfs_file_get_name( XPTR( inode_cxy , file_ptr ) , name );
+    printk("\n[%s] thread[%x,%x] created file (%x,%x) / %s (%s)\n",
+    __FUNCTION__, this->process->pid, this->trdid,
+    inode_cxy, file_ptr, vfs_inode_type_str(type), name );
+}
+if( (DEBUG_VFS_FILE_CREATE < cycle) && (type != FILE_TYPE_REG))
+{
+    printk("\n[%s] thread[%x,%x] created file (%x,%x) / %s\n",
+    __FUNCTION__, this->process->pid, this->trdid,
+    inode_cxy, file_ptr, vfs_inode_type_str(type) );
+}
 #endif
 
@@ -655,4 +706,14 @@
     vfs_file_t * file_ptr = GET_PTR( file_xp );
     cxy_t        file_cxy = GET_CXY( file_xp );
+
+#if DEBUG_VFS_FILE_DESTROY
+char name[CONFIG_VFS_MAX_NAME_LENGTH];
+vfs_file_get_name( file_xp , name );
+thread_t * this = CURRENT_THREAD;
+uint32_t cycle = (uint32_t)hal_get_cycles();
+if( DEBUG_VFS_FILE_DESTROY < cycle )
+printk("\n[%s] thread[%x,%x] enter / file_ptr %x / file_cxy %x / <%s> / cycle %d\n",
+__FUNCTION__, this->process->pid, this->trdid, file_ptr, file_cxy, name, cycle );
+#endif
 
     // release file descriptor
@@ -662,38 +723,12 @@
 	kmem_remote_free( file_cxy , &req );
 
-#if DEBUG_VFS_CLOSE
-char name[CONFIG_VFS_MAX_NAME_LENGTH];
-vfs_file_get_name( file_xp , name );
-thread_t * this = CURRENT_THREAD;
-uint32_t cycle = (uint32_t)hal_get_cycles();
-if( DEBUG_VFS_CLOSE < cycle )
-printk("\n[%s] thread[%x,%x] deleted file <%s> in cluster %x / cycle %d\n",
-__FUNCTION__, this->process->pid, this->trdid, name, file_cxy, cycle );
+#if DEBUG_VFS_FILE_DESTROY
+cycle = (uint32_t)hal_get_cycles();
+if( DEBUG_VFS_FILE_DESTROY < cycle )
+printk("\n[%s] thread[%x,%x] exit for <%s> / cycle %d\n",
+__FUNCTION__, this->process->pid, this->trdid, file_ptr, file_cxy, name, cycle );
 #endif
 
 }  // end vfs_file_destroy() 
-
-
-////////////////////////////////////////
-void vfs_file_count_up( xptr_t file_xp )
-{
-    // get file cluster and local pointer
-    cxy_t        file_cxy = GET_CXY( file_xp );
-    vfs_file_t * file_ptr = GET_PTR( file_xp ); 
-
-    // atomically increment count
-    hal_remote_atomic_add( XPTR( file_cxy , &file_ptr->refcount ) , 1 ); 
-}
-
-//////////////////////////////////////////
-void vfs_file_count_down( xptr_t file_xp )
-{
-    // get file cluster and local pointer
-    cxy_t        file_cxy = GET_CXY( file_xp );
-    vfs_file_t * file_ptr = GET_PTR( file_xp ); 
-
-    // atomically decrement count
-    hal_remote_atomic_add( XPTR( file_cxy , &file_ptr->refcount ) , -1 ); 
-}
 
 ///////////////////////////////////////
@@ -755,6 +790,9 @@
     if( (flags & O_EXCL   )      )  lookup_mode |= VFS_LOOKUP_EXCL;
  
+#if DEBUG_VFS_OPEN || DEBUG_VFS_ERROR
+uint32_t cycle = (uint32_t)hal_get_cycles();
+#endif
+
 #if DEBUG_VFS_OPEN
-uint32_t cycle = (uint32_t)hal_get_cycles();
 if( DEBUG_VFS_OPEN < cycle )
 printk("\n[%s] thread[%x,%x] enter for <%s> / root_inode (%x,%x) / cycle %d\n",
@@ -791,6 +829,10 @@
     if( error )
     {
-        printk("\n[ERROR] in %s : cannot get inode <%s>\n",
-        __FUNCTION__ , path );
+
+#if DEBUG_VFS_ERROR
+if( DEBUG_VFS_ERROR < cycle )
+printk("\n[ERROR] in %s : thread[%x,%x] cannot get inode <%s>\n",
+__FUNCTION__ , process->pid, this->trdid , path );
+#endif
         return -1;
     }
@@ -824,4 +866,25 @@
     if( error ) return error;
 
+    // get new file descriptor cluster and local pointer
+    cxy_t        file_cxy = GET_CXY( file_xp );
+    vfs_file_t * file_ptr = GET_PTR( file_xp );
+
+    //get file type
+    uint32_t file_type = hal_remote_l32( XPTR( file_cxy , &file_ptr->type ));
+
+    // link the client thead to the pipe for a FIFO type
+    if( file_type == FILE_TYPE_FIFO )
+    {
+        // get local pointer on attached pipe
+        pipe_t * pipe = hal_remote_lpt( XPTR( file_cxy , &file_ptr->pipe ));
+
+        // build extended pointer on client thread
+        xptr_t thread_xp = XPTR( local_cxy , this );
+
+        // update pipe descriptor
+        if( flags & O_RDONLY ) hal_remote_s64( XPTR(file_cxy,&pipe->reader_xp) , thread_xp );
+        if( flags & O_WRONLY ) hal_remote_s64( XPTR(file_cxy,&pipe->writer_xp) , thread_xp );
+    }
+
 #if DEBUG_VFS_OPEN
 cycle = (uint32_t)hal_get_cycles();
@@ -849,5 +912,5 @@
     mapper_t         * mapper;         // local pointer on file mapper
     vfs_inode_t      * inode;          // local pointer on file inode
-    vfs_inode_type_t   type;           // inode type
+    vfs_file_type_t   type;           // inode type
     uint32_t           offset;         // current offset in file
     uint32_t           size;           // current file size
@@ -856,5 +919,5 @@
 
 // check argument
-assert( (file_xp != XPTR_NULL), "file_xp == XPTR_NULL" );
+assert( __FUNCTION__, (file_xp != XPTR_NULL), "file_xp == XPTR_NULL" );
 
     // get cluster and local pointer on remote file descriptor
@@ -870,10 +933,13 @@
    
 // check inode type
-assert( (type == INODE_TYPE_FILE), "bad inode type" );
+assert( __FUNCTION__, (type == FILE_TYPE_REG), "bad inode type" );
+
+#if DEBUG_VFS_USER_MOVE || DEBUG_VFS_ERROR
+uint32_t      cycle      = (uint32_t)hal_get_cycles();
+thread_t    * this       = CURRENT_THREAD;
+#endif
 
 #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_get_name( XPTR( file_cxy , inode ) , name );
 if( cycle > DEBUG_VFS_USER_MOVE )
@@ -929,5 +995,10 @@
     if( error ) 
     {
-        printk("\n[ERROR] in %s : cannot move data", __FUNCTION__ );
+
+#if DEBUG_VFS_ERROR
+if( DEBUG_VFS_ERROR < cycle )
+printk("\n[ERROR] in %s thread[%x,%x] cannot move data",
+__FUNCTION__, this->process->pid, this->trdid );
+#endif
         return -1;
     }
@@ -961,5 +1032,5 @@
     cxy_t              file_cxy;     // remote file descriptor cluster 
     vfs_file_t       * file_ptr;     // remote file descriptor local pointer
-    vfs_inode_type_t   inode_type;   // remote file type
+    vfs_file_type_t   inode_type;   // remote file type
     uint32_t           file_offset;  // current offset in file
     mapper_t         * mapper_ptr;   // remote mapper local pointer
@@ -968,5 +1039,5 @@
 
 // check argument
-assert( (file_xp != XPTR_NULL) , "file_xp == XPTR_NULL" );
+assert( __FUNCTION__, (file_xp != XPTR_NULL) , "file_xp == XPTR_NULL" );
 
     // get cluster and local pointer on remote file descriptor
@@ -978,5 +1049,5 @@
 
 // check inode type
-assert( (inode_type == INODE_TYPE_FILE), "bad file type" );
+assert( __FUNCTION__, (inode_type == FILE_TYPE_REG), "bad file type" );
 
     // get mapper pointers and file offset from file descriptor
@@ -1035,6 +1106,6 @@
 
 // check arguments
-assert( (file_xp != XPTR_NULL) , "file_xp == XPTR_NULL" );
-assert( (new_offset != NULL )  , "new_offset == NULL" );
+assert( __FUNCTION__, (file_xp != XPTR_NULL) , "file_xp == XPTR_NULL" );
+assert( __FUNCTION__, (new_offset != NULL )  , "new_offset == NULL" );
 
     // get cluster and local pointer on remote file descriptor
@@ -1114,5 +1185,5 @@
 
 // check argument
-assert( (file_xp != XPTR_NULL) , "file_xp is XPTR_NULL" );
+assert( __FUNCTION__, (file_xp != XPTR_NULL) , "file_xp is XPTR_NULL" );
 
     thread_t  * this    = CURRENT_THREAD;
@@ -1241,5 +1312,4 @@
         xptr_t entry_xp = XPTR( process_cxy , &process_ptr->fd_array.array[file_id] );
         hal_remote_s64( entry_xp , XPTR_NULL );
-        vfs_file_count_down( file_xp );
         hal_fence();
     }    
@@ -1309,5 +1379,5 @@
 #endif
 
-    // build extended pointer on lock protecting Inode Tree (in VFS root inode)
+    // build extended pointer on lock protecting Inode-Tree (in VFS root inode)
     vfs_root_xp  = process->vfs_root_xp;
     vfs_root_ptr = GET_PTR( vfs_root_xp );
@@ -1398,5 +1468,5 @@
 
     // update inode "type" field
-    hal_remote_s32( XPTR( inode_cxy , &inode_ptr->type ) , INODE_TYPE_DIR ); 
+    hal_remote_s32( XPTR( inode_cxy , &inode_ptr->type ) , FILE_TYPE_DIR ); 
     
 #if(DEBUG_VFS_MKDIR & 1)
@@ -1576,5 +1646,5 @@
 
     ///////////////////////////////////////////////////////////////////////
-    if( (inode_type == INODE_TYPE_FILE) || (inode_type == INODE_TYPE_DIR) )
+    if( (inode_type == FILE_TYPE_REG) || (inode_type == FILE_TYPE_DIR) )
     {
         // 1. create one new dentry
@@ -1666,5 +1736,5 @@
     vfs_inode_t     * inode_ptr;          // target inode local pointer
     uint32_t          inode_links;        // target inode links count
-    vfs_inode_type_t  inode_type;         // target inode type
+    vfs_file_type_t  inode_type;         // target inode type
     uint32_t          inode_children;     // target inode number of children
     xptr_t            dentry_xp;          // extended pointer on dentry to unlink
@@ -1805,5 +1875,5 @@
 
     ///////////////////////////////////////////////////////////////////////
-    if( (inode_type == INODE_TYPE_FILE) || (inode_type == INODE_TYPE_DIR) )
+    if( (inode_type == FILE_TYPE_REG) || (inode_type == FILE_TYPE_DIR) )  
     {
 
@@ -1814,6 +1884,5 @@
 vfs_inode_type_str(inode_type), inode_links );
 #endif
-
-        // 1. Release clusters allocated to target inode 
+        // 1. Release space allocated to inode on IOC device 
         //    and synchronize the FAT on IOC device if last link.
         if( inode_links == 1 ) 
@@ -1834,5 +1903,5 @@
             }
 
-            // release clusters on IOC device
+            // release space on IOC device
             error = vfs_fs_release_inode( inode_xp ); 
 
@@ -1869,5 +1938,5 @@
 __FUNCTION__, process->pid, this->trdid, path );
 #endif
-        // 3. remove dentry from Inode Tree (and associated chils inode when last link)
+        // 3. remove dentry from Inode Tree (and associated child inode when last link)
         vfs_remove_child_from_parent( dentry_xp );
 
@@ -1876,4 +1945,30 @@
 
 #if DEBUG_VFS_UNLINK
+if( DEBUG_VFS_UNLINK < cycle )
+printk("\n[%s] thread[%x,%x] exit / removed <%s> inode from Inode Tree / cycle %d\n",
+__FUNCTION__, process->pid, this->trdid, path, cycle );
+#endif
+        return 0;
+    }
+    ////////////////////////////////////////
+    else if( inode_type == FILE_TYPE_FIFO )
+    {
+        // 1. destroy the associated pipe
+        pipe_t * pipe    = hal_remote_lpt( XPTR( inode_cxy , &inode_ptr->pipe )); 
+        pipe_destroy( XPTR( inode_cxy , pipe ) );
+
+#if(DEBUG_VFS_UNLINK & 1)
+if( DEBUG_VFS_UNLINK < cycle )
+printk("\n[%s] thread[%x,%x] released <%s> pipe\n",
+__FUNCTION__, process->pid, this->trdid, path );
+#endif
+
+        // 2. remove dentry from Inode Tree (and associated child inode when last link)
+        vfs_remove_child_from_parent( dentry_xp );
+
+        // release the lock protecting Inode Tree
+        remote_rwlock_wr_release( lock_xp );
+
+#if DEBUG_VFS_UNLINK 
 if( DEBUG_VFS_UNLINK < cycle )
 printk("\n[%s] thread[%x,%x] exit / removed <%s> inode from Inode Tree / cycle %d\n",
@@ -1975,5 +2070,5 @@
     cxy_t             inode_cxy;          // target inode cluster identifier       
     vfs_inode_t     * inode_ptr;          // target inode local pointer
-    vfs_inode_type_t  inode_type;         // target inode type
+    vfs_file_type_t  inode_type;         // target inode type
     xptr_t            vfs_root_xp;        // extended pointer on VFS root inode
     vfs_inode_t     * vfs_root_ptr;       // local_pointer on VFS root inode
@@ -2027,5 +2122,5 @@
     inode_type = hal_remote_l32( XPTR( inode_cxy , &inode_ptr->type ) );
 
-    if( inode_type != INODE_TYPE_DIR )
+    if( inode_type != FILE_TYPE_DIR )
     {
         printk("\n[ERROR] in %s : <%s> is not a directory\n",
@@ -2073,5 +2168,5 @@
 
 // check lookup working mode
-assert( (rights == 0), "access rights non implemented yet" );
+assert( __FUNCTION__, (rights == 0), "access rights non implemented yet" );
  
     // get extended pointer on target inode
@@ -2093,5 +2188,5 @@
     // TODO finalize implementation
 
-assert( false , "not implemented" );
+assert( __FUNCTION__, false , "not implemented" );
 
     // set inode rights in remote inode
@@ -2099,14 +2194,96 @@
 
     return 0;
-}
-
-///////////////////////////////////
-error_t vfs_mkfifo( xptr_t   cwd_xp,
+
+}   // end vfs_chmod()
+
+/////////////////////////////////////
+error_t vfs_mkfifo( xptr_t   root_xp,
                     char   * path,
-                    uint32_t rights )
-{
-    assert( false , "not implemented %l %x %x", cwd_xp, path, rights );
+                    uint32_t mode )
+{
+    error_t       error;
+    xptr_t        parent_inode_xp;         // extended pointer on parent inode in path
+    xptr_t        fifo_dentry_xp;          // extended pointer on created dentry
+    xptr_t        fifo_inode_xp;           // extended pointer on created inode
+    cxy_t         fifo_cxy;                // selected cluster for fifo inode
+
+    char          fifo_name[CONFIG_VFS_MAX_NAME_LENGTH];
+
+    thread_t    * this    = CURRENT_THREAD;
+    process_t   * process = this->process;
+
+    // build extended pointer on lock protecting Inode Tree
+    xptr_t        vfs_root_xp  = process->vfs_root_xp;
+    vfs_inode_t * vfs_root_ptr = GET_PTR( vfs_root_xp );
+    cxy_t         vfs_root_cxy = GET_CXY( vfs_root_xp );
+    xptr_t        vfs_lock_xp  = XPTR( vfs_root_cxy , &vfs_root_ptr->main_lock );
+
+    // take the lock protecting the Inode-Tree in write mode
+    remote_rwlock_wr_acquire( vfs_lock_xp );
+
+    // 1. get extended pointer on parent inode and fifo name from vfs
+    error = vfs_lookup( root_xp,
+                        path,
+                        VFS_LOOKUP_PARENT,
+                        &parent_inode_xp,
+                        fifo_name );
+    if( error )
+    {
+        printk("\n[ERROR] in %s : cannot get parent inode for <%s> path\n",
+        __FUNCTION__ , path );
+        return -1;
+    }
+
+    // get parent inode cluster and local pointer
+    cxy_t         parent_cxy = GET_CXY( parent_inode_xp );
+    vfs_inode_t * parent_ptr = GET_PTR( parent_inode_xp );
+
+    // 2. select a cluster for new fifo inode 
+    fifo_cxy = cluster_random_select();
+
+    // get parent inode FS type
+    vfs_ctx_t    * ctx_ptr = hal_remote_lpt( XPTR( parent_cxy , &parent_ptr->ctx ) );
+    vfs_fs_type_t  fs_type = hal_remote_l32( XPTR( parent_cxy , &ctx_ptr->type ) );
+
+    // 3. insert a new inode and dentry in Inode-Tree
+    error = vfs_add_child_in_parent( fifo_cxy,
+                                     fs_type, 
+                                     parent_inode_xp,
+                                     fifo_name,           
+                                     &fifo_dentry_xp,   
+                                     &fifo_inode_xp );
+   
+    // get fifo inode local pointer
+    vfs_inode_t * fifo_inode_ptr = GET_PTR( fifo_inode_xp );
+
+    if( error )
+    {
+        printk("\n[ERROR] in %s : cannot create fifo inode for <%s> path\n",
+        __FUNCTION__ , path );
+        return -1;
+    }
+
+    // 4. allocate memory for a pipe descriptor, for the
+    //    remote_buf_t descriptor, and for the associated data buffer
+    pipe_t * pipe = pipe_create( fifo_cxy,
+                                 CONFIG_PIPE_BUF_SIZE ); 
+    if( pipe == NULL )
+    {
+        printk("\n[ERROR] in %s : cannot create pipe for <%s> path\n",
+        __FUNCTION__ , path );
+        return -1;
+    }
+
+    // 5. update fifo_inode "type", "pipe", and "rights" fields
+    hal_remote_s32( XPTR( fifo_cxy , &fifo_inode_ptr->type ) , FILE_TYPE_FIFO ); 
+    hal_remote_s32( XPTR( fifo_cxy , &fifo_inode_ptr->rights ) , mode ); 
+    hal_remote_spt( XPTR( fifo_cxy , &fifo_inode_ptr->pipe ) , pipe   );
+
+    // release the lock protecting the Inode-Tree from write mode
+    remote_rwlock_wr_release( vfs_lock_xp );
+
     return 0;
-}
+
+}   // end vfs_mkfifo()
 
 
@@ -2126,5 +2303,5 @@
     cxy_t              inode_cxy;
     vfs_inode_t      * inode_ptr;
-    vfs_inode_type_t   inode_type;
+    vfs_file_type_t   inode_type;
     uint32_t           inode_size;
     uint32_t           inode_attr;
@@ -2159,7 +2336,7 @@
                                         "                              " };  // level 15
 
-assert( (inode_xp != XPTR_NULL) , "inode_xp cannot be NULL" );
-assert( (name_xp  != XPTR_NULL) , "name_xp cannot be NULL" );
-assert( (indent < 16)           , "depth cannot be larger than 15" );
+assert( __FUNCTION__, (inode_xp != XPTR_NULL) , "inode_xp cannot be NULL" );
+assert( __FUNCTION__, (name_xp  != XPTR_NULL) , "name_xp cannot be NULL" );
+assert( __FUNCTION__, (indent < 16)           , "depth cannot be larger than 15" );
     
     // get current inode cluster and local pointer
@@ -2187,5 +2364,5 @@
     // scan directory entries when current inode is a directory
     // don't scan the the "." and ".." directories to break loops 
-    if( (inode_type == INODE_TYPE_DIR) && 
+    if( (inode_type == FILE_TYPE_DIR) && 
         (strcmp( name , "." ) != 0)    &&
         (strcmp( name , ".." ) != 0) )
@@ -2449,9 +2626,12 @@
 
 // check pathname / root_xp consistency
-assert( ((pathname[0] != '/') || (root_xp == process->vfs_root_xp)), 
+assert( __FUNCTION__, ((pathname[0] != '/') || (root_xp == process->vfs_root_xp)), 
 "root inode must be VFS root for path <%s>", pathname );
 
+#if DEBUG_VFS_LOOKUP || DEBUG_VFS_ERROR
+uint32_t cycle = (uint32_t)hal_get_cycles();
+#endif
+
 #if DEBUG_VFS_LOOKUP
-uint32_t cycle = (uint32_t)hal_get_cycles();
 char     root_name[CONFIG_VFS_MAX_NAME_LENGTH];
 vfs_inode_get_name( root_xp , root_name );
@@ -2564,6 +2744,10 @@
                 if( error )
                 {
-                    printk("\n[ERROR] in %s : cannot create inode <%s> in path <%s>\n",
-                    __FUNCTION__ , name, pathname );
+
+#if DEBUG_VFS_ERROR  
+if( DEBUG_VFS_ERROR < cycle )
+printk("\n[ERROR] in %s : thread[%x,%x] cannot create inode <%s> in path <%s>\n",
+__FUNCTION__ , process->pid, this->trdid, name, pathname );
+#endif
                     return -1;
                 }
@@ -2575,5 +2759,5 @@
 #if (DEBUG_VFS_LOOKUP & 1)
 if( DEBUG_VFS_LOOKUP < cycle )
-printk("\n[%s] thread[%x,%x] created missing inode <%s> in cluster %x\n",
+printk("\n[%s] thread[%x,%x] created dentry/inode <%s> in cluster %x\n",
 __FUNCTION__, process->pid, this->trdid, name, child_cxy );
 #endif
@@ -2591,6 +2775,10 @@
                         if ( error )
                         {
-                            printk("\n[ERROR] in %s : cannot add dentry <%s> in parent dir\n",
-                            __FUNCTION__, name );
+
+#if DEBUG_VFS_ERROR
+if( DEBUG_VFS_ERROR < cycle )
+printk("\n[ERROR] in %s : thread[%x,%x] cannot add dentry <%s> in parent dir\n",
+__FUNCTION__, process->pid, this->trdid, name );
+#endif
                             vfs_remove_child_from_parent( dentry_xp );
                             return -1;
@@ -2601,11 +2789,14 @@
 printk("\n[%s] thread[%x,%x] child <%s> not found in parent mapper => created it\n",
 __FUNCTION__, process->pid, this->trdid, name );
-vfs_inode_display( child_xp );
 #endif
                     }
                     else                   // not last or not create => error
                     {                       
-                        printk("\n[ERROR] in %s : <%s> node not found in parent for <%s>\n",
-                        __FUNCTION__ , name , pathname );
+
+#if DEBUG_VFS_ERROR      
+if( DEBUG_VFS_ERROR < cycle )
+printk("\n[ERROR] in %s : thread[%x,%x] cannot found node <%s> in parent for <%s>\n",
+__FUNCTION__ , process->pid, this->trdid, name, pathname );
+#endif
                         vfs_remove_child_from_parent( dentry_xp );
                         return -1;
@@ -2617,6 +2808,10 @@
                     if( last && create && excl )
                     {
-                        printk("\n[ERROR] in %s : node already exist <%s>\n",
-                        __FUNCTION__, name );
+
+#if DEBUG_VFS_ERROR
+if( DEBUG_VFS_ERROR < cycle )
+printk("\n[ERROR] in %s : thread[%x,%x] found an existing node <%s>  %\n",
+__FUNCTION__ , process->pid, this->trdid, pathname );
+#endif
                        return -1;
                     }
@@ -2629,5 +2824,5 @@
                     // load child mapper from device if child is a directory (prefetch)
                     uint32_t type = hal_remote_l32( XPTR( child_cxy , &child_ptr->type ) );
-                    if( type == INODE_TYPE_DIR ) 
+                    if( type == FILE_TYPE_DIR ) 
                     {
                         error = vfs_inode_load_all_pages( child_xp );
@@ -2635,6 +2830,9 @@
                         if ( error )
                         {
-                            printk("\n[ERROR] in %s : cannot load <%s> from device\n",
-                            __FUNCTION__ , name );
+#if DEBUG_VFS_ERROR
+if( DEBUG_VFS_ERROR < cycle )
+printk("\n[ERROR] in %s : thread[%x,%x] cannot load <%s> from device\n",
+__FUNCTION__ , process->pid, this->trdid, name );
+#endif
                             vfs_remove_child_from_parent( dentry_xp );
                             return -1;
@@ -2664,6 +2862,10 @@
             if( last && create && excl )
             {
-                printk("\n[ERROR] in %s : node <%s> already exist\n",
-                __FUNCTION__, name );
+
+#if DEBUG_VFS_ERROR
+if( DEBUG_VFS_ERROR < cycle )
+printk("\n[ERROR] in %s : thread[%x,%x] found an existing node <%s>\n",
+__FUNCTION__ , process->pid, this->trdid, pathname );
+#endif
                 return -1;
             }
@@ -2676,7 +2878,11 @@
         // if( error ) 
         // {
-        //     printk("\n[ERROR] in %s : thread %x / permission denied for %s\n",
-        //     __FUNCTION__ , this , name );
-        //     return EACCES;
+        //     #if DEBUG_VFS_ERROR
+        //     if( DEBUG_VFS_ERROR < cycle )
+        //     printk("\n[ERROR] in %s : thread[%x,%x] / permission denied for <%s>\n",
+        //     __FUNCTION__ , process->pid, this->trdid , pathname );
+        //     #endif
+        //
+        //     return -1;
         // }
 
@@ -2983,5 +3189,5 @@
 
 // check buffer overflow
-assert( (index >= 0) , "kernel buffer too small" );
+assert( __FUNCTION__, (index >= 0) , "kernel buffer too small" );
 
             }
@@ -3009,5 +3215,5 @@
 
 // check buffer overflow
-assert( (index >= 0) , "kernel buffer too small" );
+assert( __FUNCTION__, (index >= 0) , "kernel buffer too small" );
 
             // update pathname
@@ -3067,9 +3273,12 @@
     parent_inode_ptr = GET_PTR( parent_inode_xp );
 
+#if DEBUG_VFS_ADD_CHILD || DEBUG_VFS_ERROR
+uint32_t cycle = (uint32_t)hal_get_cycles();
+thread_t * this = CURRENT_THREAD; 
+#endif
+
 #if DEBUG_VFS_ADD_CHILD
 char parent_name[CONFIG_VFS_MAX_NAME_LENGTH];
 vfs_inode_get_name( parent_inode_xp , parent_name );
-uint32_t cycle = (uint32_t)hal_get_cycles();
-thread_t * this = CURRENT_THREAD; 
 if( DEBUG_VFS_ADD_CHILD < cycle )
 printk("\n[%s] thread[%x,%x] enter / child <%s> / parent <%s> / cycle %d\n",
@@ -3085,6 +3294,10 @@
     if( error )
     {
-        printk("\n[ERROR] in %s : cannot create dentry <%s> in cluster %x\n",
-        __FUNCTION__ , name , parent_cxy );
+
+#if DEBUG_VFS_ERROR
+if( DEBUG_VFS_ERROR < cycle )
+printk("\n[ERROR] in %s : thread[%x,%x] cannot create dentry <%s> in cluster %x\n",
+__FUNCTION__ , this->process->pid, this->trdid , name , parent_cxy );
+#endif
         return -1;
     }
@@ -3115,6 +3328,10 @@
     if( error )
     {
-        printk("\n[ERROR] in %s : cannot create inode in cluster %x\n",
-               __FUNCTION__ , child_cxy );
+
+#if DEBUG_VFS_ERROR
+if( DEBUG_VFS_ERROR < cycle )
+printk("\n[ERROR] in %s : thread[%x,%x] cannot create inode in cluster %x\n",
+__FUNCTION__ , this->process->pid , this->trdid , child_cxy );
+#endif
  
         vfs_dentry_destroy( new_dentry_xp );
@@ -3184,7 +3401,14 @@
     vfs_inode_t  * parent_inode_ptr;   // local pointer on parent inode
     uint32_t       links;              // number of child inode parents
+    error_t        error;
+
+#if DEBUG_VFS_REMOVE_CHILD 
+uint32_t   cycle = (uint32_t)hal_get_cycles();
+#endif
 
     char dentry_name[CONFIG_VFS_MAX_NAME_LENGTH];
    
+    thread_t * this  = CURRENT_THREAD;
+
     // get parent cluster and dentry local pointer
     parent_cxy = GET_CXY( dentry_xp );
@@ -3203,19 +3427,65 @@
     child_inode_ptr  = GET_PTR( child_inode_xp );
 
+#if DEBUG_VFS_REMOVE_CHILD
+if( DEBUG_VFS_REMOVE_CHILD < cycle )
+printk("\n[%s] thread[%x,%x] enter for dentry[%x,%x] / inode[%x,%x] / cycle %d\n",
+__FUNCTION__, this->process->pid, this->trdid,
+parent_cxy, dentry_ptr, child_cxy, child_inode_ptr, cycle );
+#endif
+
     // remove dentry from parent_inode
-    xhtab_remove( XPTR( parent_cxy , &parent_inode_ptr->children ),
-                  dentry_name,
-                  XPTR( parent_cxy , &dentry_ptr->children ) );
+    error = xhtab_remove( XPTR( parent_cxy , &parent_inode_ptr->children ),
+                          dentry_name,
+                          XPTR( parent_cxy , &dentry_ptr->children ) );
+
+    if( error )
+    { 
+        printk("\n[WARNING] in %s] thread[%x,%x] cannot remove dentry %s from parent dir\n",
+        __FUNCTION__, this->process->pid, this->trdid, dentry_name ); 
+    }
+
+#if DEBUG_VFS_REMOVE_CHILD
+cycle = (uint32_t)hal_get_cycles();
+if( DEBUG_VFS_REMOVE_CHILD < cycle )
+printk("\n[%s] thread[%x,%x] removed dentry from parent inode / cycle %d\n",
+__FUNCTION__, this->process->pid, this->trdid, cycle );
+#endif
 
     // remove dentry from child_inode
     xlist_unlink( XPTR( parent_cxy , &dentry_ptr->parents ) );
+
+    // get and update number of parents dentries
     links = hal_remote_atomic_add( XPTR( child_cxy , &child_inode_ptr->links ) , -1 );
+
+#if DEBUG_VFS_REMOVE_CHILD
+cycle = (uint32_t)hal_get_cycles();
+if( DEBUG_VFS_REMOVE_CHILD < cycle )
+printk("\n[%s] thread[%x,%x] removed dentry from child inode / cycle %d\n",
+__FUNCTION__, this->process->pid, this->trdid, cycle );
+#endif
 
     // delete dentry descriptor
     vfs_dentry_destroy( dentry_xp );
 
+#if DEBUG_VFS_REMOVE_CHILD
+cycle = (uint32_t)hal_get_cycles();
+if( DEBUG_VFS_REMOVE_CHILD < cycle )
+printk("\n[%s] thread[%x,%x] deleted dentry descriptor / cycle %d\n",
+__FUNCTION__, this->process->pid, this->trdid, cycle );
+#endif
+
     // delete child_inode descriptor if last link
-    if( links == 1 )  vfs_inode_destroy( child_inode_xp );
-
+    if( links == 1 )
+    {
+        vfs_inode_destroy( child_inode_xp );
+
+#if DEBUG_VFS_REMOVE_CHILD
+cycle = (uint32_t)hal_get_cycles();
+if( DEBUG_VFS_REMOVE_CHILD < cycle )
+printk("\n[%s] thread[%x,%x] deleted child inode descriptor / cycle %d\n",
+__FUNCTION__, this->process->pid, this->trdid, cycle );
+#endif
+
+    }
 }  // end vfs_remove_child_from_parent()
 
@@ -3233,6 +3503,6 @@
     error_t error = 0;
 
-assert( (inode_xp   != XPTR_NULL) , "inode_xp argument is NULL" );
-assert( (dentry_ptr != NULL     ) , "dentry_ptr argument is NULL" );
+assert( __FUNCTION__, (inode_xp   != XPTR_NULL) , "inode_xp argument is NULL" );
+assert( __FUNCTION__, (dentry_ptr != NULL     ) , "dentry_ptr argument is NULL" );
 
     vfs_inode_t * inode_ptr = GET_PTR( inode_xp );
@@ -3242,5 +3512,5 @@
     mapper_t * mapper = hal_remote_lpt( XPTR( inode_cxy , &inode_ptr->mapper ) );
 
-assert( (mapper != NULL) , "mapper pointer is NULL")        
+assert( __FUNCTION__, (mapper != NULL) , "mapper pointer is NULL");        
 
     // get FS type
@@ -3262,5 +3532,5 @@
     else
     {
-        assert( false , "undefined file system type" );
+        assert( __FUNCTION__, false , "undefined file system type" );
     }
 
@@ -3275,6 +3545,6 @@
     error_t error = 0;
 
-assert( (inode_xp   != XPTR_NULL) , "inode_xp argument is NULL" );
-assert( (dentry_ptr != NULL     ) , "dentry_ptr argument is NULL" );
+assert( __FUNCTION__, (inode_xp   != XPTR_NULL) , "inode_xp argument is NULL" );
+assert( __FUNCTION__, (dentry_ptr != NULL     ) , "dentry_ptr argument is NULL" );
 
     vfs_inode_t * inode_ptr = GET_PTR( inode_xp );
@@ -3284,5 +3554,5 @@
     mapper_t * mapper = hal_remote_lpt( XPTR( inode_cxy , &inode_ptr->mapper ) );
 
-assert( (mapper != NULL) , "mapper pointer is NULL")        
+assert( __FUNCTION__, (mapper != NULL) , "mapper pointer is NULL");        
 
     // get FS type
@@ -3305,5 +3575,5 @@
     else
     {
-        assert( false , "undefined file system type" );
+        assert( __FUNCTION__, false , "undefined file system type" );
     }
 
@@ -3318,6 +3588,6 @@
     error_t error = 0;
 
-assert( (inode_xp   != XPTR_NULL) , "inode_xp argument is NULL" );
-assert( (dentry_ptr != NULL     ) , "dentry_ptr argument is NULL" );
+assert( __FUNCTION__, (inode_xp   != XPTR_NULL) , "inode_xp argument is NULL" );
+assert( __FUNCTION__, (dentry_ptr != NULL     ) , "dentry_ptr argument is NULL" );
 
     vfs_inode_t * inode_ptr = GET_PTR( inode_xp );
@@ -3327,5 +3597,5 @@
     mapper_t * mapper = hal_remote_lpt( XPTR( inode_cxy , &inode_ptr->mapper ) );
 
-assert( (mapper != NULL) , "mapper pointer is NULL")        
+assert( __FUNCTION__, (mapper != NULL) , "mapper pointer is NULL");
 
     // get FS type
@@ -3339,13 +3609,13 @@
     else if( fs_type == FS_TYPE_RAMFS )
     {
-        assert( false , "should not be called for RAMFS" );
+        assert( __FUNCTION__, false , "should not be called for RAMFS" );
     }
     else if( fs_type == FS_TYPE_DEVFS )
     {
-        assert( false , "should not be called for DEVFS" );
+        assert( __FUNCTION__, false , "should not be called for DEVFS" );
     }
     else
     {
-        assert( false , "undefined file system type" );
+        assert( __FUNCTION__, false , "undefined file system type" );
     }
 
@@ -3360,6 +3630,6 @@
     error_t error = 0;
 
-assert( (inode_xp   != XPTR_NULL) , "inode_xp argument is NULL" );
-assert( (dentry_ptr != NULL     ) , "dentry_ptr argument is NULL" );
+assert( __FUNCTION__, (inode_xp   != XPTR_NULL) , "inode_xp argument is NULL" );
+assert( __FUNCTION__, (dentry_ptr != NULL     ) , "dentry_ptr argument is NULL" );
 
     vfs_inode_t * inode_ptr = GET_PTR( inode_xp );
@@ -3369,5 +3639,5 @@
     mapper_t * mapper = hal_remote_lpt( XPTR( inode_cxy , &inode_ptr->mapper ) );
 
-assert( (mapper != NULL) , "mapper pointer is NULL")        
+assert( __FUNCTION__, (mapper != NULL) , "mapper pointer is NULL");
 
     // get FS type
@@ -3381,13 +3651,13 @@
     else if( fs_type == FS_TYPE_RAMFS )
     {
-        assert( false , "should not be called for RAMFS" );
+        assert( __FUNCTION__, false , "should not be called for RAMFS" );
     }
     else if( fs_type == FS_TYPE_DEVFS )
     {
-        assert( false , "should not be called for DEVFS" );
+        assert( __FUNCTION__, false , "should not be called for DEVFS" );
     }
     else
     {
-        assert( false , "undefined file system type" );
+        assert( __FUNCTION__, false , "undefined file system type" );
     }
 
@@ -3402,6 +3672,6 @@
     error_t error = 0;
 
-assert( (inode_xp   != XPTR_NULL) , "inode_xp argument is NULL" );
-assert( (dentry_ptr != NULL     ) , "dentry_ptr argument is NULL" );
+assert( __FUNCTION__, (inode_xp   != XPTR_NULL) , "inode_xp argument is NULL" );
+assert( __FUNCTION__, (dentry_ptr != NULL     ) , "dentry_ptr argument is NULL" );
 
     vfs_inode_t * inode_ptr = GET_PTR( inode_xp );
@@ -3411,5 +3681,5 @@
     mapper_t * mapper = hal_remote_lpt( XPTR( inode_cxy , &inode_ptr->mapper ) );
 
-assert( (mapper != NULL) , "mapper pointer is NULL")        
+assert( __FUNCTION__, (mapper != NULL) , "mapper pointer is NULL");
 
     // get FS type
@@ -3423,13 +3693,13 @@
     else if( fs_type == FS_TYPE_RAMFS )
     {
-        assert( false , "should not be called for RAMFS" );
+        assert( __FUNCTION__, false , "should not be called for RAMFS" );
     }
     else if( fs_type == FS_TYPE_DEVFS )
     {
-        assert( false , "should not be called for DEVFS" );
+        assert( __FUNCTION__, false , "should not be called for DEVFS" );
     }
     else
     {
-        assert( false , "undefined file system type" );
+        assert( __FUNCTION__, false , "undefined file system type" );
     }
 
@@ -3450,10 +3720,10 @@
 
 // check arguments
-assert( (inode != NULL) , "parent pointer is NULL");
-assert( (array != NULL) , "child pointer is NULL");
-assert( (detailed == false) , "detailed argument not supported\n");
+assert( __FUNCTION__, (inode != NULL) , "parent pointer is NULL");
+assert( __FUNCTION__, (array != NULL) , "child pointer is NULL");
+assert( __FUNCTION__, (detailed == false) , "detailed argument not supported\n");
 
     // check inode type
-    if( inode->type != INODE_TYPE_DIR )
+    if( inode->type != FILE_TYPE_DIR )
     {
         printk("\n[ERROR] in %s : target inode is not a directory\n",
@@ -3478,5 +3748,5 @@
     else if( fs_type == FS_TYPE_RAMFS )
     {
-        assert( false , "should not be called for RAMFS" );
+        assert( __FUNCTION__, false , "should not be called for RAMFS" );
     }
     else if( fs_type == FS_TYPE_DEVFS )
@@ -3492,5 +3762,5 @@
     else
     {
-        assert( false , "undefined file system type" );
+        assert( __FUNCTION__, false , "undefined file system type" );
     }
 
@@ -3504,5 +3774,5 @@
     error_t error = 0;
 
-assert( (inode_xp != XPTR_NULL) , "inode_xp argument is NULL");
+assert( __FUNCTION__, (inode_xp != XPTR_NULL) , "inode_xp argument is NULL");
 
     vfs_inode_t * inode_ptr = GET_PTR( inode_xp );
@@ -3512,5 +3782,5 @@
     mapper_t * mapper = hal_remote_lpt( XPTR( inode_cxy , &inode_ptr->mapper ) );
 
-assert( (mapper != NULL) , "mapper pointer is NULL")        
+assert( __FUNCTION__, (mapper != NULL) , "mapper pointer is NULL");
 
     // get FS type
@@ -3524,13 +3794,13 @@
     else if( fs_type == FS_TYPE_RAMFS )
     {
-        assert( false , "should not be called for RAMFS" );
+        assert( __FUNCTION__, false , "should not be called for RAMFS" );
     }
     else if( fs_type == FS_TYPE_DEVFS )
     {
-        assert( false , "should not be called for DEVFS" );
+        assert( __FUNCTION__, false , "should not be called for DEVFS" );
     }
     else
     {
-        assert( false , "undefined file system type" );
+        assert( __FUNCTION__, false , "undefined file system type" );
     }
 
@@ -3551,13 +3821,13 @@
     else if( fs_type == FS_TYPE_RAMFS )
     {
-        assert( false , "should not be called for RAMFS" );
+        assert( __FUNCTION__, false , "should not be called for RAMFS" );
     }
     else if( fs_type == FS_TYPE_DEVFS )
     {
-        assert( false , "should not be called for DEVFS" );
+        assert( __FUNCTION__, false , "should not be called for DEVFS" );
     }
     else
     {
-        assert( false , "undefined file system type" );
+        assert( __FUNCTION__, false , "undefined file system type" );
     }
 
@@ -3571,5 +3841,5 @@
     error_t error = 0;
 
-assert( (inode_xp  != XPTR_NULL) , "inode_xp argument is NULL")        
+assert( __FUNCTION__, (inode_xp  != XPTR_NULL) , "inode_xp argument is NULL");
 
     vfs_inode_t * inode_ptr = GET_PTR( inode_xp );
@@ -3579,5 +3849,5 @@
     mapper_t * mapper = hal_remote_lpt( XPTR( inode_cxy , &inode_ptr->mapper ) );
 
-assert( (mapper != NULL) , "mapper pointer is NULL")        
+assert( __FUNCTION__, (mapper != NULL) , "mapper pointer is NULL");
 
     // get FS type from mapper
@@ -3591,13 +3861,13 @@
     else if( fs_type == FS_TYPE_RAMFS )
     {
-        assert( false , "should not be called for RAMFS" );
+        assert( __FUNCTION__, false , "should not be called for RAMFS" );
     }
     else if( fs_type == FS_TYPE_DEVFS )
     {
-        assert( false , "should not be called for DEVFS" );
+        assert( __FUNCTION__, false , "should not be called for DEVFS" );
     }
     else
     {
-        assert( false , "undefined file system type" );
+        assert( __FUNCTION__, false , "undefined file system type" );
     }
 
@@ -3612,5 +3882,5 @@
     error_t error = 0;
 
-assert( (page_xp != XPTR_NULL) , "page pointer is NULL" );
+assert( __FUNCTION__, (page_xp != XPTR_NULL) , "page pointer is NULL" );
 
     page_t * page_ptr = GET_PTR( page_xp );
@@ -3620,5 +3890,5 @@
     mapper_t * mapper = hal_remote_lpt( XPTR( page_cxy , &page_ptr->mapper ) );
 
-assert( (mapper != NULL) , "no mapper for page" );
+assert( __FUNCTION__, (mapper != NULL) , "no mapper for page" );
 
     // get FS type
@@ -3632,13 +3902,13 @@
     else if( fs_type == FS_TYPE_RAMFS )
     {
-        assert( false , "should not be called for RAMFS\n" );
+        assert( __FUNCTION__, false , "should not be called for RAMFS\n" );
     }
     else if( fs_type == FS_TYPE_DEVFS )
     {
-        assert( false , "should not be called for DEVFS\n" );
+        assert( __FUNCTION__, false , "should not be called for DEVFS\n" );
     }
     else
     {
-        assert( false , "undefined file system type" );
+        assert( __FUNCTION__, false , "undefined file system type" );
     }
 
