FreeNOS
LinnGroup.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_GROUP_H
19 #define __FILESYSTEM_LINN_GROUP_H
20 
21 #include <Types.h>
22 #include "LinnSuperBlock.h"
23 
38 #define LINN_GROUP_BLOCK_BITMAP 0
39 
41 #define LINN_GROUP_INODE_BITMAP 1
42 
44 #define LINN_GROUP_INODE_TABLE 2
45 
64 #define LINN_GROUP_COUNT(sb) \
65  ((sb)->blocksCount / (sb)->blocksPerGroup ? \
66  (sb)->blocksCount / (sb)->blocksPerGroup : 1)
67 
75 #define LINN_GROUP_NUM_BLOCKMAP(sb) \
76  ((sb)->blocksPerGroup / LINN_SUPER_NUM_PTRS(sb) ? \
77  (sb)->blocksPerGroup / LINN_SUPER_NUM_PTRS(sb) : 1)
78 
86 #define LINN_GROUP_NUM_INODEMAP(sb) \
87  ((sb)->inodesPerGroup / LINN_SUPER_NUM_PTRS(sb) ? \
88  (sb)->inodesPerGroup / LINN_SUPER_NUM_PTRS(sb) : 1)
89 
97 #define LINN_GROUP_NUM_INODETAB(sb) \
98  ((sb)->inodesPerGroup / ((sb)->blockSize / sizeof(LinnInode)) ? \
99  (sb)->inodesPerGroup / ((sb)->blockSize / sizeof(LinnInode)) : 1)
100 
108 #define LINN_GROUP_PER_BLOCK(sb) \
109  ((sb)->blockSize / sizeof(LinnGroup))
110 
118 #define LINN_GROUP_BLOCKS(sb) \
119  (LINN_GROUP_COUNT(sb) / LINN_GROUP_PER_BLOCK(sb) ? \
120  LINN_GROUP_COUNT(sb) / LINN_GROUP_PER_BLOCK(sb) : 1)
121 
129 typedef struct LinnGroup
130 {
133 
136 
139 
142 
145 }
146 LinnGroup;
147 
153 #endif /* __FILESYSTEM_LINN_GROUP_H */
Types.h
LinnGroup
Structure of a group descriptor.
Definition: LinnGroup.h:129
LinnGroup::blockMap
le32 blockMap
Block bitmap.
Definition: LinnGroup.h:138
LinnGroup::inodeTable
le32 inodeTable
Inode table contains pre-allocated inodes.
Definition: LinnGroup.h:144
LinnGroup::freeBlocksCount
le32 freeBlocksCount
The number of free blocks in this group.
Definition: LinnGroup.h:132
le32
u32 BITWISE le32
Unsigned 32-bit little endian number.
Definition: Types.h:106
LinnGroup::freeInodesCount
le32 freeInodesCount
Number of free inodes in this group.
Definition: LinnGroup.h:135
LinnGroup
struct LinnGroup LinnGroup
Structure of a group descriptor.
LinnGroup::inodeMap
le32 inodeMap
Inode bitmap.
Definition: LinnGroup.h:141
LinnSuperBlock.h