Ignore:
Timestamp:
Mar 6, 2019, 4:37:15 PM (5 years ago)
Author:
alain
Message:

Introduce three new types of vsegs (KCODE,KDATA,KDEV)
to map the kernel vsegs in the process VSL and GPT.
This now used by both the TSAR and the I86 architectures.

File:
1 edited

Legend:

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

    r614 r623  
    33 *
    44 * Author   Mohamed Lamine Karaoui (2014,2015)
    5  *          Alain Greiner (2016,2017)
     5 *          Alain Greiner (2016,2017,2018,2019)
    66 *
    77 * Copyright (c) Sorbonne Universites
     
    9191                        xptr_t * devfs_external_inode_xp )
    9292{
    93     error_t  error;
    94     xptr_t   unused_xp;   // required by vfs_add_child_in_parent()
     93    error_t       error;
     94    xptr_t        unused_xp;   // required by vfs_add_child_in_parent()
     95    vfs_inode_t * inode;
    9596
    9697    // create DEVFS "dev" inode in cluster 0
    9798    error = vfs_add_child_in_parent( 0,                // cxy
    98                                      INODE_TYPE_DIR,
    9999                                     FS_TYPE_DEVFS,
    100100                                     root_inode_xp,
     
    103103                                     devfs_dev_inode_xp );
    104104
     105    // update inode "type" field
     106    inode = GET_PTR( *devfs_dev_inode_xp );
     107    inode->type = INODE_TYPE_DIR;
     108 
    105109    // create dentries <.> and <..> in <dev>
    106110    error |= vfs_add_special_dentries( *devfs_dev_inode_xp,
    107111                                       root_inode_xp );
    108112
    109 // check success
    110 assert( (error == 0) , "cannot create <dev>\n" );
     113    if( error )
     114    {
     115        printk("\n[PANIC] in %s : cannot create <dev> directory\n", __FUNCTION__ );
     116        hal_core_sleep();
     117    }
    111118
    112119#if DEBUG_DEVFS_GLOBAL_INIT
     
    120127    // create DEVFS "external" inode in cluster 0
    121128    error = vfs_add_child_in_parent( 0,               // cxy
    122                                      INODE_TYPE_DIR,
    123129                                     FS_TYPE_DEVFS,
    124130                                     *devfs_dev_inode_xp,
     
    127133                                     devfs_external_inode_xp );
    128134
     135    // update inode "type" field
     136    inode = GET_PTR( *devfs_external_inode_xp );
     137    inode->type = INODE_TYPE_DIR;
     138 
    129139    // create dentries <.> and <..> in <external>
    130140    error |= vfs_add_special_dentries( *devfs_external_inode_xp,
    131141                                       *devfs_dev_inode_xp );
    132142
    133 // check success
    134 assert( (error == 0) , "cannot create <external>\n" );
     143    if( error )
     144    {
     145        printk("\n[PANIC] in %s : cannot create <external> directory\n", __FUNCTION__ );
     146        hal_core_sleep();
     147    }
    135148
    136149#if DEBUG_DEVFS_GLOBAL_INIT
     
    153166    chdev_t     * chdev_ptr;
    154167    xptr_t        inode_xp;
    155     cxy_t         inode_cxy;
    156168    vfs_inode_t * inode_ptr;
    157169    uint32_t      channel;
     
    171183
    172184    error = vfs_add_child_in_parent( local_cxy,
    173                                      INODE_TYPE_DIR,
    174185                                     FS_TYPE_DEVFS,
    175186                                     devfs_dev_inode_xp,
     
    178189                                     devfs_internal_inode_xp );
    179190
     191    // set inode "type" field
     192    inode_ptr = GET_PTR( *devfs_internal_inode_xp );
     193    inode_ptr->type = INODE_TYPE_DEV;
     194 
    180195    // create dentries <.> and <..> in <internal>
    181196    error |= vfs_add_special_dentries( *devfs_internal_inode_xp,
    182197                                       devfs_dev_inode_xp );
    183198
    184 // check success
    185 assert( (error == 0) , "cannot create <external>\n" );
     199    if( error )
     200    {
     201        printk("\n[PANIC] in %s : cannot create <internal> directory\n", __FUNCTION__ );
     202        hal_core_sleep();
     203    }
    186204
    187205#if DEBUG_DEVFS_LOCAL_INIT
     
    199217        chdev_cxy = GET_CXY( chdev_xp );
    200218
    201 assert( (chdev_cxy == local_cxy ), "illegal MMC chdev in cluster %x\n", local_cxy );
     219        if( chdev_cxy != local_cxy )
     220        {
     221            printk("\n[PANIC] in %s : illegal MMC chdev in cluster %x\n",
     222            __FUNCTION__, local_cxy );
     223            hal_core_sleep();
     224        }
    202225
    203226        error = vfs_add_child_in_parent( local_cxy,
    204                                          INODE_TYPE_DEV,
    205227                                         FS_TYPE_DEVFS,
    206228                                         *devfs_internal_inode_xp,
     
    209231                                         &inode_xp );
    210232
    211 assert( (error == 0) , "cannot create MMC inode\n" );
    212 
    213         // update child inode "extend" field
    214         inode_cxy = GET_CXY( inode_xp );
     233        if( error )
     234        {
     235            printk("\n[PANIC] in %s : cannot create MMC inode in cluster %x\n",
     236            __FUNCTION__, local_cxy );
     237            hal_core_sleep();
     238        }
     239
     240        // update child inode "extend" and "type" fields
    215241        inode_ptr = GET_PTR( inode_xp );
    216         hal_remote_spt( XPTR( inode_cxy , &inode_ptr->extend ) , chdev_ptr );
     242        inode_ptr->extend = chdev_ptr;
     243        inode_ptr->type   = INODE_TYPE_DEV;
    217244       
    218245#if DEBUG_DEVFS_LOCAL_INIT
     
    234261            chdev_cxy = GET_CXY( chdev_xp );
    235262
    236 assert( (chdev_cxy == local_cxy ), "illegal DMA chdev in cluster %x\n", local_cxy );
     263            if( chdev_cxy != local_cxy )
     264            {
     265                printk("\d[PANIC] in %s : illegal DMA chdev in cluster %x\n",
     266                __FUNCTION__, local_cxy );
     267                hal_core_sleep();
     268            }
    237269
    238270            error = vfs_add_child_in_parent( local_cxy,
    239                                              INODE_TYPE_DEV,
    240271                                             FS_TYPE_DEVFS,
    241272                                             *devfs_internal_inode_xp,
     
    243274                                             &unused_xp,
    244275                                             &inode_xp );
    245 
    246 assert( (error == 0) , "cannot create DMA inode\n" );
    247 
    248             // update child inode "extend" field
    249             inode_cxy = GET_CXY( inode_xp );
     276            if( error )
     277            {
     278                printk("\n[PANIC] in %s : cannot create DMA inode in cluster %x\n",
     279                __FUNCTION__, local_cxy );
     280                hal_core_sleep();
     281            }
     282
     283            // update child inode "extend" and "type" fields
    250284            inode_ptr = GET_PTR( inode_xp );
    251             hal_remote_spt( XPTR( inode_cxy , &inode_ptr->extend ) , chdev_ptr );
     285            inode_ptr->extend = chdev_ptr;
     286            inode_ptr->type   = INODE_TYPE_DEV;
    252287       
    253288#if DEBUG_DEVFS_LOCAL_INIT
     
    270305        {
    271306            error = vfs_add_child_in_parent( local_cxy,
    272                                              INODE_TYPE_DEV,
    273307                                             FS_TYPE_DEVFS,
    274308                                             devfs_external_inode_xp,
     
    276310                                             &unused_xp,
    277311                                             &inode_xp );
    278 
    279 assert( (error == 0) , "cannot create IOB inode\n" );
    280 
    281             // update child inode "extend" field
    282             inode_cxy = GET_CXY( inode_xp );
     312            if( error )
     313            {
     314                printk("\n[PANIC] in %s : cannot create IOB inode in cluster %x\n",
     315                __FUNCTION__, local_cxy );
     316                hal_core_sleep();
     317            }
     318
     319            // update child inode "extend" and "type" fields
    283320            inode_ptr = GET_PTR( inode_xp );
    284             hal_remote_spt( XPTR( inode_cxy , &inode_ptr->extend ) , chdev_ptr );
     321            inode_ptr->extend = chdev_ptr;
     322            inode_ptr->type   = INODE_TYPE_DEV;
    285323       
    286324#if DEBUG_DEVFS_LOCAL_INIT
     
    303341        {
    304342            error = vfs_add_child_in_parent( local_cxy,
    305                                              INODE_TYPE_DEV,
    306343                                             FS_TYPE_DEVFS,
    307344                                             devfs_external_inode_xp,
     
    310347                                             &inode_xp );
    311348
    312 assert( (error == 0) , "cannot create PIC inode\n" );
     349            if( error )
     350            {
     351                printk("\n[PANIC] in %s : cannot create PIC inode in cluster %x\n",
     352                __FUNCTION__, local_cxy );
     353                hal_core_sleep();
     354            }
    313355
    314356            // update child inode "extend" field
    315             inode_cxy = GET_CXY( inode_xp );
    316357            inode_ptr = GET_PTR( inode_xp );
    317             hal_remote_spt( XPTR( inode_cxy , &inode_ptr->extend ) , chdev_ptr );
     358            inode_ptr->extend = chdev_ptr;
     359            inode_ptr->type   = INODE_TYPE_DEV;
    318360       
    319361#if DEBUG_DEVFS_LOCAL_INIT
     
    338380            {
    339381                error = vfs_add_child_in_parent( local_cxy,
    340                                                  INODE_TYPE_DEV,
    341382                                                 FS_TYPE_DEVFS,
    342383                                                 devfs_external_inode_xp,
     
    345386                                                 &inode_xp );
    346387
    347 assert( (error == 0) , "cannot create TXT_RX inode\n" );
    348 
    349                 // update child inode "extend" field
    350                 inode_cxy = GET_CXY( inode_xp );
     388                if( error )
     389                {
     390                    printk("\n[PANIC] in %s : cannot create TXT_RX inode in cluster %x\n",
     391                    __FUNCTION__, local_cxy );
     392                    hal_core_sleep();
     393                }
     394
     395                // update child inode "extend" and "type" fields
    351396                inode_ptr = GET_PTR( inode_xp );
    352                 hal_remote_spt( XPTR( inode_cxy , &inode_ptr->extend ) , chdev_ptr );
     397                inode_ptr->extend = chdev_ptr;
     398                inode_ptr->type   = INODE_TYPE_DEV;
    353399       
    354400#if DEBUG_DEVFS_LOCAL_INIT
     
    374420            {
    375421                error = vfs_add_child_in_parent( local_cxy,
    376                                                  INODE_TYPE_DEV,
    377422                                                 FS_TYPE_DEVFS,
    378423                                                 devfs_external_inode_xp,
     
    380425                                                 &unused_xp,
    381426                                                 &inode_xp );
    382 
    383 assert( (error == 0) , "cannot create TXT_TX inode\n" );
    384 
    385                 // update child inode "extend" field
    386                 inode_cxy = GET_CXY( inode_xp );
     427                if( error )
     428                {
     429                    printk("\n[PANIC] in %s : cannot create TXT_TX inode in cluster %x\n",
     430                    __FUNCTION__, local_cxy );
     431                    hal_core_sleep();
     432                }
     433
     434                // update child inode "extend" and "type" fields
    387435                inode_ptr = GET_PTR( inode_xp );
    388                 hal_remote_spt( XPTR( inode_cxy , &inode_ptr->extend ) , chdev_ptr );
     436                inode_ptr->extend = chdev_ptr;
     437                inode_ptr->type   = INODE_TYPE_DEV;
    389438       
    390439#if DEBUG_DEVFS_LOCAL_INIT
     
    410459            {
    411460                error = vfs_add_child_in_parent( local_cxy,
    412                                                  INODE_TYPE_DEV,
    413461                                                 FS_TYPE_DEVFS,
    414462                                                 devfs_external_inode_xp,
     
    416464                                                 &unused_xp,
    417465                                                 &inode_xp );
    418 
    419 assert( (error == 0) , "cannot create IOC inode\n" );
    420 
    421                 // update child inode "extend" field
    422                 inode_cxy = GET_CXY( inode_xp );
     466                if( error )
     467                {
     468                    printk("\n[PANIC] in %s : cannot create IOC inode in cluster %x\n",
     469                    __FUNCTION__, local_cxy );
     470                    hal_core_sleep();
     471                }
     472
     473                // update child inode "extend" and "type" fields
    423474                inode_ptr = GET_PTR( inode_xp );
    424                 hal_remote_spt( XPTR( inode_cxy , &inode_ptr->extend ) , chdev_ptr );
     475                inode_ptr->extend = chdev_ptr;
     476                inode_ptr->type   = INODE_TYPE_DEV;
    425477       
    426478#if DEBUG_DEVFS_LOCAL_INIT
     
    446498            {
    447499                error = vfs_add_child_in_parent( local_cxy,
    448                                                  INODE_TYPE_DEV,
    449500                                                 FS_TYPE_DEVFS,
    450501                                                 devfs_external_inode_xp,
     
    452503                                                 &unused_xp,
    453504                                                 &inode_xp );
    454 
    455 assert( (error == 0) , "cannot create FBF inode\n" );
    456 
    457                 // update child inode "extend" field
    458                 inode_cxy = GET_CXY( inode_xp );
     505                if( error )
     506                {
     507                    printk("\n[PANIC] in %s : cannot create FBF inode in cluster %x\n",
     508                    __FUNCTION__, local_cxy );
     509                    hal_core_sleep();
     510                }
     511
     512                // update child inode "extend" and "type" fields
    459513                inode_ptr = GET_PTR( inode_xp );
    460                 hal_remote_spt( XPTR( inode_cxy , &inode_ptr->extend ) , chdev_ptr );
     514                inode_ptr->extend = chdev_ptr;
     515                inode_ptr->type   = INODE_TYPE_DEV;
    461516       
    462517#if DEBUG_DEVFS_LOCAL_INIT
     
    482537            {
    483538                error = vfs_add_child_in_parent( local_cxy,
    484                                                  INODE_TYPE_DEV,
    485539                                                 FS_TYPE_DEVFS,
    486540                                                 devfs_external_inode_xp,
     
    488542                                                 &unused_xp,
    489543                                                 &inode_xp );
    490 
    491 assert( (error == 0) , "cannot create NIC_RX inode\n" );
    492 
    493                 // update child inode "extend" field
    494                 inode_cxy = GET_CXY( inode_xp );
     544                if( error )
     545                {
     546                    printk("\n[PANIC] in %s : cannot create NIC_RX inode in cluster %x\n",
     547                    __FUNCTION__, local_cxy );
     548                    hal_core_sleep();
     549                }
     550
     551                // update child inode "extend" and "type" fields
    495552                inode_ptr = GET_PTR( inode_xp );
    496                 hal_remote_spt( XPTR( inode_cxy , &inode_ptr->extend ) , chdev_ptr );
     553                inode_ptr->extend = chdev_ptr;
     554                inode_ptr->type   = INODE_TYPE_DEV;
    497555 
    498556#if DEBUG_DEVFS_LOCAL_INIT
     
    518576            {
    519577                error = vfs_add_child_in_parent( local_cxy,
    520                                                  INODE_TYPE_DEV,
    521578                                                 FS_TYPE_DEVFS,
    522579                                                 devfs_external_inode_xp,
     
    524581                                                 &unused_xp,
    525582                                                 &inode_xp );
    526 
    527 assert( (error == 0) , "cannot create NIC_TX inode\n" );
    528 
    529                 // update child inode "extend" field
    530                 inode_cxy = GET_CXY( inode_xp );
     583                if( error )
     584                {
     585                    printk("\n[PANIC] in %s : cannot create NIC_TX inode in cluster %x\n",
     586                    __FUNCTION__, local_cxy );
     587                    hal_core_sleep();
     588                }
     589
     590                // update child inode "extend" and "type" fields
    531591                inode_ptr = GET_PTR( inode_xp );
    532                 hal_remote_spt( XPTR( inode_cxy , &inode_ptr->extend ) , chdev_ptr );
     592                inode_ptr->extend = chdev_ptr;
     593                inode_ptr->type   = INODE_TYPE_DEV;
    533594       
    534595#if DEBUG_DEVFS_LOCAL_INIT
Note: See TracChangeset for help on using the changeset viewer.