Changeset 657 for trunk/kernel/fs/vfs.h


Ignore:
Timestamp:
Mar 18, 2020, 11:16:59 PM (4 years ago)
Author:
alain
Message:

Introduce remote_buf.c/.h & socket.c/.h files.
Update dev_nic.c/.h files.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/kernel/fs/vfs.h

    r656 r657  
    33 *
    44 * Author  Mohamed Lamine Karaoui (2014,2015)
    5  *         Alain Greiner (2016,2017,2018)
     5 *         Alain Greiner (2016,2017,2018,2019,2020)
    66 *
    77 * Copyright (c) UPMC Sorbonne Universites
     
    5555struct vseg_s;
    5656struct page_s;
     57struct ksock_s;
    5758
    5859/******************************************************************************************
     
    7273 * The <extend> field is a pointer on the FS specific context extension.
    7374 * This extension is dynamically allocated by kernel_init in all clusters.
    74  * In each cluster, both this VFS context and the FS specific context are handled as
    75  * private by the local OS intance.
     75 * In each cluster, the inum allocator can be accessed by any thread runing
     76 * in any cluster, and is therefore protected by a remote_busylock.
    7677 *****************************************************************************************/
    7778
    7879typedef enum
    7980{
    80         FS_TYPE_DEVFS = 0,
    81         FS_TYPE_FATFS = 1,
    82         FS_TYPE_RAMFS = 2,
     81        FS_TYPE_RAMFS = 0,
     82        FS_TYPE_DEVFS = 1,
     83        FS_TYPE_FATFS = 2,
    8384 
    8485        FS_TYPES_NR   = 3,
     
    9596typedef struct vfs_ctx_s
    9697{
    97         vfs_fs_type_t  type;                     /*! File System type                        */
    98         uint32_t           attr;                     /*! global attributes for all files in FS   */
    99         uint32_t       total_clusters;           /*! total number of clusters on device      */
    100         uint32_t       cluster_size;             /*! cluster size on device (bytes)          */
    101         xptr_t         vfs_root_xp;              /*! extended pointer on VFS root inode      */
    102     busylock_t     lock;                     /*! lock protecting inum allocator          */
    103     uint32_t       bitmap[BITMAP_SIZE(CONFIG_VFS_MAX_INODES)];  /* inum allocator        */
    104     void         * extend;                   /*! FS specific context extension           */
     98        vfs_fs_type_t      type;                 /*! File System type                        */
     99        uint32_t           total_clusters;       /*! total number of clusters on device      */
     100        uint32_t           cluster_size;         /*! cluster size on device (bytes)          */
     101        xptr_t             vfs_root_xp;          /*! extended pointer on VFS root inode      */
     102    remote_busylock_t  lock;                 /*! lock protecting inum allocator          */
     103    uint32_t           bitmap[BITMAP_SIZE(CONFIG_VFS_MAX_INODES)];  /* inum allocator    */
     104    void               * extend;             /*! FS specific context extension           */
    105105}
    106106vfs_ctx_t;
     
    109109 * This structure define a VFS inode.
    110110 * An inode can have several children dentries (if it is a directory), an can have several
    111  * parents dentries (if it hass several aliases links):
     111 * parents dentries (if it has several aliases links):
    112112 * - The "parents" field is the root of the xlist of parents dentries, and the "links"
    113113 *   fiels define the number of aliases parent dentries. only a FILE inode can have
     
    145145typedef enum
    146146{
    147     INODE_ATTR_DIRTY   =     0x01,       /* modified versus the value on device          */
    148     INODE_ATTR_INLOAD  =     0x04,       /* loading from device in progress              */
    149     INODE_ATTR_NEW     =     0x08,       /* not saved on device yet                      */
     147    INODE_ATTR_DIRTY   =     0x01,       /*! modified versus the value on device         */
     148    INODE_ATTR_INLOAD  =     0x04,       /*! loading from device in progress             */
     149    INODE_ATTR_NEW     =     0x08,       /*! not saved on device yet                     */
    150150}
    151151vfs_inode_attr_t;
     
    193193
    194194/******************************************************************************************
    195  Rpt* This structure defines a directory entry.
     195 * This structure defines a directory entry.
    196196 * A dentry contains the name of a remote file/dir, an extended pointer on the
    197197 * inode representing this file/dir, a local pointer on the inode representing
     
    225225typedef enum
    226226{
    227     FD_ATTR_READ_ENABLE    = 0x01,     /*! read access possible                         */
    228     FD_ATTR_WRITE_ENABLE   = 0x02,     /*! write access possible                        */
    229     FD_ATTR_APPEND         = 0x04,     /*! append on each write                         */
    230     FD_ATTR_CLOSE_EXEC     = 0x08,     /*! close file on exec                           */
    231     FD_ATTR_SYNC           = 0x10,     /*! synchronise FS on each write                 */
    232     FD_ATTR_IS_DIR         = 0x20,     /*! this is a directory                          */
     227    FD_ATTR_READ_ENABLE    = 0x01,     /*! read access possible                          */
     228    FD_ATTR_WRITE_ENABLE   = 0x02,     /*! write access possible                         */
     229    FD_ATTR_APPEND         = 0x04,     /*! append on each write                          */
     230    FD_ATTR_CLOSE_EXEC     = 0x08,     /*! close file on exec                            */
     231    FD_ATTR_SYNC           = 0x10,     /*! synchronise FS on each write                  */
     232    FD_ATTR_IS_DIR         = 0x20,     /*! this is a directory                           */
    233233}
    234234vfs_file_attr_t;
     
    237237{
    238238        struct vfs_ctx_s      * ctx;        /*! local pointer on FS context.                 */
    239         uint32_t                gc;         /*! generation counter                           */
    240239        vfs_file_attr_t         attr;       /*! file attributes bit vector (see above)       */
    241240        vfs_inode_type_t        type;       /*! same type as inode                           */
     
    245244        struct mapper_s       * mapper;     /*! associated file cache                        */
    246245        struct vfs_inode_s    * inode;      /*! local pointer on associated inode            */
     246    struct socket_s       * socket;     /*! local pointer on associated socket           */
    247247        void                  * extend;     /*! FS specific extension                        */
    248248}
     
    255255
    256256/******************************************************************************************
    257  * This function initialise a (statically allocated) VFS context in local cluster.
    258  ******************************************************************************************
     257 * This function initialises a (statically allocated) VFS context in cluster identified
     258 * by the <cxy> argument.
     259 * It is called by the kernel_init() function.
     260 ******************************************************************************************
     261 * @ cxy            : target cluster identifier.
    259262 * @ fs_type        : file system type.
    260  * @ attr           : global attributes (for all files in FS.
    261263 * @ total_clusters : total number of clusters on device.
    262264 * @ cluster_size   : cluster size on device (bytes).
     
    264266 * @ extend         : fs_type_specific extension.
    265267 *****************************************************************************************/
    266 void vfs_ctx_init( vfs_fs_type_t   type,
    267                    uint32_t        attr,
     268void vfs_ctx_init( cxy_t           cxy,
     269                   vfs_fs_type_t   type,
    268270                       uint32_t        total_clusters,
    269271                       uint32_t        cluster_size,
     
    277279 * - the 16 LSB bits contains the local inode identifier  : lid
    278280 ******************************************************************************************
    279  * @ ctx      : local pointer on file system context.
    280  * @ inum     : [ou] buffer for allocated inode identifier.
     281 * @ ctx_xp   : [in]  extended pointer on file system context.
     282 * @ inum     : [out] buffer for allocated inode identifier.
    281283 * @ return 0 if success / return non-zero if error.
    282284 *****************************************************************************************/
    283 error_t vfs_ctx_inum_alloc( vfs_ctx_t * ctx,
    284                             uint32_t  * inum );
     285error_t vfs_ctx_inum_alloc( xptr_t     ctx_xp,
     286                            uint32_t * inum );
    285287
    286288/******************************************************************************************
    287289 * This function release an inode identifier.                                 
    288290 ******************************************************************************************
    289  * @ ctx      : local pointer on file system context.
    290  * @ inum     : released inode identifier.
    291  *****************************************************************************************/
    292 void vfs_ctx_inum_release( vfs_ctx_t * ctx,
     291 * @ ctx_xp   : [in] extended pointer on file system context.
     292 * @ inum     : [in] released inode identifier.
     293 *****************************************************************************************/
     294void vfs_ctx_inum_release( xptr_t      ctx_xp,
    293295                           uint32_t    inum );
    294296
     
    305307
    306308/******************************************************************************************
    307  * This function allocates memory from local cluster for an inode descriptor and the
    308  * associated mapper, and partially initialise this inode from arguments values.
     309 * This function allocates memory in cluster identified by the <cxy> argument
     310 * for an inode descriptor and for the associated mapper, and partially initialise
     311 * this inode from arguments values.
    309312 * It does NOT link it to the Inode Tree, as this is done by add_child_in_parent().
    310  * It must called by a local thread. Use the RPC_INODE_CREATE if client thread is remote.
    311  ******************************************************************************************
    312  * @ fs_type    : file system type.
    313  * @ inode_type : inode type.
    314  * @ attr       : inode attributes.
    315  * @ rights     : inode access rights.
    316  * @ uid        : user owner ID.
    317  * @ gid        : group owner ID.
     313 * It can be called by any thread running in any cluster.
     314 ******************************************************************************************
     315 * @ cxy        : [in]  target cluster identifier
     316 * @ fs_type    : [in]  file system type.
     317 * @ attr       : [in]  inode attributes.
     318 * @ rights     : [in]  inode access rights.
     319 * @ uid        : [in]  user owner ID.
     320 * @ gid        : [in]  group owner ID.
    318321 * @ inode_xp   : [out] buffer for extended pointer on created inode.
    319  * @ return 0 if success / return ENOMEM or EINVAL if error.
    320  *****************************************************************************************/
    321 error_t vfs_inode_create( vfs_fs_type_t     fs_type,
     322 * @ return 0 if success / return -1 if error.
     323 *****************************************************************************************/
     324error_t vfs_inode_create( cxy_t             cxy,
     325                          vfs_fs_type_t     fs_type,
    322326                          uint32_t          attr,
    323327                          uint32_t          rights,
     
    330334 * all memory allocated to the mapper (both mapper descriptor and radix tree).
    331335 * The mapper should not contain any dirty page (should be synchronized before deletion).
    332  * It must be executed by a thread running in the cluster containing the inode.
    333  * Use the rpc_vfs_inode_destroy_client() function if required.
     336 * It can be called by any thread running in any cluster.
    334337 ******************************************************************************************
    335  * @ inode  : local pointer on inode descriptor.
    336  *****************************************************************************************/
    337 void vfs_inode_destroy( vfs_inode_t *  inode ); 
     338 * @ inode_xp  : extended pointer on inode descriptor.
     339 *****************************************************************************************/
     340void vfs_inode_destroy( xptr_t  inode_xp ); 
    338341
    339342/******************************************************************************************
    340343 * This function returns the <size> of a file/dir from a remote inode,
    341344 * taking the remote_rwlock protecting <size> in READ_MODE.
     345 * It can be called by any thread running in any cluster.
    342346 *****************************************************************************************
    343347 * @ inode_xp  : extended pointer on the remote inode.
     
    350354 * It takes the rwlock protecting the file size in WRITE_MODE, and set the "size" field
    351355 * when the current size is smaller than the requested <size> argument.
     356 * It can be called by any thread running in any cluster.
    352357 *****************************************************************************************
    353358 * @ inode_xp  : extended pointer on the remote inode.
     
    358363
    359364/******************************************************************************************
    360  * This function takes the main lock of a remote inode.
     365 * This function takes the main lock of a remote inode identified by the <inode_xp>.
    361366 * This lock protect all inode fields, including the children dentries.
     367 * It can be called by any thread running in any cluster.
    362368 *****************************************************************************************
    363369 * @ inode_xp  : extended pointer on the remote inode.
     
    366372
    367373/******************************************************************************************
    368  * This function releases the main lock of a remote inode.
     374 * This function releases the main lock of a remote inode identified by <inode_xp>.
    369375 * This lock protect all inode fiels, including the children dentries.
     376 * It can be called by any thread running in any cluster.
    370377 *****************************************************************************************
    371378 * @ inode_xp  : extended pointer on the remote inode.
     
    377384 * argument to a local buffer identified by the <name> argument.
    378385 * The local buffer size must be at least CONFIG_VFS_MAX_NAME_LENGTH.
     386 * It can be called by any thread running in any cluster.
    379387 ******************************************************************************************
    380388 * @ inode_xp  : extended pointer on the remote inode.
     
    385393
    386394/******************************************************************************************
    387  * This function accesses successively all pages of a file identified by the <inode>,
     395 * This function accesses successively all pages of a file identified by the <inode_xp>,
    388396 * argument, to force misses, and load all pages into mapper.
    389397 * The target inode can be a directory or a file, but this function is mainly used
    390398 * to prefetch a complete directory to the mapper.
    391  * It must be executed by a thread running in the cluster containing the inode.
    392399 * This function does NOT take any lock.
    393  ******************************************************************************************
    394  * @ inode  : local pointer on inode.
     400 * It can be called by any thread running in any cluster.
     401 ******************************************************************************************
     402 * @ inode_xp  : extended pointer on inode.
    395403 * @ return 0 if success / return -1 if device access failure.
    396404 *****************************************************************************************/
    397 error_t vfs_inode_load_all_pages( vfs_inode_t * inode );
    398 
    399 /******************************************************************************************
    400  * This debug function display the curren state of an inode descriptor identified by
    401  * the <inode_xp> argument.
     405error_t vfs_inode_load_all_pages( xptr_t inode_xp );
     406
     407/******************************************************************************************
     408 * This debug function display the curren state of an inode descriptor.
     409 * It can be called by any thread running in any cluster.
    402410 *****************************************************************************************/
    403411void vfs_inode_display( xptr_t inode_xp );
     
    408416
    409417/******************************************************************************************
    410  * This function allocates memory from local cluster for a dentry descriptor,
    411  * initialises it from  arguments values, and returns the extended pointer on dentry.
    412  * It must called by a local thread. Use the RPC_DENTRY_CREATE if client thread is remote.
    413  ******************************************************************************************
     418 * This function allocates memory in cluster identified by the <cxy> argument
     419 * for a dentry descriptor, initialises it from  arguments values, and returns
     420 * in <dentry_xp> the extended pointer on dentry.
     421 * It can be called by any thread running in any cluster.
     422 ******************************************************************************************
     423 * @ cxy        : [in]  target cluster identifier
    414424 * @ fs_type    : [in]  file system type.
    415425 * @ name       : [in]  directory entry file/dir name.
     
    417427 * @ return 0 if success / return ENOMEM or EINVAL if error.
    418428 *****************************************************************************************/
    419 error_t vfs_dentry_create( vfs_fs_type_t   fs_type,
     429error_t vfs_dentry_create( cxy_t           cxy,
     430                           vfs_fs_type_t   fs_type,
    420431                           char          * name,
    421432                           xptr_t        * dentry_xp );
     
    424435 * This function removes the dentry from the parent inode xhtab, and releases the memory
    425436 * allocated to the dentry descriptor.
    426  * It must be executed by a thread running in the cluster containing the dentry.
    427  * Use the RPC_DENTRY_DESTROY if required.
     437 * It can be called by any thread running in any cluster.
    428438 ******************************************************************************************
    429  * @ dentry  : [in] local pointer on dentry descriptor.
    430  *****************************************************************************************/
    431 void vfs_dentry_destroy( vfs_dentry_t *  dentry ); 
     439 * @ dentry_xp  : [in] extended pointer on dentry descriptor.
     440 *****************************************************************************************/
     441void vfs_dentry_destroy( xptr_t  dentry_xp ); 
    432442
    433443
     
    437447
    438448/******************************************************************************************
    439  * This function allocates memory and initializes a new local file descriptor.
    440  * It must be executed in the cluster containing the inode.
    441  * If the client thread is not running in the owner cluster, it must use the
    442  * rpc_vfs_file_create_client() function.
     449 * This function allocates memory and initializes a new file descriptor in the
     450 * cluster defined by the <inode_xp> argument.
     451 * It can be called by any thread running in any cluster.
    443452 ******************************************************************************************
    444  * @ inode    : local pointer on associated inode.
    445  * @ attr     : file descriptor attributes.
    446  * @ file_xp  : [out] buffer for extended pointer on created file descriptor.
     453 * @ inode_xp  : [in]  extended pointer on associated inode.
     454 * @ attr      : [in] file descriptor attributes.
     455 * @ file_xp   : [out] buffer for extended pointer on created file descriptor.
    447456 * @ return 0 if success / return ENOMEM if error.
    448457 *****************************************************************************************/
    449 error_t vfs_file_create( vfs_inode_t * inode,
     458error_t vfs_file_create( xptr_t        inode_xp,
    450459                         uint32_t      attr,
    451460                         xptr_t      * file_xp ); 
    452461
    453462/******************************************************************************************
    454  * This function releases memory allocated to a local file descriptor.
    455  * It must be executed by a thread running in the cluster containing the inode,
    456  * and the file refcount must be zero. Use the RPC_VFS_FILE_DESTROY if required.
     463 * This function releases memory allocated to file descriptor identified
     464 * by the <file_xp> argument.
     465 * It can be called by any thread running in any cluster.
    457466 ******************************************************************************************
    458  * @ file  : local pointer on file descriptor.
    459  *****************************************************************************************/
    460 void vfs_file_destroy( vfs_file_t *  file ); 
     467 * @ file_xp  : [in] extended pointer on file descriptor.
     468 *****************************************************************************************/
     469void vfs_file_destroy( xptr_t  file_xp ); 
    461470
    462471/******************************************************************************************
    463472 * These functions increment (resp. decrement) the count field in a remote file
    464473 * descriptor, using a remote_atomic access.
     474 *****************************************************************************************
     475 * @ file_xp  : extended pointer on file descriptor.
    465476 *****************************************************************************************/
    466477void vfs_file_count_up  ( xptr_t   file_xp );
     
    472483 * The local buffer size must be at least CONFIG_VFS_MAX_NAME_LENGTH.
    473484 *****************************************************************************************
    474  * @ file_xp  : extended pointer on the remote inode.
    475  * @ name     : local buffer pointer.
    476  *****************************************************************************************/
     485 * @ ionde_xp  : [in] extended pointer on the remote inode.
     486 * @ name      : [out] local string.
     487 ***************************************************************************************/
    477488void vfs_file_get_name( xptr_t inode_xp,
    478489                        char * name );
     
    596607
    597608/******************************************************************************************
    598  * This function is called by the vfs_lookup() function when a new (dentry/inode) must
    599  * be created from scratch and introduced in both the parent mapper and the IOC device.
    600  * The dentry and inode descriptors must have been previously created by the caller.
    601  * 1. It allocates one cluster from the relevant FS, updates the FAT mapper,
    602  *    and synchronously update the IOC device).
    603  * 2. It set the "size", and "extend" fields in child inode descriptor.
    604  *    The size is 4096 for a directory, the size is 0 for a file.
    605  * 3. It updates the parent directory mapper to introduce the new child,
    606  *    and synchronously update the IOC device.
    607  * 4. It set the "extend" field in dentry descriptor.
    608  * It can be called by a thread running in any cluster.
    609  ******************************************************************************************
    610  * @ parent_xp   : extended pointer on parent inode descriptor.
    611  * @ dentry_xp   : extended pointer on new dentry descriptor.
    612  * @ child_xp    : extended pointer on child inode descriptor.
    613  * @ return 0 if success / -1 if failure.
    614  *****************************************************************************************/
    615 error_t vfs_new_dentry_init( xptr_t   parent_xp,
    616                              xptr_t   dentry_xp,
    617                              xptr_t   child_xp );
    618 
    619 /******************************************************************************************
    620  * This function creates in the directory identified by the <child_xp> argument,
     609 * This function creates in the directory identified by the <child_inode_xp> argument,
    621610 * the two special dentries <.> and <..>. The parent directory inode is defined
    622  * by the <parent_xp> argument. The two dentries are introduced in the Inode Tree.
     611 * by the <parent_inode_xp> argument. The two dentries are introduced in the Inode Tree.
    623612 * They are also introduced in the child directory mapper, and the IOC device is updated.
    624613 * This function is called by all functions creating a brand new directory : vfs_mkdir(),
     
    629618 * @ return 0 if success / -1 if failure.
    630619 *****************************************************************************************/
    631 error_t vfs_add_special_dentries( xptr_t  child_xp,
    632                                   xptr_t  parent_xp );
     620error_t vfs_add_special_dentries( xptr_t  child_inode_xp,
     621                                  xptr_t  parent_inode_xp );
    633622
    634623/******************************************************************************************
     
    893882
    894883/******************************************************************************************
    895  *        These functions define the VFS "FS" API to a specific File System
    896  *****************************************************************************************/
    897 
    898 /******************************************************************************************
    899  * This function makes the I/O operation to move one page identified by the <page_xp>
    900  * argument to/from the IOC device from/to the mapper, as defined by the <cmd_type>.
     884 *      These functions define the VFS "FS" API to access a specific File System
     885 *****************************************************************************************/
     886
     887/******************************************************************************************
     888 * This function introduces in a directory mapper identified by the <parent_inode_xp>
     889 * argument, a new entry identified by the <dentry_ptr> argument.
    901890 * Depending on the file system type, it calls the proper, FS specific function.
    902  * It is used in case of MISS on the mapper (read), or when a dirty page in the mapper
    903  * must be updated in the File System (write).
    904  * The mapper pointer, and the page index in file are obtained from the page descriptor.
    905  * It can be executed by any thread running in any cluster.
    906  * This function does NOT take any lock.
    907  ******************************************************************************************
    908  * @ page_xp   : extended pointer on page descriptor (for mapper and page_id).
    909  * @ cmd_type  : IOC_READ / IOC_WRITE / IOC_SYNC_READ / IOC_SYNC_WRITE
    910  * @ returns 0 if success / return -1 if device access failure.
    911  *****************************************************************************************/
    912 error_t vfs_fs_move_page( xptr_t      page_xp,
    913                           cmd_type_t  cmd_type );
    914 
    915 /******************************************************************************************
    916  * This function updates the mapper associated to a directory inode identified by the
    917  * <parent> argument, to add a new entry identified by the <dentry> argument.
    918  * The directory inode descriptor and the dentry descriptor are in the same cluster.
    919  * Depending on the file system type, it calls the proper, FS specific function.
    920  * It also updates the dentry descriptor and/or the inode descriptor extensions
    921  * as required by the specific file system type.
     891 * All informations related to the new directory must be contained in the dentry
     892 * descriptor, or in the associated child inode descriptor.
     893 * The dentry descriptor "extend" field is updated as required by the specific FS.
    922894 * Finally, it synchronously updates the parent directory on IOC device.
    923  *
    924  * It must be executed by a thread running in the cluster containing the parent directory.
    925  * It can be the RPC_VFS_FS_ADD_DENTRY. This function does NOT take any lock.
     895 * This function can be called by any thread running in any cluster.
    926896 ******************************************************************************************
    927897 * @ parent  : local pointer on parent (directory) inode.
     
    929899 * @ return 0 if success / return -1 if device access failure.
    930900 *****************************************************************************************/
    931 error_t vfs_fs_add_dentry( vfs_inode_t  * parent,
    932                            vfs_dentry_t * dentry );
    933 
    934 /******************************************************************************************
    935  * This function updates the mapper associated to a directory inode identified by the
    936  * <parent> argument, to remove an entry identified by the <dentry> argument.
    937  * The directory inode descriptor and the dentry descriptor are in the same cluster.
     901error_t vfs_fs_add_dentry( xptr_t         parent_inode_xp,
     902                           vfs_dentry_t * dentry_ptr );
     903
     904/******************************************************************************************
     905 * This function removes from a directory mapper identified by the <parent_inode_xp>
     906 * argument, an entry identified by the <dentry_ptr> argument.
    938907 * Depending on the file system type, it calls the proper, FS specific function.
    939908 * Finally, it synchronously updates the parent directory on IOC device.
    940  *
    941  * Depending on the file system type, it calls the relevant, FS specific function.
    942  * It must be executed by a thread running in the cluster containing the parent directory.
    943  * It can be the RPC_VFS_FS_REMOVE_DENTRY. This function does NOT take any lock.
    944  ******************************************************************************************
    945  * @ parent  : local pointer on parent (directory) inode.
    946  * @ dentry  : local pointer on dentry containing name.
     909 * This function can be called by any thread running in any cluster.
     910 ******************************************************************************************
     911 * @ parent_inode_xp  : extended pointer on parent (directory) inode.
     912 * @ dentry_ptr       : local pointer on dentry containing name.
    947913 * @ return 0 if success / return -1 if device access failure.
    948914 *****************************************************************************************/
    949 error_t vfs_fs_remove_dentry( vfs_inode_t  * parent,
    950                               vfs_dentry_t * dentry );
    951 
    952 /******************************************************************************************
    953  * This function scan the mapper of an an existing parent inode directory, identified by
    954  * the <parent> argument to find a directory entry identified by the <name> argument,
    955  * and updates both the child inode descriptor, identified by the <child_xp> argument,
    956  * and the associated dentry descriptor :
     915error_t vfs_fs_remove_dentry( xptr_t         parent_inode_xp,
     916                              vfs_dentry_t * dentry_ptr );
     917
     918/******************************************************************************************
     919 * This function scan a directory mapper, identified by the <parent_inode_xp> argument
     920 * to find a directory entry identified by the <dentry_ptr> argument,
     921 * and updates both the child inode descriptor, and the associated dentry descriptor:
    957922 * - It set the "size", "type", and "extend" fields in inode descriptor.
    958923 * - It set the "extend" field in dentry descriptor.
    959  * It is called by the vfs_lookup() function in case of miss.
    960  *
     924 * It is called by the vfs_lookup() function in case of miss, and does NOT take any lock.
    961925 * Depending on the file system type, it calls the relevant, FS specific function.
    962  * It must be called by a thread running in the cluster containing the parent inode.
    963  * It can be the RPC_VFS_FS_NEW_DENTRY. This function does NOT take any lock.
    964  ******************************************************************************************
    965  * @ parent    : local pointer on parent inode (directory).
    966  * @ name      : child name.
    967  * @ child_xp  : extended pointer on remote child inode (file or directory)
     926 * This function can be called by any thread running in any cluster.
     927 ******************************************************************************************
     928 * @ parent_inode_xp  : extended pointer on parent inode (directory).
     929 * @ dentry_ptr       : local pointer on new entry (in parent inode cluster).
    968930 * @ return 0 if success / return -1 if dentry not found.
    969931 *****************************************************************************************/
    970 error_t vfs_fs_new_dentry( vfs_inode_t * parent,
    971                            char        * name,
    972                            xptr_t        child_xp );
    973 
    974 /******************************************************************************************
    975  * This function scan the mapper of an an existing inode directory, identified by
    976  * the <inode> argument, to find a directory entry identified by the <dentry> argument,
    977  * and update the size for this directory entry in mapper, as defined by <size>.
     932error_t vfs_fs_new_dentry_from_mapper( xptr_t         parent_inode_xp,
     933                                       vfs_dentry_t * dentry_ptr );
     934
     935/*****************************************************************************************
     936 * This function  introduces a brand new dentry identified by the <dentry_ptr> argument
     937 * in the mapper of a directory identified by the <parent_inode_xp> argument.
     938 * It is called by the vfs_lookup() function, and does NOT take any lock.
     939 * The child inode descriptor, and the dentry descriptor must have been previously
     940 * allocated and introduced in the Inode Tree. The dentry descriptor contains the name.
     941 * Depending on the file system type, it calls the relevant, FS specific function.
     942 * This function can be called by any thread running in any cluster.
     943 *****************************************************************************************
     944 * @ parent_inode_xp : [in]  extended pointer on parent inode (directory).
     945 * @ dentry_ptr      : [in]  local pointer on dentry (in parent inode cluster).
     946 * @ return 0 if success / return -1 if failure.
     947 ****************************************************************************************/
     948error_t vfs_fs_new_dentry_to_mapper( xptr_t         parent_inode_xp,
     949                                     vfs_dentry_t * dentry_ptr );
     950
     951/******************************************************************************************
     952 * This function updates the "size" field of a directory entry identified by the
     953 * <dentry_ptr> argument in a directory mapper identified by the <parent_inode_xp>
     954 * from the value contained in the inode descriptor.
    978955 * The parent directory on device is synchronously updated.
    979956 * It is called by the vfs_close() function.
    980  *
    981957 * Depending on the file system type, it calls the relevant, FS specific function.
    982  * It must be called by a thread running in the cluster containing the parent inode.
    983  * It can be the RPC_VFS_FS_UPDATE_DENTRY. This function does NOT take any lock.
    984  ******************************************************************************************
    985  * @ parent    : local pointer on parent inode (directory).
    986  * @ dentry    : local pointer on dentry.
    987  * @ size      : new size value (bytes).
    988  * @ return 0 if success / return ENOENT if not found.
    989  *****************************************************************************************/
    990 error_t vfs_fs_update_dentry( vfs_inode_t  * inode,
    991                               vfs_dentry_t * dentry,
    992                               uint32_t       size );
     958 * This function can be called by any thread running in any cluster.
     959 ******************************************************************************************
     960 * @ parent_inode_xp  : local pointer on parent inode (directory).
     961 * @ dentry_ptr       : local pointer on dentry (in parent directory cluster).
     962 * @ return 0 if success / return -1 if not found.
     963 *****************************************************************************************/
     964error_t vfs_fs_update_dentry( xptr_t         parent_inode_xp,
     965                              vfs_dentry_t * dentry_ptr );
    993966
    994967/******************************************************************************************
     
    1002975 * the Inode Tree is dynamically created, and all dirent fiels are documented in the
    1003976 * dirent array. Otherwise, only the dentry name is documented.
    1004  *
     977 * This function does NOT take any lock.
    1005978 * Depending on the file system type, it calls the relevant, FS specific function.
    1006  * It must be called by a thread running in the cluster containing the parent inode.
    1007  * This function does NOT take any lock.
     979 *
     980 * WARNING : this function must be called by a thread running in the cluster containing
     981 * the target directory inode.
    1008982 ******************************************************************************************
    1009983 * @ inode      : [in]  local pointer on directory inode.
     
    10311005 * directory are synchronously done on the IOC device by the two vfs_fs_add_dentry()
    10321006 * and vfs_fs_remove_dentry() functions.
    1033  *
    10341007 * Depending on the file system type, it calls the relevant, FS specific function.
    1035  * It must be called by a thread running in the inode cluster.
     1008 * This function can be called by any thread running in any cluster.
    10361009 *****************************************************************************************
    1037  * @ inode   : local pointer on inode.
    1038  * @ return 0 if success / return EIO if failure during device access.
     1010 * @ inode_xp   : remote pointer on inode.
     1011 * @ return 0 if success / return -1 if failure.
    10391012 ****************************************************************************************/
    1040 error_t vfs_fs_sync_inode( struct vfs_inode_s * inode );
     1013error_t vfs_fs_sync_inode( xptr_t inode_xp );
    10411014
    10421015/*****************************************************************************************
     
    10441017 * for the FAT itself. It scan all clusters registered in the FAT mapper, and copies
    10451018 * to device each page marked as dirty.
    1046  *
    10471019 * Depending on the file system type, it calls the relevant, FS specific function.
    10481020 * It can be called by a thread running in any cluster.
     
    10531025error_t vfs_fs_sync_fat( vfs_fs_type_t fs_type );
    10541026
    1055 /*****************************************************************************************
    1056  * This function updates the free clusters info on the IOC device for the FS defined
    1057  * by the <fs_type> argument.
    1058  *
    1059  * Depending on the file system type, it calls the relevant, FS specific function.
    1060  * It can be called by a thread running in any cluster.
    1061  *****************************************************************************************
    1062  * @ fs_type   : specific file system type.
    1063  * @ return 0 if success / return EIO if failure during device access.
    1064  ****************************************************************************************/
    1065 error_t vfs_fs_sync_free_info( vfs_fs_type_t fs_type );
    1066 
    1067 /******************************************************************************************
    1068  * This function allocates a free cluster from the FS identified by the <fs_type>
    1069  * argument. It updates the selected FS File Allocation Table.
    1070  *
    1071  * Depending on the file system type, it calls the relevant, FS specific function.
    1072  * It can be called by a thread running in any cluster.
    1073  ******************************************************************************************
    1074  * @ fs_type   : [in]  File System type.
    1075  * @ cluster   : [out] cluster index in File system.
    1076  * @ return 0 if success / return -1 if no free cluster
    1077  *****************************************************************************************/
    1078 error_t vfs_fs_cluster_alloc( uint32_t   fs_type,
    1079                               uint32_t * cluster );
    1080 
    10811027/******************************************************************************************
    10821028 * This function makes all I/O operations required to release all clusters allocated
     
    10841030 * Depending on the file system type, it calls the proper, FS specific function.
    10851031 * It is called by the vfs_unlink() function.
    1086  * It can be executed by a thread running in any cluster.
    10871032 * This function does NOT take any lock.
     1033 * Depending on the file system type, it calls the relevant, FS specific function.
     1034 * This function can be executed by any thread running in any cluster.
    10881035 ******************************************************************************************
    10891036 * @ inode_xp  : extended pointer on inode.
     
    10921039error_t vfs_fs_release_inode( xptr_t  inode_xp );
    10931040
     1041/******************************************************************************************
     1042 * This function makes the I/O operation to move one page identified by the <page_xp>
     1043 * argument to/from the IOC device from/to the mapper, as defined by the <cmd_type>.
     1044 * It is used in case of MISS on the mapper (read), or when a dirty page in the mapper
     1045 * must be updated in the File System (write).
     1046 * The mapper pointer, and the page index in file are obtained from the page descriptor.
     1047 * This function does NOT take any lock.
     1048 * Depending on the file system type, it calls the proper, FS specific function.
     1049 * This function can be executed by any thread running in any cluster.
     1050 ******************************************************************************************
     1051 * @ page_xp   : extended pointer on page descriptor (for mapper and page_id).
     1052 * @ cmd_type  : IOC_READ / IOC_WRITE / IOC_SYNC_READ / IOC_SYNC_WRITE
     1053 * @ returns 0 if success / return -1 if device access failure.
     1054 *****************************************************************************************/
     1055error_t vfs_fs_move_page( xptr_t          page_xp,
     1056                          ioc_cmd_type_t  cmd_type );
     1057
    10941058
    10951059#endif  /* _VFS_H_ */
Note: See TracChangeset for help on using the changeset viewer.