source: trunk/kernel/vfs/ramfs.c @ 9

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

First import

File size: 2.8 KB
Line 
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////////////////////////////////////////////////////////////
46error_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    ramfs_inode_t * ramfs_inode;
53
54    // allocate memory for ramfs inode
55        req.type    = KMEM_RAMFS_INODE;
56        req.size    = sizeof(ramfs_inode_t);
57    req.flags   = AF_KERNEL | AF_ZERO;
58        ramfs_inode = (ramfs_inode_t *)kmem_alloc( &req );
59
60    if( ramfs_inode == NULL ) return ENOMEM;
61
62    // initialise ramfs_inode TODO
63
64    // link vfs_inode to ramfs_inode
65    vfs_inode->extend = ramfs_inode;
66
67    return 0;
68}
69
70//////////////////////////////////////////////////////
71void ramfs_inode_destroy( struct vfs_inode_s * inode )
72{
73    printk("\n[PANIC] %s not fully implemented yet\n", __FUNCTION__ );
74    hal_core_sleep();
75
76    return 0;
77}
78
79/////////////////////////////////////////////////
80error_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    return 0;
86}
87
88////////////////////////////////////////////////
89error_t ramfs_read_page( struct page_s  * page )
90{
91    printk("\n[PANIC] %s not fully implemented yet\n", __FUNCTION__ );
92    hal_core_sleep();
93
94    return 0;
95}
96   
Note: See TracBrowser for help on using the repository browser.