Ignore:
Timestamp:
Dec 3, 2018, 12:15:01 PM (5 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/kern/rpc.h

    r583 r601  
    5959typedef enum
    6060{
    61     RPC_PMEM_GET_PAGES         = 0,
    62     RPC_PMEM_RELEASE_PAGES     = 1,
    63     RPC_UNDEFINED_2            = 2,     
    64     RPC_PROCESS_MAKE_FORK      = 3,
    65     RPC_UNDEFINED_4            = 4,
    66     RPC_UNDEFINED_5            = 5,
    67     RPC_THREAD_USER_CREATE     = 6,
    68     RPC_THREAD_KERNEL_CREATE   = 7,
    69     RPC_UNDEFINED_8            = 8,
    70     RPC_PROCESS_SIGACTION      = 9,
    71 
    72     RPC_VFS_INODE_CREATE       = 10,
    73     RPC_VFS_INODE_DESTROY      = 11,
    74     RPC_VFS_DENTRY_CREATE      = 12,
    75     RPC_VFS_DENTRY_DESTROY     = 13,
    76     RPC_VFS_FILE_CREATE        = 14,
    77     RPC_VFS_FILE_DESTROY       = 15,
    78     RPC_VFS_INODE_LOAD         = 16,
    79     RPC_VFS_MAPPER_LOAD_ALL    = 17,
    80     RPC_FATFS_GET_CLUSTER      = 18,
    81     RPC_UNDEFINED_19           = 19,
    82 
    83     RPC_VMM_GET_VSEG           = 20,
    84     RPC_VMM_GLOBAL_UPDATE_PTE  = 21,
    85     RPC_KCM_ALLOC              = 22,
    86     RPC_KCM_FREE               = 23,
    87     RPC_MAPPER_MOVE_BUFFER     = 24,
    88     RPC_MAPPER_GET_PAGE        = 25,
    89     RPC_VMM_CREATE_VSEG        = 26,
    90     RPC_UNDEFINED_27           = 27,
    91     RPC_VMM_SET_COW            = 28,
    92     RPC_VMM_DISPLAY            = 29,
    93 
    94     RPC_MAX_INDEX              = 30,
     61    RPC_PMEM_GET_PAGES            = 0,
     62    RPC_PMEM_RELEASE_PAGES        = 1,
     63    RPC_UNDEFINED_2               = 2,     
     64    RPC_PROCESS_MAKE_FORK         = 3,
     65    RPC_UNDEFINED_4               = 4,
     66    RPC_UNDEFINED_5               = 5,
     67    RPC_THREAD_USER_CREATE        = 6,
     68    RPC_THREAD_KERNEL_CREATE      = 7,
     69    RPC_UNDEFINED_8               = 8,
     70    RPC_PROCESS_SIGACTION         = 9,
     71
     72    RPC_VFS_INODE_CREATE          = 10,
     73    RPC_VFS_INODE_DESTROY         = 11,
     74    RPC_VFS_DENTRY_CREATE         = 12,
     75    RPC_VFS_DENTRY_DESTROY        = 13,
     76    RPC_VFS_FILE_CREATE           = 14,
     77    RPC_VFS_FILE_DESTROY          = 15,
     78    RPC_VFS_FS_CHILD_INIT         = 16,
     79    RPC_VFS_FS_REMOVE_DENTRY      = 17,
     80    RPC_VFS_FS_ADD_DENTRY         = 18,
     81    RPC_VFS_INODE_LOAD_ALL_PAGES  = 19,
     82
     83    RPC_VMM_GET_VSEG              = 20,
     84    RPC_VMM_GLOBAL_UPDATE_PTE     = 21,
     85    RPC_KCM_ALLOC                 = 22,
     86    RPC_KCM_FREE                  = 23,
     87    RPC_MAPPER_MOVE_USER          = 24,
     88    RPC_MAPPER_HANDLE_MISS        = 25,
     89    RPC_UNDEFINED_26              = 26,
     90    RPC_VMM_CREATE_VSEG           = 27,
     91    RPC_VMM_SET_COW               = 28,
     92    RPC_VMM_DISPLAY               = 29,
     93
     94    RPC_MAX_INDEX                 = 30,
    9595}
    9696rpc_index_t;
     
    310310 * @ fs_type    : [in]  file system type.
    311311 * @ inode_type : [in]  file system type.
    312  * @ extend     : [in]  fs_type_specific inode extension.
    313312 * @ attr       : [in]  inode attributes.
    314313 * @ rights     : [in]  access rights
     
    322321                                  uint32_t   fs_type,
    323322                                  uint32_t   inode_type,
    324                                   void     * extend,
    325323                                  uint32_t   attr,   
    326324                                  uint32_t   rights, 
     
    338336 * @ cxy       :  server cluster identifier
    339337 * @ inode     : [in]  local pointer on inode.
    340  * @ error     : [out] error status (0 if success).
    341  **********************************************************************************/
    342 void rpc_vfs_inode_destroy_client( cxy_t                 cxy,
    343                                    struct vfs_inode_s * inode,
    344                                    error_t            * error );
     338 **********************************************************************************/
     339void rpc_vfs_inode_destroy_client( cxy_t                cxy,
     340                                   struct vfs_inode_s * inode );
    345341
    346342void rpc_vfs_inode_destroy_server( xptr_t xp );
     
    372368 * @ cxy       :  server cluster identifier
    373369 * @ dentry     : [in]  local pointer on dentry.
    374  * @ error     : [out] error status (0 if success).
    375370 **********************************************************************************/
    376371void rpc_vfs_dentry_destroy_client( cxy_t                 cxy,
    377                                     struct vfs_dentry_s * dentry,
    378                                     error_t             * error );
     372                                    struct vfs_dentry_s * dentry );
    379373
    380374void rpc_vfs_dentry_destroy_server( xptr_t xp );
     
    411405
    412406/***********************************************************************************
    413  * [16] The RPC_VFS_LOAD_INODE calls the vfs_inode_load() kernel function in a
    414  * remote cluster containing a parent inode directory to scan the associated
    415  * mapper, find a directory entry, identified by its name, and update the remote
    416  * child inode.
    417  ***********************************************************************************
    418  * @ cxy            :  server cluster identifier
     407 * [16] The RPC_VFS_FS_CHILD_INIT calls the vfs_fs_child_init_load_inode()
     408 * function in a remote cluster containing a parent inode directory to scan the
     409 * associated mapper, find a directory entry identified by its name, and update
     410 * both the child inode and the dentry.
     411 ***********************************************************************************
     412 * @ cxy            : server cluster identifier
    419413 * @ parent_inode   : [in]  local pointer on parent inode.
    420414 * @ name           : [in]  local pointer on child name (in client cluster).
     
    422416 * @ error          : [out] error status (0 if success).
    423417 **********************************************************************************/
    424 void rpc_vfs_inode_load_client( cxy_t                cxy,
    425                                 struct vfs_inode_s * parent_inode,
    426                                 char               * name,
    427                                 xptr_t               child_inode_xp,
    428                                 error_t            * error );
    429 
    430 void rpc_vfs_inode_load_server( xptr_t xp );
    431 
    432 /***********************************************************************************
    433  * [17] The RPC_VFS_MAPPER_LOAD_ALL calls the vfs_mapper_load_all() kernel function
    434  * in a remote cluster containing an inode, to load all pages of the associated
    435  * mapper from the file system on device.
    436  ***********************************************************************************
    437  * @ cxy     :  server cluster identifier
     418void rpc_vfs_fs_child_init_client( cxy_t                cxy,
     419                                   struct vfs_inode_s * parent_inode,
     420                                   char               * name,
     421                                   xptr_t               child_inode_xp,
     422                                   error_t            * error );
     423
     424void rpc_vfs_fs_child_init_server( xptr_t xp );
     425
     426/***********************************************************************************
     427 * [17] The RPC_VFS_FS_ADD_DENTRY calls the vfs_fs_add_dentry() function in a
     428 * remote cluster containing a directory inode and mapper, to add a new dentry
     429 * in the mapper of this directory.
     430 ***********************************************************************************
     431 * @ cxy            : server cluster identifier
     432 * @ parent         : [in]  local pointer on directory inode.
     433 * @ dentry         : [in]  local pointer on dentry.
     434 * @ error          : [out] error status (0 if success).
     435 **********************************************************************************/
     436void rpc_vfs_fs_add_dentry_client( cxy_t,
     437                                   struct vfs_inode_s  * parent,
     438                                   struct vfs_dentry_s * dentry,
     439                                   error_t             * error );
     440
     441void rpc_vfs_fs_add_dentry_server( xptr_t xp );
     442
     443/***********************************************************************************
     444 * [18] The RPC_VFS_FS_REMOVE_DENTRY calls the vfs_fs_remove_dentry() function in a
     445 * remote cluster containing a directory inode and mapper, to remove a dentry from
     446 * the mapper of this directory.
     447 ***********************************************************************************
     448 * @ cxy            : server cluster identifier
     449 * @ parent         : [in]  local pointer on directory inode.
     450 * @ dentry         : [in]  local pointer on dentry.
     451 * @ error          : [out] error status (0 if success).
     452 **********************************************************************************/
     453void rpc_vfs_fs_remove_dentry_client( cxy_t,
     454                                      struct vfs_inode_s  * parent,
     455                                      struct vfs_dentry_s * dentry,
     456                                      error_t             * error );
     457
     458void rpc_vfs_fs_remove_dentry_server( xptr_t xp );
     459
     460/***********************************************************************************
     461 * [19] The RPC_VFS_INODE_LOAD_ALL_PAGES calls the vfs_inode_load_all_pages()
     462 * function a remote cluster containing an inode to load all pages in the
     463 * associated mapper. 
     464 ***********************************************************************************
     465 * @ cxy     : server cluster identifier
    438466 * @ inode   : [in]  local pointer on inode in server cluster.
    439467 * @ error   : [out] error status (0 if success).
    440468 **********************************************************************************/
    441 void rpc_vfs_mapper_load_all_client( cxy_t                cxy,
    442                                      struct vfs_inode_s * inode,
    443                                      error_t            * error );
    444 
    445 void rpc_vfs_mapper_load_all_server( xptr_t xp );
    446 
    447 /***********************************************************************************
    448  * [18] The RPC_FATFS_GET_CLUSTER can be send by any thread running in a "client"
    449  * cluster to scan the FAT mapper, stored in a remote "server" cluster, and get
    450  * from the mapper the local pointer on a given page.
    451  ***********************************************************************************
    452  * @ cxy      : server cluster identifier.
    453  * @ mapper   : [in]  local pointer on FAT mapper.
    454  * @ first    : [in]  FATFS cluster index allocated to first page of file.
    455  * @ page     : [in]  page index in file.
    456  * @ cluster  : [out] local pointer on buffer for found FATFS cluster index.
    457  * @ error    : [out] local pointer on buffer for error code (in client cluster).
    458  **********************************************************************************/
    459 void rpc_fatfs_get_cluster_client( cxy_t             cxy,
    460                                    struct mapper_s * mapper,
    461                                    uint32_t          first,
    462                                    uint32_t          page,
    463                                    uint32_t        * cluster,
    464                                    error_t         * error );   
    465 
    466 void rpc_fatfs_get_cluster_server( xptr_t xp );
    467 
    468 /***********************************************************************************
    469  * [19] undefined slot
    470  **********************************************************************************/
     469void rpc_vfs_inode_load_all_pages_client( cxy_t                cxy,
     470                                          struct vfs_inode_s * inode,
     471                                          error_t            * error );
     472
     473void rpc_vfs_inode_load_all_pages_server( xptr_t xp );
    471474
    472475/***********************************************************************************
     
    543546
    544547/***********************************************************************************
    545  * [24] The RPC_MAPPER_MOVE_BUFFER allows a client thread to require a remote
    546  * mapper to move data to/from a kernel or user buffer.
    547  * - It calls the mapper_move_user() function for a - possibly distributed -
    548  *   user buffer identified by a user-space pointer, and casted to uint64_t.
    549  * - It calls the mapper_move_kernel() function for a - possibly remote -
    550  *   kernel buffer identified by an extended pointer, and casted to uint64_t.
     548 * [24] The RPC_MAPPER_MOVE_USER allows a client thread to require a remote
     549 * mapper to move data to/from a distributed user buffer.
    551550 * It is used by the vfs_move_user() function to move data between a mapper
    552551 * and an user buffer required by a sys_read() or a sys_write().
    553  * It is used by the vmm_get_one_ppn() function to initialise a physical page
    554  * from a .elf file mapper, for a CODE or DATA vseg page fault.
    555  ***********************************************************************************
    556  * @ cxy         : server cluster identifier.
    557  * @ mapper      : [in]  local pointer on mapper
    558  * @ to_buffer   : [in]  move data from mapper to buffer if non zero.
    559  * @ is_user     : [in]  buffer in user space if true
    560  * @ file_offset : [in]  first byte to move in mapper
    561  * @ buffer      : [in]  user space pointer / kernel extended pointer
    562  * @ size        : [in]  number of bytes to move
    563  * @ error       : [out] error status (0 if success).
    564  **********************************************************************************/
    565 void rpc_mapper_move_buffer_client( cxy_t             cxy,
    566                                     struct mapper_s * mapper,
    567                                     bool_t            to_buffer,
    568                                     bool_t            is_user,
    569                                     uint32_t          file_offset,
    570                                     uint64_t          buffer,
    571                                     uint32_t          size,
    572                                     error_t         * error );
    573 
    574 void rpc_mapper_move_buffer_server( xptr_t xp );
    575 
    576 /***********************************************************************************
    577  * [25] The RPC_MAPPER_GET_PAGE allows a client thread to get the local pointer
    578  * on a remote page descriptor, for a page, identified by the page index in mapper.
    579  * It is used by the vmm_get_one_ppn() function to handle a page fault on
    580  * a FILE type vseg.
    581552 ***********************************************************************************
    582553 * @ cxy         : server cluster identifier.
    583554 * @ mapper      : [in]  local pointer on mapper.
    584  * @ index       : [in]  page index in mapper.
    585  * @ page        : [out] local pointer on page descriptor / NULL if failure.
    586  **********************************************************************************/
    587 void rpc_mapper_get_page_client( cxy_t             cxy,
    588                                  struct mapper_s * mapper,
    589                                  uint32_t          index,
    590                                  struct page_s  ** page );
    591 
    592 void rpc_mapper_get_page_server( xptr_t xp );
    593 
    594 /***********************************************************************************
    595  * [26] The RPC_VMM_CREATE_VSEG allows a client thread to request the remote
     555 * @ to_buffer   : [in]  move data from mapper to buffer if non zero.
     556 * @ file_offset : [in]  first byte to move in mapper.
     557 * @ buffer      : [in]  user space buffer pointer.
     558 * @ size        : [in]  number of bytes to move.
     559 * @ error       : [out] error status (0 if success).
     560 **********************************************************************************/
     561void rpc_mapper_move_user_client( cxy_t             cxy,
     562                                  struct mapper_s * mapper,
     563                                  bool_t            to_buffer,
     564                                  uint32_t          file_offset,
     565                                  void            * buffer,
     566                                  uint32_t          size,
     567                                  error_t         * error );
     568
     569void rpc_mapper_move_user_server( xptr_t xp );
     570
     571/***********************************************************************************
     572 * [25] The RPC__MAPPER_HANDLE_MISS allows a client thread to request a remote
     573 * mapper to load a missing page from the IOC device.
     574 * On the server side, this RPC call the mapper_handle_miss() function and return
     575 * an extended pointer on the allocated page descriptor and an error status.
     576 * @ cxy         : server cluster identifier.
     577 * @ mapper      : [in]  local pointer on mapper.
     578 * @ page_id     : [in]  missing page index in mapper
     579 * @ buffer      : [in]  user space pointer / kernel extended pointer
     580 * @ page_xp     : [out] pointer on buffer for extended pointer on page descriptor.
     581 * @ error       : [out] error status (0 if success).
     582 **********************************************************************************/
     583void rpc_mapper_handle_miss_client( cxy_t             cxy,
     584                                    struct mapper_s * mapper,
     585                                    uint32_t          page_id,
     586                                    xptr_t          * page_xp,
     587                                    error_t         * error );
     588 
     589void rpc_mapper_handle_miss_server( xptr_t xp );
     590
     591/***********************************************************************************
     592 * [26] undefined slot
     593 **********************************************************************************/
     594
     595/***********************************************************************************
     596 * [27] The RPC_VMM_CREATE_VSEG allows a client thread to request the remote
    596597 * reference cluster of a given process to allocate and register in the reference
    597598 * process VMM a new vseg descriptor.
     
    624625
    625626/***********************************************************************************
    626  * [27] undefined slot
    627  **********************************************************************************/
    628 
    629 /***********************************************************************************
    630627 * [28] The RPC_VMM_SET_COW allows a client thread to request the remote reference
    631628 * cluster to set the COW flag and reset the WRITABLE flag of all GPT entries for
Note: See TracChangeset for help on using the changeset viewer.