source: trunk/kernel/vfs/ramfs.h @ 1

Last change on this file since 1 was 1, checked in by alain, 8 years ago

First import

File size: 4.1 KB
Line 
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
30struct vfs_inode_s;
31struct page_s;
32
33/*****************************************************************************************
34 * This structure defines a RAMFS specific context extension.
35 ****************************************************************************************/
36
37typedef struct ramfs_ctx_s
38{
39    intptr_t          base;                                                                 
40    rwlock_t          size;
41}
42ramfs_ctx_t;
43
44/*****************************************************************************************
45 * This structure defines the RAMFS inode specific extension (versus the VFS inode).
46 ****************************************************************************************/
47
48typedef struct ramfs_inode_s
49{
50    struct vfs_inode_s * vfs_inode;   /*! local pointer on VFS inode                    */
51}
52ramfs_inode_t;
53
54
55
56
57/*****************************************************************************************
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.
62 ****************************************************************************************/
63error_t ramfs_inode_create( struct vfs_inode_s * inode );
64
65/*****************************************************************************************
66 * This function releases memory allocated for a RAMFS inode.
67 *****************************************************************************************
68 * @ inode   : local pointer on vfs_inode.
69 ****************************************************************************************/
70void ramfs_inode_destroy( struct vfs_inode_s * inode );
71
72/*****************************************************************************************
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.
80 ****************************************************************************************/
81error_t ramfs_write_page( struct page_s  * page );
82
83/*****************************************************************************************
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.
91 ****************************************************************************************/
92error_t ramfs_read_page( struct page_s  * page );
93
94
95   
96#endif  /* _RAMFS_H_ */
Note: See TracBrowser for help on using the repository browser.