Index: trunk/kernel/kern/rpc.h
===================================================================
--- trunk/kernel/kern/rpc.h	(revision 583)
+++ trunk/kernel/kern/rpc.h	(revision 601)
@@ -59,38 +59,38 @@
 typedef enum
 {
-    RPC_PMEM_GET_PAGES         = 0,
-    RPC_PMEM_RELEASE_PAGES     = 1,
-    RPC_UNDEFINED_2            = 2,      
-    RPC_PROCESS_MAKE_FORK      = 3,
-    RPC_UNDEFINED_4            = 4,
-    RPC_UNDEFINED_5            = 5,
-    RPC_THREAD_USER_CREATE     = 6,
-    RPC_THREAD_KERNEL_CREATE   = 7,
-    RPC_UNDEFINED_8            = 8,
-    RPC_PROCESS_SIGACTION      = 9,
-
-    RPC_VFS_INODE_CREATE       = 10,
-    RPC_VFS_INODE_DESTROY      = 11,
-    RPC_VFS_DENTRY_CREATE      = 12,
-    RPC_VFS_DENTRY_DESTROY     = 13,
-    RPC_VFS_FILE_CREATE        = 14,
-    RPC_VFS_FILE_DESTROY       = 15,
-    RPC_VFS_INODE_LOAD         = 16,
-    RPC_VFS_MAPPER_LOAD_ALL    = 17,
-    RPC_FATFS_GET_CLUSTER      = 18,
-    RPC_UNDEFINED_19           = 19,
-
-    RPC_VMM_GET_VSEG           = 20,
-    RPC_VMM_GLOBAL_UPDATE_PTE  = 21,
-    RPC_KCM_ALLOC              = 22,
-    RPC_KCM_FREE               = 23,
-    RPC_MAPPER_MOVE_BUFFER     = 24,
-    RPC_MAPPER_GET_PAGE        = 25,
-    RPC_VMM_CREATE_VSEG        = 26,
-    RPC_UNDEFINED_27           = 27,
-    RPC_VMM_SET_COW            = 28,
-    RPC_VMM_DISPLAY            = 29,
-
-    RPC_MAX_INDEX              = 30,
+    RPC_PMEM_GET_PAGES            = 0,
+    RPC_PMEM_RELEASE_PAGES        = 1,
+    RPC_UNDEFINED_2               = 2,      
+    RPC_PROCESS_MAKE_FORK         = 3,
+    RPC_UNDEFINED_4               = 4,
+    RPC_UNDEFINED_5               = 5,
+    RPC_THREAD_USER_CREATE        = 6,
+    RPC_THREAD_KERNEL_CREATE      = 7,
+    RPC_UNDEFINED_8               = 8,
+    RPC_PROCESS_SIGACTION         = 9,
+
+    RPC_VFS_INODE_CREATE          = 10,
+    RPC_VFS_INODE_DESTROY         = 11,
+    RPC_VFS_DENTRY_CREATE         = 12,
+    RPC_VFS_DENTRY_DESTROY        = 13,
+    RPC_VFS_FILE_CREATE           = 14,
+    RPC_VFS_FILE_DESTROY          = 15,
+    RPC_VFS_FS_CHILD_INIT         = 16,
+    RPC_VFS_FS_REMOVE_DENTRY      = 17,
+    RPC_VFS_FS_ADD_DENTRY         = 18,
+    RPC_VFS_INODE_LOAD_ALL_PAGES  = 19,
+
+    RPC_VMM_GET_VSEG              = 20,
+    RPC_VMM_GLOBAL_UPDATE_PTE     = 21,
+    RPC_KCM_ALLOC                 = 22,
+    RPC_KCM_FREE                  = 23,
+    RPC_MAPPER_MOVE_USER          = 24,
+    RPC_MAPPER_HANDLE_MISS        = 25,
+    RPC_UNDEFINED_26              = 26,
+    RPC_VMM_CREATE_VSEG           = 27,
+    RPC_VMM_SET_COW               = 28,
+    RPC_VMM_DISPLAY               = 29,
+
+    RPC_MAX_INDEX                 = 30,
 }
 rpc_index_t;
@@ -310,5 +310,4 @@
  * @ fs_type    : [in]  file system type.
  * @ inode_type : [in]  file system type.
- * @ extend     : [in]  fs_type_specific inode extension.
  * @ attr       : [in]  inode attributes.
  * @ rights     : [in]  access rights
@@ -322,5 +321,4 @@
                                   uint32_t   fs_type,
                                   uint32_t   inode_type,
-                                  void     * extend,
                                   uint32_t   attr,    
                                   uint32_t   rights,  
@@ -338,9 +336,7 @@
  * @ cxy       :  server cluster identifier
  * @ inode     : [in]  local pointer on inode.
- * @ error     : [out] error status (0 if success).
- **********************************************************************************/
-void rpc_vfs_inode_destroy_client( cxy_t                 cxy,
-                                   struct vfs_inode_s * inode,
-                                   error_t            * error );
+ **********************************************************************************/
+void rpc_vfs_inode_destroy_client( cxy_t                cxy,
+                                   struct vfs_inode_s * inode );
 
 void rpc_vfs_inode_destroy_server( xptr_t xp );
@@ -372,9 +368,7 @@
  * @ cxy       :  server cluster identifier
  * @ dentry     : [in]  local pointer on dentry.
- * @ error     : [out] error status (0 if success).
  **********************************************************************************/
 void rpc_vfs_dentry_destroy_client( cxy_t                 cxy,
-                                    struct vfs_dentry_s * dentry,
-                                    error_t             * error );
+                                    struct vfs_dentry_s * dentry );
 
 void rpc_vfs_dentry_destroy_server( xptr_t xp );
@@ -411,10 +405,10 @@
 
 /*********************************************************************************** 
- * [16] The RPC_VFS_LOAD_INODE calls the vfs_inode_load() kernel function in a
- * remote cluster containing a parent inode directory to scan the associated
- * mapper, find a directory entry, identified by its name, and update the remote
- * child inode.
- ***********************************************************************************
- * @ cxy            :  server cluster identifier
+ * [16] The RPC_VFS_FS_CHILD_INIT calls the vfs_fs_child_init_load_inode()
+ * function in a remote cluster containing a parent inode directory to scan the 
+ * associated mapper, find a directory entry identified by its name, and update
+ * both the child inode and the dentry.
+ ***********************************************************************************
+ * @ cxy            : server cluster identifier
  * @ parent_inode   : [in]  local pointer on parent inode.
  * @ name           : [in]  local pointer on child name (in client cluster).
@@ -422,51 +416,60 @@
  * @ error          : [out] error status (0 if success).
  **********************************************************************************/
-void rpc_vfs_inode_load_client( cxy_t                cxy,
-                                struct vfs_inode_s * parent_inode,
-                                char               * name,
-                                xptr_t               child_inode_xp,
-                                error_t            * error );
-
-void rpc_vfs_inode_load_server( xptr_t xp );
-
-/*********************************************************************************** 
- * [17] The RPC_VFS_MAPPER_LOAD_ALL calls the vfs_mapper_load_all() kernel function
- * in a remote cluster containing an inode, to load all pages of the associated 
- * mapper from the file system on device.
- ***********************************************************************************
- * @ cxy     :  server cluster identifier
+void rpc_vfs_fs_child_init_client( cxy_t                cxy,
+                                   struct vfs_inode_s * parent_inode,
+                                   char               * name,
+                                   xptr_t               child_inode_xp,
+                                   error_t            * error );
+
+void rpc_vfs_fs_child_init_server( xptr_t xp );
+
+/*********************************************************************************** 
+ * [17] The RPC_VFS_FS_ADD_DENTRY calls the vfs_fs_add_dentry() function in a 
+ * remote cluster containing a directory inode and mapper, to add a new dentry
+ * in the mapper of this directory.
+ ***********************************************************************************
+ * @ cxy            : server cluster identifier
+ * @ parent         : [in]  local pointer on directory inode.
+ * @ dentry         : [in]  local pointer on dentry.
+ * @ error          : [out] error status (0 if success).
+ **********************************************************************************/
+void rpc_vfs_fs_add_dentry_client( cxy_t,
+                                   struct vfs_inode_s  * parent,
+                                   struct vfs_dentry_s * dentry,
+                                   error_t             * error );
+
+void rpc_vfs_fs_add_dentry_server( xptr_t xp );
+
+/*********************************************************************************** 
+ * [18] The RPC_VFS_FS_REMOVE_DENTRY calls the vfs_fs_remove_dentry() function in a
+ * remote cluster containing a directory inode and mapper, to remove a dentry from
+ * the mapper of this directory.
+ ***********************************************************************************
+ * @ cxy            : server cluster identifier
+ * @ parent         : [in]  local pointer on directory inode.
+ * @ dentry         : [in]  local pointer on dentry.
+ * @ error          : [out] error status (0 if success).
+ **********************************************************************************/
+void rpc_vfs_fs_remove_dentry_client( cxy_t,
+                                      struct vfs_inode_s  * parent,
+                                      struct vfs_dentry_s * dentry,
+                                      error_t             * error );
+
+void rpc_vfs_fs_remove_dentry_server( xptr_t xp );
+
+/***********************************************************************************
+ * [19] The RPC_VFS_INODE_LOAD_ALL_PAGES calls the vfs_inode_load_all_pages()
+ * function a remote cluster containing an inode to load all pages in the
+ * associated mapper.  
+ ***********************************************************************************
+ * @ cxy     : server cluster identifier
  * @ inode   : [in]  local pointer on inode in server cluster.
  * @ error   : [out] error status (0 if success).
  **********************************************************************************/
-void rpc_vfs_mapper_load_all_client( cxy_t                cxy,
-                                     struct vfs_inode_s * inode,
-                                     error_t            * error );
-
-void rpc_vfs_mapper_load_all_server( xptr_t xp );
-
-/***********************************************************************************
- * [18] The RPC_FATFS_GET_CLUSTER can be send by any thread running in a "client" 
- * cluster to scan the FAT mapper, stored in a remote "server" cluster, and get 
- * from the mapper the local pointer on a given page.
- ***********************************************************************************
- * @ cxy      : server cluster identifier.
- * @ mapper   : [in]  local pointer on FAT mapper.
- * @ first    : [in]  FATFS cluster index allocated to first page of file.
- * @ page     : [in]  page index in file.
- * @ cluster  : [out] local pointer on buffer for found FATFS cluster index.
- * @ error    : [out] local pointer on buffer for error code (in client cluster). 
- **********************************************************************************/
-void rpc_fatfs_get_cluster_client( cxy_t             cxy,
-                                   struct mapper_s * mapper,
-                                   uint32_t          first,
-                                   uint32_t          page,
-                                   uint32_t        * cluster,
-                                   error_t         * error );    
-
-void rpc_fatfs_get_cluster_server( xptr_t xp );
-
-/***********************************************************************************
- * [19] undefined slot
- **********************************************************************************/
+void rpc_vfs_inode_load_all_pages_client( cxy_t                cxy,
+                                          struct vfs_inode_s * inode,
+                                          error_t            * error );
+
+void rpc_vfs_inode_load_all_pages_server( xptr_t xp );
 
 /***********************************************************************************
@@ -543,55 +546,53 @@
 
 /***********************************************************************************
- * [24] The RPC_MAPPER_MOVE_BUFFER allows a client thread to require a remote
- * mapper to move data to/from a kernel or user buffer.
- * - It calls the mapper_move_user() function for a - possibly distributed -
- *   user buffer identified by a user-space pointer, and casted to uint64_t.
- * - It calls the mapper_move_kernel() function for a - possibly remote -
- *   kernel buffer identified by an extended pointer, and casted to uint64_t.
+ * [24] The RPC_MAPPER_MOVE_USER allows a client thread to require a remote
+ * mapper to move data to/from a distributed user buffer.
  * It is used by the vfs_move_user() function to move data between a mapper
  * and an user buffer required by a sys_read() or a sys_write().
- * It is used by the vmm_get_one_ppn() function to initialise a physical page
- * from a .elf file mapper, for a CODE or DATA vseg page fault.
- ***********************************************************************************
- * @ cxy         : server cluster identifier.
- * @ mapper      : [in]  local pointer on mapper
- * @ to_buffer   : [in]  move data from mapper to buffer if non zero.
- * @ is_user     : [in]  buffer in user space if true
- * @ file_offset : [in]  first byte to move in mapper 
- * @ buffer      : [in]  user space pointer / kernel extended pointer
- * @ size        : [in]  number of bytes to move
- * @ error       : [out] error status (0 if success).
- **********************************************************************************/
-void rpc_mapper_move_buffer_client( cxy_t             cxy,
-                                    struct mapper_s * mapper,
-                                    bool_t            to_buffer,
-                                    bool_t            is_user,
-                                    uint32_t          file_offset,
-                                    uint64_t          buffer,
-                                    uint32_t          size,
-                                    error_t         * error );
-
-void rpc_mapper_move_buffer_server( xptr_t xp );
-
-/***********************************************************************************
- * [25] The RPC_MAPPER_GET_PAGE allows a client thread to get the local pointer
- * on a remote page descriptor, for a page, identified by the page index in mapper.
- * It is used by the vmm_get_one_ppn() function to handle a page fault on 
- * a FILE type vseg.
  ***********************************************************************************
  * @ cxy         : server cluster identifier.
  * @ mapper      : [in]  local pointer on mapper.
- * @ index       : [in]  page index in mapper.
- * @ page        : [out] local pointer on page descriptor / NULL if failure.
- **********************************************************************************/
-void rpc_mapper_get_page_client( cxy_t             cxy,
-                                 struct mapper_s * mapper,
-                                 uint32_t          index,
-                                 struct page_s  ** page );
-
-void rpc_mapper_get_page_server( xptr_t xp );
-
-/***********************************************************************************
- * [26] The RPC_VMM_CREATE_VSEG allows a client thread to request the remote 
+ * @ to_buffer   : [in]  move data from mapper to buffer if non zero.
+ * @ file_offset : [in]  first byte to move in mapper.
+ * @ buffer      : [in]  user space buffer pointer.
+ * @ size        : [in]  number of bytes to move.
+ * @ error       : [out] error status (0 if success).
+ **********************************************************************************/
+void rpc_mapper_move_user_client( cxy_t             cxy,
+                                  struct mapper_s * mapper,
+                                  bool_t            to_buffer,
+                                  uint32_t          file_offset,
+                                  void            * buffer,
+                                  uint32_t          size,
+                                  error_t         * error );
+
+void rpc_mapper_move_user_server( xptr_t xp );
+
+/***********************************************************************************
+ * [25] The RPC__MAPPER_HANDLE_MISS allows a client thread to request a remote
+ * mapper to load a missing page from the IOC device.
+ * On the server side, this RPC call the mapper_handle_miss() function and return
+ * an extended pointer on the allocated page descriptor and an error status.
+ * @ cxy         : server cluster identifier.
+ * @ mapper      : [in]  local pointer on mapper.
+ * @ page_id     : [in]  missing page index in mapper 
+ * @ buffer      : [in]  user space pointer / kernel extended pointer
+ * @ page_xp     : [out] pointer on buffer for extended pointer on page descriptor.
+ * @ error       : [out] error status (0 if success).
+ **********************************************************************************/
+void rpc_mapper_handle_miss_client( cxy_t             cxy,
+                                    struct mapper_s * mapper,
+                                    uint32_t          page_id,
+                                    xptr_t          * page_xp,
+                                    error_t         * error );
+ 
+void rpc_mapper_handle_miss_server( xptr_t xp );
+
+/***********************************************************************************
+ * [26] undefined slot
+ **********************************************************************************/
+
+/***********************************************************************************
+ * [27] The RPC_VMM_CREATE_VSEG allows a client thread to request the remote 
  * reference cluster of a given process to allocate and register in the reference
  * process VMM a new vseg descriptor.
@@ -624,8 +625,4 @@
 
 /***********************************************************************************
- * [27] undefined slot
- **********************************************************************************/
-
-/***********************************************************************************
  * [28] The RPC_VMM_SET_COW allows a client thread to request the remote reference
  * cluster to set the COW flag and reset the WRITABLE flag of all GPT entries for
