Changeset 611 for trunk/kernel/fs


Ignore:
Timestamp:
Jan 9, 2019, 3:02:51 PM (6 years ago)
Author:
alain
Message:

Introduce sigificant modifs in VFS to support the <ls> command,
and the . and .. directories entries.

Location:
trunk/kernel/fs
Files:
4 edited

Legend:

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

    r610 r611  
    20112011
    20122012    // get pointer on local FATFS context
    2013     fatfs_ctx_t * fatfs_ctx      = fs_context[FS_TYPE_FATFS].extend;
     2013    fatfs_ctx_t * fatfs_ctx = fs_context[FS_TYPE_FATFS].extend;
    20142014
    20152015    // get page base address
     
    20342034#if (DEBUG_FATFS_MOVE_PAGE & 0x1)
    20352035if( DEBUG_FATFS_MOVE_PAGE < cycle )
    2036 {
    2037     uint32_t * tab = (uint32_t *)buffer;
    2038     uint32_t line , word;
    2039     printk("\n***** %s : First 64 words of page %d in FAT mapper\n",
    2040     __FUNCTION__ , page_id );
    2041     for( line = 0 ; line < 8 ; line++ )
    2042     {
    2043         printk("%X : ", line );
    2044         for( word = 0 ; word < 8 ; word++ ) printk("%X ", tab[(line<<3) + word] );
    2045         printk("\n");
    2046     }
    2047 }
     2036mapper_display_page( XPTR(page_cxy , mapper_ptr) , page_id , "FAT" );
    20482037#endif
    20492038
     
    21032092#if (DEBUG_FATFS_MOVE_PAGE & 0x1)
    21042093if( DEBUG_FATFS_MOVE_PAGE < cycle )
    2105 {
    2106     uint32_t * tab = (uint32_t *)buffer;
    2107     uint32_t line , word;
    2108     printk("\n***** %s : First 64 words of page %d in <%s> mapper\n",
    2109     __FUNCTION__, page_id, name );
    2110     for( line = 0 ; line < 8 ; line++ )
    2111     {
    2112         printk("%X : ", line );
    2113         for( word = 0 ; word < 8 ; word++ ) printk("%X ", tab[(line<<3) + word] );
    2114         printk("\n");
    2115     }
    2116 }
     2094char string[CONFIG_VFS_MAX_NAME_LENGTH];
     2095vfs_inode_get_name( XPTR(page_cxy , inode_ptr) , string );
     2096mapper_display_page( XPTR(page_cxy , mapper_ptr) , page_id , string );
    21172097#endif
    21182098
  • trunk/kernel/fs/fatfs.h

    r610 r611  
    238238
    239239
    240 
    241240//////////////////////////////////////////////////////////////////////////////////////////
    242241// Generic API: These functions are called by the kernel VFS,
     
    409408 *****************************************************************************************
    410409 * This function moves a page from/to the mapper to/from the FATFS file system on device.
    411  * The page must have been previously allocated and registered in the mapper, but the 
    412  * page - and the mapper - can be located in another cluster than the calling thread.
     410 * The page must have been previously allocated and registered in the mapper.  
     411 * The page - and the mapper - can be located in another cluster than the calling thread.
    413412 * The pointer on the mapper and the page index in file are found in the page descriptor.
    414  * It is used both for the regular file/directory mappers, and for the FAT mapper.
     413 * It is used for both for a regular file/directory mapper, and the FAT mapper.
    415414 * For the FAT mapper, it access the FATFS to get the location on IOC device.
    416415 * For a regular file, it access the FAT mapper to get the cluster index on IOC device.
  • trunk/kernel/fs/vfs.c

    r610 r611  
    2323 */
    2424
    25 
    2625#include <kernel_config.h>
    2726#include <hal_kernel_types.h>
     
    4847#include <syscalls.h>
    4948
    50 
    5149//////////////////////////////////////////////////////////////////////////////////////////
    5250//           Extern variables         
     
    136134        case INODE_TYPE_SOCK: return "SOCK";
    137135        case INODE_TYPE_DEV:  return "DEV ";
     136        case INODE_TYPE_BLK:  return "BLK ";
    138137        case INODE_TYPE_SYML: return "SYML";
    139138        default:              return "undefined";
     
    10091008    cxy_t          vfs_root_cxy;       // VFS root inode cluster identifier
    10101009    xptr_t         lock_xp;            // extended pointer on lock protecting Inode Tree
    1011     xptr_t         inode_xp;           // extended pointer on target inode
    1012     vfs_inode_t  * inode_ptr;          // local pointer on target inode
    1013     cxy_t          inode_cxy;          // target inode cluster identifier
     1010    xptr_t         inode_xp;           // extended pointer on new directory inode
     1011    vfs_inode_t  * inode_ptr;          // local pointer on new directory inode
     1012    cxy_t          inode_cxy;          // new directory inode cluster identifier
    10141013    xptr_t         dentry_xp;          // extended pointer on new dentry
    1015     vfs_dentry_t * dentry_ptr;         // target dentry local pointer
    1016     xptr_t         parent_xp;          // extended pointer on new parent inode
    1017     vfs_inode_t  * parent_ptr;         // local pointer on new parent inode 
    1018     cxy_t          parent_cxy;         // new parent inode cluster identifier
    1019     vfs_ctx_t    * parent_ctx_ptr;     // local pointer on target inode context
    1020     uint32_t       parent_fs_type;     // target inode file system type
     1014    vfs_dentry_t * dentry_ptr;         // new dentry local pointer
     1015    xptr_t         parent_xp;          // extended pointer on parent inode
     1016    vfs_inode_t  * parent_ptr;         // local pointer on parent inode 
     1017    cxy_t          parent_cxy;         // parent inode cluster identifier
     1018    vfs_ctx_t    * parent_ctx_ptr;     // local pointer on parent inode context
     1019    uint32_t       parent_fs_type;     // parent inode file system type
    10211020
    10221021    xptr_t         parents_root_xp;    // extended pointer on parents field in inode (root)
     
    11091108#endif
    11101109
    1111     // 3. create new directory inode in child cluster
     1110    // 3. create new directory inode
    11121111    // TODO : define attr / uid / gid
    11131112    uint32_t attr = 0;
     
    11181117    inode_cxy = cluster_random_select();
    11191118   
    1120     if( inode_cxy == local_cxy )      // child cluster is local
     1119    if( inode_cxy == local_cxy )      // target cluster is local
    11211120    {
    11221121        error = vfs_inode_create( parent_fs_type,
     
    11281127                                  &inode_xp );
    11291128    }
    1130     else                              // child cluster is remote
     1129    else                              // target cluster is remote
    11311130    {
    11321131        rpc_vfs_inode_create_client( inode_cxy,
     
    11431142    if( error )
    11441143    {
     1144        remote_rwlock_wr_release( lock_xp );
    11451145        printk("\n[ERROR] in %s : cannot create new inode in cluster %x for <%s>\n",
    11461146               __FUNCTION__ , inode_cxy , path );
    1147  
    11481147        if( parent_cxy == local_cxy ) vfs_dentry_destroy( dentry_ptr );
    11491148        else rpc_vfs_dentry_destroy_client( parent_cxy , dentry_ptr );
     
    11811180#endif
    11821181
     1182    // 7. create the two special dentries <.> and <..> in new directory
     1183    // both the new directory mapper, and the Inode Tree are updated
     1184    error = vfs_add_special_dentries( inode_xp,
     1185                                      parent_xp );
     1186
     1187    if( error )
     1188    {
     1189        remote_rwlock_wr_release( lock_xp );
     1190        printk("\n[ERROR] in %s : cannot create new inode in cluster %x for <%s>\n",
     1191               __FUNCTION__ , inode_cxy , path );
     1192        if( parent_cxy == local_cxy ) vfs_dentry_destroy( dentry_ptr );
     1193        else rpc_vfs_dentry_destroy_client( parent_cxy , dentry_ptr );
     1194        return -1;
     1195    }
     1196
    11831197    // release the lock protecting Inode Tree
    11841198    remote_rwlock_wr_release( lock_xp );
    11851199
    1186     // 5. update parent directory mapper
     1200    // 8. update parent directory mapper
    11871201    //    and synchronize the parent directory on IOC device
    11881202    if (parent_cxy == local_cxy)
     
    16251639}  // end vfs_unlink()
    16261640
    1627 ///////////////////////////////////////////
    1628 error_t vfs_stat( xptr_t     root_inode_xp,
    1629                   char     * path,
    1630                   stat_t   * st )
     1641////////////////////////////////////////////////
     1642error_t vfs_stat( xptr_t         root_inode_xp,
     1643                  char         * path,
     1644                  struct stat  * st )
    16311645{
    16321646    error_t       error;
     
    19361950                  inode_inum, inode_size, inode_dirty, inode_cxy, inode_ptr, mapper_ptr );
    19371951
    1938     // scan directory entries 
    1939     if( inode_type == INODE_TYPE_DIR )
     1952    // scan directory entries when current inode is a directory
     1953    // don't scan the the "." and ".." directories to break loops
     1954    if( (inode_type == INODE_TYPE_DIR) &&
     1955        (strcmp( name , "." ) != 0)    &&
     1956        (strcmp( name , ".." ) != 0) )
    19401957    {
    19411958        // get extended pointer on directory entries xhtab
     
    22342251        error = vfs_get_name_from_path( current , name , &next , &last );
    22352252
    2236         // VFS root case
     2253        // handle VFS root case
    22372254        if ( error )
    22382255        {
     
    22582275                               name,
    22592276                               &child_xp );
     2277
     2278        // get child inode local pointer and cluster
     2279        child_ptr  = GET_PTR( child_xp );
     2280        child_cxy  = GET_CXY( child_xp );
    22602281
    22612282        // analyse found & last, depending on lookup_mode
     
    23022323                else      child_type = INODE_TYPE_FILE;
    23032324 
    2304                 // insert (speculatively) a new child dentry/inode in inode tree
     2325                // insert a new child dentry/inode couple in inode tree
    23052326                error = vfs_add_child_in_parent( child_cxy,
    23062327                                                 child_type,
     
    23262347#endif
    23272348                // scan parent mapper to find the missing dentry, and complete
    2328                 // the initialisation of dentry and child inode desciptors
     2349                // the initialisation of dentry and child inode descriptors
    23292350                if( parent_cxy == local_cxy )
    2330 
    23312351                {
    23322352                    error = vfs_fs_child_init( parent_ptr,
     
    24242444if( DEBUG_VFS_LOOKUP < cycle )
    24252445printk("\n[%s] thread[%x,%x] found <%s> in Inode Tree / inode (%x,%x)\n",
    2426 __FUNCTION__, process->pid, this->trdid, name, GET_CXY(child_xp), GET_PTR(child_xp) );
    2427 #endif
    2428             // get child inode local pointer and cluster
    2429             child_ptr  = GET_PTR( child_xp );
    2430             child_cxy  = GET_CXY( child_xp );
    2431 
     2446__FUNCTION__, process->pid, this->trdid, name, child_cxy, child_ptr );
     2447#endif
    24322448            // check the excl flag
    24332449            if( last && create && excl )
     
    25842600
    25852601}  // end vfs_new_child_init()
     2602
     2603///////////////////////////////////////////////////
     2604error_t vfs_add_special_dentries( xptr_t  child_xp,
     2605                                  xptr_t  parent_xp )
     2606{
     2607    error_t         error;
     2608    vfs_inode_t   * child_ptr;         // local pointer on child inode directory
     2609    cxy_t           child_cxy;         // child inode directory cluster identifier
     2610    vfs_inode_t   * parent_ptr;        // local pointer on parent inode directory
     2611    cxy_t           parent_cxy;        // parent inode directory cluster identifier
     2612    vfs_ctx_t     * ctx_ptr;           // local pointer on child inode FS context
     2613    vfs_fs_type_t   fs_type;           // FS type of child inode
     2614    xptr_t          dentry_xp;         // extended pointer on dentry (used for . and ..)
     2615    vfs_dentry_t  * dentry_ptr;        // local pointer on dentry (used for . and ..)
     2616
     2617    xptr_t          parents_root_xp;   // extended pointer on inode "parents" field
     2618    xptr_t          parents_entry_xp;  // extended pointer on dentry "parents" field
     2619    xptr_t          children_xhtab_xp; // extended pointer on inode "children" field
     2620    xptr_t          children_entry_xp; // extended pointer on dentry "children" field
     2621
     2622#if DEBUG_VFS_ADD_SPECIAL
     2623uint32_t   cycle = (uint32_t)hal_get_cycles();
     2624thread_t * this  = CURRENT_THREAD;
     2625char child_name[CONFIG_VFS_MAX_NAME_LENGTH];
     2626char parent_name[CONFIG_VFS_MAX_NAME_LENGTH];
     2627vfs_inode_get_name( child_xp  , child_name );
     2628vfs_inode_get_name( parent_xp , parent_name );
     2629if( DEBUG_VFS_ADD_SPECIAL < cycle )
     2630printk("\n[%s] thread[%x,%x] enter / child <%s> / parent <%s> / cycle %d\n",
     2631__FUNCTION__, this->process->pid, this->trdid, child_name, parent_name, cycle );
     2632#endif
     2633
     2634    // get new directory cluster and local pointer
     2635    child_cxy  = GET_CXY( child_xp );
     2636    child_ptr  = GET_PTR( child_xp );
     2637
     2638    // get parent directory cluster and local pointer
     2639    parent_cxy = GET_CXY( parent_xp );
     2640    parent_ptr = GET_PTR( parent_xp );
     2641
     2642    // get child inode FS type
     2643    ctx_ptr    = hal_remote_lpt( XPTR( child_cxy , &child_ptr->ctx ) );
     2644    fs_type    = hal_remote_l32( XPTR( child_cxy , &ctx_ptr->type ) );
     2645
     2646    //////////////////////////// create <.>
     2647    if( child_cxy == local_cxy )     
     2648    {
     2649        error = vfs_dentry_create( fs_type,
     2650                                   ".",
     2651                                   &dentry_xp );
     2652    }
     2653    else
     2654    {
     2655        rpc_vfs_dentry_create_client( child_cxy,
     2656                                      fs_type,
     2657                                      ".",
     2658                                      &dentry_xp,
     2659                                      &error );
     2660    }
     2661    if( error )
     2662    {
     2663        printk("\n[ERROR] in %s : cannot create dentry <.> in cluster %x\n",
     2664        __FUNCTION__ , child_cxy );
     2665        return -1;
     2666    }
     2667
     2668    // get <.> dentry local pointer
     2669    dentry_ptr = GET_PTR( dentry_xp );
     2670
     2671#if(DEBUG_VFS_ADD_SPECIAL & 1)
     2672if( DEBUG_VFS_ADD_SPECIAL < cycle )
     2673printk("\n[%s] thread[%x,%x] created dentry <.> (%x,%x)\n",
     2674__FUNCTION__, this->process->pid, this->trdid, child_cxy, dentry_ptr );
     2675#endif
     2676
     2677    // register <.> dentry in child inode xhtab of children
     2678    children_xhtab_xp = XPTR( child_cxy , &child_ptr->children );
     2679    children_entry_xp = XPTR( child_cxy , &dentry_ptr->children );
     2680    error = xhtab_insert( children_xhtab_xp , "." , children_entry_xp );
     2681    if( error )
     2682    {
     2683        printk("\n[ERROR] in %s : cannot register dentry <.> in xhtab\n",
     2684        __FUNCTION__ );
     2685        return -1;
     2686    }
     2687
     2688    // register <.> dentry in child_inode xlist of parents TODO faut-il ?
     2689    parents_root_xp  = XPTR( child_cxy , &child_ptr->parents );
     2690    parents_entry_xp = XPTR( child_cxy , &dentry_ptr->parents );
     2691    xlist_add_first( parents_root_xp , parents_entry_xp );
     2692    hal_remote_atomic_add( XPTR( child_cxy , &child_ptr->links ) , 1 );
     2693
     2694    // update "parent" and "child_xp" fields in <.> dentry
     2695    hal_remote_s64( XPTR( child_cxy , &dentry_ptr->child_xp ) , child_xp );
     2696    hal_remote_spt( XPTR( child_cxy , &dentry_ptr->parent ) , child_ptr );
     2697
     2698#if(DEBUG_VFS_ADD_SPECIAL & 1)
     2699if( DEBUG_VFS_ADD_SPECIAL < cycle )
     2700printk("\n[%s] thread[%x,%x] linked dentry <.> to parent and child inodes\n",
     2701__FUNCTION__, this->process->pid, this->trdid );
     2702#endif
     2703
     2704    // introduce <.> dentry into child directory mapper
     2705    if( child_cxy == local_cxy )
     2706    {
     2707        error = vfs_fs_add_dentry( child_ptr,
     2708                                   dentry_ptr );
     2709    }
     2710    else
     2711    {
     2712        rpc_vfs_fs_add_dentry_client( child_cxy,
     2713                                      child_ptr,
     2714                                      dentry_ptr,
     2715                                      &error );
     2716    }
     2717    if( error )
     2718    {
     2719        printk("\n[ERROR] in %s : cannot introduce dentry <..> in mapper %x\n",
     2720        __FUNCTION__ );
     2721        return -1;
     2722    }
     2723
     2724#if(DEBUG_VFS_ADD_SPECIAL & 1)
     2725if( DEBUG_VFS_ADD_SPECIAL < cycle )
     2726printk("\n[%s] thread[%x,%x] registered dentry <.> in child mapper\n",
     2727__FUNCTION__, this->process->pid, this->trdid );
     2728#endif
     2729
     2730    ///////////////////////////// create <..> dentry
     2731    if( child_cxy == local_cxy )     
     2732    {
     2733        error = vfs_dentry_create( fs_type,
     2734                                   "..",
     2735                                   &dentry_xp );
     2736    }
     2737    else
     2738    {
     2739        rpc_vfs_dentry_create_client( child_cxy,
     2740                                      fs_type,
     2741                                      "..",
     2742                                      &dentry_xp,
     2743                                      &error );
     2744    }
     2745    if( error )
     2746    {
     2747        printk("\n[ERROR] in %s : cannot create dentry <..> in cluster %x\n",
     2748        __FUNCTION__ , child_cxy );
     2749        return -1;
     2750    }
     2751
     2752    // get <..> dentry local pointer
     2753    dentry_ptr = GET_PTR( dentry_xp );
     2754
     2755#if(DEBUG_VFS_ADD_SPECIAL & 1)
     2756if( DEBUG_VFS_ADD_SPECIAL < cycle )
     2757printk("\n[%s] thread[%x,%x] created dentry <..> (%x,%x)\n",
     2758__FUNCTION__, this->process->pid, this->trdid, child_cxy, dentry_ptr );
     2759#endif
     2760
     2761    // register <..> dentry in child_inode xhtab of children
     2762    children_xhtab_xp = XPTR( child_cxy , &child_ptr->children );
     2763    children_entry_xp = XPTR( child_cxy , &dentry_ptr->children );
     2764    error = xhtab_insert( children_xhtab_xp , ".." , children_entry_xp );
     2765    if( error )
     2766    {
     2767        printk("\n[ERROR] in %s : cannot register dentry <..> in xhtab\n",
     2768        __FUNCTION__ );
     2769        return -1;
     2770    }
     2771
     2772    // register <..> dentry in parent_inode xlist of parents TODO faut-il ?
     2773    parents_root_xp  = XPTR( parent_cxy , &parent_ptr->parents );
     2774    parents_entry_xp = XPTR( child_cxy  , &dentry_ptr->parents );
     2775    xlist_add_first( parents_root_xp , parents_entry_xp );
     2776    hal_remote_atomic_add( XPTR( parent_cxy , &parent_ptr->links ) , 1 );
     2777
     2778    // update "parent" and "child_xp" fields in <..> dentry
     2779    hal_remote_s64( XPTR( child_cxy , &dentry_ptr->child_xp ) , parent_xp );
     2780    hal_remote_spt( XPTR( child_cxy , &dentry_ptr->parent ) , child_ptr );
     2781
     2782#if(DEBUG_VFS_ADD_SPECIAL & 1)
     2783if( DEBUG_VFS_ADD_SPECIAL < cycle )
     2784printk("\n[%s] thread[%x,%x] linked dentry <..> to parent and child inodes\n",
     2785__FUNCTION__, this->process->pid, this->trdid );
     2786#endif
     2787
     2788    // introduce <..> dentry into child directory mapper
     2789    if( child_cxy == local_cxy )
     2790    {
     2791        error = vfs_fs_add_dentry( child_ptr,
     2792                                   dentry_ptr );
     2793    }
     2794    else
     2795    {
     2796        rpc_vfs_fs_add_dentry_client( child_cxy,
     2797                                      child_ptr,
     2798                                      dentry_ptr,
     2799                                      &error );
     2800    }
     2801    if( error )
     2802    {
     2803        printk("\n[ERROR] in %s : cannot introduce dentry <..> in mapper %x\n",
     2804        __FUNCTION__ );
     2805        return -1;
     2806    }
     2807
     2808#if(DEBUG_VFS_ADD_SPECIAL & 1)
     2809if( DEBUG_VFS_ADD_SPECIAL < cycle )
     2810printk("\n[%s] thread[%x,%x] registered dentry <..> in child mapper\n",
     2811__FUNCTION__, this->process->pid, this->trdid );
     2812#endif
     2813
     2814#if DEBUG_VFS_ADD_SPECIAL
     2815cycle = (uint32_t)hal_get_cycles();
     2816if( DEBUG_VFS_ADD_SPECIAL < cycle )
     2817printk("\n[%s] thread[%x,%x] exit / cycle %d\n",
     2818__FUNCTION__, this->process->pid, this->trdid, (uint32_t)hal_get_cycles() );
     2819#endif
     2820
     2821    return 0;
     2822
     2823}  // end vfs_add_special_dentries()
    25862824
    25872825//////////////////////////////////////////
     
    28453083
    28463084#if(DEBUG_VFS_ADD_CHILD & 1)
    2847 if( local_cxy == 1 )
    2848 // if( DEBUG_VFS_ADD_CHILD < cycle )
     3085if( DEBUG_VFS_ADD_CHILD < cycle )
    28493086printk("\n[%s] thread[%x,%x] / dentry (%x,%x) registered in child inode (%x,%x)\n",
    28503087__FUNCTION__, this->process->pid, this->trdid,
     
    28523089#endif
    28533090
    2854     // 4. register new_dentry in parent_inode xhtab of children
     3091    // register new_dentry in parent_inode xhtab of children
    28553092    children_xhtab_xp = XPTR( parent_cxy , &parent_inode_ptr->children );
    28563093    children_entry_xp = XPTR( parent_cxy , &new_dentry_ptr->children );
     
    28643101#endif
    28653102
    2866     // 5. update "parent" and "child_xp" fields in new_dentry
     3103    // update "parent" and "child_xp" fields in new_dentry
    28673104    hal_remote_s64( XPTR( parent_cxy , &new_dentry_ptr->child_xp ) , new_inode_xp );
    28683105    hal_remote_spt( XPTR( parent_cxy , &new_dentry_ptr->parent ) , parent_inode_ptr );
  • trunk/kernel/fs/vfs.h

    r610 r611  
    4545
    4646struct vfs_inode_s;
    47 struct vfs_dentry_t;
    48 struct vfs_ctx_t;
    49 struct vfs_file_ref_s;
     47struct vfs_dentry_s;
     48struct vfs_ctx_s;
    5049struct vfs_file_s;
    51 
    52 struct vfs_inode_op_s;
    53 struct vfs_dentry_op_s;
    54 struct vfs_file_op_s;
    55 struct vfs_ctx_op_s;
    56 
    57 struct vfs_lookup_cmd_s;
    58 struct vfs_lookup_rsp_s;
    5950
    6051struct mapper_s;
     
    6354struct vseg_s;
    6455struct page_s;
    65 
    6656
    6757/******************************************************************************************
     
    133123 *****************************************************************************************/
    134124
    135 /* this enum define the VFS inode types values */
    136 /* WARNING : this enum must be kept consistent with macros in <shared_stat.h> file */
     125/* this enum define the VFS inode types values                                           */
     126/* WARNING : this enum must be kept consistent with macros in <shared_stat.h> file       */
     127/*           and with types in <shared_dirent.h> file.                                   */
    137128
    138129typedef enum   
     
    144135    INODE_TYPE_SOCK  =     4,           /*! POSIX socket                                 */
    145136    INODE_TYPE_DEV   =     5,           /*! character device                             */
    146     INODE_TYPE_SYML  =     6,           /*! symbolic link                                */
     137    INODE_TYPE_BLK   =     6,           /*! block device                                 */
     138    INODE_TYPE_SYML  =     7,           /*! symbolic link                                */
    147139}
    148140vfs_inode_type_t;
     
    184176#define VFS_ISUID          0x0004000
    185177#define VFS_ISGID          0x0002000
    186 define VFS_ISVTX           0x0001000
     178#define VFS_ISVTX          0x0001000
    187179
    188180#define VFS_IRWXU      0x0000700
     
    316308 * This function allocates memory from local cluster for an inode descriptor and the
    317309 * associated mapper. It initialise these descriptors from arguments values.
    318  * If the client thread is not running in the cluster containing this inode,
    319  * it must use the rpc_vfs_inode_create_client() function.
     310 * It must called by a local thread. Use the RPC_INODE_CREATE if client thread is remote.
    320311 ******************************************************************************************
    321312 * @ fs_type    : file system type.
     
    407398
    408399
     400
    409401/******************************************************************************************
    410402 *        These low-level functions access / modify a VFS dentry descriptor
     
    414406 * This function allocates memory from local cluster for a dentry descriptor,
    415407 * initialises it from  arguments values, and returns the extended pointer on dentry.
    416  * If the client thread is not running in the target cluster for this inode,
    417  * it must use the rpc_dentry_create_client() function.
     408 * It must called by a local thread. Use the RPC_DENTRY_CREATE if client thread is remote.
    418409 ******************************************************************************************
    419410 * @ fs_type    : file system type.
     
    548539 *
    549540 * [Implementation]
    550  * As there are cross-references between the inode and the associated dentry, this
    551  * function implement a three steps scenario :
     541 * As there are cross-references between inode and dentry, this function implements
     542 * a three steps scenario :
    552543 * 1) The dentry descriptor is created in the cluster containing the existing <parent_xp>
    553  *    inode, and is only partially initialized : "fs_type", "name", "parent_xp" fields.
     544 *    inode, and partially initialized, using the RPC_VFS_CREATE DENTRY if required.
    554545 * 2) The inode and its associated mapper are created in cluster identified by <child_cxy>,
    555  *    and initialised. The new inode and the parent inode can have different FS types.
    556  * 3) The "child_xp" field in dentry (pointing on the created inode) is updated,
    557  *    and the refcount is incremented for both the inode and the dentry.
     546 *    and partially initialised, using the RPC_VFS_CREATE_INODE if required.
     547 *    The new inode and the parent inode can have different FS types.
     548 * 3) The pointers between the parent inode, the new dentry, and the child inode
     549 *    are updated, using remote accesses.
    558550 ******************************************************************************************
    559551 * @ child_inode_cxy  : [in]  target cluster for child inode.
     
    612604
    613605/******************************************************************************************
     606 * This function is called by the vfs_mkdir() function to create the two special dentries
     607 * <.> and <..> in a new directory identified by the <child_xp> argument. The parent
     608 * directory inode is defined by the <parent_xp> argument.
     609 * The two dentries are introduced in the Inode Tree. They are also introduced in the
     610 * in the child directory mapper, and the IOC device is updated.
     611 ******************************************************************************************
     612 * @ child_xp    : extended pointer on new directory inode.
     613 * @ parent_xp   : extended pointer on parent directory inode.
     614 * @ return 0 if success / -1 if failure.
     615 *****************************************************************************************/
     616error_t vfs_add_special_dentries( xptr_t  child_xp,
     617                                  xptr_t  parent_xp );
     618
     619/******************************************************************************************
    614620 * This recursive function diplays a complete inode/dentry sub-tree.
    615621 * Any inode can be selected as the sub-tree root.
    616  * TODO this function is not protected against a concurrent inode/dentry removal...
     622 * WARNING : this function is not protected against a concurrent inode/dentry removal...
    617623 ******************************************************************************************
    618624 * @ inode_xp   : extended pointer on sub-tree root inode.
     
    809815
    810816/******************************************************************************************
    811  * This function returns, in the structure pointed by the <k_dirent> kernel pointer,
    812  * various infos on the directory entry currently pointed by the <file_xp> file descriptor.
    813  * TODO not implemented yet...
    814  ******************************************************************************************
    815  * @ file_xp    : extended pointer on the file descriptor of the searched directory .
    816  * @ k_dirent   : local pointer on the dirent structure in kernel space.
    817  * @ returns 0 if success / -1 if error.
    818  *****************************************************************************************/
    819 error_t vfs_readdir( xptr_t          file_xp,
    820                      struct dirent * k_dirent );
    821 
    822 /******************************************************************************************
    823817 * This function  creates a new directory as defined by the <root_xp> & <path> arguments.
    824818 * TODO not implemented yet...
     
    880874 * The directory inode descriptor and the dentry descriptor are in the same cluster.
    881875 * Depending on the file system type, it calls the proper, FS specific function.
    882  * It ulso pdates the dentry descriptor and/or the inode descriptor extensions
     876 * It also updates the dentry descriptor and/or the inode descriptor extensions
    883877 * as required by the specific file system type.
    884878 * Finally, it synchronously updates the parent directory on IOC device.
    885879 *
    886880 * It must be executed by a thread running in the cluster containing the parent directory.
    887  * It can be the RPC_VFS_VS_ADD_DENTRY. This function does NOT take any lock.
     881 * It can be the RPC_VFS_FS_ADD_DENTRY. This function does NOT take any lock.
    888882 ******************************************************************************************
    889883 * @ parent  : local pointer on parent (directory) inode.
Note: See TracChangeset for help on using the changeset viewer.