Changeset 652


Ignore:
Timestamp:
Jul 22, 2015, 2:31:34 PM (9 years ago)
Author:
guerin
Message:

fat32: create Inode-Tree root using _allocate_one_inode()

No need to duplicate the code.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • soft/giet_vm/giet_fat32/fat32.c

    r651 r652  
    27512751    if ( kernel_mode )
    27522752    {
    2753         unsigned int   n;
    2754 
    2755         // allocate and initialise the Inode-Tree root
    2756         fat_inode_t*      inode  = _malloc( sizeof(fat_inode_t) );
    2757         fat_cache_node_t* cache  = _allocate_one_cache_node( NULL );
    2758 
    2759         inode->parent   = NULL;        // no parent
    2760         inode->next     = NULL;        // no brother
    2761         inode->child    = NULL;        // children come later
    2762         inode->cache    = cache;       // empty cache
    2763         inode->cluster  = 2;           // forced value
    2764         inode->size     = 0;           // no size for a directory
    2765         inode->count    = 0;           // children come later
    2766         inode->dentry   = 0;           // no parent => no dentry
    2767         inode->levels   = 1;           // one level cache
    2768         inode->is_dir   = 1;           // it's a directory
    2769         _strcpy( inode->name , "/" );
    2770 
    2771         _fat.inode_tree_root = inode;
    2772 
    2773         // initialise the lock
     2753        unsigned int i;
     2754
     2755        // create Inode-Tree root
     2756        _fat.inode_tree_root = _allocate_one_inode("/", // dir name
     2757                                                   1,   // directory
     2758                                                   2,   // cluster id
     2759                                                   0,   // no size
     2760                                                   0,   // no children
     2761                                                   0,   // no dentry
     2762                                                   1);  // allocate cache
     2763
     2764        // initialize lock
    27742765        _spin_lock_init( &_fat.fat_lock );
    27752766
    2776         // initialise File Descriptor Array
    2777         for( n = 0 ; n < GIET_OPEN_FILES_MAX ; n++ ) _fat.fd[n].allocated = 0;
    2778 
    2779         // initialise fat_cache root
     2767        // initialize File Descriptor Array
     2768        for( i = 0 ; i < GIET_OPEN_FILES_MAX ; i++ ) _fat.fd[i].allocated = 0;
     2769
     2770        // initialize fat_cache root
    27802771        _fat.fat_cache_root   = _allocate_one_cache_node( NULL );
    27812772        _fat.fat_cache_levels = _get_levels_from_size( _fat.fat_sectors << 9 );
Note: See TracChangeset for help on using the changeset viewer.