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


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

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

File:
1 edited

Legend:

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

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