Changeset 101 for trunk/kernel/vfs


Ignore:
Timestamp:
Jun 29, 2017, 4:44:52 PM (7 years ago)
Author:
alain
Message:

euh...

Location:
trunk/kernel/vfs
Files:
3 edited

Legend:

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

    r68 r101  
    319319    uint32_t   line;
    320320    uint32_t   byte = 0;
    321     printk("\n*** boot record at cycle %d ***\n", hal_time_stamp() );
     321    printk("\n*** boot record at cycle %d ***\n", hal_get_cycles() );
    322322    for ( line = 0 ; line < 32 ; line++ )
    323323    {
  • trunk/kernel/vfs/vfs.c

    r50 r101  
    246246}
    247247
    248 /////////////////////////////////////////////////
    249 void vfs_inode_size_set_size( xptr_t    inode_xp,
     248////////////////////////////////////////////
     249void vfs_inode_set_size( xptr_t    inode_xp,
    250250                              uint32_t  size )
    251251{
     
    260260}
    261261
    262 ///////////////////////////////////////////////
    263 void vfs_inode_remote_unlock( xptr_t inode_xp )
     262////////////////////////////////////////
     263void vfs_inode_unlock( xptr_t inode_xp )
    264264{
    265265    // get inode cluster and local pointer
     
    271271}
    272272
    273 /////////////////////////////////////////////
    274 void vfs_inode_remote_lock( xptr_t inode_xp )
     273//////////////////////////////////////
     274void vfs_inode_lock( xptr_t inode_xp )
    275275{
    276276    // get inode cluster and local pointer
     
    280280    // get the main lock
    281281    remote_spinlock_lock( XPTR( cxy , &ptr->main_lock ) );
     282}
     283
     284/////////////////////////////////////////
     285xptr_t vfs_inode_owner( xptr_t inode_xp )
     286{
     287    // get inode cluster and local pointer
     288    cxy_t         cxy = GET_CXY( inode_xp );
     289    vfs_inode_t * ptr = (vfs_inode_t *)GET_PTR( inode_xp );
     290
     291    // get the main lock
     292    return remote_spinlock_owner( XPTR( cxy , &ptr->main_lock ) );
    282293}
    283294
     
    459470    xptr_t        file_xp;      // extended pointer on created file descriptor
    460471    uint32_t      file_id;      // created file descriptor index in reference fd_array
     472
     473    vfs_dmsg("\n[INFO] %s : enters for <%s> at cycle %d\n",
     474             __FUNCTION__ , path , hal_get_cycles() );
    461475
    462476    // compute lookup working mode
     
    476490    // get extended pointer on target inode
    477491    error = vfs_lookup( cwd_xp , path , lookup_mode , &inode_xp );
     492
     493    vfs_dmsg("\n[INFO] %s : get inode_xp = %l for <%s> at cycle %d\n",
     494             __FUNCTION__ , inode_xp , path , hal_get_cycles() );
    478495
    479496    if( error ) return error;
     
    848865
    849866    // return child inode
    850     *child_xp = (xptr_t)hal_remote_lwd( XPTR( dentry_cxy , &dentry_ptr->parent ) );
     867    *child_xp = (xptr_t)hal_remote_lwd( XPTR( dentry_cxy , &dentry_ptr->child_xp ) );
    851868    return true;
    852869}
     
    903920                                        xptr_t           * inode_xp )
    904921{
    905     char          name[CONFIG_VFS_MAX_NAME_LENGTH];   // one name in path
     922    char               name[CONFIG_VFS_MAX_NAME_LENGTH];   // one name in path
    906923
    907924    xptr_t             parent_xp;    // extended pointer on parent inode
     
    922939    error_t            error;
    923940
     941    vfs_dmsg("\n[INFO] %s : enters for <%s>\n",
     942             __FUNCTION__ , pathname );
     943
    924944    this    = CURRENT_THREAD;
    925945    process = this->process;
     
    929949    else                     parent_xp = cwd_xp;
    930950
    931     // initialise loop variables
     951    // initialise other loop variables
    932952    current  = pathname;
    933953    next     = NULL;
     
    936956
    937957    // take lock on parent inode
    938     vfs_inode_remote_lock( parent_xp );
    939 
    940     // break : if one intermediate name not found
    941     // exit  : when last name found (i.e. last == true)
     958    vfs_inode_lock( parent_xp );
     959
     960    // load from device if one intermediate node not found
     961    // exit  when last name found (i.e. last == true)
    942962    do
    943963    {
    944         // get one name from path and the last flag
     964        // get one name from path, and the "last" flag
    945965        vfs_get_name_from_path( current , name , &next , &last );
     966
     967        vfs_dmsg("\n[INFO] %s : looking for node <%s> / last = %d\n",
     968                 __FUNCTION__ , name , last );
    946969
    947970        // search a child dentry matching name for parent inode
     
    952975        if( found == false ) // child inode not found in inode tree => try to load it
    953976        {
     977            vfs_dmsg("\n[INFO] %s : node <%s> not found, try to load it\n",
     978                     __FUNCTION__ , name );
     979
    954980            // release lock on parent inode
    955             vfs_inode_remote_unlock( parent_xp );
     981            vfs_inode_unlock( parent_xp );
    956982
    957983            // get cluster and local pointer on parent inode
     
    9821008
    9831009            // take lock on parent inode
    984             vfs_inode_remote_lock( parent_xp );
     1010            vfs_inode_lock( parent_xp );
    9851011        }
    9861012
    987         // check access rights
     1013        vfs_dmsg("\n[INFO] %s : node <%s> found / parent = %l / child = %l / last = %d\n",
     1014                 __FUNCTION__ , name , parent_xp , child_xp , last );
     1015
     1016        // TODO check access rights
    9881017        // error = vfs_access_denied( child_xp,
    9891018        //                            client_uid,
     
    9951024        // }
    9961025
     1026printk("\n@@@ bloup 0 : parent lock owner = %l / child lock owner = %l\n",
     1027       vfs_inode_owner( parent_xp ) , vfs_inode_owner( child_xp ) );
     1028
    9971029        // take lock on child inode if not last
    998         if( last == false ) vfs_inode_remote_lock( child_xp );
     1030        if( last == false ) vfs_inode_lock( child_xp );
     1031
     1032printk("\n@@@ bloup 1\n");
    9991033
    10001034        // release lock on parent inode
    1001         vfs_inode_remote_unlock( parent_xp );
     1035        vfs_inode_unlock( parent_xp );
     1036
     1037printk("\n@@@ bloup 2\n");
    10021038
    10031039        // update loop variables
    10041040        parent_xp = child_xp;
    10051041        current   = next;
     1042
     1043        vfs_dmsg("\n[INFO] %s : complete node <%s> / last = %d\n",
     1044                 __FUNCTION__ , name , last );
     1045
    10061046    }
    10071047    while( last == false );
     
    11421182    uint32_t  y_size    = LOCAL_CLUSTER->y_size;
    11431183    uint32_t  y_width   = LOCAL_CLUSTER->y_width;
    1144     uint32_t  index     = ( hal_time_stamp() + hal_get_gid() ) % (x_size * y_size);
     1184    uint32_t  index     = ( hal_get_cycles() + hal_get_gid() ) % (x_size * y_size);
    11451185    uint32_t  x         = index / y_size;   
    11461186    uint32_t  y         = index % y_size;
  • trunk/kernel/vfs/vfs.h

    r23 r101  
    414414 * @ inode_xp  : extended pointer on the remote inode.
    415415 *****************************************************************************************/
    416 void vfs_inode_remote_lock( xptr_t inode_xp );
     416void vfs_inode_lock( xptr_t inode_xp );
    417417
    418418/******************************************************************************************
     
    422422 * @ inode_xp  : extended pointer on the remote inode.
    423423 *****************************************************************************************/
    424 void vfs_inode_remote_unlock( xptr_t inode_xp );
    425 
    426 
    427 
    428 
    429 /******************************************************************************************
    430  * This function TODO                                                         
    431  *****************************************************************************************/
    432 error_t vfs_inode_hold( vfs_inode_t * inode,
    433                         uint32_t      gc );
     424void vfs_inode_unlock( xptr_t inode_xp );
     425
     426/******************************************************************************************
     427 * This debug function returns the current owner of the inode main lock.
     428 *****************************************************************************************
     429 * @ inode_xp  : extended pointer on the remote inode.
     430 * @ return extended pointer on owner thread / return XPTR_NULL if lock not taken.
     431 *****************************************************************************************/
     432xptr_t vfs_inode_owner( xptr_t inode_xp );
    434433
    435434/******************************************************************************************
Note: See TracChangeset for help on using the changeset viewer.