1 | /* |
---|
2 | * ramfs.h RAMFS file system API definition. |
---|
3 | * |
---|
4 | * Authors Mohamed Lamine Karaoui (2015) |
---|
5 | * Alain Greiner (2016) |
---|
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 | /**** Forward declarations ****/ |
---|
29 | |
---|
30 | struct vfs_inode_s; |
---|
31 | struct page_s; |
---|
32 | |
---|
33 | /***************************************************************************************** |
---|
34 | * This structure defines the RAMFS inode specific extension (versus the VFS inode). |
---|
35 | ****************************************************************************************/ |
---|
36 | |
---|
37 | typedef struct ramfs_inode_s |
---|
38 | { |
---|
39 | struct vfs_inode_s * vfs_inode; /*! local pointer on VFS inode */ |
---|
40 | } |
---|
41 | ramfs_inode_t; |
---|
42 | |
---|
43 | |
---|
44 | |
---|
45 | |
---|
46 | /***************************************************************************************** |
---|
47 | * This function allocates memory for a RAMFS inode, and link it to the VFS inode. |
---|
48 | ***************************************************************************************** |
---|
49 | * @ inode : local pointer on vfs_inode. |
---|
50 | * @ return 0 if success / return ENOMEM if error. |
---|
51 | ****************************************************************************************/ |
---|
52 | error_t ramfs_inode_create( struct vfs_inode_s * inode ); |
---|
53 | |
---|
54 | /***************************************************************************************** |
---|
55 | * This function releases memory allocated for a RAMFS inode. |
---|
56 | ***************************************************************************************** |
---|
57 | * @ inode : local pointer on vfs_inode. |
---|
58 | ****************************************************************************************/ |
---|
59 | void ramfs_inode_destroy( struct vfs_inode_s * inode ); |
---|
60 | |
---|
61 | /***************************************************************************************** |
---|
62 | * This function moves a page from the mapper to the RAMFS file system. |
---|
63 | * It must be called by a thread running in cluster containing the mapper. |
---|
64 | * The pointer on the mapper and the page index in file are supposed to be registered |
---|
65 | * in the page descriptor. |
---|
66 | ****************************************************************************************** |
---|
67 | * @ page : local pointer on source page descriptor. |
---|
68 | * @ return 0 if success / return EIO if error. |
---|
69 | ****************************************************************************************/ |
---|
70 | error_t ramfs_write_page( struct page_s * page ); |
---|
71 | |
---|
72 | /***************************************************************************************** |
---|
73 | * This function moves a page from the RAMFS file system to the mapper. |
---|
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 destination page descriptor. |
---|
79 | * @ return 0 if success / return EIO if error. |
---|
80 | ****************************************************************************************/ |
---|
81 | error_t ramfs_read_page( struct page_s * page ); |
---|
82 | |
---|
83 | |
---|
84 | |
---|
85 | #endif /* _RAMFS_H_ */ |
---|