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


Ignore:
Timestamp:
Aug 22, 2018, 11:55:48 PM (6 years ago)
Author:
viala@…
Message:

Refactoring assert calling to conform with new assert macro.

Made with this command for the general case.
find ./kernel/ hal/ -name "*.c" | xargs sed -i -e '/assert(/ s/,[ ]*FUNCTION[ ]*,/,/'

And some done by hand.

File:
1 edited

Legend:

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

    r484 r492  
    171171    {
    172172        ctx = NULL;
    173                 assert( false , __FUNCTION__ , "illegal file system type = %d\n" , fs_type );
     173                assert( false , "illegal file system type = %d\n" , fs_type );
    174174    }
    175175
     
    250250error_t vfs_inode_destroy( vfs_inode_t * inode )
    251251{
    252     assert( (inode->refcount == 0), __FUNCTION__ , "inode refcount non zero\n" );
     252    assert( (inode->refcount == 0) , "inode refcount non zero\n" );
    253253
    254254    // release memory allocated for mapper
     
    280280    error_t error = 0;
    281281
    282     assert( (parent != NULL) , __FUNCTION__ , "parent pointer is NULL\n");
    283 
    284     assert( (child_xp != XPTR_NULL) , __FUNCTION__ , "child pointer is NULL\n");
     282    assert( (parent != NULL) , "parent pointer is NULL\n");
     283
     284    assert( (child_xp != XPTR_NULL) , "child pointer is NULL\n");
    285285
    286286    // get parent inode FS type
     
    294294    else if( fs_type == FS_TYPE_RAMFS )
    295295    {
    296         assert( false , __FUNCTION__ , "should not be called for RAMFS\n" );
     296        assert( false , "should not be called for RAMFS\n" );
    297297    }
    298298    else if( fs_type == FS_TYPE_DEVFS )
    299299    {
    300         assert( false , __FUNCTION__ , "should not be called for DEVFS\n" );
     300        assert( false , "should not be called for DEVFS\n" );
    301301    }
    302302    else
    303303    {
    304         assert( false , __FUNCTION__ , "undefined file system type\n" );
     304        assert( false , "undefined file system type\n" );
    305305    }
    306306
     
    581581    if( file->refcount )
    582582    {
    583         assert( false , __FUNCTION__ , "refcount non zero\n" );
     583        assert( false , "refcount non zero\n" );
    584584    }       
    585585
     
    713713                   uint32_t size )
    714714{
    715     assert( ( file_xp != XPTR_NULL ) , __FUNCTION__ , "file_xp == XPTR_NULL" );
     715    assert( ( file_xp != XPTR_NULL ) , "file_xp == XPTR_NULL" );
    716716
    717717    cxy_t              file_cxy;     // remote file descriptor cluster
     
    729729    inode_type = hal_remote_lw( XPTR( file_cxy , &file_ptr->type   ) );
    730730   
    731     assert( (inode_type == INODE_TYPE_FILE) , __FUNCTION__ ,
     731    assert( (inode_type == INODE_TYPE_FILE) ,
    732732    "inode type is not INODE_TYPE_FILE" );
    733733
     
    768768                         uint32_t size )
    769769{
    770     assert( ( file_xp != XPTR_NULL ) , __FUNCTION__ , "file_xp == XPTR_NULL" );
     770    assert( ( file_xp != XPTR_NULL ) , "file_xp == XPTR_NULL" );
    771771
    772772    cxy_t              file_cxy;     // remote file descriptor cluster
     
    835835    uint32_t       new;
    836836
    837     assert( (file_xp != XPTR_NULL) , __FUNCTION__ , "file_xp == XPTR_NULL" );
     837    assert( (file_xp != XPTR_NULL) , "file_xp == XPTR_NULL" );
    838838
    839839    // get cluster and local pointer on remote file descriptor
     
    899899    process_t  * process_ptr;      // process copy local pointer
    900900
    901     assert( (file_xp != XPTR_NULL) , __FUNCTION__ , "file_xp == XPTR_NULL" );
    902 
    903     assert( (file_id < CONFIG_PROCESS_FILE_MAX_NR) , __FUNCTION__ , "illegal file_id" );
     901    assert( (file_xp != XPTR_NULL) , "file_xp == XPTR_NULL" );
     902
     903    assert( (file_id < CONFIG_PROCESS_FILE_MAX_NR) , "illegal file_id" );
    904904
    905905    thread_t  * this    = CURRENT_THREAD;
     
    996996                    char   * path )
    997997{
    998     assert( false , __FUNCTION__ , "not implemented\n", cwd_xp, path );
     998    assert( false , "not implemented cwd_xp %x, path <%s> \n",
     999      cwd_xp, path );   
    9991000    return 0;
    10001001}
     
    10041005                  struct stat * k_stat )
    10051006{
    1006     assert( false , __FUNCTION__ , "not implemented\n", file_xp, k_stat );
     1007    assert( false , "not implemented file_xp: %x, k_stat ptr %x\n",
     1008      file_xp, k_stat );
    10071009    return 0;
    10081010}
     
    10121014                     struct dirent * k_dirent )
    10131015{
    1014     assert( false , __FUNCTION__ , "not implemented\n", file_xp, k_dirent );
     1016    assert( false , "not implemented file_xp: %x, k_dirent ptr %x\n",
     1017      file_xp, k_dirent );
    10151018    return 0;
    10161019}
     
    10211024                   uint32_t   mode )
    10221025{
    1023     assert( false , __FUNCTION__ , "not implemented\n", file_xp, path, mode );
     1026    assert( false , "not implemented file_xp: %x, path <%s>, mode: %x\n",
     1027      file_xp, path, mode );
    10241028    return 0;
    10251029}
     
    10291033                   char   * path )
    10301034{
    1031     assert( false , __FUNCTION__ , "not implemented\n", file_xp, path );
     1035    assert( false , "not implemented file_xp: %x, path <%s>\n",
     1036      file_xp, path );
    10321037    return 0;
    10331038}
     
    10651070    }
    10661071
    1067     assert( false , __FUNCTION__ , "not implemented\n" );
     1072    assert( false , "not implemented\n" );
    10681073    return 0;
    10691074}
     
    10971102
    10981103   
    1099     assert( false , __FUNCTION__ , "not implemented\n" );
     1104    assert( false , "not implemented\n" );
    11001105    return 0;
    11011106}
     
    11061111                    uint32_t rights )
    11071112{
    1108     assert( false , __FUNCTION__ , "not implemented\n", cwd_xp, path, rights );
     1113    assert( false , "not implemented cwd_xp: %x, path <%s>, rights %x\n",
     1114      cwd_xp, path, rights );
    11091115    return 0;
    11101116}
     
    11681174                                        "                              " };  // level 15
    11691175
    1170     assert( (inode_xp != XPTR_NULL) , __FUNCTION__ , "inode_xp cannot be NULL\n" );
    1171     assert( (name_xp  != XPTR_NULL) , __FUNCTION__ , "name_xp cannot be NULL\n" );
    1172     assert( (indent < 16)           , __FUNCTION__ , "depth cannot be larger than 15\n" );
     1176    assert( (inode_xp != XPTR_NULL) , "inode_xp cannot be NULL\n" );
     1177    assert( (name_xp  != XPTR_NULL) , "name_xp cannot be NULL\n" );
     1178    assert( (indent < 16)           , "depth cannot be larger than 15\n" );
    11731179   
    11741180    // get inode cluster and local pointer
     
    19441950    error_t error = 0;
    19451951
    1946     assert( (page != NULL) , __FUNCTION__ , "page pointer is NULL\n" );
     1952    assert( (page != NULL) , "page pointer is NULL\n" );
    19471953
    19481954    mapper_t    * mapper = page->mapper;
    19491955
    1950     assert( (mapper != NULL) , __FUNCTION__ , "no mapper for page\n" );
     1956    assert( (mapper != NULL) , "no mapper for page\n" );
    19511957
    19521958#if DEBUG_VFS_MAPPER_MOVE
     
    19691975    else if( fs_type == FS_TYPE_RAMFS )
    19701976    {
    1971         assert( false , __FUNCTION__ , "should not be called for RAMFS\n" );
     1977        assert( false , "should not be called for RAMFS\n" );
    19721978    }
    19731979    else if( fs_type == FS_TYPE_DEVFS )
    19741980    {
    1975         assert( false , __FUNCTION__ , "should not be called for DEVFS\n" );
     1981        assert( false , "should not be called for DEVFS\n" );
    19761982    }
    19771983    else
    19781984    {
    1979         assert( false , __FUNCTION__ , "undefined file system type\n" );
     1985        assert( false , "undefined file system type\n" );
    19801986    }
    19811987
     
    19942000error_t vfs_mapper_load_all( vfs_inode_t * inode )
    19952001{
    1996     assert( (inode != NULL) , __FUNCTION__ , "inode pointer is NULL\n" );
     2002    assert( (inode != NULL) , "inode pointer is NULL\n" );
    19972003
    19982004    uint32_t   index;
     
    20022008    uint32_t   size   = inode->size;
    20032009
    2004     assert( (mapper != NULL) , __FUNCTION__ , "mapper pointer is NULL\n" );
     2010    assert( (mapper != NULL) , "mapper pointer is NULL\n" );
    20052011
    20062012#if DEBUG_VFS_MAPPER_LOAD
Note: See TracChangeset for help on using the changeset viewer.