Ignore:
Timestamp:
Mar 2, 2016, 3:08:27 PM (8 years ago)
Author:
meunier
Message:
  • Bug fixes in Rosenfeld
File:
1 edited

Legend:

Unmodified
Added
Removed
  • soft/giet_vm/giet_fat32/fat32.c

    r797 r798  
    565565
    566566/////////////////////////////////////////////////////////////////
    567 static inline unsigned int _get_fat_entry( unsigned int  cluster,
     567static unsigned int _get_fat_entry( unsigned int  cluster,
    568568                                           unsigned int* value )
    569569{
     
    24402440
    24412441#if GIET_DEBUG_FAT
    2442 unsigned int procid  = _get_procid();
    2443 unsigned int x       = procid >> (Y_WIDTH + P_WIDTH);
    2444 unsigned int y       = (procid >> P_WIDTH) & ((1<<Y_WIDTH)-1);
    2445 unsigned int p       = procid & ((1<<P_WIDTH)-1);
    2446 if ( _get_proctime() > GIET_DEBUG_FAT )
    2447 _printf("\n[DEBUG FAT] _fat_open(): P[%d,%d,%d] enters for path <%s>\n"
    2448         " create = %d / read_only = %d / truncate = %d\n",
    2449         x, y, p, pathname , create , read_only , truncate );
     2442    unsigned int procid  = _get_procid();
     2443    unsigned int x       = procid >> (Y_WIDTH + P_WIDTH);
     2444    unsigned int y       = (procid >> P_WIDTH) & ((1 << Y_WIDTH) - 1);
     2445    unsigned int p       = procid & ((1 << P_WIDTH) - 1);
     2446    if ( _get_proctime() > GIET_DEBUG_FAT )
     2447        _printf("\n[DEBUG FAT] _fat_open(): P[%d,%d,%d] enters for path <%s>\n"
     2448                " create = %d / read_only = %d / truncate = %d\n",
     2449                x, y, p, pathname , create , read_only , truncate );
    24502450#endif
    24512451
    24522452    // checking FAT initialized
    2453     if( _fat.initialized != FAT_INITIALIZED )
     2453    if ( _fat.initialized != FAT_INITIALIZED )
    24542454    {
    24552455        _printf("\n[FAT ERROR] _fat_open(): FAT not initialized\n");
     
    24992499
    25002500#if GIET_DEBUG_FAT
    2501 if ( _get_proctime() > GIET_DEBUG_FAT )
    2502 _printf("\n[DEBUG FAT] _fat_open(): P[%d,%d,%d] create a new file <%s>\n",
    2503         x , y , p , pathname );
     2501        if ( _get_proctime() > GIET_DEBUG_FAT )
     2502            _printf("\n[DEBUG FAT] _fat_open(): P[%d,%d,%d] create a new file <%s>\n",
     2503                    x , y , p , pathname );
    25042504#endif
    25052505
     
    25622562
    25632563#if GIET_DEBUG_FAT
    2564 if ( _get_proctime() > GIET_DEBUG_FAT )
    2565 {
    2566     _printf("\n[DEBUG FAT] _fat_open() : new inode created for <%s>\n"
    2567             " size = %x / cluster = %x / cache = %x",
    2568             child->name , child->size , child->cluster , child->cache );
    2569     if ( child->cache != NULL )
    2570     {
    2571          _printf(" / pdesc[0] = %x\n", (unsigned int)(child->cache->children[0]) );
    2572     }
    2573     else
    2574     {
    2575          _printf("\n");
    2576     }
    2577 }
     2564        if ( _get_proctime() > GIET_DEBUG_FAT )
     2565        {
     2566            _printf("\n[DEBUG FAT] _fat_open() : new inode created for <%s>\n"
     2567                    " size = %x / cluster = %x / cache = %x",
     2568                    child->name , child->size , child->cluster , child->cache );
     2569            if ( child->cache != NULL )
     2570            {
     2571                _printf(" / pdesc[0] = %x\n", (unsigned int)(child->cache->children[0]) );
     2572            }
     2573            else
     2574            {
     2575                _printf("\n");
     2576            }
     2577        }
    25782578#endif
    25792579
     
    25852585
    25862586#if GIET_DEBUG_FAT
    2587 if ( _get_proctime() > GIET_DEBUG_FAT )
    2588 {
    2589     _printf("\n[DEBUG FAT] _fat_open(): P[%d,%d,%d] found file <%s>\n"
    2590             " inode = %x / size = %x\n",
    2591             x , y , p , pathname , (unsigned int)child , child->size );
    2592 
    2593     _display_clusters_list( child );
    2594 }
     2587        if ( _get_proctime() > GIET_DEBUG_FAT )
     2588        {
     2589            _printf("\n[DEBUG FAT] _fat_open(): P[%d,%d,%d] found file <%s>\n"
     2590                    " inode = %x / size = %x\n",
     2591                    x , y , p , pathname , (unsigned int)child , child->size );
     2592
     2593            _display_clusters_list( child );
     2594        }
    25952595#endif
    25962596
     
    26242624
    26252625    // truncate the file if requested
    2626     if ( truncate && !read_only && !child->is_dir )
     2626    if ( truncate && !read_only && !child->is_dir && child->size != 0 )
    26272627    {
    26282628        // empty file
     
    26552655
    26562656#if GIET_DEBUG_FAT
    2657 if ( _get_proctime() > GIET_DEBUG_FAT )
    2658 _printf("\n[DEBUG FAT] _fat_open(): P[%d,%d,%d] get fd = %d for <%s>\n"
    2659         " inode = %x / offset = %x / read_only = %d / size = %x / cluster = %x\n",
    2660         x , y , p , fd_id , pathname ,
    2661         (unsigned int)_fat.fd[fd_id].inode,
    2662         _fat.fd[fd_id].seek,
    2663         _fat.fd[fd_id].read_only,
    2664         _fat.fd[fd_id].inode->size,
    2665         _fat.fd[fd_id].inode->cluster );
     2657    if ( _get_proctime() > GIET_DEBUG_FAT )
     2658        _printf("\n[DEBUG FAT] _fat_open(): P[%d,%d,%d] get fd = %d for <%s>\n"
     2659                " inode = %x / offset = %x / read_only = %d / size = %x / cluster = %x\n",
     2660                x , y , p , fd_id , pathname ,
     2661                (unsigned int)_fat.fd[fd_id].inode,
     2662                _fat.fd[fd_id].seek,
     2663                _fat.fd[fd_id].read_only,
     2664                _fat.fd[fd_id].inode->size,
     2665                _fat.fd[fd_id].inode->cluster );
    26662666#endif
    26672667
Note: See TracChangeset for help on using the changeset viewer.