1 | /* |
---|
2 | * ramfs.h RAMFS file system API definition. |
---|
3 | * |
---|
4 | * Authors Mohamed Lamine Karaoui (2014,2015) |
---|
5 | * Alain Greiner (2016,2017) |
---|
6 | * |
---|
7 | * Copyright (c) UPMC Sorbonne Universites |
---|
8 | * |
---|
9 | * This file is part of ALMOS-MKH. |
---|
10 | * |
---|
11 | * ALMOS-MKH is free software; you can redistribute it and/or modify it |
---|
12 | * under the terms of the GNU General Public License as published by |
---|
13 | * the Free Software Foundation; version 2.0 of the License. |
---|
14 | * |
---|
15 | * ALMOS-MKH is distributed in the hope that it will be useful, but |
---|
16 | * WITHOUT ANY WARRANTY; without even the implied warranty of |
---|
17 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
---|
18 | * General Public License for more details. |
---|
19 | * |
---|
20 | * You should have received a copy of the GNU General Public License |
---|
21 | * along with ALMOS-MKH; if not, write to the Free Software Foundation, |
---|
22 | * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA |
---|
23 | */ |
---|
24 | |
---|
25 | #ifndef _RAMFS_H_ |
---|
26 | #define _RAMFS_H_ |
---|
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 | |
---|
37 | /**** Forward declarations ****/ |
---|
38 | |
---|
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 ); |
---|
59 | |
---|
60 | /***************************************************************************************** |
---|
61 | * This function initializes all fields of the VFS context. |
---|
62 | * No extra memory is allocated for a RAMFS context. |
---|
63 | ****************************************************************************************/ |
---|
64 | error_t ramfs_ctx_init( struct vfs_ctx_s * vfs_ctx, |
---|
65 | xptr_t root_inode_xp ); |
---|
66 | |
---|
67 | /***************************************************************************************** |
---|
68 | * This function does not exist for a RAMFS context, as there is no RAMFS context. |
---|
69 | ****************************************************************************************/ |
---|
70 | error_t ramfs_ctx_destroy(); |
---|
71 | |
---|
72 | /***************************************************************************************** |
---|
73 | * This function does not exist, as the RAMFS does not use a RAMFS inode extension. |
---|
74 | ****************************************************************************************/ |
---|
75 | error_t ramfs_inode_create( struct vfs_inode_s * inode ); |
---|
76 | |
---|
77 | /***************************************************************************************** |
---|
78 | * This function does not exist, as the RAMFS does not use a RAMFS inode extension. |
---|
79 | ****************************************************************************************/ |
---|
80 | void ramfs_inode_destroy( struct vfs_inode_s * inode ); |
---|
81 | |
---|
82 | /***************************************************************************************** |
---|
83 | * This function does nothing for the RAMFS File System. |
---|
84 | ****************************************************************************************/ |
---|
85 | error_t ramfs_write_page( struct page_s * page ); |
---|
86 | |
---|
87 | /***************************************************************************************** |
---|
88 | * This function does not exist for the RAMFS File System. |
---|
89 | ****************************************************************************************/ |
---|
90 | error_t ramfs_read_page( struct page_s * page ); |
---|
91 | |
---|
92 | |
---|
93 | #endif /* _RAMFS_H_ */ |
---|