Changeset 673 for trunk/kernel/fs/vfs.c


Ignore:
Timestamp:
Nov 19, 2020, 11:54:16 PM (3 years ago)
Author:
alain
Message:

Introduce the DEBUG_VFS_ERROR in kernel_config to make
error messges display conditional.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/kernel/fs/vfs.c

    r657 r673  
    22 * vfs.c - Virtual File System implementation.
    33 *
    4  * Author  Mohamed Lamine Karaoui (2015)
    5  *         Alain Greiner (2016,2017,2018,2019,2020)
     4 * Author  Mohamed Lamine Karaoui (2014,2015)
     5 *         Alain Greiner          (2016,2017,2018,2019,2020)
    66 *
    77 * Copyright (c) UPMC Sorbonne Universites
     
    3838#include <thread.h>
    3939#include <chdev.h>
     40#include <pipe.h>
    4041#include <process.h>
    4142#include <cluster.h>
     
    155156//////////////////////////////////////////////////////////////////////////////////////////
    156157
    157 const char * vfs_inode_type_str( vfs_inode_type_t type )
     158const char * vfs_inode_type_str( vfs_file_type_t type )
    158159{
    159160    switch ( type )
    160161    {
    161         case INODE_TYPE_FILE: return "FILE";
    162         case INODE_TYPE_DIR:  return "DIR ";
    163         case INODE_TYPE_FIFO: return "FIFO";
    164         case INODE_TYPE_PIPE: return "PIPE";
    165         case INODE_TYPE_SOCK: return "SOCK";
    166         case INODE_TYPE_DEV:  return "DEV ";
    167         case INODE_TYPE_BLK:  return "BLK ";
    168         case INODE_TYPE_SYML: return "SYML";
     162        case FILE_TYPE_REG: return "FILE";
     163        case FILE_TYPE_DIR:  return "DIR ";
     164        case FILE_TYPE_FIFO: return "FIFO";
     165        case FILE_TYPE_PIPE: return "PIPE";
     166        case FILE_TYPE_SOCK: return "SOCK";
     167        case FILE_TYPE_DEV:  return "DEV ";
     168        case FILE_TYPE_BLK:  return "BLK ";
     169        case FILE_TYPE_SYML: return "SYML";
    169170        default:              return "undefined";
    170171    }
     
    188189    error_t            error;
    189190
     191#if DEBUG_VFS_INODE_CREATE || DEBUG_VFS_ERROR
     192uint32_t       cycle      = (uint32_t)hal_get_cycles();
     193thread_t *     this       = CURRENT_THREAD;
     194#endif
     195
    190196    // check fs type and get pointer on context
    191197    if     ( fs_type == FS_TYPE_FATFS ) ctx = &fs_context[FS_TYPE_FATFS];
     
    194200    else
    195201    {
    196         printk("\n[ERROR] in %s : illegal FS type\n", __FUNCTION__ );
     202
     203#if DEBUG_VFS_ERROR
     204if( DEBUG_VFS_ERROR < cycle )
     205printk("\n[ERROR] in %s : thread[%x,%x] / illegal FS type\n",
     206__FUNCTION__ , this->process->pid , this->trdid );
     207#endif
    197208        return -1;
    198209    }
    199210
    200211// check inode descriptor contained in one page
    201 assert( (sizeof(vfs_inode_t) <= CONFIG_PPM_PAGE_SIZE),
     212assert( __FUNCTION__, (sizeof(vfs_inode_t) <= CONFIG_PPM_PAGE_SIZE),
    202213"inode descriptor must fit in one page" );
    203214
     
    207218    if( error )
    208219    {
    209         printk("\n[ERROR] in %s : cannot allocate inum\n", __FUNCTION__ );
     220
     221#if DEBUG_VFS_ERROR
     222if( DEBUG_VFS_ERROR < cycle )
     223printk("\n[ERROR] in %s : thread[%x,%x] cannot allocate inum\n",
     224__FUNCTION__ , this->process->pid , this->trdid );
     225#endif
    210226        return -1;
    211227    }
     
    216232    if( mapper_xp == XPTR_NULL )
    217233    {
    218         printk("\n[ERROR] in %s : cannot allocate mapper\n", __FUNCTION__ );
     234
     235#if DEBUG_VFS_ERROR
     236if( DEBUG_VFS_ERROR < cycle )
     237printk("\n[ERROR] in %s : thread[%x,%x] cannot allocate mapper\n",
     238__FUNCTION__ , this->process->pid , this->trdid );
     239#endif
    219240        vfs_ctx_inum_release( XPTR( cxy , ctx ) , inum );
    220241        return -1;
     
    232253    if( inode_ptr == NULL )
    233254    {
    234         printk("\n[ERROR] in %s : cannot allocate inode descriptor\n", __FUNCTION__ );
     255
     256#if DEBUG_VFS_ERROR
     257if( DEBUG_VFS_ERROR < cycle )
     258printk("\n[ERROR] in %s : thread[%x,%x] cannot allocate inode\n",
     259__FUNCTION__ , this->process->pid , this->trdidi );
     260#endif
    235261        vfs_ctx_inum_release( XPTR( cxy , ctx ) , inum );
    236262        mapper_destroy( mapper_xp );
     
    242268 
    243269    // initialize inode descriptor
    244     hal_remote_s32( XPTR( cxy , &inode_ptr->type   ) , INODE_TYPE_FILE );  // default value
     270    hal_remote_s32( XPTR( cxy , &inode_ptr->type   ) , FILE_TYPE_REG );  // default value
    245271    hal_remote_s32( XPTR( cxy , &inode_ptr->inum   ) , inum ); 
    246272    hal_remote_s32( XPTR( cxy , &inode_ptr->attr   ) , attr ); 
     
    269295
    270296#if DEBUG_VFS_INODE_CREATE
    271 uint32_t       cycle      = (uint32_t)hal_get_cycles();
    272 thread_t *     this       = CURRENT_THREAD;
    273297if( DEBUG_VFS_INODE_CREATE < cycle )
    274298printk("\n[%s] thread[%x,%x] created inode (%x,%x) / ctx %x / fs_type %d / cycle %d\n",
     
    287311    cxy_t         inode_cxy = GET_CXY( inode_xp );
    288312
     313    // get local pointer on mapper
     314    mapper_t    * mapper_ptr = hal_remote_lpt( XPTR( inode_cxy , &inode_ptr->mapper ));
     315
    289316    // release memory allocated for mapper
    290     mapper_destroy( XPTR( inode_cxy , &inode_ptr->mapper ) );
     317    mapper_destroy( XPTR( inode_cxy , mapper_ptr ) );
    291318
    292319    // release memory allocated for inode descriptor
     
    458485void vfs_inode_display( xptr_t inode_xp )
    459486{
    460     assert( (inode_xp != XPTR_NULL), "inode pointer is NULL");
     487    assert( __FUNCTION__, (inode_xp != XPTR_NULL), "inode pointer is NULL");
    461488
    462489    char  name[CONFIG_VFS_MAX_NAME_LENGTH];
     
    468495    vfs_inode_t * inode_ptr = GET_PTR( inode_xp );
    469496
    470     vfs_inode_type_t type    = hal_remote_l32( XPTR( inode_cxy , &inode_ptr->type ) );
     497    vfs_file_type_t type    = hal_remote_l32( XPTR( inode_cxy , &inode_ptr->type ) );
    471498    uint32_t         attr    = hal_remote_l32( XPTR( inode_cxy , &inode_ptr->attr ) );
    472499    uint32_t         size    = hal_remote_l32( XPTR( inode_cxy , &inode_ptr->size ) );
     
    511538    vfs_dentry_t   * dentry_ptr;     // dentry descriptor (to be allocated)
    512539
    513 #if DEBUG_VFS_DENTRY_CREATE
     540#if DEBUG_VFS_DENTRY_CREATE || DEBUG_VFS_ERROR
    514541thread_t * this  = CURRENT_THREAD;
    515542uint32_t   cycle = (uint32_t)hal_get_cycles();
     543#endif
     544
     545#if DEBUG_VFS_DENTRY_CREATE
    516546if( DEBUG_VFS_DENTRY_CREATE < cycle )
    517547printk("\n[%s] thread[%x,%x] enters for <%s> /  fs_type %x / cycle %d\n",
     
    525555    else
    526556    {
    527         printk("\n[ERROR] in %s undefined fs_type %d\n", __FUNCTION__, fs_type );
     557
     558#if DEBUG_VFS_ERROR
     559if( DEBUG_VFS_ERROR < cycle )
     560printk("\n[ERROR] in %s : thread[%x,%x] / undefined fs_type %d\n",
     561__FUNCTION__ , this->process->pid, this->trdid, fs_type );
     562#endif
    528563        return -1;
    529564    }
     
    542577    if( dentry_ptr == NULL )
    543578    {
    544         printk("\n[ERROR] in %s : cannot allocate dentry descriptor\n",
    545         __FUNCTION__ );
     579
     580#if DEBUG_VFS_ERROR
     581if( DEBUG_VFS_ERROR < cycle )
     582printk("\n[ERROR] in %s : thread[%x,%x] cannot allocate dentry descriptor\n",
     583__FUNCTION__ , this->process->pid, this->trdid );
     584#endif
    546585        return -1;
    547586    }
     
    594633                         xptr_t   * file_xp )
    595634{
    596     vfs_file_t  * file_ptr;
    597         kmem_req_t    req;
    598     uint32_t      type;
    599     mapper_t    * mapper;
    600     vfs_ctx_t   * ctx;
     635    vfs_file_t   * file_ptr;
     636        kmem_req_t     req;
     637    uint32_t       type;
     638    mapper_t     * mapper;
     639    pipe_t       * pipe;
     640    vfs_ctx_t    * ctx;
    601641
    602642    // get inode cluster and local pointer
     
    607647thread_t * this = CURRENT_THREAD;
    608648uint32_t cycle = (uint32_t)hal_get_cycles();
    609 if( DEBUG_VFS_OPEN < cycle )
     649if( DEBUG_VFS_FILE_CREATE < cycle )
    610650printk("\n[%s] thread[%x,%x] enter for inode (%x,%x) / cycle %d\n",
    611651__FUNCTION__, this->process->pid, this->trdid, inode_cxy, inode_ptr, cycle );
     
    620660    if( file_ptr == NULL ) return -1;
    621661
    622     // get type, ctx and mapper from inode descriptor
     662    // get type, ctx, mapper, and buffer from inode descriptor
    623663    type   = hal_remote_l32( XPTR( inode_cxy , &inode_ptr->type ) );
    624664    ctx    = hal_remote_lpt( XPTR( inode_cxy , &inode_ptr->ctx ) );
    625665    mapper = hal_remote_lpt( XPTR( inode_cxy , &inode_ptr->mapper ) );
     666    pipe   = hal_remote_lpt( XPTR( inode_cxy , &inode_ptr->pipe ) );
    626667
    627668    // initializes new file descriptor
    628669    hal_remote_s32( XPTR( inode_cxy , &file_ptr->type     ) , type );
    629670    hal_remote_s32( XPTR( inode_cxy , &file_ptr->attr     ) , attr );
     671    hal_remote_spt( XPTR( inode_cxy , &file_ptr->ctx      ) , ctx );
    630672    hal_remote_s32( XPTR( inode_cxy , &file_ptr->offset   ) , 0 );
    631     hal_remote_s32( XPTR( inode_cxy , &file_ptr->refcount ) , 1 );
    632673    hal_remote_spt( XPTR( inode_cxy , &file_ptr->inode    ) , inode_ptr );
    633     hal_remote_spt( XPTR( inode_cxy , &file_ptr->ctx      ) , ctx );
    634674    hal_remote_spt( XPTR( inode_cxy , &file_ptr->mapper   ) , mapper );
     675    hal_remote_spt( XPTR( inode_cxy , &file_ptr->pipe     ) , pipe );
    635676
    636677    remote_rwlock_init( XPTR( inode_cxy , &file_ptr->lock ), LOCK_VFS_FILE );
     
    639680
    640681#if DEBUG_VFS_FILE_CREATE
    641 cycle = (uint32_t)hal_get_cycles();
    642 if( DEBUG_VFS_OPEN < cycle )
    643 printk("\n[%s] thread[%x,%x] created file (%x,%x) %x\n",
    644 __FUNCTION__, this->process->pid, this->trdid, inode_cxy, file_ptr, cycle );
     682if( (DEBUG_VFS_FILE_CREATE < cycle) && (type == FILE_TYPE_REG))
     683{
     684    char name[CONFIG_VFS_MAX_NAME_LENGTH];
     685    vfs_file_get_name( XPTR( inode_cxy , file_ptr ) , name );
     686    printk("\n[%s] thread[%x,%x] created file (%x,%x) / %s (%s)\n",
     687    __FUNCTION__, this->process->pid, this->trdid,
     688    inode_cxy, file_ptr, vfs_inode_type_str(type), name );
     689}
     690if( (DEBUG_VFS_FILE_CREATE < cycle) && (type != FILE_TYPE_REG))
     691{
     692    printk("\n[%s] thread[%x,%x] created file (%x,%x) / %s\n",
     693    __FUNCTION__, this->process->pid, this->trdid,
     694    inode_cxy, file_ptr, vfs_inode_type_str(type) );
     695}
    645696#endif
    646697
     
    655706    vfs_file_t * file_ptr = GET_PTR( file_xp );
    656707    cxy_t        file_cxy = GET_CXY( file_xp );
     708
     709#if DEBUG_VFS_FILE_DESTROY
     710char name[CONFIG_VFS_MAX_NAME_LENGTH];
     711vfs_file_get_name( file_xp , name );
     712thread_t * this = CURRENT_THREAD;
     713uint32_t cycle = (uint32_t)hal_get_cycles();
     714if( DEBUG_VFS_FILE_DESTROY < cycle )
     715printk("\n[%s] thread[%x,%x] enter / file_ptr %x / file_cxy %x / <%s> / cycle %d\n",
     716__FUNCTION__, this->process->pid, this->trdid, file_ptr, file_cxy, name, cycle );
     717#endif
    657718
    658719    // release file descriptor
     
    662723        kmem_remote_free( file_cxy , &req );
    663724
    664 #if DEBUG_VFS_CLOSE
    665 char name[CONFIG_VFS_MAX_NAME_LENGTH];
    666 vfs_file_get_name( file_xp , name );
    667 thread_t * this = CURRENT_THREAD;
    668 uint32_t cycle = (uint32_t)hal_get_cycles();
    669 if( DEBUG_VFS_CLOSE < cycle )
    670 printk("\n[%s] thread[%x,%x] deleted file <%s> in cluster %x / cycle %d\n",
    671 __FUNCTION__, this->process->pid, this->trdid, name, file_cxy, cycle );
     725#if DEBUG_VFS_FILE_DESTROY
     726cycle = (uint32_t)hal_get_cycles();
     727if( DEBUG_VFS_FILE_DESTROY < cycle )
     728printk("\n[%s] thread[%x,%x] exit for <%s> / cycle %d\n",
     729__FUNCTION__, this->process->pid, this->trdid, file_ptr, file_cxy, name, cycle );
    672730#endif
    673731
    674732}  // end vfs_file_destroy()
    675 
    676 
    677 ////////////////////////////////////////
    678 void vfs_file_count_up( xptr_t file_xp )
    679 {
    680     // get file cluster and local pointer
    681     cxy_t        file_cxy = GET_CXY( file_xp );
    682     vfs_file_t * file_ptr = GET_PTR( file_xp );
    683 
    684     // atomically increment count
    685     hal_remote_atomic_add( XPTR( file_cxy , &file_ptr->refcount ) , 1 );
    686 }
    687 
    688 //////////////////////////////////////////
    689 void vfs_file_count_down( xptr_t file_xp )
    690 {
    691     // get file cluster and local pointer
    692     cxy_t        file_cxy = GET_CXY( file_xp );
    693     vfs_file_t * file_ptr = GET_PTR( file_xp );
    694 
    695     // atomically decrement count
    696     hal_remote_atomic_add( XPTR( file_cxy , &file_ptr->refcount ) , -1 );
    697 }
    698733
    699734///////////////////////////////////////
     
    755790    if( (flags & O_EXCL   )      )  lookup_mode |= VFS_LOOKUP_EXCL;
    756791 
     792#if DEBUG_VFS_OPEN || DEBUG_VFS_ERROR
     793uint32_t cycle = (uint32_t)hal_get_cycles();
     794#endif
     795
    757796#if DEBUG_VFS_OPEN
    758 uint32_t cycle = (uint32_t)hal_get_cycles();
    759797if( DEBUG_VFS_OPEN < cycle )
    760798printk("\n[%s] thread[%x,%x] enter for <%s> / root_inode (%x,%x) / cycle %d\n",
     
    791829    if( error )
    792830    {
    793         printk("\n[ERROR] in %s : cannot get inode <%s>\n",
    794         __FUNCTION__ , path );
     831
     832#if DEBUG_VFS_ERROR
     833if( DEBUG_VFS_ERROR < cycle )
     834printk("\n[ERROR] in %s : thread[%x,%x] cannot get inode <%s>\n",
     835__FUNCTION__ , process->pid, this->trdid , path );
     836#endif
    795837        return -1;
    796838    }
     
    824866    if( error ) return error;
    825867
     868    // get new file descriptor cluster and local pointer
     869    cxy_t        file_cxy = GET_CXY( file_xp );
     870    vfs_file_t * file_ptr = GET_PTR( file_xp );
     871
     872    //get file type
     873    uint32_t file_type = hal_remote_l32( XPTR( file_cxy , &file_ptr->type ));
     874
     875    // link the client thead to the pipe for a FIFO type
     876    if( file_type == FILE_TYPE_FIFO )
     877    {
     878        // get local pointer on attached pipe
     879        pipe_t * pipe = hal_remote_lpt( XPTR( file_cxy , &file_ptr->pipe ));
     880
     881        // build extended pointer on client thread
     882        xptr_t thread_xp = XPTR( local_cxy , this );
     883
     884        // update pipe descriptor
     885        if( flags & O_RDONLY ) hal_remote_s64( XPTR(file_cxy,&pipe->reader_xp) , thread_xp );
     886        if( flags & O_WRONLY ) hal_remote_s64( XPTR(file_cxy,&pipe->writer_xp) , thread_xp );
     887    }
     888
    826889#if DEBUG_VFS_OPEN
    827890cycle = (uint32_t)hal_get_cycles();
     
    849912    mapper_t         * mapper;         // local pointer on file mapper
    850913    vfs_inode_t      * inode;          // local pointer on file inode
    851     vfs_inode_type_t   type;           // inode type
     914    vfs_file_type_t   type;           // inode type
    852915    uint32_t           offset;         // current offset in file
    853916    uint32_t           size;           // current file size
     
    856919
    857920// check argument
    858 assert( (file_xp != XPTR_NULL), "file_xp == XPTR_NULL" );
     921assert( __FUNCTION__, (file_xp != XPTR_NULL), "file_xp == XPTR_NULL" );
    859922
    860923    // get cluster and local pointer on remote file descriptor
     
    870933   
    871934// check inode type
    872 assert( (type == INODE_TYPE_FILE), "bad inode type" );
     935assert( __FUNCTION__, (type == FILE_TYPE_REG), "bad inode type" );
     936
     937#if DEBUG_VFS_USER_MOVE || DEBUG_VFS_ERROR
     938uint32_t      cycle      = (uint32_t)hal_get_cycles();
     939thread_t    * this       = CURRENT_THREAD;
     940#endif
    873941
    874942#if DEBUG_VFS_USER_MOVE
    875943char          name[CONFIG_VFS_MAX_NAME_LENGTH];
    876 uint32_t      cycle      = (uint32_t)hal_get_cycles();
    877 thread_t    * this       = CURRENT_THREAD;
    878944vfs_inode_get_name( XPTR( file_cxy , inode ) , name );
    879945if( cycle > DEBUG_VFS_USER_MOVE )
     
    929995    if( error )
    930996    {
    931         printk("\n[ERROR] in %s : cannot move data", __FUNCTION__ );
     997
     998#if DEBUG_VFS_ERROR
     999if( DEBUG_VFS_ERROR < cycle )
     1000printk("\n[ERROR] in %s thread[%x,%x] cannot move data",
     1001__FUNCTION__, this->process->pid, this->trdid );
     1002#endif
    9321003        return -1;
    9331004    }
     
    9611032    cxy_t              file_cxy;     // remote file descriptor cluster
    9621033    vfs_file_t       * file_ptr;     // remote file descriptor local pointer
    963     vfs_inode_type_t   inode_type;   // remote file type
     1034    vfs_file_type_t   inode_type;   // remote file type
    9641035    uint32_t           file_offset;  // current offset in file
    9651036    mapper_t         * mapper_ptr;   // remote mapper local pointer
     
    9681039
    9691040// check argument
    970 assert( (file_xp != XPTR_NULL) , "file_xp == XPTR_NULL" );
     1041assert( __FUNCTION__, (file_xp != XPTR_NULL) , "file_xp == XPTR_NULL" );
    9711042
    9721043    // get cluster and local pointer on remote file descriptor
     
    9781049
    9791050// check inode type
    980 assert( (inode_type == INODE_TYPE_FILE), "bad file type" );
     1051assert( __FUNCTION__, (inode_type == FILE_TYPE_REG), "bad file type" );
    9811052
    9821053    // get mapper pointers and file offset from file descriptor
     
    10351106
    10361107// check arguments
    1037 assert( (file_xp != XPTR_NULL) , "file_xp == XPTR_NULL" );
    1038 assert( (new_offset != NULL )  , "new_offset == NULL" );
     1108assert( __FUNCTION__, (file_xp != XPTR_NULL) , "file_xp == XPTR_NULL" );
     1109assert( __FUNCTION__, (new_offset != NULL )  , "new_offset == NULL" );
    10391110
    10401111    // get cluster and local pointer on remote file descriptor
     
    11141185
    11151186// check argument
    1116 assert( (file_xp != XPTR_NULL) , "file_xp is XPTR_NULL" );
     1187assert( __FUNCTION__, (file_xp != XPTR_NULL) , "file_xp is XPTR_NULL" );
    11171188
    11181189    thread_t  * this    = CURRENT_THREAD;
     
    12411312        xptr_t entry_xp = XPTR( process_cxy , &process_ptr->fd_array.array[file_id] );
    12421313        hal_remote_s64( entry_xp , XPTR_NULL );
    1243         vfs_file_count_down( file_xp );
    12441314        hal_fence();
    12451315    }   
     
    13091379#endif
    13101380
    1311     // build extended pointer on lock protecting Inode Tree (in VFS root inode)
     1381    // build extended pointer on lock protecting Inode-Tree (in VFS root inode)
    13121382    vfs_root_xp  = process->vfs_root_xp;
    13131383    vfs_root_ptr = GET_PTR( vfs_root_xp );
     
    13981468
    13991469    // update inode "type" field
    1400     hal_remote_s32( XPTR( inode_cxy , &inode_ptr->type ) , INODE_TYPE_DIR );
     1470    hal_remote_s32( XPTR( inode_cxy , &inode_ptr->type ) , FILE_TYPE_DIR );
    14011471   
    14021472#if(DEBUG_VFS_MKDIR & 1)
     
    15761646
    15771647    ///////////////////////////////////////////////////////////////////////
    1578     if( (inode_type == INODE_TYPE_FILE) || (inode_type == INODE_TYPE_DIR) )
     1648    if( (inode_type == FILE_TYPE_REG) || (inode_type == FILE_TYPE_DIR) )
    15791649    {
    15801650        // 1. create one new dentry
     
    16661736    vfs_inode_t     * inode_ptr;          // target inode local pointer
    16671737    uint32_t          inode_links;        // target inode links count
    1668     vfs_inode_type_t  inode_type;         // target inode type
     1738    vfs_file_type_t  inode_type;         // target inode type
    16691739    uint32_t          inode_children;     // target inode number of children
    16701740    xptr_t            dentry_xp;          // extended pointer on dentry to unlink
     
    18051875
    18061876    ///////////////////////////////////////////////////////////////////////
    1807     if( (inode_type == INODE_TYPE_FILE) || (inode_type == INODE_TYPE_DIR) )
     1877    if( (inode_type == FILE_TYPE_REG) || (inode_type == FILE_TYPE_DIR) ) 
    18081878    {
    18091879
     
    18141884vfs_inode_type_str(inode_type), inode_links );
    18151885#endif
    1816 
    1817         // 1. Release clusters allocated to target inode
     1886        // 1. Release space allocated to inode on IOC device
    18181887        //    and synchronize the FAT on IOC device if last link.
    18191888        if( inode_links == 1 )
     
    18341903            }
    18351904
    1836             // release clusters on IOC device
     1905            // release space on IOC device
    18371906            error = vfs_fs_release_inode( inode_xp );
    18381907
     
    18691938__FUNCTION__, process->pid, this->trdid, path );
    18701939#endif
    1871         // 3. remove dentry from Inode Tree (and associated chils inode when last link)
     1940        // 3. remove dentry from Inode Tree (and associated child inode when last link)
    18721941        vfs_remove_child_from_parent( dentry_xp );
    18731942
     
    18761945
    18771946#if DEBUG_VFS_UNLINK
     1947if( DEBUG_VFS_UNLINK < cycle )
     1948printk("\n[%s] thread[%x,%x] exit / removed <%s> inode from Inode Tree / cycle %d\n",
     1949__FUNCTION__, process->pid, this->trdid, path, cycle );
     1950#endif
     1951        return 0;
     1952    }
     1953    ////////////////////////////////////////
     1954    else if( inode_type == FILE_TYPE_FIFO )
     1955    {
     1956        // 1. destroy the associated pipe
     1957        pipe_t * pipe    = hal_remote_lpt( XPTR( inode_cxy , &inode_ptr->pipe ));
     1958        pipe_destroy( XPTR( inode_cxy , pipe ) );
     1959
     1960#if(DEBUG_VFS_UNLINK & 1)
     1961if( DEBUG_VFS_UNLINK < cycle )
     1962printk("\n[%s] thread[%x,%x] released <%s> pipe\n",
     1963__FUNCTION__, process->pid, this->trdid, path );
     1964#endif
     1965
     1966        // 2. remove dentry from Inode Tree (and associated child inode when last link)
     1967        vfs_remove_child_from_parent( dentry_xp );
     1968
     1969        // release the lock protecting Inode Tree
     1970        remote_rwlock_wr_release( lock_xp );
     1971
     1972#if DEBUG_VFS_UNLINK
    18781973if( DEBUG_VFS_UNLINK < cycle )
    18791974printk("\n[%s] thread[%x,%x] exit / removed <%s> inode from Inode Tree / cycle %d\n",
     
    19752070    cxy_t             inode_cxy;          // target inode cluster identifier       
    19762071    vfs_inode_t     * inode_ptr;          // target inode local pointer
    1977     vfs_inode_type_t  inode_type;         // target inode type
     2072    vfs_file_type_t  inode_type;         // target inode type
    19782073    xptr_t            vfs_root_xp;        // extended pointer on VFS root inode
    19792074    vfs_inode_t     * vfs_root_ptr;       // local_pointer on VFS root inode
     
    20272122    inode_type = hal_remote_l32( XPTR( inode_cxy , &inode_ptr->type ) );
    20282123
    2029     if( inode_type != INODE_TYPE_DIR )
     2124    if( inode_type != FILE_TYPE_DIR )
    20302125    {
    20312126        printk("\n[ERROR] in %s : <%s> is not a directory\n",
     
    20732168
    20742169// check lookup working mode
    2075 assert( (rights == 0), "access rights non implemented yet" );
     2170assert( __FUNCTION__, (rights == 0), "access rights non implemented yet" );
    20762171 
    20772172    // get extended pointer on target inode
     
    20932188    // TODO finalize implementation
    20942189
    2095 assert( false , "not implemented" );
     2190assert( __FUNCTION__, false , "not implemented" );
    20962191
    20972192    // set inode rights in remote inode
     
    20992194
    21002195    return 0;
    2101 }
    2102 
    2103 ///////////////////////////////////
    2104 error_t vfs_mkfifo( xptr_t   cwd_xp,
     2196
     2197}   // end vfs_chmod()
     2198
     2199/////////////////////////////////////
     2200error_t vfs_mkfifo( xptr_t   root_xp,
    21052201                    char   * path,
    2106                     uint32_t rights )
    2107 {
    2108     assert( false , "not implemented %l %x %x", cwd_xp, path, rights );
     2202                    uint32_t mode )
     2203{
     2204    error_t       error;
     2205    xptr_t        parent_inode_xp;         // extended pointer on parent inode in path
     2206    xptr_t        fifo_dentry_xp;          // extended pointer on created dentry
     2207    xptr_t        fifo_inode_xp;           // extended pointer on created inode
     2208    cxy_t         fifo_cxy;                // selected cluster for fifo inode
     2209
     2210    char          fifo_name[CONFIG_VFS_MAX_NAME_LENGTH];
     2211
     2212    thread_t    * this    = CURRENT_THREAD;
     2213    process_t   * process = this->process;
     2214
     2215    // build extended pointer on lock protecting Inode Tree
     2216    xptr_t        vfs_root_xp  = process->vfs_root_xp;
     2217    vfs_inode_t * vfs_root_ptr = GET_PTR( vfs_root_xp );
     2218    cxy_t         vfs_root_cxy = GET_CXY( vfs_root_xp );
     2219    xptr_t        vfs_lock_xp  = XPTR( vfs_root_cxy , &vfs_root_ptr->main_lock );
     2220
     2221    // take the lock protecting the Inode-Tree in write mode
     2222    remote_rwlock_wr_acquire( vfs_lock_xp );
     2223
     2224    // 1. get extended pointer on parent inode and fifo name from vfs
     2225    error = vfs_lookup( root_xp,
     2226                        path,
     2227                        VFS_LOOKUP_PARENT,
     2228                        &parent_inode_xp,
     2229                        fifo_name );
     2230    if( error )
     2231    {
     2232        printk("\n[ERROR] in %s : cannot get parent inode for <%s> path\n",
     2233        __FUNCTION__ , path );
     2234        return -1;
     2235    }
     2236
     2237    // get parent inode cluster and local pointer
     2238    cxy_t         parent_cxy = GET_CXY( parent_inode_xp );
     2239    vfs_inode_t * parent_ptr = GET_PTR( parent_inode_xp );
     2240
     2241    // 2. select a cluster for new fifo inode
     2242    fifo_cxy = cluster_random_select();
     2243
     2244    // get parent inode FS type
     2245    vfs_ctx_t    * ctx_ptr = hal_remote_lpt( XPTR( parent_cxy , &parent_ptr->ctx ) );
     2246    vfs_fs_type_t  fs_type = hal_remote_l32( XPTR( parent_cxy , &ctx_ptr->type ) );
     2247
     2248    // 3. insert a new inode and dentry in Inode-Tree
     2249    error = vfs_add_child_in_parent( fifo_cxy,
     2250                                     fs_type,
     2251                                     parent_inode_xp,
     2252                                     fifo_name,           
     2253                                     &fifo_dentry_xp,   
     2254                                     &fifo_inode_xp );
     2255   
     2256    // get fifo inode local pointer
     2257    vfs_inode_t * fifo_inode_ptr = GET_PTR( fifo_inode_xp );
     2258
     2259    if( error )
     2260    {
     2261        printk("\n[ERROR] in %s : cannot create fifo inode for <%s> path\n",
     2262        __FUNCTION__ , path );
     2263        return -1;
     2264    }
     2265
     2266    // 4. allocate memory for a pipe descriptor, for the
     2267    //    remote_buf_t descriptor, and for the associated data buffer
     2268    pipe_t * pipe = pipe_create( fifo_cxy,
     2269                                 CONFIG_PIPE_BUF_SIZE );
     2270    if( pipe == NULL )
     2271    {
     2272        printk("\n[ERROR] in %s : cannot create pipe for <%s> path\n",
     2273        __FUNCTION__ , path );
     2274        return -1;
     2275    }
     2276
     2277    // 5. update fifo_inode "type", "pipe", and "rights" fields
     2278    hal_remote_s32( XPTR( fifo_cxy , &fifo_inode_ptr->type ) , FILE_TYPE_FIFO );
     2279    hal_remote_s32( XPTR( fifo_cxy , &fifo_inode_ptr->rights ) , mode );
     2280    hal_remote_spt( XPTR( fifo_cxy , &fifo_inode_ptr->pipe ) , pipe   );
     2281
     2282    // release the lock protecting the Inode-Tree from write mode
     2283    remote_rwlock_wr_release( vfs_lock_xp );
     2284
    21092285    return 0;
    2110 }
     2286
     2287}   // end vfs_mkfifo()
    21112288
    21122289
     
    21262303    cxy_t              inode_cxy;
    21272304    vfs_inode_t      * inode_ptr;
    2128     vfs_inode_type_t   inode_type;
     2305    vfs_file_type_t   inode_type;
    21292306    uint32_t           inode_size;
    21302307    uint32_t           inode_attr;
     
    21592336                                        "                              " };  // level 15
    21602337
    2161 assert( (inode_xp != XPTR_NULL) , "inode_xp cannot be NULL" );
    2162 assert( (name_xp  != XPTR_NULL) , "name_xp cannot be NULL" );
    2163 assert( (indent < 16)           , "depth cannot be larger than 15" );
     2338assert( __FUNCTION__, (inode_xp != XPTR_NULL) , "inode_xp cannot be NULL" );
     2339assert( __FUNCTION__, (name_xp  != XPTR_NULL) , "name_xp cannot be NULL" );
     2340assert( __FUNCTION__, (indent < 16)           , "depth cannot be larger than 15" );
    21642341   
    21652342    // get current inode cluster and local pointer
     
    21872364    // scan directory entries when current inode is a directory
    21882365    // don't scan the the "." and ".." directories to break loops
    2189     if( (inode_type == INODE_TYPE_DIR) &&
     2366    if( (inode_type == FILE_TYPE_DIR) &&
    21902367        (strcmp( name , "." ) != 0)    &&
    21912368        (strcmp( name , ".." ) != 0) )
     
    24492626
    24502627// check pathname / root_xp consistency
    2451 assert( ((pathname[0] != '/') || (root_xp == process->vfs_root_xp)),
     2628assert( __FUNCTION__, ((pathname[0] != '/') || (root_xp == process->vfs_root_xp)),
    24522629"root inode must be VFS root for path <%s>", pathname );
    24532630
     2631#if DEBUG_VFS_LOOKUP || DEBUG_VFS_ERROR
     2632uint32_t cycle = (uint32_t)hal_get_cycles();
     2633#endif
     2634
    24542635#if DEBUG_VFS_LOOKUP
    2455 uint32_t cycle = (uint32_t)hal_get_cycles();
    24562636char     root_name[CONFIG_VFS_MAX_NAME_LENGTH];
    24572637vfs_inode_get_name( root_xp , root_name );
     
    25642744                if( error )
    25652745                {
    2566                     printk("\n[ERROR] in %s : cannot create inode <%s> in path <%s>\n",
    2567                     __FUNCTION__ , name, pathname );
     2746
     2747#if DEBUG_VFS_ERROR 
     2748if( DEBUG_VFS_ERROR < cycle )
     2749printk("\n[ERROR] in %s : thread[%x,%x] cannot create inode <%s> in path <%s>\n",
     2750__FUNCTION__ , process->pid, this->trdid, name, pathname );
     2751#endif
    25682752                    return -1;
    25692753                }
     
    25752759#if (DEBUG_VFS_LOOKUP & 1)
    25762760if( DEBUG_VFS_LOOKUP < cycle )
    2577 printk("\n[%s] thread[%x,%x] created missing inode <%s> in cluster %x\n",
     2761printk("\n[%s] thread[%x,%x] created dentry/inode <%s> in cluster %x\n",
    25782762__FUNCTION__, process->pid, this->trdid, name, child_cxy );
    25792763#endif
     
    25912775                        if ( error )
    25922776                        {
    2593                             printk("\n[ERROR] in %s : cannot add dentry <%s> in parent dir\n",
    2594                             __FUNCTION__, name );
     2777
     2778#if DEBUG_VFS_ERROR
     2779if( DEBUG_VFS_ERROR < cycle )
     2780printk("\n[ERROR] in %s : thread[%x,%x] cannot add dentry <%s> in parent dir\n",
     2781__FUNCTION__, process->pid, this->trdid, name );
     2782#endif
    25952783                            vfs_remove_child_from_parent( dentry_xp );
    25962784                            return -1;
     
    26012789printk("\n[%s] thread[%x,%x] child <%s> not found in parent mapper => created it\n",
    26022790__FUNCTION__, process->pid, this->trdid, name );
    2603 vfs_inode_display( child_xp );
    26042791#endif
    26052792                    }
    26062793                    else                   // not last or not create => error
    26072794                    {                       
    2608                         printk("\n[ERROR] in %s : <%s> node not found in parent for <%s>\n",
    2609                         __FUNCTION__ , name , pathname );
     2795
     2796#if DEBUG_VFS_ERROR     
     2797if( DEBUG_VFS_ERROR < cycle )
     2798printk("\n[ERROR] in %s : thread[%x,%x] cannot found node <%s> in parent for <%s>\n",
     2799__FUNCTION__ , process->pid, this->trdid, name, pathname );
     2800#endif
    26102801                        vfs_remove_child_from_parent( dentry_xp );
    26112802                        return -1;
     
    26172808                    if( last && create && excl )
    26182809                    {
    2619                         printk("\n[ERROR] in %s : node already exist <%s>\n",
    2620                         __FUNCTION__, name );
     2810
     2811#if DEBUG_VFS_ERROR
     2812if( DEBUG_VFS_ERROR < cycle )
     2813printk("\n[ERROR] in %s : thread[%x,%x] found an existing node <%s>  %\n",
     2814__FUNCTION__ , process->pid, this->trdid, pathname );
     2815#endif
    26212816                       return -1;
    26222817                    }
     
    26292824                    // load child mapper from device if child is a directory (prefetch)
    26302825                    uint32_t type = hal_remote_l32( XPTR( child_cxy , &child_ptr->type ) );
    2631                     if( type == INODE_TYPE_DIR )
     2826                    if( type == FILE_TYPE_DIR )
    26322827                    {
    26332828                        error = vfs_inode_load_all_pages( child_xp );
     
    26352830                        if ( error )
    26362831                        {
    2637                             printk("\n[ERROR] in %s : cannot load <%s> from device\n",
    2638                             __FUNCTION__ , name );
     2832#if DEBUG_VFS_ERROR
     2833if( DEBUG_VFS_ERROR < cycle )
     2834printk("\n[ERROR] in %s : thread[%x,%x] cannot load <%s> from device\n",
     2835__FUNCTION__ , process->pid, this->trdid, name );
     2836#endif
    26392837                            vfs_remove_child_from_parent( dentry_xp );
    26402838                            return -1;
     
    26642862            if( last && create && excl )
    26652863            {
    2666                 printk("\n[ERROR] in %s : node <%s> already exist\n",
    2667                 __FUNCTION__, name );
     2864
     2865#if DEBUG_VFS_ERROR
     2866if( DEBUG_VFS_ERROR < cycle )
     2867printk("\n[ERROR] in %s : thread[%x,%x] found an existing node <%s>\n",
     2868__FUNCTION__ , process->pid, this->trdid, pathname );
     2869#endif
    26682870                return -1;
    26692871            }
     
    26762878        // if( error )
    26772879        // {
    2678         //     printk("\n[ERROR] in %s : thread %x / permission denied for %s\n",
    2679         //     __FUNCTION__ , this , name );
    2680         //     return EACCES;
     2880        //     #if DEBUG_VFS_ERROR
     2881        //     if( DEBUG_VFS_ERROR < cycle )
     2882        //     printk("\n[ERROR] in %s : thread[%x,%x] / permission denied for <%s>\n",
     2883        //     __FUNCTION__ , process->pid, this->trdid , pathname );
     2884        //     #endif
     2885        //
     2886        //     return -1;
    26812887        // }
    26822888
     
    29833189
    29843190// check buffer overflow
    2985 assert( (index >= 0) , "kernel buffer too small" );
     3191assert( __FUNCTION__, (index >= 0) , "kernel buffer too small" );
    29863192
    29873193            }
     
    30093215
    30103216// check buffer overflow
    3011 assert( (index >= 0) , "kernel buffer too small" );
     3217assert( __FUNCTION__, (index >= 0) , "kernel buffer too small" );
    30123218
    30133219            // update pathname
     
    30673273    parent_inode_ptr = GET_PTR( parent_inode_xp );
    30683274
     3275#if DEBUG_VFS_ADD_CHILD || DEBUG_VFS_ERROR
     3276uint32_t cycle = (uint32_t)hal_get_cycles();
     3277thread_t * this = CURRENT_THREAD;
     3278#endif
     3279
    30693280#if DEBUG_VFS_ADD_CHILD
    30703281char parent_name[CONFIG_VFS_MAX_NAME_LENGTH];
    30713282vfs_inode_get_name( parent_inode_xp , parent_name );
    3072 uint32_t cycle = (uint32_t)hal_get_cycles();
    3073 thread_t * this = CURRENT_THREAD;
    30743283if( DEBUG_VFS_ADD_CHILD < cycle )
    30753284printk("\n[%s] thread[%x,%x] enter / child <%s> / parent <%s> / cycle %d\n",
     
    30853294    if( error )
    30863295    {
    3087         printk("\n[ERROR] in %s : cannot create dentry <%s> in cluster %x\n",
    3088         __FUNCTION__ , name , parent_cxy );
     3296
     3297#if DEBUG_VFS_ERROR
     3298if( DEBUG_VFS_ERROR < cycle )
     3299printk("\n[ERROR] in %s : thread[%x,%x] cannot create dentry <%s> in cluster %x\n",
     3300__FUNCTION__ , this->process->pid, this->trdid , name , parent_cxy );
     3301#endif
    30893302        return -1;
    30903303    }
     
    31153328    if( error )
    31163329    {
    3117         printk("\n[ERROR] in %s : cannot create inode in cluster %x\n",
    3118                __FUNCTION__ , child_cxy );
     3330
     3331#if DEBUG_VFS_ERROR
     3332if( DEBUG_VFS_ERROR < cycle )
     3333printk("\n[ERROR] in %s : thread[%x,%x] cannot create inode in cluster %x\n",
     3334__FUNCTION__ , this->process->pid , this->trdid , child_cxy );
     3335#endif
    31193336 
    31203337        vfs_dentry_destroy( new_dentry_xp );
     
    31843401    vfs_inode_t  * parent_inode_ptr;   // local pointer on parent inode
    31853402    uint32_t       links;              // number of child inode parents
     3403    error_t        error;
     3404
     3405#if DEBUG_VFS_REMOVE_CHILD
     3406uint32_t   cycle = (uint32_t)hal_get_cycles();
     3407#endif
    31863408
    31873409    char dentry_name[CONFIG_VFS_MAX_NAME_LENGTH];
    31883410   
     3411    thread_t * this  = CURRENT_THREAD;
     3412
    31893413    // get parent cluster and dentry local pointer
    31903414    parent_cxy = GET_CXY( dentry_xp );
     
    32033427    child_inode_ptr  = GET_PTR( child_inode_xp );
    32043428
     3429#if DEBUG_VFS_REMOVE_CHILD
     3430if( DEBUG_VFS_REMOVE_CHILD < cycle )
     3431printk("\n[%s] thread[%x,%x] enter for dentry[%x,%x] / inode[%x,%x] / cycle %d\n",
     3432__FUNCTION__, this->process->pid, this->trdid,
     3433parent_cxy, dentry_ptr, child_cxy, child_inode_ptr, cycle );
     3434#endif
     3435
    32053436    // remove dentry from parent_inode
    3206     xhtab_remove( XPTR( parent_cxy , &parent_inode_ptr->children ),
    3207                   dentry_name,
    3208                   XPTR( parent_cxy , &dentry_ptr->children ) );
     3437    error = xhtab_remove( XPTR( parent_cxy , &parent_inode_ptr->children ),
     3438                          dentry_name,
     3439                          XPTR( parent_cxy , &dentry_ptr->children ) );
     3440
     3441    if( error )
     3442    {
     3443        printk("\n[WARNING] in %s] thread[%x,%x] cannot remove dentry %s from parent dir\n",
     3444        __FUNCTION__, this->process->pid, this->trdid, dentry_name );
     3445    }
     3446
     3447#if DEBUG_VFS_REMOVE_CHILD
     3448cycle = (uint32_t)hal_get_cycles();
     3449if( DEBUG_VFS_REMOVE_CHILD < cycle )
     3450printk("\n[%s] thread[%x,%x] removed dentry from parent inode / cycle %d\n",
     3451__FUNCTION__, this->process->pid, this->trdid, cycle );
     3452#endif
    32093453
    32103454    // remove dentry from child_inode
    32113455    xlist_unlink( XPTR( parent_cxy , &dentry_ptr->parents ) );
     3456
     3457    // get and update number of parents dentries
    32123458    links = hal_remote_atomic_add( XPTR( child_cxy , &child_inode_ptr->links ) , -1 );
     3459
     3460#if DEBUG_VFS_REMOVE_CHILD
     3461cycle = (uint32_t)hal_get_cycles();
     3462if( DEBUG_VFS_REMOVE_CHILD < cycle )
     3463printk("\n[%s] thread[%x,%x] removed dentry from child inode / cycle %d\n",
     3464__FUNCTION__, this->process->pid, this->trdid, cycle );
     3465#endif
    32133466
    32143467    // delete dentry descriptor
    32153468    vfs_dentry_destroy( dentry_xp );
    32163469
     3470#if DEBUG_VFS_REMOVE_CHILD
     3471cycle = (uint32_t)hal_get_cycles();
     3472if( DEBUG_VFS_REMOVE_CHILD < cycle )
     3473printk("\n[%s] thread[%x,%x] deleted dentry descriptor / cycle %d\n",
     3474__FUNCTION__, this->process->pid, this->trdid, cycle );
     3475#endif
     3476
    32173477    // delete child_inode descriptor if last link
    3218     if( links == 1 )  vfs_inode_destroy( child_inode_xp );
    3219 
     3478    if( links == 1 )
     3479    {
     3480        vfs_inode_destroy( child_inode_xp );
     3481
     3482#if DEBUG_VFS_REMOVE_CHILD
     3483cycle = (uint32_t)hal_get_cycles();
     3484if( DEBUG_VFS_REMOVE_CHILD < cycle )
     3485printk("\n[%s] thread[%x,%x] deleted child inode descriptor / cycle %d\n",
     3486__FUNCTION__, this->process->pid, this->trdid, cycle );
     3487#endif
     3488
     3489    }
    32203490}  // end vfs_remove_child_from_parent()
    32213491
     
    32333503    error_t error = 0;
    32343504
    3235 assert( (inode_xp   != XPTR_NULL) , "inode_xp argument is NULL" );
    3236 assert( (dentry_ptr != NULL     ) , "dentry_ptr argument is NULL" );
     3505assert( __FUNCTION__, (inode_xp   != XPTR_NULL) , "inode_xp argument is NULL" );
     3506assert( __FUNCTION__, (dentry_ptr != NULL     ) , "dentry_ptr argument is NULL" );
    32373507
    32383508    vfs_inode_t * inode_ptr = GET_PTR( inode_xp );
     
    32423512    mapper_t * mapper = hal_remote_lpt( XPTR( inode_cxy , &inode_ptr->mapper ) );
    32433513
    3244 assert( (mapper != NULL) , "mapper pointer is NULL")       
     3514assert( __FUNCTION__, (mapper != NULL) , "mapper pointer is NULL");       
    32453515
    32463516    // get FS type
     
    32623532    else
    32633533    {
    3264         assert( false , "undefined file system type" );
     3534        assert( __FUNCTION__, false , "undefined file system type" );
    32653535    }
    32663536
     
    32753545    error_t error = 0;
    32763546
    3277 assert( (inode_xp   != XPTR_NULL) , "inode_xp argument is NULL" );
    3278 assert( (dentry_ptr != NULL     ) , "dentry_ptr argument is NULL" );
     3547assert( __FUNCTION__, (inode_xp   != XPTR_NULL) , "inode_xp argument is NULL" );
     3548assert( __FUNCTION__, (dentry_ptr != NULL     ) , "dentry_ptr argument is NULL" );
    32793549
    32803550    vfs_inode_t * inode_ptr = GET_PTR( inode_xp );
     
    32843554    mapper_t * mapper = hal_remote_lpt( XPTR( inode_cxy , &inode_ptr->mapper ) );
    32853555
    3286 assert( (mapper != NULL) , "mapper pointer is NULL")       
     3556assert( __FUNCTION__, (mapper != NULL) , "mapper pointer is NULL");       
    32873557
    32883558    // get FS type
     
    33053575    else
    33063576    {
    3307         assert( false , "undefined file system type" );
     3577        assert( __FUNCTION__, false , "undefined file system type" );
    33083578    }
    33093579
     
    33183588    error_t error = 0;
    33193589
    3320 assert( (inode_xp   != XPTR_NULL) , "inode_xp argument is NULL" );
    3321 assert( (dentry_ptr != NULL     ) , "dentry_ptr argument is NULL" );
     3590assert( __FUNCTION__, (inode_xp   != XPTR_NULL) , "inode_xp argument is NULL" );
     3591assert( __FUNCTION__, (dentry_ptr != NULL     ) , "dentry_ptr argument is NULL" );
    33223592
    33233593    vfs_inode_t * inode_ptr = GET_PTR( inode_xp );
     
    33273597    mapper_t * mapper = hal_remote_lpt( XPTR( inode_cxy , &inode_ptr->mapper ) );
    33283598
    3329 assert( (mapper != NULL) , "mapper pointer is NULL")       
     3599assert( __FUNCTION__, (mapper != NULL) , "mapper pointer is NULL");
    33303600
    33313601    // get FS type
     
    33393609    else if( fs_type == FS_TYPE_RAMFS )
    33403610    {
    3341         assert( false , "should not be called for RAMFS" );
     3611        assert( __FUNCTION__, false , "should not be called for RAMFS" );
    33423612    }
    33433613    else if( fs_type == FS_TYPE_DEVFS )
    33443614    {
    3345         assert( false , "should not be called for DEVFS" );
     3615        assert( __FUNCTION__, false , "should not be called for DEVFS" );
    33463616    }
    33473617    else
    33483618    {
    3349         assert( false , "undefined file system type" );
     3619        assert( __FUNCTION__, false , "undefined file system type" );
    33503620    }
    33513621
     
    33603630    error_t error = 0;
    33613631
    3362 assert( (inode_xp   != XPTR_NULL) , "inode_xp argument is NULL" );
    3363 assert( (dentry_ptr != NULL     ) , "dentry_ptr argument is NULL" );
     3632assert( __FUNCTION__, (inode_xp   != XPTR_NULL) , "inode_xp argument is NULL" );
     3633assert( __FUNCTION__, (dentry_ptr != NULL     ) , "dentry_ptr argument is NULL" );
    33643634
    33653635    vfs_inode_t * inode_ptr = GET_PTR( inode_xp );
     
    33693639    mapper_t * mapper = hal_remote_lpt( XPTR( inode_cxy , &inode_ptr->mapper ) );
    33703640
    3371 assert( (mapper != NULL) , "mapper pointer is NULL")       
     3641assert( __FUNCTION__, (mapper != NULL) , "mapper pointer is NULL");
    33723642
    33733643    // get FS type
     
    33813651    else if( fs_type == FS_TYPE_RAMFS )
    33823652    {
    3383         assert( false , "should not be called for RAMFS" );
     3653        assert( __FUNCTION__, false , "should not be called for RAMFS" );
    33843654    }
    33853655    else if( fs_type == FS_TYPE_DEVFS )
    33863656    {
    3387         assert( false , "should not be called for DEVFS" );
     3657        assert( __FUNCTION__, false , "should not be called for DEVFS" );
    33883658    }
    33893659    else
    33903660    {
    3391         assert( false , "undefined file system type" );
     3661        assert( __FUNCTION__, false , "undefined file system type" );
    33923662    }
    33933663
     
    34023672    error_t error = 0;
    34033673
    3404 assert( (inode_xp   != XPTR_NULL) , "inode_xp argument is NULL" );
    3405 assert( (dentry_ptr != NULL     ) , "dentry_ptr argument is NULL" );
     3674assert( __FUNCTION__, (inode_xp   != XPTR_NULL) , "inode_xp argument is NULL" );
     3675assert( __FUNCTION__, (dentry_ptr != NULL     ) , "dentry_ptr argument is NULL" );
    34063676
    34073677    vfs_inode_t * inode_ptr = GET_PTR( inode_xp );
     
    34113681    mapper_t * mapper = hal_remote_lpt( XPTR( inode_cxy , &inode_ptr->mapper ) );
    34123682
    3413 assert( (mapper != NULL) , "mapper pointer is NULL")       
     3683assert( __FUNCTION__, (mapper != NULL) , "mapper pointer is NULL");
    34143684
    34153685    // get FS type
     
    34233693    else if( fs_type == FS_TYPE_RAMFS )
    34243694    {
    3425         assert( false , "should not be called for RAMFS" );
     3695        assert( __FUNCTION__, false , "should not be called for RAMFS" );
    34263696    }
    34273697    else if( fs_type == FS_TYPE_DEVFS )
    34283698    {
    3429         assert( false , "should not be called for DEVFS" );
     3699        assert( __FUNCTION__, false , "should not be called for DEVFS" );
    34303700    }
    34313701    else
    34323702    {
    3433         assert( false , "undefined file system type" );
     3703        assert( __FUNCTION__, false , "undefined file system type" );
    34343704    }
    34353705
     
    34503720
    34513721// check arguments
    3452 assert( (inode != NULL) , "parent pointer is NULL");
    3453 assert( (array != NULL) , "child pointer is NULL");
    3454 assert( (detailed == false) , "detailed argument not supported\n");
     3722assert( __FUNCTION__, (inode != NULL) , "parent pointer is NULL");
     3723assert( __FUNCTION__, (array != NULL) , "child pointer is NULL");
     3724assert( __FUNCTION__, (detailed == false) , "detailed argument not supported\n");
    34553725
    34563726    // check inode type
    3457     if( inode->type != INODE_TYPE_DIR )
     3727    if( inode->type != FILE_TYPE_DIR )
    34583728    {
    34593729        printk("\n[ERROR] in %s : target inode is not a directory\n",
     
    34783748    else if( fs_type == FS_TYPE_RAMFS )
    34793749    {
    3480         assert( false , "should not be called for RAMFS" );
     3750        assert( __FUNCTION__, false , "should not be called for RAMFS" );
    34813751    }
    34823752    else if( fs_type == FS_TYPE_DEVFS )
     
    34923762    else
    34933763    {
    3494         assert( false , "undefined file system type" );
     3764        assert( __FUNCTION__, false , "undefined file system type" );
    34953765    }
    34963766
     
    35043774    error_t error = 0;
    35053775
    3506 assert( (inode_xp != XPTR_NULL) , "inode_xp argument is NULL");
     3776assert( __FUNCTION__, (inode_xp != XPTR_NULL) , "inode_xp argument is NULL");
    35073777
    35083778    vfs_inode_t * inode_ptr = GET_PTR( inode_xp );
     
    35123782    mapper_t * mapper = hal_remote_lpt( XPTR( inode_cxy , &inode_ptr->mapper ) );
    35133783
    3514 assert( (mapper != NULL) , "mapper pointer is NULL")       
     3784assert( __FUNCTION__, (mapper != NULL) , "mapper pointer is NULL");
    35153785
    35163786    // get FS type
     
    35243794    else if( fs_type == FS_TYPE_RAMFS )
    35253795    {
    3526         assert( false , "should not be called for RAMFS" );
     3796        assert( __FUNCTION__, false , "should not be called for RAMFS" );
    35273797    }
    35283798    else if( fs_type == FS_TYPE_DEVFS )
    35293799    {
    3530         assert( false , "should not be called for DEVFS" );
     3800        assert( __FUNCTION__, false , "should not be called for DEVFS" );
    35313801    }
    35323802    else
    35333803    {
    3534         assert( false , "undefined file system type" );
     3804        assert( __FUNCTION__, false , "undefined file system type" );
    35353805    }
    35363806
     
    35513821    else if( fs_type == FS_TYPE_RAMFS )
    35523822    {
    3553         assert( false , "should not be called for RAMFS" );
     3823        assert( __FUNCTION__, false , "should not be called for RAMFS" );
    35543824    }
    35553825    else if( fs_type == FS_TYPE_DEVFS )
    35563826    {
    3557         assert( false , "should not be called for DEVFS" );
     3827        assert( __FUNCTION__, false , "should not be called for DEVFS" );
    35583828    }
    35593829    else
    35603830    {
    3561         assert( false , "undefined file system type" );
     3831        assert( __FUNCTION__, false , "undefined file system type" );
    35623832    }
    35633833
     
    35713841    error_t error = 0;
    35723842
    3573 assert( (inode_xp  != XPTR_NULL) , "inode_xp argument is NULL")       
     3843assert( __FUNCTION__, (inode_xp  != XPTR_NULL) , "inode_xp argument is NULL");
    35743844
    35753845    vfs_inode_t * inode_ptr = GET_PTR( inode_xp );
     
    35793849    mapper_t * mapper = hal_remote_lpt( XPTR( inode_cxy , &inode_ptr->mapper ) );
    35803850
    3581 assert( (mapper != NULL) , "mapper pointer is NULL")       
     3851assert( __FUNCTION__, (mapper != NULL) , "mapper pointer is NULL");
    35823852
    35833853    // get FS type from mapper
     
    35913861    else if( fs_type == FS_TYPE_RAMFS )
    35923862    {
    3593         assert( false , "should not be called for RAMFS" );
     3863        assert( __FUNCTION__, false , "should not be called for RAMFS" );
    35943864    }
    35953865    else if( fs_type == FS_TYPE_DEVFS )
    35963866    {
    3597         assert( false , "should not be called for DEVFS" );
     3867        assert( __FUNCTION__, false , "should not be called for DEVFS" );
    35983868    }
    35993869    else
    36003870    {
    3601         assert( false , "undefined file system type" );
     3871        assert( __FUNCTION__, false , "undefined file system type" );
    36023872    }
    36033873
     
    36123882    error_t error = 0;
    36133883
    3614 assert( (page_xp != XPTR_NULL) , "page pointer is NULL" );
     3884assert( __FUNCTION__, (page_xp != XPTR_NULL) , "page pointer is NULL" );
    36153885
    36163886    page_t * page_ptr = GET_PTR( page_xp );
     
    36203890    mapper_t * mapper = hal_remote_lpt( XPTR( page_cxy , &page_ptr->mapper ) );
    36213891
    3622 assert( (mapper != NULL) , "no mapper for page" );
     3892assert( __FUNCTION__, (mapper != NULL) , "no mapper for page" );
    36233893
    36243894    // get FS type
     
    36323902    else if( fs_type == FS_TYPE_RAMFS )
    36333903    {
    3634         assert( false , "should not be called for RAMFS\n" );
     3904        assert( __FUNCTION__, false , "should not be called for RAMFS\n" );
    36353905    }
    36363906    else if( fs_type == FS_TYPE_DEVFS )
    36373907    {
    3638         assert( false , "should not be called for DEVFS\n" );
     3908        assert( __FUNCTION__, false , "should not be called for DEVFS\n" );
    36393909    }
    36403910    else
    36413911    {
    3642         assert( false , "undefined file system type" );
     3912        assert( __FUNCTION__, false , "undefined file system type" );
    36433913    }
    36443914
Note: See TracChangeset for help on using the changeset viewer.