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


Ignore:
Timestamp:
Dec 3, 2018, 12:15:53 PM (3 years ago)
Author:
alain
Message:

Improve the FAT32 file system to support cat, rm, cp commands.

File:
1 edited

Legend:

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

    r598 r602  
    7878 * This structure defines a VFS context, that contains informations common to all inodes
    7979 * and dentries for a given file system. As it is declared as a global variable in the
    80  * kdata segment, it is handled as private by each OS intance in a given cluster.
     80 * kdata segment (fs_context[] array), it is replicated in all clusters.
     81 * The <extend> field is a pointer on the FS specific context extension.
     82 * This extension is dynamically allocated by kernel_init in all clusters.
     83 * In each cluster, both this VFS context and the FS specific context are handled as
     84 * private by the local OS intance.
    8185 *****************************************************************************************/
    8286
     
    252256
    253257
    254 /*****************************************************************************************/
    255 /******************** VFS global functions ***********************************************/
    256 /*****************************************************************************************/
    257 
    258 
    259 /******************************************************************************************
    260  * This function mount a given file system type for a given process TODO.     
    261  *****************************************************************************************/
    262 error_t vfs_mount_fs_root( struct device_s  * device,
    263                                        uint32_t           fs_type,
    264                                        struct process_s * process );
    265 
    266 
    267 /*****************************************************************************************/
    268 /******************* VFS Context related functions ****************************************/
    269 /*****************************************************************************************/
     258/******************************************************************************************
     259 *        These functions access / modify  a VFS context.
     260 *****************************************************************************************/
    270261
    271262/******************************************************************************************
     
    311302
    312303
    313 /*****************************************************************************************/
    314 /********************* Inode related functions *******************************************/
    315 /*****************************************************************************************/
     304/******************************************************************************************
     305 *        These low-level functions access / modify a VFS inode descriptor
     306 *****************************************************************************************/
     307
     308/******************************************************************************************
     309 * This function returns a printable string for the inode type.
     310 *****************************************************************************************/
     311const char * vfs_inode_type_str( vfs_inode_type_t type );
    316312
    317313/******************************************************************************************
     
    325321 * @ fs_type    : file system type.
    326322 * @ inode_type : inode type.
    327  * @ extend     : local pointer on vs_type_specific extension.
    328323 * @ attr       : inode attributes.
    329324 * @ rights     : inode access rights.
     
    336331                          vfs_fs_type_t     fs_type,
    337332                          vfs_inode_type_t  inode_type,
    338                           void            * extend,
    339333                          uint32_t          attr,
    340334                          uint32_t          rights,
     
    344338
    345339/******************************************************************************************
    346  * This function releases memory allocated to an inode descriptor.
    347  * It must be executed by a thread running in the cluster containing the inode,
    348  * and the inode refcount must be zero. If the client thread is not running in the owner
    349  * cluster, you must use the rpc_vfs_inode_destroy_client() function.
     340 * This function releases memory allocated to an inode descriptor, including
     341 * all memory allocated to the mapper (both mapper descriptor and radix tree).
     342 * The mapper should not contain any dirty page (shold be synchronized before deletion),
     343 * and the inode refcount must be zero.
     344 * It must be executed by a thread running in the cluster containing the inode.
     345 * Use the rpc_vfs_inode_destroy_client() function if required.
    350346 ******************************************************************************************
    351347 * @ inode  : local pointer on inode descriptor.
    352  * @ return 0 if success / return EINVAL if error.
    353  *****************************************************************************************/
    354 error_t vfs_inode_destroy( vfs_inode_t *  inode ); 
    355 
    356 /******************************************************************************************
    357  * This function scan an existing parent inode directory, identified by the <parent>
    358  * argument to find a directory entry identified by the <name> argument, and update
    359  * the remote child inode, identified by the <child_xp> argument.
    360  * Depending on the file system type, it calls the relevant, FS specific function,
    361  * to scan the directory, and set the "type", "size", and "extend" fields.
    362  * It must be called by a thread running in the cluster containing the parent inode.
    363  ******************************************************************************************
    364  * @ parent    : local pointer on parent inode (directory).
    365  * @ name      : child name.
    366  * @ child_xp  : extended pointer on remote child inode (file or directory)
    367  * @ return 0 if success / return ENOENT if not found.
    368  *****************************************************************************************/
    369 error_t vfs_inode_load( vfs_inode_t * parent,
    370                         char        * name,
    371                         xptr_t        child_xp );
     348 *****************************************************************************************/
     349void vfs_inode_destroy( vfs_inode_t *  inode ); 
    372350
    373351/******************************************************************************************
     
    399377/******************************************************************************************
    400378 * This function takes the main lock of a remote inode.
    401  * This lock protect all inode fiels, including the children dentries.
     379 * This lock protect all inode fields, including the children dentries.
    402380 *****************************************************************************************
    403381 * @ inode_xp  : extended pointer on the remote inode.
     
    424402                         char * name );
    425403
    426 
    427 /*****************************************************************************************/
    428 /***************** Dentry related functions **********************************************/
    429 /*****************************************************************************************/
     404/******************************************************************************************
     405 * This function accesses successively all pages of a file identified by the <inode>,
     406 * argument, to force misses, and load all pages into mapper.
     407 * The target inode can be a directory or a file, but this function is mainly used
     408 * to prefetch a complete directory to the mapper.
     409 * It must be executed by a thread running in the cluster containing the inode.
     410 * This function does NOT take any lock.
     411 ******************************************************************************************
     412 * @ inode  : local pointer on inode.
     413 * @ return 0 if success / return -1 if device access failure.
     414 *****************************************************************************************/
     415error_t vfs_inode_load_all_pages( vfs_inode_t * inode );
     416
     417
     418/******************************************************************************************
     419 *        These low-level functions access / modify a VFS dentry descriptor
     420 *****************************************************************************************/
    430421
    431422/******************************************************************************************
     
    449440/******************************************************************************************
    450441 * This function releases memory allocated to a dentry descriptor.
    451  * It must be executed by a thread running in the cluster containing the dentry,
    452  * and the dentry refcount must be zero. If the client thread is not running in the owner
    453  * cluster, you must use the rpc_dentry_destroy_client() function.
     442 * The dentry refcount must be zero.
     443 * It must be executed by a thread running in the cluster containing the dentry.
     444 * Use the rpc_vfs_dentry_destroy_client() function if required.
    454445 ******************************************************************************************
    455446 * @ dentry  : local pointer on dentry descriptor.
    456  * @ return 0 if success / return EINVAL if error.
    457  *****************************************************************************************/
    458 error_t vfs_dentry_destroy( vfs_dentry_t *  dentry ); 
     447 *****************************************************************************************/
     448void vfs_dentry_destroy( vfs_dentry_t *  dentry ); 
    459449
    460450/******************************************************************************************
     
    466456
    467457
    468 /*****************************************************************************************/
    469 /************************ File descriptor related functions ******************************/
    470 /*****************************************************************************************/
     458/******************************************************************************************
     459 *        These low-level functions access / modify a VFS file descriptor
     460 *****************************************************************************************/
    471461
    472462/******************************************************************************************
     
    505495
    506496
    507 /*****************************************************************************************/
    508 /******************* Inode-Tree related functions ****************************************/
    509 /*****************************************************************************************/
    510 
    511 /******************************************************************************************
    512  * This function returns a printable string for the inode type.
    513  *****************************************************************************************/
    514 const char * vfs_inode_type_str( vfs_inode_type_t type );
     497/******************************************************************************************
     498 *        These functions access / modify the distributed VFS Inode Treee
     499 *****************************************************************************************/
    515500
    516501/******************************************************************************************
     
    555540 * This function creates a new couple dentry/inode, and insert it in the Inode-Tree.
    556541 * It can be executed by any thread running in any cluster (can be different from both
    557  * the child cluster and the parent cluster), as it uses the rpc_dentry_create_client()
    558  * and rpc_inode_create client() if required. This is done in three steps:
    559  * 1) The dentry is created in the cluster containing the existing <parent_xp> inode.
    560  *    The new dentry name is defined by the <name> argument.
    561  * 2) The inode and its associated mapper are created in cluster identified by <child_cxy>.
    562  *    The new inode and the parent inode can have different FS types.
    563  * 3) The "child_xp" field in created dentry (pointing on the created inode) is updated.
    564  ******************************************************************************************
    565  * @ child_cxy  : target cluster for child inode.
    566  * @ inode_type : new inode type
    567  * @ fs_type    : new inode FS type.
    568  * @ parent_xp  : extended pointer on parent inode.
    569  * @ name       : new directory entry name.
    570  * @ extend     : fs_type_specific inode extension.
    571  * @ child_xp   : [out] buffer for extended pointer on child inode.
    572  * @ return 0 if success / ENOMEM if dentry or inode cannot be created.
    573  *****************************************************************************************/
    574 error_t vfs_add_child_in_parent( cxy_t              child_cxy,
    575                                  vfs_inode_type_t   inode_type,
     542 * the child cluster and the parent cluster), as it uses RPCs if required.
     543 * Only the distributed Inode Tree is modified: Even for a new file, this function
     544 * does NOT modify the parent mapper, and does NOT update the FS on IOC device.
     545 *
     546 * [Implementation]
     547 * As there are cross-references between the inode and the associated dentry, this
     548 * function implement a three steps scenario :
     549 * 1) The dentry descriptor is created in the cluster containing the existing <parent_xp>
     550 *    inode, and is only partially initialized : "fs_type", "name", "parent_xp" fields.
     551 * 2) The inode and its associated mapper are created in cluster identified by <child_cxy>,
     552 *    and initialised. The new inode and the parent inode can have different FS types.
     553 * 3) The "child_xp" field in dentry (pointing on the created inode) is updated,
     554 *    and the refcount is incremented for both the inode and the dentry.
     555 ******************************************************************************************
     556 * @ child_inode_cxy  : [in]  target cluster for child inode.
     557 * @ child_inode_type : [in]  child inode type
     558 * @ fs_type          : [in]  child inode FS type.
     559 * @ parent_inode_xp  : [in]  extended pointer on parent inode.
     560 * @ name             : [in]  new directory entry name.
     561 * @ dentry_xp        : [out] buffer for extended pointer on dentry
     562 * @ child_inode_xp   : [out] buffer for extended pointer on child inode.
     563 * @ return 0 if success / -1 if dentry or inode cannot be created.
     564 *****************************************************************************************/
     565error_t vfs_add_child_in_parent( cxy_t              child_inodecxy,
     566                                 vfs_inode_type_t   chilg_inode_type,
    576567                                 vfs_fs_type_t      fs_type,
    577                                  xptr_t             parent_xp,
    578                                  char             * name,   
    579                                  void             * extend,
    580                                  xptr_t           * child_xp );
    581 
    582 /******************************************************************************************
    583  * This function removes a couple dentry/inode from the Inode-Tree, and remove it from
    584  * the external device.
     568                                 xptr_t             parent_inode_xp,
     569                                 char             * name,
     570                                 xptr_t           * dentry_xp,   
     571                                 xptr_t           * child_inode_xp );
     572
     573/******************************************************************************************
     574 * This function removes a couple dentry/inode from the Inode-Tree.
     575 * Both the inode and dentry references counters must be 1.
     576 * It can be executed by any thread running in any cluster (can be different from both
     577 * the inode cluster and the dentry cluster), as it uses RPCs if required.
    585578 ******************************************************************************************
    586579 * @ child_xp   : extended pointer on removed inode.
    587580 *****************************************************************************************/
    588 error_t vfs_remove_child_from_parent( xptr_t inode_xp );
     581void vfs_remove_child_from_parent( xptr_t inode_xp );
     582
     583/******************************************************************************************
     584 * This function is called by the vfs_lookup() function when a new dentry/inode must
     585 * be created from scratch and introduced in both the Inode Tree and the IOC device.
     586 * The dentry and inode descriptors have been created by the caller:
     587 * - It allocates one cluster from the relevant FS, and updates the File Allocation
     588 *   Table (both the FAT mapper, and the IOC device).
     589 * - It set the "size", and "extend" fields in child inode descriptor.
     590 * - It updates the parent directory to introduce the new child in the parent directory
     591 *   inode descriptor (radix tree), in theparent inode mapper, and on IOC device.
     592 * - It set the "extend" field in dentry descriptor.
     593 * It can be called by a thread running in any cluster.
     594 ******************************************************************************************
     595 * @ parent_xp   : extended pointer on parent inode descriptor.
     596 * @ dentry_xp   : extended pointer on new dentry descriptor.
     597 * @ child_xp    : extended pointer on child inode descriptor.
     598 * @ return 0 if success / -1 if failure.
     599 *****************************************************************************************/
     600error_t vfs_new_child_init( xptr_t   parent_xp,
     601                         xptr_t   dentry_xp,
     602                         xptr_t   child_xp );
    589603
    590604/******************************************************************************************
     
    597611void vfs_display( xptr_t   inode_xp );
    598612
    599 
    600 
    601 
    602 
    603 /*****************************************************************************************/
    604 /****************** File access API ******************************************************/
    605 /*****************************************************************************************/
     613/******************************************************************************************
     614 * This function mount a given file system type for a given process
     615 * TODO non implemented yet [AG].     
     616 *****************************************************************************************/
     617error_t vfs_mount_fs_root( struct device_s  * device,
     618                                       uint32_t           fs_type,
     619                                       struct process_s * process );
     620
     621
     622
     623/******************************************************************************************
     624 *        These functions define the VFS "syscalls" API (user commands)
     625 *****************************************************************************************/
     626
     627/******************************************************************************************
     628 * This function moves <size> bytes between a remote file mapper, identified by the
     629 * <file_xp> argument, and a - possibly distributed - user space <buffer>, taken into
     630 * account the offset in <file_xp>. The transfer direction is defined by <to_buffer>.
     631 * It is called by the sys_read() and sys_write() functions.
     632 ******************************************************************************************
     633 * @ to_buffer : mapper -> buffer if true / buffer -> mapper if false.
     634 * @ file_xp   : extended pointer on the remote file descriptor.
     635 * @ buffer    : user space pointer on buffer (can be physically distributed).
     636 * @ size      : requested number of bytes from offset.
     637 * @ returns number of bytes actually moved if success / -1 if error.
     638 *****************************************************************************************/
     639int vfs_user_move( bool_t   to_buffer,
     640                   xptr_t   file_xp,
     641                   void   * buffer,
     642                   uint32_t size );
     643
     644/******************************************************************************************
     645 * This function moves <size> bytes between a remote file mapper, identified by the
     646 * <file_xp> argument, and a - possibly remote - kernel <buffer_xp>, taken into
     647 * account the offset in <file_xp>. The transfer direction is defined by <to_buffer>.
     648 * It is called by the elf_load_process() function.
     649 ******************************************************************************************
     650 * @ to_buffer : mapper -> buffer if true / buffer -> mapper if false.
     651 * @ file_xp   : extended pointer on the remote file descriptor.
     652 * @ buffer_xp : user space pointer on buffer (can be physically distributed).
     653 * @ size      : requested number of bytes from offset.
     654 * @ returns 0 if success / -1 if error.
     655 *****************************************************************************************/
     656error_t vfs_kernel_move( bool_t   to_buffer,
     657                         xptr_t   file_xp,
     658                         xptr_t   buffer_xp,
     659                         uint32_t size );
    606660
    607661/******************************************************************************************
     
    619673 * @ process     : local pointer on local process descriptor copy.
    620674 * @ path        : file pathname (absolute or relative to current directory).
    621  * @ flags       : defined above.
    622  * @ mode        : access rights (as defined by chmod)
     675 * @ flags       : defined in vfs_file_t structure.
     676 * @ mode        : access rights (as defined by chmod).
    623677 * @ file_xp     : [out] buffer for extended pointer on created remote file descriptor.
    624678 * @ file_id     : [out] buffer for created file descriptor index in reference fd_array.
     
    631685                          xptr_t           * file_xp,
    632686                          uint32_t         * file_id );
    633 
    634 /******************************************************************************************
    635  * This function moves <size> bytes between a remote file mapper, identified by the
    636  * <file_xp> argument, and a - possibly distributed - user space <buffer>, taken into
    637  * account the offset in <file_xp>. The transfer direction is defined by <to_buffer>.
    638  * It is called by the sys_read() and sys_write() functions.
    639  ******************************************************************************************
    640  * @ to_buffer : mapper -> buffer if true / buffer -> mapper if false.
    641  * @ file_xp   : extended pointer on the remote file descriptor.
    642  * @ buffer    : user space pointer on buffer (can be physically distributed).
    643  * @ size      : requested number of bytes from offset.
    644  * @ returns number of bytes actually moved if success / -1 if error.
    645  *****************************************************************************************/
    646 int vfs_user_move( bool_t   to_buffer,
    647                    xptr_t   file_xp,
    648                    void   * buffer,
    649                    uint32_t size );
    650 
    651 /******************************************************************************************
    652  * This function moves <size> bytes between a remote file mapper, identified by the
    653  * <file_xp> argument, and a - possibly remote - kernel <buffer_xp>, taken into
    654  * account the offset in <file_xp>. The transfer direction is defined by <to_buffer>.
    655  * It is called by the elf_load_process() function.
    656  ******************************************************************************************
    657  * @ to_buffer : mapper -> buffer if true / buffer -> mapper if false.
    658  * @ file_xp   : extended pointer on the remote file descriptor.
    659  * @ buffer_xp : user space pointer on buffer (can be physically distributed).
    660  * @ size      : requested number of bytes from offset.
    661  * @ returns 0 if success / -1 if error.
    662  *****************************************************************************************/
    663 error_t vfs_kernel_move( bool_t   to_buffer,
    664                          xptr_t   file_xp,
    665                          xptr_t   buffer_xp,
    666                          uint32_t size );
    667687
    668688/******************************************************************************************
     
    685705
    686706/******************************************************************************************
    687  * This function close the -non-replicated- file descriptor identified by the <file_xp>
     707 * This function close the - non-replicated - file descriptor identified by the <file_xp>
    688708 * and <file_id> arguments.
    689709 * 1) All entries in the fd_array copies are directly reset by the calling thread,
     
    700720
    701721/******************************************************************************************
    702  * This function remove from the file system a directory entry identified by the
    703  * <cwd_xp> & <path> arguments.
     722 * This function is called by the kernel to create in the file system a new directory
     723 * entry identified by the <cwd_xp> & <path_1>, linked to the node identified by the
     724 * <cwd_xp> & <path_2> arguments.  It can be any type of node.
     725 * If the link is successful, the link count of the target node is incremented.
     726 * <path_1> and <path_2> share equal access rights to the underlying object.
     727 * Both the IOC device and the Inode Tree are modified.
     728 ******************************************************************************************
     729 * @ cwd_xp   : extended pointer on current working directory file descriptor.
     730 * @ path_1   : new pathname (absolute or relative to current directory).
     731 * @ path_1   : existing pathname (absolute or relative to current directory).
     732 * @ returns 0 if success / -1 if error.
     733 *****************************************************************************************/
     734error_t vfs_link( xptr_t   cwd_xp,
     735                  char   * path_1,
     736                  char   * path_2 );
     737
     738/******************************************************************************************
     739 * This function is called by the kernel to remove from the file system a directory entry
     740 * identified by the  <cwd_xp> & <path> arguments. The target node can be any type of node.
     741 * The link count of the target node is decremented. If the removed link is the last,
     742 * the target node is deleted.
     743 * Both the IOC device and the Inode Tree are modified.
    704744 ******************************************************************************************
    705745 * @ cwd_xp   : extended pointer on the current working directory file descriptor.
     
    747787                   char     * path,
    748788                   uint32_t   mode );
    749 
    750 /******************************************************************************************
    751  * This function remove a directory identified by the <cwd_xp / path> arguments
    752  * from the file system.
    753  * TODO not implemented yet...
    754  ******************************************************************************************
    755  * @ cwd_xp   : extended pointer on the current working directory file descriptor.
    756  * @ path     : pathname (absolute or relative to current directory).                     
    757  * @ returns 0 if success / -1 if error.
    758  *****************************************************************************************/
    759 error_t vfs_rmdir( xptr_t   cwd_xp,
    760                    char   * path );
    761789
    762790/******************************************************************************************
     
    797825
    798826
    799 /*****************************************************************************************/
    800 /****************** Mapper access API ****************************************************/
    801 /*****************************************************************************************/
    802 
    803 /******************************************************************************************
    804  * This function makes an I/O operation to move one page to/from device from/to the mapper.
     827
     828/******************************************************************************************
     829 *        These functions define the VFS "FS" API (to a specific File System)
     830 *****************************************************************************************/
     831
     832/******************************************************************************************
     833 * This function updates the mapper associated to a directory inode identified by the
     834 * <parent> argument, to add a new entry identified by the <dentry> argument.
     835 * The directory inode descriptor and the dentry descriptor are in the same cluster.
     836 * Depending on the file system type, it calls the proper, FS specific function.
     837 * It ulso pdates the dentry descriptor and/or the inode descriptor extensions
     838 * as required by the specific file system type.
     839 * Finally, it synchronously updates the parent directory on IOC device.
     840 *
     841 * It must be executed by a thread running in the cluster containing the parent directory.
     842 * It can be the RPC_VFS_VS_ADD_DENTRY. This function does NOT take any lock.
     843 ******************************************************************************************
     844 * @ parent  : local pointer on parent (directory) inode.
     845 * @ dentry  : local pointer on dentry containing name.
     846 * @ return 0 if success / return -1 if device access failure.
     847 *****************************************************************************************/
     848error_t vfs_fs_add_dentry( vfs_inode_t  * parent,
     849                           vfs_dentry_t * dentry );
     850
     851/******************************************************************************************
     852 * This function updates the mapper associated to a directory inode identified by the
     853 * <parent> argument, to remove an entry identified by the <dentry> argument.
     854 * The directory inode descriptor and the dentry descriptor are in the same cluster.
     855 * Depending on the file system type, it calls the proper, FS specific function.
     856 * Finally, it synchronously updates the parent directory on IOC device.
     857 *
     858 * It must be executed by a thread running in the cluster containing the parent directory.
     859 * It can be the RPC_VFS_VS_REMOVE_DENTRY. This function does NOT take any lock.
     860 ******************************************************************************************
     861 * @ parent  : local pointer on parent (directory) inode.
     862 * @ dentry  : local pointer on dentry containing name.
     863 * @ return 0 if success / return -1 if device access failure.
     864 *****************************************************************************************/
     865error_t vfs_fs_remove_dentry( vfs_inode_t  * parent,
     866                              vfs_dentry_t * dentry );
     867
     868/******************************************************************************************
     869 * This function scan the mapper of an an existing parent inode directory, identified by
     870 * the <parent> argument to find a directory entry identified by the <name> argument,
     871 * and updates both the child inode descriptor, identified by the <child_xp> argument,
     872 * and the associated dentry descriptor :
     873 * - It set the "size", and "extend" fields in inode descriptor.
     874 * - It set the "extend" field in dentry descriptor.
     875 * It is called by the vfs_lookup() function in case of miss.
     876 *
     877 * Depending on the file system type, it calls the relevant, FS specific function.
     878 * It must be called by a thread running in the cluster containing the parent inode.
     879 * This function does NOT take any lock.
     880 ******************************************************************************************
     881 * @ parent    : local pointer on parent inode (directory).
     882 * @ name      : child name.
     883 * @ child_xp  : extended pointer on remote child inode (file or directory)
     884 * @ return 0 if success / return ENOENT if not found.
     885 *****************************************************************************************/
     886error_t vfs_fs_child_init( vfs_inode_t * parent,
     887                           char        * name,
     888                           xptr_t        child_xp );
     889
     890/*****************************************************************************************
     891 * This function  updates the FS on the IOC device for a given inode identified by
     892 * the <inode> argument. It scan all pages registered in the associated mapper,
     893 * and copies from mapper to device each page marked as dirty.
     894 * WARNING : The target <inode> cannot be a directory, because all modifications in a
     895 * directory are synchronously done on the IOC device by the two vfs_fs_add_dentry()
     896 * and vfs_fs_remove_dentry() functions.
     897 *
     898 * Depending on the file system type, it calls the relevant, FS specific function.
     899 * It must be called by a thread running in the inode cluster.
     900 *****************************************************************************************
     901 * @ inode   : local pointer on inode.
     902 * @ return 0 if success / return EIO if failure during device access.
     903 ****************************************************************************************/
     904error_t vfs_fs_sync_inode( struct vfs_inode_s * inode );
     905
     906/*****************************************************************************************
     907 * This function updates the FS on the IOC device for the FAT itself.
     908 * It scan all clusters registered in the FAT mapper, and copies to device
     909 * each page marked as dirty.
     910 *
     911 * Depending on the file system type, it calls the relevant, FS specific function.
     912 * It can be called by a thread running in any cluster.
     913 *****************************************************************************************
     914 * @ return 0 if success / return EIO if failure during device access.
     915 ****************************************************************************************/
     916error_t vfs_fs_sync_fat( void );
     917
     918/*****************************************************************************************
     919 * This function updates the free clusters info on the IOC device.
     920 *
     921 * Depending on the file system type, it calls the relevant, FS specific function.
     922 * It can be called by a thread running in any cluster.
     923 *****************************************************************************************
     924 * @ return 0 if success / return EIO if failure during device access.
     925 ****************************************************************************************/
     926error_t vfs_fs_sync_free_info( void );
     927
     928/******************************************************************************************
     929 * This function allocates a free cluster from the FS identified by the <fs_type>
     930 * argument. It updates the selected FS File Allocation Table.
     931 *
     932 * Depending on the file system type, it calls the relevant, FS specific function.
     933 * It can be called by a thread running in any cluster.
     934 ******************************************************************************************
     935 * @ fs_type   : [in]  File System type.
     936 * @ cluster   : [out] cluster index in File system.
     937 * @ return 0 if success / return -1 if no free cluster
     938 *****************************************************************************************/
     939error_t vfs_fs_cluster_alloc( uint32_t   fs_type,
     940                              uint32_t * cluster );
     941
     942/******************************************************************************************
     943 * This function makes all I/O operations required to release all clusters allocated
     944 * on IOC device to a given inode, identified by the <inode_xp> argument.
     945 * Depending on the file system type, it calls the proper, FS specific function.
     946 * It is called by the vfs_unlink() function.
     947 * It can be executed by a thread running in any cluster.
     948 * This function does NOT take any lock.
     949 ******************************************************************************************
     950 * @ inode_xp  : extended pointer on inode.
     951 * @ return 0 if success / return -1 if device access failure.
     952 *****************************************************************************************/
     953error_t vfs_fs_release_inode( xptr_t  inode_xp );
     954
     955/******************************************************************************************
     956 * This function makes the I/O operation to move one page identified by the <page_xp>
     957 * argument to/from the IOC device from/to the mapper, as defined by <to_mapper>.
     958 * Depending on the file system type, it calls the proper, FS specific function.
    805959 * It is used in case of MISS on the mapper, or when a dirty page in the mapper must
    806960 * be updated in the File System.
    807  * Depending on the file system type, it calls the proper, FS specific function.
    808  * It must be executed by a thread running in the cluster containing the mapper.
    809961 * The mapper pointer is obtained from the page descriptor.
    810  * It takes the mapper lock before launching the IO operation.
    811  ******************************************************************************************
    812  * @ page      : local pointer on the page descriptor.
     962 * It can be executed by any thread running in any cluster.
     963 * This function does NOT take any lock.
     964 ******************************************************************************************
     965 * @ page_xp   : extended pointer on the page descriptor.
    813966 * @ to_mapper : transfer direction.
    814  * @ returns 0 if success / return EINVAL if it cannot access the external device.
    815  *****************************************************************************************/
    816 error_t vfs_mapper_move_page( struct page_s * page,
    817                               bool_t          to_mapper );
    818 
    819 /******************************************************************************************
    820  * This function makes the I/O operations required to move, from device to mapper,
    821  * all pages covering a given inode, identified by the <inode> argument. The target
    822  * inode can be a directory or a file, but this function is mainly used to load (prefetch)
    823  * a complete directory to the mapper.
    824  * Depending on the file system type, it calls the proper, FS specific function.
    825  * It must be executed by a thread running in the cluster containing the mapper.
    826  * The mapper pointer is obtained from the inode descriptor.
    827  * It takes the mapper lock before launching the IO operation.
    828  ******************************************************************************************
    829  * @ inode  : local pointer on inode.
    830  * @ return 0 if success / return EIO if device access failure.
    831  *****************************************************************************************/
    832 error_t vfs_mapper_load_all( vfs_inode_t * inode );
     967 * @ returns 0 if success / return -1 if device access failure.
     968 *****************************************************************************************/
     969error_t vfs_fs_move_page( xptr_t  page_xp,
     970                          bool_t  to_mapper );
    833971
    834972
Note: See TracChangeset for help on using the changeset viewer.