Index: trunk/kernel/vfs/fatfs.h
===================================================================
--- trunk/kernel/vfs/fatfs.h	(revision 188)
+++ trunk/kernel/vfs/fatfs.h	(revision 238)
@@ -33,4 +33,14 @@
 ///////////////////////////////////////////////////////////////////////////////////////////
 // The FATFS File System implements a FAT32 read/write file system.
+//
+// The FATFS extensions to the generic VFS are the following:
+// 1) The vfs_ctx_t "extend" field is a void* pointing on the fatfs_ctx_t structure.
+//    This structure contains various general informations such as the total
+//    number of sectors in FAT region, the number of bytes per sector, the number 
+//    of sectors per cluster, the lba of FAT region, the lba of data region, or the
+//    cluster index for the root directory. It contains also an extended pointer
+//    on the FAT mapper.
+// 2) The vfs_inode_t "extend" field is a void*, but contains for each inode,
+//    the first FAT cluster index (after cast to intptr).
 ///////////////////////////////////////////////////////////////////////////////////////////
 
@@ -173,4 +183,34 @@
 
 //////////////////////////////////////////////////////////////////////////////////////////
+//              FATFS specific but public functions (used by RPC) 
+//////////////////////////////////////////////////////////////////////////////////////////
+
+/******************************************************************************************
+ * This static function scan the FAT (File Allocation Table), stored in the FAT mapper,
+ * and returns the FATFS cluster index for a given page of a given file.
+ * It must be called by a thread running in the cluster containing the FAT mapper.
+ * The FAT is actually an array of uint32_t slots. Each slot in this array contains the 
+ * index of another slot in this array, to form one linked list for each file stored on
+ * device in the FATFS file system. This index in the FAT array is also the index of the
+ * FATFS cluster on the device. One FATFS cluster is supposed to contain one PPM page. 
+ * For a given file, the entry point in the FAT is simply the index of the FATFS cluster 
+ * containing the first page of the file. The mapper being a cache, this function 
+ * automatically updates the FAT mapper from informations stored on device in case of miss.
+ ******************************************************************************************
+ * @ mapper	         : local pointer on the FAT mapper.
+ * @ first_cluster	 : index of the first FATFS cluster allocated to the file.
+ * @ searched_page   : index of searched page in the file.
+ * @ cluster         : [out] pointer on buffer for the found FATFS cluster index.
+ * @ return 0 if success / return EIO if FAT mapper miss cannot be solved.
+ *****************************************************************************************/
+error_t fatfs_get_cluster( struct mapper_s * mapper,
+                           uint32_t          first_cluster,
+                           uint32_t          searched_page,
+                           uint32_t        * cluster );
+
+
+
+
+//////////////////////////////////////////////////////////////////////////////////////////
 // Generic API: These functions are called by the kernel,
 //              and must be implemented by all File Systems.
@@ -185,5 +225,5 @@
 
 /*****************************************************************************************
- * This function access the external boot device, and initialises it
+ * This function access the boot device, and initialises the FATFS context
  * from informations contained in the boot record. 
  *****************************************************************************************
@@ -200,48 +240,32 @@
 
 /*****************************************************************************************
- * This function moves a page from the mapper to the FATFS file system on device.
+ * This function moves a page from/to the mapper to/from the FATFS file system on device.
  * It must be called by a thread running in cluster containing the mapper.
  * The pointer on the mapper and the page index in file are registered
  * in the page descriptor. 
  *****************************************************************************************
- * @ page    : local pointer on page descriptor.
+ * @ page      : local pointer on page descriptor.
+ * @ to_mapper : transfer direction
  * @ return 0 if success / return EIO if error. 
  ****************************************************************************************/
-error_t fatfs_write_page( struct page_s * page );
-
-/*****************************************************************************************
- * This function moves a page from the FATFS file system on device to the mapper.
- * It must be called by a thread running in cluster containing the mapper.
- * The pointer on the mapper and the page index in file are registered
- * in the page descriptor. 
- *****************************************************************************************
- * @ page    : local pointer on page descriptor.
- * @ return 0 if success / return EIO if error. 
- ****************************************************************************************/
-error_t fatfs_read_page( struct page_s * page );
-
-/*****************************************************************************************
- * This function scan the FAT (File Allocation Table), stored in the FAT mapper,
- * and return the FATFS cluster index for a given page of a given file.
- * It must be called by a thread running in the cluster containing the FAT mapper
- * (can be a local thread or a RPC thread).
- * The FAT is actually an array of uint32_t slots. Each slot in this array contains the 
- * index of another slot in this array, to form one linked list for each file stored on
- * device in the RAMFS file system. This index in the FAT array is also the index of the
- * FATFS cluster on the device. One FATFS cluster is supposed to contain one PPM page. 
- * For a given file, the entry point in the FAT is simply the index of the FATFS cluster 
- * containing the first page of the file. The mapper being a cache, this function 
- * automatically updates the FAT mapper from informations stored on device in case of miss.
- *****************************************************************************************
- * @ mapper	         : local pointer on the FAT mapper.
- * @ first_cluster	 : index of the first FATFS cluster allocated to the file.
- * @ searched_page   : index of searched page in the file.
- * @ cluster         : [out] pointer on buffer for the found FATFS cluster index.
- * @ return 0 if success / return EIO if FAT mapper miss cannot be solved.
- ****************************************************************************************/
-error_t fatfs_get_cluster( struct mapper_s * mapper,
-                           uint32_t          first_cluster,
-                           uint32_t          searched_page,
-                           uint32_t *        cluster );
+error_t fatfs_move_page( struct page_s * page,
+                         bool_t          to_mapper );
+
+
+/*****************************************************************************************
+ * This function scan an existing parent directory, identified by the <parent> argument,
+ * to find a directory entry identified by the <name> argument and update the remote
+ * child inode, identified by the <child_xp> argument.
+ * It set the "type", "size", and "extend" (FAT cluster index) fields in child inode.
+ * It must be called by a thread running in the cluster containing the parent inode.
+ *****************************************************************************************
+ * @ parent_inode    : local pointer on parent inode (directory).
+ * @ name            : child name.
+ * @ child_inode_xp  : extended pointer on remote child inode (file or directory).
+ * @ return 0 if success / return ENOENT if child not found.
+ ****************************************************************************************/
+error_t fatfs_inode_load( struct vfs_inode_s * parent_inode,
+                          char               * name,
+                          xptr_t               child_inode_xp );
 
 #endif	/* _FATFS_H_ */
