Changeset 18 for trunk/kernel/mm/kmem.c


Ignore:
Timestamp:
Jun 3, 2017, 4:42:49 PM (7 years ago)
Author:
max@…
Message:

cosmetic, and a few typos

File:
1 edited

Legend:

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

    r14 r18  
    6363        if( kcm != NULL )
    6464        {
    65             if( index == kcm->type ) 
     65            if( index == kcm->type )
    6666            {
    6767                printk("     - KCM[%s] (at address %x) is OK\n",
    6868                       kmem_type_str( index ) , (intptr_t)kcm );
    6969            }
    70             else 
     70            else
    7171            {
    7272                printk("     - KCM[%s] (at address %x) is KO : has type %s\n",
    7373                       kmem_type_str( index ) , (intptr_t)kcm , kmem_type_str( kcm->type ) );
    74             }           
     74            }
    7575        }
    7676    }
     
    100100    else if( type == KMEM_SEM )           return sizeof( remote_sem_t );
    101101    else                                  return 0;
    102 } 
     102}
    103103
    104104/////////////////////////////////////
     
    121121    else if( type == KMEM_VFS_CTX )       return "KMEM_VFS_CTX";
    122122    else if( type == KMEM_VFS_INODE )     return "KMEM_VFS_INODE";
    123     else if( type == KMEM_VFS_DENTRY )    return "KMEM_VFS_DENTRY"; 
     123    else if( type == KMEM_VFS_DENTRY )    return "KMEM_VFS_DENTRY";
    124124    else if( type == KMEM_VFS_FILE )      return "KMEM_VFS_FILE";
    125125    else if( type == KMEM_SEM )           return "KMEM_SEM";
     
    153153    }
    154154
    155     // initializes the new KCM allocator 
     155    // initializes the new KCM allocator
    156156        kcm_init( kcm , type );
    157157
     
    168168}  // end kmem_create_kcm()
    169169
    170  
     170
    171171
    172172/////////////////////////////////////
     
    184184        size  = req->size;
    185185        flags = req->flags;
    186  
     186
    187187        assert( (type < KMEM_TYPES_NR) , __FUNCTION__ , "illegal KMEM request type" );
    188  
     188
    189189        kmem_dmsg("\n[INFO] %s : enters in cluster %x for type %s / size %d\n",
    190190                      __FUNCTION__ , local_cxy , kmem_type_str( type ) , size );
     
    192192    // analyse request type
    193193        if( type ==  KMEM_PAGE )                       // PPM allocator
    194     {       
     194    {
    195195        // allocate the number of requested pages
    196196                ptr = (void *)ppm_alloc_pages( size );
     
    198198        // reset page if required
    199199                if( flags & AF_ZERO ) page_zero( (page_t *)ptr );
    200    
     200
    201201        kmem_dmsg("\n[INFO] %s : exit in cluster %x for type %s / page = %x / base = %x\n",
    202                   __FUNCTION__, local_cxy , kmem_type_str( type ) , 
     202                  __FUNCTION__, local_cxy , kmem_type_str( type ) ,
    203203                  (intptr_t)ptr , (intptr_t)ppm_page2base( ptr ) );
    204204        }
     
    218218        // initialize the KCM allocator if not already done
    219219            if( cluster->kcm_tbl[type] == NULL )
    220             { 
     220            {
    221221            spinlock_lock( &cluster->kcm_lock );
    222222                        error_t error = kmem_create_kcm( type );
     
    225225            }
    226226
    227         // allocate memory from KCM 
     227        // allocate memory from KCM
    228228        ptr = kcm_alloc( cluster->kcm_tbl[type] );
    229229
     
    237237    if( ptr == NULL )
    238238    {
    239             printk("\n[ERROR] in %s : failed for type %d / size %d in cluster %x\n", 
     239            printk("\n[ERROR] in %s : failed for type %d / size %d in cluster %x\n",
    240240               __FUNCTION__ , type , size , local_cxy );
    241  
     241
    242242            return NULL;
    243243    }
     
    255255        hal_core_sleep();
    256256    }
    257  
     257
    258258        switch(req->type)
    259259        {
Note: See TracChangeset for help on using the changeset viewer.