Ignore:
Timestamp:
Dec 27, 2018, 7:38:58 PM (6 years ago)
Author:
alain
Message:

Fix several bugs in VFS to support the following
ksh commandis : cp, mv, rm, mkdir, cd, pwd

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/kernel/mm/mapper.c

    r606 r610  
    188188        {
    189189
     190            if( mapper_cxy == local_cxy )   // mapper is local
     191            {
     192
    190193#if (DEBUG_MAPPER_GET_PAGE & 1)
    191194if( DEBUG_MAPPER_GET_PAGE < cycle )
    192 printk("\n[%s] missing page => load it from IOC device\n", __FUNCTION__ );
    193 #endif
    194             if( mapper_cxy == local_cxy )   // mapper is local
    195             {
     195printk("\n[%s] missing page => load it from FS / local access \n", __FUNCTION__ );
     196#endif
    196197                 error = mapper_handle_miss( mapper_ptr,
    197198                                             page_id,
     
    200201            else
    201202            {
     203
     204#if (DEBUG_MAPPER_GET_PAGE & 1)
     205if( DEBUG_MAPPER_GET_PAGE < cycle )
     206printk("\n[%s] missing page => load it from FS / RPC access \n", __FUNCTION__ );
     207#endif
    202208                 rpc_mapper_handle_miss_client( mapper_cxy,
    203209                                                mapper_ptr,
     
    253259vfs_inode_t * inode = mapper->inode;
    254260vfs_inode_get_name( XPTR( local_cxy , inode ) , name );
    255 if( DEBUG_MAPPER_HANDLE_MISS < cycle )
    256 printk("\n[%s] enter for page %d in <%s> / cycle %d\n",
     261// if( DEBUG_MAPPER_HANDLE_MISS < cycle )
     262// if( (page_id == 1) && (cycle > 10000000) )
     263printk("\n[%s] enter for page %d in <%s> / cycle %d",
    257264__FUNCTION__, page_id, name, cycle );
    258265if( DEBUG_MAPPER_HANDLE_MISS & 1 )
    259 grdxt_display( &mapper->rt , name );
    260 #endif
    261 
    262     // allocate one page from the mapper cluster
     266grdxt_display( XPTR( local_cxy , &mapper->rt ) , name );
     267#endif
     268
     269    // allocate one page from the local cluster
    263270    req.type  = KMEM_PAGE;
    264271    req.size  = 0;
     
    313320#if DEBUG_MAPPER_HANDLE_MISS
    314321cycle = (uint32_t)hal_get_cycles();
    315 if( DEBUG_MAPPER_HANDLE_MISS < cycle )
    316 printk("\n[%s] exit for page %d in <%s> / ppn %x / cycle %d\n",
     322// if( DEBUG_MAPPER_HANDLE_MISS < cycle )
     323// if( (page_id == 1) && (cycle > 10000000) )
     324printk("\n[%s] exit for page %d in <%s> / ppn %x / cycle %d",
    317325__FUNCTION__, page_id, name, ppm_page2ppn( *page_xp ), cycle );
    318326if( DEBUG_MAPPER_HANDLE_MISS & 1 )
    319 grdxt_display( &mapper->rt , name );
     327grdxt_display( XPTR( local_cxy , &mapper->rt ) , name );
    320328#endif
    321329
     
    348356}  // end mapper_release_page()
    349357
    350 ////////////////////////////////////////////
    351 error_t mapper_move_user( mapper_t * mapper,
     358///////////////////////////////////////////////
     359error_t mapper_move_user( xptr_t     mapper_xp,
    352360                          bool_t     to_buffer,
    353361                          uint32_t   file_offset,
     
    355363                          uint32_t   size )
    356364{
    357     xptr_t     mapper_xp;      // extended pointer on local mapper
    358365    uint32_t   page_offset;    // first byte to move to/from a mapper page
    359366    uint32_t   page_count;     // number of bytes to move to/from a mapper page
     
    371378#endif
    372379
    373     // build extended pointer on mapper
    374     mapper_xp = XPTR( local_cxy , mapper );
    375 
    376380    // compute offsets of first and last bytes in file
    377381    uint32_t min_byte = file_offset;
     
    384388#if (DEBUG_MAPPER_MOVE_USER & 1)
    385389if( DEBUG_MAPPER_MOVE_USER < cycle )
    386 printk("\n[%s] first_page %d / last_page %d\n", __FUNCTION__, first, last );
     390printk("\n[%s] thread[%x,%x] : first_page %d / last_page %d\n",
     391__FUNCTION__, this->process->pid, this->trdid, first, last );
    387392#endif
    388393
     
    404409#if (DEBUG_MAPPER_MOVE_USER & 1)
    405410if( DEBUG_MAPPER_MOVE_USER < cycle )
    406 printk("\n[%s] page_id = %d / page_offset = %d / page_count = %d\n",
    407 __FUNCTION__ , page_id , page_offset , page_count );
     411printk("\n[%s] thread[%x,%x] : page_id = %d / page_offset = %d / page_count = %d\n",
     412__FUNCTION__, this->process->pid, this->trdid, page_id , page_offset , page_count );
    408413#endif
    409414
     
    412417
    413418        if ( page_xp == XPTR_NULL ) return -1;
     419
     420#if (DEBUG_MAPPER_MOVE_USER & 1)
     421if( DEBUG_MAPPER_MOVE_USER < cycle )
     422printk("\n[%s] thread[%x,%x] : get page (%x,%x) from mapper\n",
     423__FUNCTION__, this->process->pid, this->trdid, GET_CXY(page_xp), GET_PTR(page_xp) );
     424#endif
    414425
    415426        // compute pointer in mapper
     
    547558        }
    548559
     560#if (DEBUG_MAPPER_MOVE_KERNEL & 1)
     561if( DEBUG_MAPPER_MOVE_KERNEL < cycle )
     562printk("\n[%s] src_cxy %x / src_ptr %x / dst_cxy %x / dst_ptr %x\n",
     563__FUNCTION__, src_cxy, src_ptr, dst_cxy, dst_ptr );
     564#endif
     565
    549566        // move fragment
    550567        hal_remote_memcpy( XPTR( dst_cxy , dst_ptr ), XPTR( src_cxy , src_ptr ), page_count );
Note: See TracChangeset for help on using the changeset viewer.