Changeset 23 for trunk/kernel/vfs/ramfs.h
- Timestamp:
- Jun 18, 2017, 10:06:41 PM (6 years ago)
- File:
-
- 1 copied
Legend:
- Unmodified
- Added
- Removed
-
trunk/kernel/vfs/ramfs.h
r15 r23 2 2 * ramfs.h RAMFS file system API definition. 3 3 * 4 * Authors Mohamed Lamine Karaoui (201 5)5 * Alain Greiner (2016 )4 * Authors Mohamed Lamine Karaoui (2014,2015) 5 * Alain Greiner (2016,2017) 6 6 * 7 7 * Copyright (c) UPMC Sorbonne Universites … … 26 26 #define _RAMFS_H_ 27 27 28 /////////////////////////////////////////////////////////////////////////////////////////// 29 // The RAMFS File System Rdoes not uses any external device to store data. 30 // It stores the dynamically created files and directories in the VFS mappers. 31 // The ramfs_read_page() and ramfs_write_page() functions should never be used. 32 // The RAMFS cannot be used as the root FS. 33 // There is no RAMFS context extension, and no RAMFS inode extension. 34 /////////////////////////////////////////////////////////////////////////////////////////// 35 36 28 37 /**** Forward declarations ****/ 29 38 30 struct vfs_inode_s; 31 struct page_s; 39 40 ////////////////////////////////////////////////////////////////////////////////////////// 41 // These functions are called by the VFS, and must be implemented by all FS. 42 ////////////////////////////////////////////////////////////////////////////////////////// 43 44 /****************************************************************************************** 45 * This function does not exist, as the RAMFS cannot be the root FS. 46 *****************************************************************************************/ 47 xptr_t ramfs_init(); 48 49 /****************************************************************************************** 50 * This function mount a RAMFS on a given inode of the root FS. 51 * It actually creates a new VFS dentry in the cluster containing the parent inode, 52 * and create a new VFS inode in another cluster. 53 ****************************************************************************************** 54 * @ parent_inode_xp : extended pointer on the parent inode. 55 * @ ramfs_root_name : RAMFS root directory name. 56 *****************************************************************************************/ 57 error_t ramfs_mount( xptr_t parent_inode_xp, 58 char * ramfs_root_name ); 32 59 33 60 /***************************************************************************************** 34 * This structure defines a RAMFS specific context extension. 61 * This function initializes all fields of the VFS context. 62 * No extra memory is allocated for a RAMFS context. 35 63 ****************************************************************************************/ 36 37 typedef struct ramfs_ctx_s 38 { 39 intptr_t base; 40 rwlock_t size; 41 } 42 ramfs_ctx_t; 64 error_t ramfs_ctx_init( struct vfs_ctx_s * vfs_ctx, 65 xptr_t root_inode_xp ); 43 66 44 67 /***************************************************************************************** 45 * This structure defines the RAMFS inode specific extension (versus the VFS inode).68 * This function does not exist for a RAMFS context, as there is no RAMFS context. 46 69 ****************************************************************************************/ 47 48 typedef struct ramfs_inode_s 49 { 50 struct vfs_inode_s * vfs_inode; /*! local pointer on VFS inode */ 51 } 52 ramfs_inode_t; 53 54 55 70 error_t ramfs_ctx_destroy(); 56 71 57 72 /***************************************************************************************** 58 * This function allocates memory for a RAMFS inode, and link it to the VFS inode. 59 ***************************************************************************************** 60 * @ inode : local pointer on vfs_inode. 61 * @ return 0 if success / return ENOMEM if error. 73 * This function does not exist, as the RAMFS does not use a RAMFS inode extension. 62 74 ****************************************************************************************/ 63 75 error_t ramfs_inode_create( struct vfs_inode_s * inode ); 64 76 65 77 /***************************************************************************************** 66 * This function releases memory allocated for a RAMFS inode. 67 ***************************************************************************************** 68 * @ inode : local pointer on vfs_inode. 78 * This function does not exist, as the RAMFS does not use a RAMFS inode extension. 69 79 ****************************************************************************************/ 70 80 void ramfs_inode_destroy( struct vfs_inode_s * inode ); 71 81 72 82 /***************************************************************************************** 73 * This function moves a page from the mapper to the RAMFS file system. 74 * It must be called by a thread running in cluster containing the mapper. 75 * The pointer on the mapper and the page index in file are supposed to be registered 76 * in the page descriptor. 77 ****************************************************************************************** 78 * @ page : local pointer on source page descriptor. 79 * @ return 0 if success / return EIO if error. 83 * This function does nothing for the RAMFS File System. 80 84 ****************************************************************************************/ 81 error_t ramfs_write_page( struct page_s 85 error_t ramfs_write_page( struct page_s * page ); 82 86 83 87 /***************************************************************************************** 84 * This function moves a page from the RAMFS file system to the mapper. 85 * It must be called by a thread running in cluster containing the mapper. 86 * The pointer on the mapper and the page index in file are supposed to be registered 87 * in the page descriptor. 88 ***************************************************************************************** 89 * @ page : local pointer on destination page descriptor. 90 * @ return 0 if success / return EIO if error. 88 * This function does not exist for the RAMFS File System. 91 89 ****************************************************************************************/ 92 error_t ramfs_read_page( struct page_s 90 error_t ramfs_read_page( struct page_s * page ); 93 91 94 92 95 96 93 #endif /* _RAMFS_H_ */
Note: See TracChangeset
for help on using the changeset viewer.