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 */
Abstract filesystem class.
Efficient key -> value lookups.
Definition HashTable.h:45
Linnenbank FileSystem (LinnFS).
void notSupportedHandler(FileSystemMessage *msg)
Callback handler for unsupported operations.
LinnSuperBlock * getSuperBlock()
Retrieve the superblock pointer.
Storage * getStorage()
Get the underlying Storage object.
LinnInode * getInode(u32 inodeNum)
Read an inode from the filesystem.
LinnSuperBlock super
Describes the filesystem.
Storage * storage
Provides storage.
LinnGroup * getGroupByInode(u32 inodeNum)
Read a group descriptor from the filesystem, given an inode number.
Vector< LinnGroup * > * groups
Group descriptors.
LinnGroup * getGroup(u32 groupNum)
Read a group descriptor from the filesystem.
u64 getOffsetRange(const LinnInode *inode, const u32 blk, Size &numContiguous)
Calculates the offset inside storage for a given block.
HashTable< u32, LinnInode * > inodes
Inode cache.
Provides a storage device to build filesystems on top.
Definition Storage.h:36
Vectors are dynamically resizeable Arrays.
Definition Vector.h:42
unsigned int u32
Unsigned 32-bit number.
Definition Types.h:53
unsigned int Size
Any sane size indicator cannot go negative.
Definition Types.h:128
unsigned long long u64
Unsigned 64-bit number.
Definition Types.h:50
FileSystem IPC message.
Structure of a group descriptor.
Definition LinnGroup.h:130
Structure of an inode on the disk in the LinnFS filesystem.
Definition LinnInode.h:93
Linnenbank Filesystem (LinnFS) super block.