Changeset 367 for trunk/kernel/vfs


Ignore:
Timestamp:
Aug 14, 2017, 11:39:03 AM (7 years ago)
Author:
alain
Message:

Change Time unit from cycle to TICK (in millisecond).
Fix several bugs in VFS.

Location:
trunk/kernel/vfs
Files:
3 edited

Legend:

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

    r315 r367  
    264264
    265265#if (CONFIG_FATFS_DEBUG > 1)
    266     uint32_t * buf = (uint32_t *)ppm_page2vaddr( mapper_get_page ( mapper , 0 ) );
    267     uint32_t line , word;
     266    xptr_t     base_xp = ppm_page2base( XPTR( local_cxy , mapper_get_page ( mapper , 0 ) ) );
     267    uint32_t * buf     = (uint32_t *)GET_PTR( base_xp );
     268    uint32_t   line , word;
    268269    printk("\n***  FAT mapper content for first 256 entries ***\n");
    269270    for( line = 0 ; line < 16 ; line++ )
     
    369370    uint32_t   line;
    370371    uint32_t   byte = 0;
    371     printk("\n*** boot record at cycle %d ***\n", hal_get_cycles() );
     372    printk("\n***** FAT boot record\n" );
    372373    for ( line = 0 ; line < 32 ; line++ )
    373374    {
     
    554555        if( error ) return EIO;
    555556
    556         fatfs_dmsg("\n[INFO] %s : exit for inode %x / page = %x / mapper = %x\n",
    557                    __FUNCTION__ , inode , page , mapper );
     557        fatfs_dmsg("\n[INFO] %s : exit for inode %x / page_index = %d / mapper = %x\n",
     558                   __FUNCTION__ , inode , index , mapper );
    558559    }
    559560
     
    612613    uint32_t * buf = (uint32_t *)base;
    613614    uint32_t line , word;
    614     printk("\n*** DIRECTORY content for first 16 entries ***\n");
     615    printk("\n***** first 16 dir entries for parent inode %x\n", parent_inode );
    615616    for( line = 0 ; line < 16 ; line++ )
    616617    {
  • trunk/kernel/vfs/fatfs.h

    r265 r367  
    248248 * This function moves a page from/to the mapper to/from the FATFS file system on device.
    249249 * It must be called by a thread running in cluster containing the mapper.
    250  * The pointer on the mapper and the page index in file are registered
    251  * in the page descriptor.
     250 * The pointer on the mapper and the page index in file are found in the page descriptor.
    252251 * WARNING : The inode field in the mapper must be NULL for the FAT mapper.
    253252 * This is used to implement a specific behaviour to access the FAT zone on device.
     
    260259                                bool_t          to_mapper );
    261260
    262 
    263261/*****************************************************************************************
    264262 * This function scan an existing parent directory, identified by the <parent> argument,
    265263 * to find a directory entry identified by the <name> argument and update the remote
    266  * child inode, identified by the <child_xp> argument.
     264 * child inode descriptor, identified by the <child_xp> argument.
    267265 * It set the "type", "size", and "extend" (FAT cluster index) fields in child inode.
    268266 * It must be called by a thread running in the cluster containing the parent inode.
  • trunk/kernel/vfs/vfs.c

    r337 r367  
    11031103    inode_type = hal_remote_lw( XPTR( inode_cxy , &inode_ptr->type ) );
    11041104
     1105    // get local pointer on associated mapper
     1106    mapper_t * mapper_ptr = hal_remote_lpt( XPTR( inode_cxy , &inode_ptr->mapper ) );
     1107
    11051108    // make a local copy of node name
    11061109    hal_remote_strcpy( XPTR( local_cxy , name ) , name_xp );
    11071110
    11081111    // display inode
    1109     nolock_printk("%s%s <%s> inode_xp = %l / dentry_xp = %l\n",
    1110                   indent_str[indent], vfs_inode_type_str( inode_type ),
    1111                   name , inode_xp , dentry_xp );
     1112    nolock_printk("%s%s <%s> : inode = %l / mapper = %l / dentry = %l\n",
     1113                  indent_str[indent], vfs_inode_type_str( inode_type ), name,
     1114                  inode_xp , XPTR( inode_cxy , mapper_ptr ) , dentry_xp );
    11121115
    11131116    // scan directory entries 
     
    11651168
    11661169    // get extended pointer on associated dentry
    1167     dentry_xp = hal_remote_lwd( XPTR( inode_cxy , &inode_ptr->parent_xp ) );
     1170    dentry_xp   = hal_remote_lwd( XPTR( inode_cxy , &inode_ptr->parent_xp ) );
    11681171
    11691172    // check if target inode is the File System root
     
    16041607    parent_ptr = (vfs_inode_t *)GET_PTR( parent_xp );
    16051608
    1606     vfs_dmsg("\n[INFO] %s : enter in cluster %x for %s / child_cxy = %x / parent_xp = %l\n",
     1609    vfs_dmsg("\n[INFO] %s : enter in cluster %x for <%s> / child_cxy = %x / parent_xp = %l\n",
    16071610    __FUNCTION__ , local_cxy , name , child_cxy , parent_xp );
    16081611
     
    16151618                                   &dentry_xp );
    16161619
    1617         vfs_dmsg("\n[INFO] %s : dentry created in local cluster %x\n",
    1618                  __FUNCTION__ , local_cxy );
     1620        vfs_dmsg("\n[INFO] %s : dentry <%s> created in local cluster %x\n",
     1621                 __FUNCTION__ , name , local_cxy );
    16191622    }
    16201623    else                               // parent cluster is remote
     
    16271630                                      &error );
    16281631
    1629         vfs_dmsg("\n[INFO] %s : dentry created in remote cluster %x\n",
    1630                  __FUNCTION__ , parent_cxy );
     1632        vfs_dmsg("\n[INFO] %s : dentry <%s> created in remote cluster %x\n",
     1633                 __FUNCTION__ , name , parent_cxy );
    16311634    }
    16321635                                     
     
    16561659                                  &inode_xp );
    16571660
    1658         vfs_dmsg("\n[INFO] %s : inode created in local cluster %x\n",
    1659                  __FUNCTION__ , local_cxy );
     1661        vfs_dmsg("\n[INFO] %s : inode %l created in local cluster %x\n",
     1662                 __FUNCTION__ , inode_xp , local_cxy );
    16601663    }
    16611664    else                              // child cluster is remote
     
    16731676                                     &error );
    16741677
    1675         vfs_dmsg("\n[INFO] %s : inodecreated in remote cluster %x\n",
    1676                  __FUNCTION__ , child_cxy );
     1678        vfs_dmsg("\n[INFO] %s : inode %l created in remote cluster %x\n",
     1679                 __FUNCTION__ , inode_xp , child_cxy );
    16771680    }
    16781681                                     
     
    16931696    hal_remote_swd( XPTR( dentry_cxy , &dentry_ptr->child_xp ) , inode_xp );
    16941697
    1695     vfs_dmsg("\n[INFO] %s : exit in cluster %x for %s\n",
     1698    vfs_dmsg("\n[INFO] %s : exit in cluster %x for <%s>\n",
    16961699    __FUNCTION__ , local_cxy , name );
    16971700
     
    17161719    mapper_t    * mapper = page->mapper;
    17171720
    1718 
    17191721    assert( (mapper != NULL) , __FUNCTION__ , "no mapper for page\n" );
    17201722
    1721     vfs_dmsg("\n[INFO] %s : enters for page = %d in mapper = %x\n",
    1722              __FUNCTION__ , page->index , mapper );
     1723    vfs_dmsg("\n[INFO] %s : enters for page %d in mapper / inode %l\n",
     1724    __FUNCTION__ , page->index , XPTR( local_cxy , &mapper->inode ) );
    17231725
    17241726    // get FS type
     
    17451747    }
    17461748
    1747     vfs_dmsg("\n[INFO] %s : exit for page = %d in mapper = %x\n",
    1748              __FUNCTION__ , page->index , mapper );
     1749    vfs_dmsg("\n[INFO] %s : exit for page %d in mapper / inode %l\n",
     1750    __FUNCTION__ , page->index , XPTR( local_cxy , &mapper->inode) );
    17491751
    17501752    return error;
Note: See TracChangeset for help on using the changeset viewer.