The structure of the Reiser file system
00000000 02 00 00 00 0e 00 00 00 00 00 00 00 00 00 00 00 ................
00000010 ff ff 2c 00 d4 0f 01 00 ÿÿ,.Ô...
Key: {2, 14, 0, 0} Count: 0xffff Length: 44 bytes Location: byte 4052 Version: 1 (3.6)
Items Items finally contain actual data. There are four types of items: stat items, directory items, direct items, and indirect items. Files are made up of one or more direct or indirect item, depending on the file's size. Every file and directory is preceded by a stat item.
Stat Items Stat items contain the meta-data for files and directories. Keys belonging to stat items always have an offset and type of 0, so that the stat item key always comes first before the other one(s) belonging to the same "inode number". Due to the same reason that there are two versions of keys, there are also two versions of stat items, as the size field was increased from 32 bits to 64 bits. For some reason, the fields for number of hard links, user id, and group id also were increased from 16 bits to 32 bits, each and other fields were introduced. Thus a stat item of version 3.5 is 32 bytes in size, whereas one of version 3.6 has 44 bytes.
The structure of a stat item of version 1:
Name |
Size |
Description |
Mode |
2 |
file type and permissions |
Num links |
2 |
number of hard links |
UID |
2 |
user id |
GID |
2 |
group id |
Size |
4 |
file size in bytes |
Atime |
4 |
time of last access |
Mtime |
4 |
time of last modification |
Ctime |
4 |
time stat data was last changed |
Rdev/blocks |
4 |
Device number / number of blocks file uses |
First dir. byte |
4 |
first byte of file which is stored in a direct item if it equals 1 it is a symlink if it equals 0xffffffff there is no direct item. |
The structure of a stat item of version 2:
Name |
Size |
Description |
Mode |
2 |
file type and permissions |
Reserved |
2 |
|
Num links |
4 |
number of hard links |
Size |
8 |
file size in bytes |
UID |
4 |
user id |
GID |
4 |
group id |
Atime |
4 |
time of last access |
Mtime |
4 |
time of last modification |
Ctime |
4 |
time stat data was last changed |
Blocks |
4 |
number of blocks file uses |
Rdev/gen/first |
4 |
Device number/ File's generation/ first byte of file which is stored in a direct item if it equals 1 it is a symlink if it equals 0xffffffff there is no direct item. |
The file mode field identifies the type of the file as well as the permissions. The low 9 bits (3 octals) contain the permissions for world, group, and user, the next 3 bits (from lower to higher) are the sticky bit, the set GID bit, and the set UID bit. The high 4 bits contain the file type. On a Linux system, possible values for the file type are (as defined in stat.h):
Constant Name |
16-bit Mask |
4-bit value |
Description |
S_IFSOCK |
0xc000 |
12 |
socket |
S_IFLNK |
0xa000 |
10 |
symbolic link |
S_IFREG |
0x8000 |
8 |
regular file |
S_IFBLK |
0x6000 |
6 |
block device |
S_IFDIR |
0x4000 |
4 |
directory |
S_IFCHR |
0x2000 |
2 |
character device |
S_IFIFO |
0x1000 |
1 |
fifo |
|