1 | /* |
---|
2 | * ramfs.c RAMFS file system API implementation. |
---|
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 | |
---|
26 | #include <hal_types.h> |
---|
27 | #include <hal_special.h> |
---|
28 | #include <printk.h> |
---|
29 | #include <kmem.h> |
---|
30 | #include <vfs.h> |
---|
31 | #include <ramfs.h> |
---|
32 | |
---|
33 | |
---|
34 | /////////////////////////////////////////////////////////////////////////////////////// |
---|
35 | // RAMFS specific functions : these static functions cannot be called by the VFS |
---|
36 | /////////////////////////////////////////////////////////////////////////////////////// |
---|
37 | |
---|
38 | |
---|
39 | |
---|
40 | /////////////////////////////////////////////////////////////////////////////////////// |
---|
41 | // Generic API : the following functions are called by the VFS, |
---|
42 | // and must be defined by all supported file systems. |
---|
43 | /////////////////////////////////////////////////////////////////////////////////////// |
---|
44 | |
---|
45 | //////////////////////////////////////////////////////////// |
---|
46 | error_t ramfs_inode_create( struct vfs_inode_s * vfs_inode ) |
---|
47 | { |
---|
48 | printk("\n[PANIC] %s not fully implemented yet\n", __FUNCTION__ ); |
---|
49 | hal_core_sleep(); |
---|
50 | |
---|
51 | kmem_req_t req; |
---|
52 | error_t error; |
---|
53 | ramfs_inode_t * ramfs_inode; |
---|
54 | |
---|
55 | // allocate memory for ramfs inode |
---|
56 | req.type = KMEM_RAMFS_INODE; |
---|
57 | req.size = sizeof(ramfs_inode_t); |
---|
58 | req.flags = AF_KERNEL | AF_ZERO; |
---|
59 | ramfs_inode = (ramfs_inode_t *)kmem_alloc( &req ); |
---|
60 | |
---|
61 | if( ramfs_inode == NULL ) return ENOMEM; |
---|
62 | |
---|
63 | // initialise ramfs_inode TODO |
---|
64 | |
---|
65 | // link vfs_inode to ramfs_inode |
---|
66 | inode->extend = ramfs_inode; |
---|
67 | ramfs->vfs_inode = vfs_inode; |
---|
68 | |
---|
69 | return 0; |
---|
70 | } |
---|
71 | |
---|
72 | ////////////////////////////////////////////////////// |
---|
73 | void ramfs_inode_destroy( struct vfs_inode_s * inode ) |
---|
74 | { |
---|
75 | printk("\n[PANIC] %s not fully implemented yet\n", __FUNCTION__ ); |
---|
76 | hal_core_sleep(); |
---|
77 | } |
---|
78 | |
---|
79 | ///////////////////////////////////////////////// |
---|
80 | error_t ramfs_write_page( struct page_s * page ) |
---|
81 | { |
---|
82 | printk("\n[PANIC] %s not fully implemented yet\n", __FUNCTION__ ); |
---|
83 | hal_core_sleep(); |
---|
84 | } |
---|
85 | |
---|
86 | //////////////////////////////////////////////// |
---|
87 | error_t ramfs_read_page( struct page_s * page ) |
---|
88 | { |
---|
89 | printk("\n[PANIC] %s not fully implemented yet\n", __FUNCTION__ ); |
---|
90 | hal_core_sleep(); |
---|
91 | } |
---|
92 | |
---|