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


Ignore:
Timestamp:
Dec 27, 2018, 7:38:58 PM (3 years ago)
Author:
alain
Message:

Fix several bugs in VFS to support the following
ksh commandis : cp, mv, rm, mkdir, cd, pwd

File:
1 edited

Legend:

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

    r602 r610  
    6969 *****************************************************************************************/
    7070
    71 #define VFS_LOOKUP_DIR      0x01     /* the searched inode is a directory                */
     71#define VFS_LOOKUP_DIR      0x01     /* the searched inode must be a directory           */
    7272#define VFS_LOOKUP_OPEN         0x02     /* the search is for an open/opendir                */
    7373#define VFS_LOOKUP_PARENT       0x04     /* return the parent inode (not the inode itself)   */
    7474#define VFS_LOOKUP_CREATE   0x10     /* file must be created if missing                  */
    75 #define VFS_LOOKUP_EXCL     0x20     /* file cannot previously exist                     */   
     75#define VFS_LOOKUP_EXCL     0x20     /* file cannot previously exist                     */
    7676
    7777/******************************************************************************************
     
    117117/******************************************************************************************
    118118 * This structure define a VFS inode.
    119  * It contains an extended pointer on the parent dentry, and (for directory only)
    120  * an hash table (xhtab) registering all children dentries.
    121  * The <parent> inode is unique for a directory (no hard links for directories).
    122  * For a file, the parent field points to the first dentry who created this inode.
     119 * An inode has several children dentries (if it is a directory), an can have several
     120 * parents dentries (if it hass several aliases links):
     121 * - The "parents" field is the root of the xlist of parents dentries, and the "links"
     122 *   fiels define the number of aliases parent dentries. only a FILE inode can have
     123 *   several parents (no hard links for directories).
     124 * - The "children" field is an embedded xhtab containing pointers on all local children
     125 *   dentries. This set of children is empty for a FILE inode.
    123126 * Synchronisation:
    124  * - the main_lock (remote_busylock) is used during the inode tree traversal,
    125  *   or for inode modification (add/remove children).
    126  * - the data_lock (remote_rwlock) is used during read/write accesses to the data
    127  *   stored in the mapper.
    128  * - the mapper lock (remote rwlock) is only used during the radix tree traversal
    129  *   to return the relevant page for read/write.
     127 * - the main_lock (remote_rwlock) is used during the inode tree traversal,
     128 *   or for inode modification (add/remove children in xhtab).
     129 * - the size_lock (remote_rwlock) is used during read/write accesses to the size
     130 *   field in the mapper.
     131 * - access to the data stored in the associated mapper use the mapper remote_rwlock
     132 *   protecting radix tree traversal and modifications.
    130133 *****************************************************************************************/
    131134
     
    158161{
    159162        struct vfs_ctx_s * ctx;              /*! local pointer on FS context                 */
    160     uint32_t           gc;               /*! generation counter                          */
    161163        uint32_t           inum;             /*! inode identifier (unique in file system)    */
    162164        uint32_t           attr;             /*! inode attributes (see above)                */
    163165        vfs_inode_type_t   type;             /*! inode type (see above)                      */
    164166        uint32_t           size;             /*! number of bytes                             */
    165         uint32_t           links;            /*! number of alias dentry                      */
    166167        uint32_t           uid;              /*! user owner identifier                       */
    167168        uint32_t           gid;              /*! group owner identifier                      */
    168169    uint32_t           rights;           /*! access rights                               */
    169         uint32_t               refcount;         /*! reference counter (all pointers)            */
    170         xptr_t             parent_xp;        /*! extended pointer on parent dentry           */
     170        xlist_entry_t      parents;          /*! root of list of parents dentries            */
     171        uint32_t           links;            /*! number of parent dentries (hard links)      */
    171172        xhtab_t            children;         /*! embedded xhtab of children dentries         */
    172         remote_rwlock_t    data_lock;        /*! protect read/write to data and to size      */
    173         remote_busylock_t  main_lock;        /*! protect inode tree traversal and modifs     */
    174         list_entry_t       list;             /*! member of set of inodes in same cluster     */
    175         xlist_entry_t      wait_root;        /*! root of threads waiting on this inode       */
     173        remote_rwlock_t    size_lock;        /*! protect read/write to size                  */
     174        remote_rwlock_t    main_lock;        /*! protect inode tree traversal and modifs     */
     175//  list_entry_t       list;             /*! member of set of inodes in same cluster     */
     176//  list_entry_t       wait_root;        /*! root of threads waiting on this inode       */
    176177        struct mapper_s  * mapper;           /*! associated file cache                       */
    177178        void             * extend;           /*! fs_type_specific inode extension            */
     
    183184#define VFS_ISUID          0x0004000
    184185#define VFS_ISGID          0x0002000
    185 #define VFS_ISVTX          0x0001000
     186define VFS_ISVTX           0x0001000
    186187
    187188#define VFS_IRWXU      0x0000700
     
    203204 * This structure defines a directory entry.
    204205 * A dentry contains the name of a remote file/dir, an extended pointer on the
    205  * inode representing this file/dir, and a local pointer on the inode representing
     206 * inode representing this file/dir, a local pointer on the inode representing
    206207 * the parent directory.
     208 * A dentry can be member of the set of children of a given directory inode (xhtab).
     209 * A dentry can be member of the set of parents  of a given inode (xlist).
    207210 *****************************************************************************************/
    208211
     
    212215        char                 name[CONFIG_VFS_MAX_NAME_LENGTH];
    213216        uint32_t             length;         /*! name length (bytes)                         */
    214         uint32_t             refcount;       /*! reference counter (all pointers)            */
    215217    struct vfs_inode_s * parent;         /*! local pointer on parent inode               */
    216218    xptr_t               child_xp;       /*! extended pointer on child inode             */
    217     xlist_entry_t        list;           /*! member of list of dentries with same key    */
     219    xlist_entry_t        children;       /*! member of set of children dentries          */
     220    xlist_entry_t        parents;        /*! member of set of parent dentries            */
    218221        void               * extend;         /*! FS specific extension                       */
    219222}
     
    301304
    302305
    303 
    304306/******************************************************************************************
    305307 *        These low-level functions access / modify a VFS inode descriptor
     
    314316 * This function allocates memory from local cluster for an inode descriptor and the
    315317 * associated mapper. It initialise these descriptors from arguments values.
    316  * The parent dentry must have been previously created.
    317318 * If the client thread is not running in the cluster containing this inode,
    318319 * it must use the rpc_vfs_inode_create_client() function.
    319320 ******************************************************************************************
    320  * @ dentry_xp  : extended pointer on associated dentry (in parent inode cluster).
    321321 * @ fs_type    : file system type.
    322322 * @ inode_type : inode type.
     
    328328 * @ return 0 if success / return ENOMEM or EINVAL if error.
    329329 *****************************************************************************************/
    330 error_t vfs_inode_create( xptr_t            dentry_xp,
    331                           vfs_fs_type_t     fs_type,
     330error_t vfs_inode_create( vfs_fs_type_t     fs_type,
    332331                          vfs_inode_type_t  inode_type,
    333332                          uint32_t          attr,
     
    340339 * This function releases memory allocated to an inode descriptor, including
    341340 * 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.
     341 * The mapper should not contain any dirty page (should be synchronized before deletion).
    344342 * It must be executed by a thread running in the cluster containing the inode.
    345343 * Use the rpc_vfs_inode_destroy_client() function if required.
     
    348346 *****************************************************************************************/
    349347void vfs_inode_destroy( vfs_inode_t *  inode ); 
    350 
    351 /******************************************************************************************
    352  * This function atomically increment/decrement the inode refcount.
    353  * It can be called by any thread running in any cluster.
    354  *****************************************************************************************/
    355 void vfs_inode_remote_up( xptr_t  inode_xp );
    356 void vfs_inode_remote_down( xptr_t  inode_xp );
    357348
    358349/******************************************************************************************
     
    423414 * This function allocates memory from local cluster for a dentry descriptor,
    424415 * initialises it from  arguments values, and returns the extended pointer on dentry.
    425  * The inode field is not initialized, because the inode does not exist yet.
    426416 * If the client thread is not running in the target cluster for this inode,
    427417 * it must use the rpc_dentry_create_client() function.
     
    429419 * @ fs_type    : file system type.
    430420 * @ name       : directory entry file/dir name.
    431  * @ parent     : local pointer on parent inode.
    432421 * @ dentry_xp  : [out] buffer for extended pointer on created dentry.
    433422 * @ return 0 if success / return ENOMEM or EINVAL if error.
     
    435424error_t vfs_dentry_create( vfs_fs_type_t   fs_type,
    436425                           char          * name,
    437                            vfs_inode_t   * parent,
    438426                           xptr_t        * dentry_xp );
    439427 
    440428/******************************************************************************************
    441  * This function releases memory allocated to a dentry descriptor.
    442  * The dentry refcount must be zero.
     429 * This function removes the dentry from the parent inode xhtab, and releases the memory
     430 * allocated to the dentry descriptor.
    443431 * It must be executed by a thread running in the cluster containing the dentry.
    444432 * Use the rpc_vfs_dentry_destroy_client() function if required.
     
    447435 *****************************************************************************************/
    448436void vfs_dentry_destroy( vfs_dentry_t *  dentry ); 
    449 
    450 /******************************************************************************************
    451  * These functions atomically increment/decrement the dentry refcount.
    452  * It can be called by any thread running in any cluster.
    453  *****************************************************************************************/
    454 void vfs_dentry_remote_up( xptr_t dentry_xp );
    455 void vfs_dentry_remote_down( xptr_t dentry_xp );
    456437
    457438
     
    496477
    497478/******************************************************************************************
    498  *        These functions access / modify the distributed VFS Inode Treee
    499  *****************************************************************************************/
    500 
    501 /******************************************************************************************
    502  * This function returns in a kernel buffer allocated by the caller function,
    503  * the pathname of a file/dir identified by an extended pointer on the inode.
     479 *        These functions access / modify the distributed VFS Inode Tree
     480 *****************************************************************************************/
     481
     482/******************************************************************************************
     483 * This function returns in a kernel <buffer> allocated by the caller function,
     484 * the pathname of a file/dir identified by the <inode_xp> argument.
    504485 * It traverse the Inode Tree from the target node to the root.
    505486 * It can be called by any thread running in any cluster.
    506  ******************************************************************************************
    507  * @ inode_xp    : pointer on inode descriptor.
    508  * @ buffer      : kernel buffer for pathname (must be allocated by caller).
    509  * @ size        : max number of characters in buffer.
     487 * As this buffer if filled in "reverse order" (i.e. from the target inode to the root),
     488 * the pathname is stored in the higher part of the buffer.
     489 * A pointer on the first character of the pathname is returned in <first> buffer.
     490 *
     491 * WARNING : This function takes & releases the remote_rwlock protecting the Inode Tree.
     492 ******************************************************************************************
     493 * @ inode_xp    : [in]  extended pointer on target inode descriptor.
     494 * @ buffer      : [in]  kernel buffer for pathname (allocated by caller).
     495 * @ first       : [out] pointer on first character in buffer.
     496 * @ max_size    : [in]  max number of characters in buffer.
    510497 * @ return 0 if success / return EINVAL if buffer too small.
    511498 *****************************************************************************************/
    512499error_t vfs_get_path( xptr_t    inode_xp,
    513500                      char    * buffer,
     501                      char   ** first,
    514502                      uint32_t  max_size );
    515503
    516504/******************************************************************************************
    517  * This function takes a pathname (absolute or relative to cwd) and returns an extended
    518  * pointer on the associated inode.
     505 * This function traverses the the Inode Tree, from inode identified by the <root_xp>
     506 * argument, and returns in <inode_xp> the inode identified by the < pathname> argument.
     507 * It can be called by a thread running in any cluster.
     508 * It supports the following flags that define the lookup modes :
     509 * - VFS_LOOKUP_DIR    : the searched inode must be a directory
     510 * - VFS_LOOKUP_OPEN   : the search is for an open/opendir
     511 * - VFS_LOOKUP_PARENT : return the parent inode (not the inode itself)
     512 * - VFS_LOOKUP_CREATE : file/directory must be created if missing on IOC
     513 * - VFS_LOOKUP_EXCL   : file cannot previously exist
     514 * As the inode Tree is a cache, the search policy is the following :
    519515 * - If a given directory name in the path is not found in the inode tree, it try to load
    520516 *   the missing dentry/inode couple, from informations found in the parent directory.
    521  * - If this directory entry does not exist on device, it returns an error.
    522  * - If the the file identified by the pathname does not exist on device but the
    523  *   flag CREATE is set, the inode is created.
    524  * - If the the file identified by the pathname exist on device but both flags EXCL
     517 * - If this directory entry does not exist on IOC, it returns an error.
     518 * - If the the file identified by the pathname does not exist on IOC but the
     519 *   flag CREATE is set, the inode is created. It returns an error otherwise.
     520 * - If the the file identified by the pathname exist on device, but both flags EXCL
    525521 *   and CREATE are set, an error is returned.
    526  ******************************************************************************************
    527  * @ cwd_xp      : extended pointer on current directory (for relative path).
    528  * @ pathname    : path in kernel space (can be relative or absolute).
    529  * @ lookup_mode : flags defining the working mode (defined above in this file).
     522 * - If the PARENT flag is set, it returns in <inode_xp> an extended pointer on the parent
     523 *   inode, and copies in <last_name> buffer a string containing the last name in path.
     524 *
     525 * WARNING : The remote_rwlock protecting the Inode Tree must be taken by the caller.
     526 *
     527 * TODO the access rights are not checked yet.
     528 ******************************************************************************************
     529 * @ root_xp     : [in]  extended pointer on root inode (can be root of a subtree).
     530 * @ pathname    : [in]  path (can be relative or absolute).
     531 * @ lookup_mode : [in]  flags defining the searching mode.
    530532 * @ inode_xp    : [out] buffer for extended pointer on searched inode.
     533 * @ last_name   : [out] pointer on buffer for last name in path.
    531534 * @ return 0 if success / ENOENT if inode not found , EACCES if permisson denied,
    532  *                         EAGAIN if a new complete lookup must be made
    533  *****************************************************************************************/
    534 error_t vfs_lookup( xptr_t             cwd_xp,
     535 *****************************************************************************************/
     536error_t vfs_lookup( xptr_t             root_xp,
    535537                    char             * pathname,
    536538                    uint32_t           lookup_mode,
    537                                         xptr_t           * inode_xp );
     539                                        xptr_t           * inode_xp,
     540                    char             * last_name );
    538541
    539542/******************************************************************************************
    540543 * This function creates a new couple dentry/inode, and insert it in the Inode-Tree.
     544 * Only the distributed Inode Tree is modified: it does NOT modify the parent mapper,
     545 * and does NOT update the FS on IOC device.
    541546 * It can be executed by any thread running in any cluster (can be different from both
    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.
     547 * the child cluster and the parent cluster).
    545548 *
    546549 * [Implementation]
     
    563566 * @ return 0 if success / -1 if dentry or inode cannot be created.
    564567 *****************************************************************************************/
    565 error_t vfs_add_child_in_parent( cxy_t              child_inodecxy,
    566                                  vfs_inode_type_t   chilg_inode_type,
     568error_t vfs_add_child_in_parent( cxy_t              child_inode_cxy,
     569                                 vfs_inode_type_t   child_inode_type,
    567570                                 vfs_fs_type_t      fs_type,
    568571                                 xptr_t             parent_inode_xp,
     
    572575
    573576/******************************************************************************************
    574  * This function removes a couple dentry/inode from the Inode-Tree.
    575  * Both the inode and dentry references counters must be 1.
     577 * This function removes a remote dentry from the Inode-Tree.
     578 * - It removes the dentry from the parent inode xhtab ("children" field), and from the
     579 *   child inode xlist ("parents" field).
     580 * - It releases the memory allocated to the dentry descriptor.
     581 * - If the number of parents of the child inode is one, it also releases the memory
     582 *   allocated to the child inode.
     583 * Only the Inode Tree is modified: it does NOT modify the parent mapper,
     584 * and does NOT update the FS on IOC device.
    576585 * 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.
    578  ******************************************************************************************
    579  * @ child_xp   : extended pointer on removed inode.
    580  *****************************************************************************************/
    581 void vfs_remove_child_from_parent( xptr_t inode_xp );
     586 * the inode cluster and the dentry cluster).
     587 ******************************************************************************************
     588 * @ dentry_xp   : extended pointer on removed dentry.
     589 *****************************************************************************************/
     590void vfs_remove_child_from_parent( xptr_t dentry_xp );
    582591
    583592/******************************************************************************************
     
    599608 *****************************************************************************************/
    600609error_t vfs_new_child_init( xptr_t   parent_xp,
    601                          xptr_t   dentry_xp,
    602                          xptr_t   child_xp );
     610                            xptr_t   dentry_xp,
     611                            xptr_t   child_xp );
    603612
    604613/******************************************************************************************
     
    661670/******************************************************************************************
    662671 * This function allocates a vfs_file_t structure in the cluster containing the inode
    663  * associated to the file identified by the <cwd_xp> & <path> arguments.
     672 * identified by the <root_xp> & <path> arguments.
    664673 * It initializes it, register it in the reference process fd_array identified by the
    665  * <process> argument, and returns both the extended pointer on the file descriptor,
    666  * and the allocated index in the fd_array.
     674 * <process_xp> argument, and returns both the extended pointer on the file descriptor,
     675 * and the allocated index in the <file_xp> and <file_id> buffers.
    667676 * The pathname can be relative to current directory or absolute.
    668  * If the inode does not exist in the inode cache, it try to find the file on the mounted
     677 * If the inode does not exist in the inode cache, it try to find the file on the IOC
    669678 * device, and creates an inode on a pseudo randomly selected cluster if found.
    670679 * It the requested file does not exist on device, it creates a new inode if the
    671680 * O_CREAT flag is set, and return an error otherwise.
     681 *
     682 * WARNING : this function takes & releases the remote_rwlock protecting the Inode Tree.
    672683 ******************************************************************************************
    673  * @ process     : local pointer on local process descriptor copy.
     684 * @ root_xp     : extended pointer on path root inode.
    674685 * @ path        : file pathname (absolute or relative to current directory).
     686 * @ process_xp  : extended pointer on client reference process.
    675687 * @ flags       : defined in vfs_file_t structure.
    676688 * @ mode        : access rights (as defined by chmod).
     
    679691 * @ return 0 if success / return non-zero if error.
    680692 *****************************************************************************************/
    681 error_t vfs_open( struct process_s * process,
     693error_t vfs_open( xptr_t             root_xp,
    682694                          char             * path,
     695                  xptr_t             process_xp,
    683696                          uint32_t           flags,
    684697                  uint32_t           mode,
     
    721734/******************************************************************************************
    722735 * 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.
     736 * identified by the <root_xp> & <path> arguments, with the access permission defined
     737 * by the <rights> argument. All nodes in the path - but the last -  must exist.
     738 *
     739 * WARNING : this function takes & releases the remote_rwlock protecting the Inode Tree.
     740 ******************************************************************************************
     741 * @ root_xp : extended pointer on path root inode (any inode in Inode Tree).
     742 * @ path    : pathname (absolute or relative to current directory).
     743 * @ rights  : access rights.
     744 * @ returns 0 if success / -1 if error.
     745 *****************************************************************************************/
     746error_t vfs_mkdir( xptr_t   root_xp,
     747                   char   * path,
     748                   uint32_t rights );
     749
     750/******************************************************************************************
     751 * This function is called by the kernel to create in the file system a new directory
     752 * entry identified by the <new_root_xp> & <new_path> arguments, to be linked to an
     753 * existing inode, identified by the  <old_root_xp> & <old_path> arguments.
     754 * If the link is successful, the link count of the target inode is incremented.
     755 * The <new_path> and <old_path> share equal access rights to the underlying inode.
    727756 * 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).
     757 $
     758 * TODO This function should handle any type of node, but the current implementation
     759 * handles only the FILE and DIR types.
     760 *
     761 * WARNING : this function takes & releases the remote_rwlock protecting the Inode Tree.
     762 ******************************************************************************************
     763 * @ old_root_xp : extended pointer on old path root inode (any inode in Inode Tree).
     764 * @ old_path    : old pathname (absolute or relative to current directory).
     765 * @ nld_root_xp : extended pointer on new path root inode (any inode in Inode Tree).
     766 * @ new_path    : new pathname (absolute or relative to current directory).
    732767 * @ returns 0 if success / -1 if error.
    733768 *****************************************************************************************/
    734 error_t vfs_link( xptr_t   cwd_xp,
    735                   char   * path_1,
    736                   char   * path_2 );
     769error_t vfs_link( xptr_t   old_root_xp,
     770                  char   * old_path,
     771                  xptr_t   new_root_xp,
     772                  char   * new_path );
    737773
    738774/******************************************************************************************
    739775 * 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.
     776 * identified by the  <root_xp> & <path> arguments.
     777 * The link count of the target node is decremented.
     778 * If the removed link is the last, the target inode is deleted.
    743779 * Both the IOC device and the Inode Tree are modified.
    744  ******************************************************************************************
    745  * @ cwd_xp   : extended pointer on the current working directory file descriptor.
     780 *
     781 * TODO This function should handle any type of node, but the current implementation
     782 * handles only only the FILE and DIR types.
     783 *
     784 * WARNING : this function takes & releases the remote_rwlock protecting the Inode Tree.
     785 ******************************************************************************************
     786 * @ root_xp  : extended pointer on root inode (can be any inode in Inode Tree).
    746787 * @ path     : pathname (absolute or relative to current directory).
    747788 * @ returns 0 if success / -1 if error.
    748789 *****************************************************************************************/
    749 error_t vfs_unlink( xptr_t   cwd_xp,
     790error_t vfs_unlink( xptr_t   root_xp,
    750791                    char   * path );
    751792
    752793/******************************************************************************************
    753  * This function returns, in the structure pointed by the <st> pointer,
    754  * various informations on the inode identified by the <inode_xp> argument.
    755  * TODO : only partially implemented yet...
    756  ******************************************************************************************
    757  * @ inode_xp   : extended pointer on the remote inode.
     794 * This function returns, in the structure pointed by the <st> pointer, various
     795 * informations on the inode identified by the <root_inode_xp> and <patname> arguments.
     796 *
     797 * TODO : only partially implemented yet (only size and inum fields).
     798 *
     799 * WARNING : this function takes & releases the remote_rwlock protecting the Inode Tree.
     800 ******************************************************************************************
     801 * @ root_xp    : extended pointer on path root inode (any inode in Inode Tree)
     802 * @ pathname   : pathname to target inode.
    758803 * @ st         : local pointer on the stat structure in kernel space.
    759804 * @ returns 0 if success / -1 if error.
    760805 *****************************************************************************************/
    761 error_t vfs_stat( xptr_t        inode_xp,
     806error_t vfs_stat( xptr_t        root_xp,
     807                  char        * pathname,
    762808                  struct stat * st );
    763809
     
    775821
    776822/******************************************************************************************
    777  * This function  creates a new inode and associated dentry  for the directory defined
    778  * by the <cwd_xp> & <path> arguments.
     823 * This function  creates a new directory as defined by the <root_xp> & <path> arguments.
    779824 * TODO not implemented yet...
    780825 ******************************************************************************************
    781  * @ cwd_xp   : extended pointer on the current working directory file descriptor.
    782  * @ path     : pathname (absolute or relative to current directory).                     
     826 * @ root_xp  : extended pointer on the path root directory.
     827 * @ path     : pathname (absolute or relative to CWD).                     
    783828 * @ mode     : access rights (as defined by chmod)
    784829 * @ returns 0 if success / -1 if error.
    785830 *****************************************************************************************/
    786 error_t vfs_mkdir( xptr_t     cwd_xp,
     831error_t vfs_mkdir( xptr_t     root_xp,
    787832                   char     * path,
    788833                   uint32_t   mode );
    789834
    790835/******************************************************************************************
    791  * This function makes the directory identified by <cwd_xp / path> arguments to become
    792  * the working directory for the calling process.
     836 * This function makes the directory identified by the <root_xp and <path> arguments
     837 * to become the working directory for the calling process.
    793838 ******************************************************************************************
    794  * @ cwd_xp      : extended pointer on current directory file descriptor (relative path).
    795  * @ path        : file pathname (absolute or relative to current directory).
     839 * @ root_xp  : extended pointer on the path root directory.
     840 * @ path     : pathname (absolute or relative to CWD).
    796841 * return 0 if success / -1 if error.
    797842 *****************************************************************************************/
    798 error_t vfs_chdir( xptr_t   cwd_xp,
     843error_t vfs_chdir( xptr_t   root_xp,
    799844                   char   * path );
    800845
    801846/******************************************************************************************
    802  * This function change the access rigths for the file identified by the <cwd_xp / path>
    803  * arguments. The new access rights are defined by the <mode> argument value.
     847 * This function change the access rigths for the file/directory identified by the
     848 * <root_xp> and <path> arguments as defined by the <mode> argument value.
    804849 ******************************************************************************************
    805  * @ cwd_xp      : extended pointer on current directory file descriptor (relative path).
    806  * @ path        : file pathname (absolute or relative to current directory).
    807  * @ mode        : access rights new value.
     850 * @ root_xp  : extended pointer on the path root directory.
     851 * @ path     : pathname (absolute or relative to CWD).
     852 * @ mode     : access rights
    808853 * return 0 if success / -1 if error.
    809854 *****************************************************************************************/
    810 error_t vfs_chmod( xptr_t        cwd_xp,
     855error_t vfs_chmod( xptr_t        root_xp,
    811856                   char        * path,
    812857                   uint32_t      mode );
     
    816861 * TODO not implemented yet                                                         
    817862 ******************************************************************************************
    818  * @ path        : FIFO pathname (absolute or relative to current directory).
    819  * @ cwd_xp      : extended pointer on the current working directory file descriptor.
    820  * @ mode        : access rights new value.
    821  *****************************************************************************************/
    822 error_t vfs_mkfifo( xptr_t       cwd_xp,
     863 * @ root_xp  : extended pointer on the path root directory.
     864 * @ path     : pathname (absolute or relative to CWD).
     865 * @ mode     : access rights new value.
     866 *****************************************************************************************/
     867error_t vfs_mkfifo( xptr_t       root_xp,
    823868                    char       * path,
    824869                    uint32_t     mode );
     
    905950
    906951/*****************************************************************************************
    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.
     952 * This function updates the FS defined by the <fs_type> argument on the IOC device
     953 * for the FAT itself. It scan all clusters registered in the FAT mapper, and copies
     954 * to device each page marked as dirty.
    910955 *
    911956 * Depending on the file system type, it calls the relevant, FS specific function.
    912957 * It can be called by a thread running in any cluster.
    913958 *****************************************************************************************
     959 * @ fs_type   : specific file system type.
    914960 * @ return 0 if success / return EIO if failure during device access.
    915961 ****************************************************************************************/
    916 error_t vfs_fs_sync_fat( void );
     962error_t vfs_fs_sync_fat( vfs_fs_type_t fs_type );
    917963
    918964/*****************************************************************************************
    919  * This function updates the free clusters info on the IOC device.
     965 * This function updates the free clusters info on the IOC device for the FS defined
     966 * by the <fs_type> argument.
    920967 *
    921968 * Depending on the file system type, it calls the relevant, FS specific function.
    922969 * It can be called by a thread running in any cluster.
    923970 *****************************************************************************************
     971 * @ fs_type   : specific file system type.
    924972 * @ return 0 if success / return EIO if failure during device access.
    925973 ****************************************************************************************/
    926 error_t vfs_fs_sync_free_info( void );
     974error_t vfs_fs_sync_free_info( vfs_fs_type_t fs_type );
    927975
    928976/******************************************************************************************
Note: See TracChangeset for help on using the changeset viewer.