FreeNOS
LinnFileSystem.h
Go to the documentation of this file.
1 /*
2  * Copyright (C) 2009 Niek Linnenbank
3  *
4  * This program is free software: you can redistribute it and/or modify
5  * it under the terms of the GNU General Public License as published by
6  * the Free Software Foundation, either version 3 of the License, or
7  * (at your option) any later version.
8  *
9  * This program is distributed in the hope that it will be useful,
10  * but WITHOUT ANY WARRANTY; without even the implied warranty of
11  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12  * GNU General Public License for more details.
13  *
14  * You should have received a copy of the GNU General Public License
15  * along with this program. If not, see <http://www.gnu.org/licenses/>.
16  */
17 
18 #ifndef __FILESYSTEM_LINN_FILESYSTEM_H
19 #define __FILESYSTEM_LINN_FILESYSTEM_H
20 
21 #include <FileSystemServer.h>
22 #include <FileSystemMessage.h>
23 #include <Storage.h>
24 #include <Types.h>
25 #include <Vector.h>
26 #include <HashTable.h>
27 #include "LinnSuperBlock.h"
28 #include "LinnInode.h"
29 #include "LinnGroup.h"
30 
40 #define LINNFS_ROOTFS_FILE "./rootfs.linn"
41 
48 #define LINN_MIN_BLOCK_SIZE 1024
49 
51 #define LINN_MAX_BLOCK_SIZE 4096
52 
57 #ifndef __HOST__
58 
74 {
75  public:
76 
83  LinnFileSystem(const char *path, Storage *storage);
84 
93  {
94  return &super;
95  }
96 
105  {
106  return storage;
107  }
108 
118  LinnInode * getInode(u32 inodeNum);
119 
129  LinnGroup * getGroup(u32 groupNum);
130 
141  LinnGroup * getGroupByInode(u32 inodeNum);
142 
155  u64 getOffsetRange(const LinnInode *inode,
156  const u32 blk,
157  Size & numContiguous);
158 
159  private:
160 
167 
168  private:
169 
172 
175 
178 
181 };
182 
183 #endif /* __HOST__ */
184 
190 #endif /* __FILESYSTEM_LINN_FILESYSTEM_H */
HashTable< u32, LinnInode * >
Vector.h
Types.h
LinnFileSystem::inodes
HashTable< u32, LinnInode * > inodes
Inode cache.
Definition: LinnFileSystem.h:180
LinnFileSystem
Linnenbank FileSystem (LinnFS).
Definition: LinnFileSystem.h:73
LinnGroup.h
FileSystemServer.h
HashTable.h
LinnFileSystem::groups
Vector< LinnGroup * > * groups
Group descriptors.
Definition: LinnFileSystem.h:177
Storage.h
LinnGroup
Structure of a group descriptor.
Definition: LinnGroup.h:129
FileSystemMessage
FileSystem IPC message.
Definition: FileSystemMessage.h:37
FileSystemServer
Abstract filesystem class.
Definition: FileSystemServer.h:44
LinnFileSystem::getStorage
Storage * getStorage()
Get the underlying Storage object.
Definition: LinnFileSystem.h:104
LinnFileSystem::getInode
LinnInode * getInode(u32 inodeNum)
Read an inode from the filesystem.
Definition: LinnFileSystem.cpp:83
u64
unsigned long long u64
Unsigned 64-bit number.
Definition: Types.h:50
LinnFileSystem::super
LinnSuperBlock super
Describes the filesystem.
Definition: LinnFileSystem.h:174
LinnFileSystem::getGroup
LinnGroup * getGroup(u32 groupNum)
Read a group descriptor from the filesystem.
Definition: LinnFileSystem.cpp:122
LinnFileSystem::storage
Storage * storage
Provides storage.
Definition: LinnFileSystem.h:171
LinnSuperBlock
Linnenbank Filesystem (LinnFS) super block.
Definition: LinnSuperBlock.h:113
LinnInode.h
u32
unsigned int u32
Unsigned 32-bit number.
Definition: Types.h:53
LinnInode
Structure of an inode on the disk in the LinnFS filesystem.
Definition: LinnInode.h:92
LinnFileSystem::notSupportedHandler
void notSupportedHandler(FileSystemMessage *msg)
Callback handler for unsupported operations.
Definition: LinnFileSystem.cpp:223
Size
unsigned int Size
Any sane size indicator cannot go negative.
Definition: Types.h:128
LinnFileSystem::getGroupByInode
LinnGroup * getGroupByInode(u32 inodeNum)
Read a group descriptor from the filesystem, given an inode number.
Definition: LinnFileSystem.cpp:127
LinnFileSystem::LinnFileSystem
LinnFileSystem(const char *path, Storage *storage)
Class constructor function.
Definition: LinnFileSystem.cpp:25
Vector< LinnGroup * >
LinnFileSystem::getSuperBlock
LinnSuperBlock * getSuperBlock()
Retrieve the superblock pointer.
Definition: LinnFileSystem.h:92
Storage
Provides a storage device to build filesystems on top.
Definition: Storage.h:35
FileSystemMessage.h
LinnSuperBlock.h
LinnFileSystem::getOffsetRange
u64 getOffsetRange(const LinnInode *inode, const u32 blk, Size &numContiguous)
Calculates the offset inside storage for a given block.
Definition: LinnFileSystem.cpp:132