Changeset 279 for trunk/kernel/vfs


Ignore:
Timestamp:
Jul 27, 2017, 12:23:29 AM (5 years ago)
Author:
alain
Message:

1) Introduce independant command fields for the various devices in the thread descriptor.
2) Introduce a new dev_pic_enable_ipi() function in the generic PIC device
3) Fix two bugs identified by Maxime in the scheduler initialisation, and in the sched_select().
4) fix several bugs in the TSAR hal_kentry.S.
5) Introduce a third kgiet segment (besides kdata and kcode) in the TSAR bootloader.

Location:
trunk/kernel/vfs
Files:
3 edited

Legend:

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

    r204 r279  
    7979    error_t  error;
    8080
     81    devfs_dmsg("\n[INFO] %s : enter in cluster %x\n",
     82               __FUNCTION__ , local_cxy );
     83
    8184    // creates DEVFS "dev" inode in cluster IO
    8285    error = vfs_add_child_in_parent( LOCAL_CLUSTER->io_cxy,
     
    8891                                     devfs_dev_inode_xp );
    8992
    90     nolock_assert( (error == 0) , __FUNCTION__ , "cannot create <dev>\n" );
     93    assert( (error == 0) , __FUNCTION__ , "cannot create <dev>\n" );
     94
     95    devfs_dmsg("\n[INFO] %s : <dev> created in cluster %x\n",
     96               __FUNCTION__ , local_cxy );
    9197
    9298    // create DEVFS "external" inode in cluster IO
     
    99105                                     devfs_external_inode_xp );
    100106
    101     nolock_assert( (error == 0) , __FUNCTION__ , "cannot create <external>\n" );
     107    assert( (error == 0) , __FUNCTION__ , "cannot create <external>\n" );
     108
     109    devfs_dmsg("\n[INFO] %s : <external> created in cluster %x\n",
     110               __FUNCTION__ , local_cxy );
    102111}
    103112
  • trunk/kernel/vfs/fatfs.c

    r265 r279  
    217217} // end get_name_from_long()
    218218
    219 //////////////////////////////////////////////////////////////////////////////////////////
    220 // This function returns the FATFS cluster index of a page identified by its page
    221 // index in the file, using the FAT mapper. It scans the FAT mapper, starting from the
    222 // FATFS cluster index allocated to the first page of the file, until it reaches the
    223 // searched page. The FAT mapper is automatically updated in case of miss.
    224 // This function can be called by any thread running in any cluster, as it uses the
    225 // RPC_FATFS_GET_CLUSTER to access the remote FAT mapper if required.
    226 // We use a RPC to scan the FAT because the RPC_FIFO will avoid contention
    227 // in the cluster containing the FAT mapper, and the RPC latency is not critical
    228 // compared to the device access latency.
    229 //////////////////////////////////////////////////////////////////////////////////////////
    230 // @ ctx               : pointer on local FATFS context.
    231 // @ first_cluster : first cluster allocated to a file in FATFS.
    232 // @ page_index    : index of searched page in file (one page occupies one cluster).
    233 // @ cluster_index : [out] pointer on buffer for FATFS cluster index.
    234 // @ return 0 if success / return EIO if a FAT cluster miss cannot be solved.
    235 //////////////////////////////////////////////////////////////////////////////////////////
    236 static error_t fatfs_cluster_from_index( fatfs_ctx_t * ctx,
    237                                          uint32_t      first_cluster,
    238                                          uint32_t      page_index,
    239                                          uint32_t    * cluster_index )
    240 {
    241     uint32_t searched_cluster;   // searched FATFS cluster index
    242     error_t  error;
    243 
    244     // get extended pointer on FAT mapper
    245     xptr_t fat_mapper_xp = ctx->fat_mapper_xp;
    246 
    247     // get cluster cxy and local pointer on FAT mapper
    248     cxy_t      fat_mapper_cxy = GET_CXY( fat_mapper_xp );
    249     mapper_t * fat_mapper_ptr = (mapper_t *)GET_PTR( fat_mapper_xp );
    250 
    251     if( fat_mapper_cxy == local_cxy )    // FAT mapper is local
    252     {
    253         error = fatfs_get_cluster( fat_mapper_ptr,
    254                                    first_cluster,
    255                                    page_index,
    256                                    &searched_cluster );
    257     }
    258     else                                 // FAT mapper is remote
    259     {
    260         rpc_fatfs_get_cluster_client( fat_mapper_cxy,
    261                                       fat_mapper_ptr,
    262                                       first_cluster,
    263                                       page_index,
    264                                       &searched_cluster,
    265                                       &error );
    266     }
    267    
    268     if( error )
    269     {
    270         printk("\n[ERROR] in %s : cannot access FAT\n", __FUNCTION__ );
    271         return error;
    272     }
    273 
    274     // return success
    275     *cluster_index = searched_cluster;
    276     return 0;
    277 
    278 }  // end fatfs_cluster_from_index()
    279219
    280220//////////////////////////////////////////////////////////////////////////////////////////
     
    400340    uint8_t     * buffer;
    401341
    402     fatfs_dmsg("\n[INFO] %s : enters for fatfs_ctx = %x\n",
     342    fatfs_dmsg("\n[INFO] %s : enter for fatfs_ctx = %x\n",
    403343               __FUNCTION__ , fatfs_ctx );
    404344
     
    414354                   "cannot allocate memory for 512 bytes buffer\n" );
    415355     
     356    fatfs_dmsg("\n[INFO] %s : allocated 512 bytes buffer\n", __FUNCTION__ );
     357
    416358    // load the boot record from device
    417359    // using a synchronous access to IOC device 
    418360    error = dev_ioc_sync_read( buffer , 0 , 1 );
     361
     362    fatfs_dmsg("\n[INFO] %s : buffer loaded\n", __FUNCTION__ );
    419363
    420364    assert( (error == 0) , __FUNCTION__ ,
     
    441385    uint32_t sector_size = fatfs_get_record( BPB_BYTSPERSEC , buffer , 1 );
    442386
    443     nolock_assert( (sector_size == 512) , __FUNCTION__ ,
    444                    "sector size must be 512 bytes\n" );
     387    assert( (sector_size == 512) , __FUNCTION__ ,
     388            "sector size must be 512 bytes\n" );
    445389
    446390    // check cluster size from boot record
    447391    uint32_t nb_sectors = fatfs_get_record( BPB_SECPERCLUS , buffer , 1 );
    448392
    449     nolock_assert( (nb_sectors == 8) , __FUNCTION__ ,
    450                    "cluster size must be 8 sectors\n" );
     393    assert( (nb_sectors == 8) , __FUNCTION__ ,
     394            "cluster size must be 8 sectors\n" );
    451395
    452396    // check number of FAT copies from boot record
    453397    uint32_t nb_fats = fatfs_get_record( BPB_NUMFATS , buffer , 1 );
    454398
    455     nolock_assert( (nb_fats == 1) , __FUNCTION__ ,
    456                    "number of FAT copies must be 1\n" );
     399    assert( (nb_fats == 1) , __FUNCTION__ ,
     400            "number of FAT copies must be 1\n" );
    457401
    458402    // get & check number of sectors in FAT from boot record
    459403    uint32_t fat_sectors = fatfs_get_record( BPB_FAT32_FATSZ32 , buffer , 1 );
    460404
    461     nolock_assert( ((fat_sectors & 0xF) == 0) , __FUNCTION__ ,
    462                    "FAT not multiple of 16 sectors\n");
     405    assert( ((fat_sectors & 0xF) == 0) , __FUNCTION__ ,
     406            "FAT not multiple of 16 sectors\n");
    463407
    464408    // get and check root cluster from boot record
    465409    uint32_t root_cluster = fatfs_get_record( BPB_FAT32_ROOTCLUS , buffer , 1 );
    466410
    467     nolock_assert( (root_cluster == 2) , __FUNCTION__ ,
    468                    "root cluster index must be  2\n");
     411    assert( (root_cluster == 2) , __FUNCTION__ ,
     412            "root cluster index must be  2\n");
    469413
    470414    // get FAT lba from boot record
     
    475419    req.ptr  = buffer;
    476420    kmem_free( &req );
     421
     422    fatfs_dmsg("\n[INFO] %s : boot record read & released\n",
     423               __FUNCTION__ );
    477424
    478425    // allocate a mapper for the FAT itself
     
    494441    fatfs_ctx->last_allocated_index  = 0;    // TODO ???
    495442    fatfs_ctx->fat_mapper_xp         = XPTR( local_cxy , fat_mapper );
     443
     444    fatfs_dmsg("\n[INFO] %s : exit for fatfs_ctx = %x\n",
     445               __FUNCTION__ , fatfs_ctx );
    496446
    497447}  // end fatfs_ctx_init()
  • trunk/kernel/vfs/vfs.c

    r271 r279  
    154154    error_t            error;
    155155
     156    vfs_dmsg("\n[INFO] %s : enter / local_cluster = %x / parent_cluster = %x\n",
     157             __FUNCTION__ , local_cxy , GET_CXY( dentry_xp ) );
     158 
    156159    // check fs type and get pointer on context
    157160    if     ( fs_type == FS_TYPE_FATFS ) ctx = &fs_context[FS_TYPE_FATFS];
     
    224227    remote_rwlock_init( XPTR( local_cxy , &inode->data_lock ) );
    225228    remote_spinlock_init( XPTR( local_cxy , &inode->main_lock ) );
     229
     230    vfs_dmsg("\n[INFO] %s : enter / local_cluster = %x / parent_cluster = %x\n",
     231             __FUNCTION__ , local_cxy , GET_CXY( dentry_xp ) );
    226232
    227233    // return extended pointer on inode
     
    15161522    parent_ptr = (vfs_inode_t *)GET_PTR( parent_xp );
    15171523
     1524    vfs_dmsg("\n[INFO] %s : enter in cluster %x / child_cxy = %x / parent_cxy = %x\n",
     1525             __FUNCTION__ , local_cxy , child_cxy , parent_cxy );
     1526
    15181527    // 1. create dentry
    15191528    if( parent_cxy == local_cxy )      // parent cluster is the local cluster
     
    15231532                                   parent_ptr,
    15241533                                   &dentry_xp );
     1534
     1535        vfs_dmsg("\n[INFO] %s : dentry created in local cluster %x\n",
     1536                 __FUNCTION__ , local_cxy );
    15251537    }
    15261538    else                               // parent cluster is remote
     
    15321544                                      &dentry_xp,
    15331545                                      &error );
     1546
     1547        vfs_dmsg("\n[INFO] %s : dentry created in remote cluster %x\n",
     1548                 __FUNCTION__ , parent_cxy );
    15341549    }
    15351550                                     
     
    15581573                                  gid,
    15591574                                  &inode_xp );
     1575
     1576        vfs_dmsg("\n[INFO] %s : inode created in local cluster %x\n",
     1577                 __FUNCTION__ , local_cxy );
    15601578    }
    15611579    else                              // child cluster is remote
     
    15721590                                     &inode_xp,
    15731591                                     &error );
     1592
     1593        vfs_dmsg("\n[INFO] %s : inodecreated in remote cluster %x\n",
     1594                 __FUNCTION__ , child_cxy );
    15741595    }
    15751596                                     
Note: See TracChangeset for help on using the changeset viewer.