Changeset 492 for trunk/kernel/fs


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.

Location:
trunk/kernel/fs
Files:
3 edited

Legend:

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

    r484 r492  
    108108                                     devfs_dev_inode_xp );
    109109
    110     assert( (error == 0) , __FUNCTION__ , "cannot create <dev>\n" );
     110    assert( (error == 0) , "cannot create <dev>\n" );
    111111
    112112#if( DEBUG_DEVFS_INIT & 1 )
     
    124124                                     devfs_external_inode_xp );
    125125
    126     assert( (error == 0) , __FUNCTION__ , "cannot create <external>\n" );
     126    assert( (error == 0) , "cannot create <external>\n" );
    127127
    128128#if DEBUG_DEVFS_INIT
     
    372372                     uint32_t   size )
    373373{
    374     assert( ( file_xp != XPTR_NULL ) , __FUNCTION__ , "file_xp == XPTR_NULL" );
    375 
    376     assert( ( size < CONFIG_TXT_KBUF_SIZE ) , __FUNCTION__ , "string size too large" );
     374    assert( ( file_xp != XPTR_NULL ) , "file_xp == XPTR_NULL" );
     375
     376    assert( ( size < CONFIG_TXT_KBUF_SIZE ) , "string size too large" );
    377377
    378378    xptr_t             chdev_xp;
     
    471471    else
    472472    {
    473         assert( false , __FUNCTION__ ,
     473        assert( false ,
    474474        "%s does not support direct user access", chdev_func_str(func) );
    475475
  • trunk/kernel/fs/fatfs.c

    r484 r492  
    259259    uint32_t   next_cluster_id;        // content of current FAT slot
    260260
    261     assert( (searched_page_index > 0) , __FUNCTION__ ,
     261    assert( (searched_page_index > 0) ,
    262262    "no FAT access required for first page\n");
    263263
     
    352352#endif
    353353
    354     assert( (fatfs_ctx != NULL) , __FUNCTION__ ,
     354    assert( (fatfs_ctx != NULL) ,
    355355    "cannot allocate memory for FATFS context\n" );
    356356
     
    360360        buffer      = (uint8_t *)kmem_alloc( &req );
    361361
    362     assert( (buffer != NULL) , __FUNCTION__ ,
     362    assert( (buffer != NULL) ,
    363363    "cannot allocate memory for 512 bytes buffer\n" );
    364364     
     
    367367    error = dev_ioc_sync_read( buffer , 0 , 1 );
    368368
    369     assert( (error == 0) , __FUNCTION__ ,
     369    assert( (error == 0) ,
    370370    "cannot access boot record\n" );
    371371
     
    393393    uint32_t sector_size = fatfs_get_record( BPB_BYTSPERSEC , buffer , 1 );
    394394
    395     assert( (sector_size == 512) , __FUNCTION__ ,
     395    assert( (sector_size == 512) ,
    396396            "sector size must be 512 bytes\n" );
    397397
     
    399399    uint32_t nb_sectors = fatfs_get_record( BPB_SECPERCLUS , buffer , 1 );
    400400
    401     assert( (nb_sectors == 8) , __FUNCTION__ ,
     401    assert( (nb_sectors == 8) ,
    402402    "cluster size must be 8 sectors\n" );
    403403
     
    405405    uint32_t nb_fats = fatfs_get_record( BPB_NUMFATS , buffer , 1 );
    406406
    407     assert( (nb_fats == 1) , __FUNCTION__ ,
     407    assert( (nb_fats == 1) ,
    408408    "number of FAT copies must be 1\n" );
    409409
     
    411411    uint32_t fat_sectors = fatfs_get_record( BPB_FAT32_FATSZ32 , buffer , 1 );
    412412
    413     assert( ((fat_sectors & 0xF) == 0) , __FUNCTION__ ,
     413    assert( ((fat_sectors & 0xF) == 0) ,
    414414    "FAT not multiple of 16 sectors\n");
    415415
     
    417417    uint32_t root_cluster = fatfs_get_record( BPB_FAT32_ROOTCLUS , buffer , 1 );
    418418
    419     assert( (root_cluster == 2) , __FUNCTION__ ,
     419    assert( (root_cluster == 2) ,
    420420    "root cluster index must be  2\n");
    421421
     
    431431    mapper_t * fat_mapper = mapper_create( FS_TYPE_FATFS );
    432432
    433     assert( (fat_mapper != NULL) , __FUNCTION__ ,
     433    assert( (fat_mapper != NULL) ,
    434434    "no memory for FAT mapper" );
    435435
     
    632632    mapper_t * mapper = parent_inode->mapper;
    633633
    634     assert( (mapper != NULL) , __FUNCTION__ , "parent mapper undefined\n");
     634    assert( (mapper != NULL) , "parent mapper undefined\n");
    635635   
    636636    char       cname[CONFIG_VFS_MAX_NAME_LENGTH];  // name extracter from each directory entry
     
    659659        page = mapper_get_page( mapper , index );
    660660
    661         assert( (page != NULL) , __FUNCTION__ , "bad parent mapper\n");
     661        assert( (page != NULL) , "bad parent mapper\n");
    662662
    663663        // get page base
  • 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.