File structure is text-binary. I.e. despite the fact that file containing maybe easy viewed with plain text editor, its editing produce some trouble so as there are strict field size fixation and links -- numbers meaning offset in bytes. All numbers in this file is hexadecimal.
Look at file structure more detailed. File consists of 4 sections with fixed headers:
1) BLOCK_SIZE, then after space there is 32-bit number (eight hex-digits) -- filesystem blocksize and end of line.
2) INODES, then after space there is also 32-bit number -- number of inodes in filesystem, and end of line
3) INODE_TABLE, after that there is end of line and yet INODES lines describing each inode.
4) DATA, end of line and variable number of lines describing directory structure and symbolic links.
Inode description line in INODE_TABLE section consists of nine numbers divided with spaces. Total the line length -- 72 + end of line (73-th symbol). Meaning of the nine fields is next:
1) 16-bit number (4 digits) -- protection with mode_t type. The field bits meaning described in stat(2).
2) 16-bit number (4 digits) -- user ID of file owner UID.
3) 16-bit number (4 digits) -- group ID of file owner GID.
4) 64-bit number (16 digits) -- file size.
5) 32-bit number (8 digits) -- time of last access atime.
6) 32-bit number (8 digits) -- time of last modification mtime.
7) 32-bit number (8 digits) -- time of last status change ctime.
8) 16-bit number (4 digits) -- number of hard links.
9) 32-bit number (8 digits) has two possibly meaning:
a) in case of
regular files, symbolic links and directories, is link to additional
information for this inode in
DATA
section. The link is offset in bytes from beginning of
DATA
section, i.e. beginning from first line after
DATA
header.
b) in case of special files of devices, this field keeps device type
(value of
dev_t
type)
In DATA section keeps additional information for directories, symbolic links and regular files:
a) for directories description begins with fixed header:
DIR,
after that there is 32-bit number (8 digits) -- number of entries
in the directory
(entries),
end of line,
after that also yet
entries
lines -- description of each entries.
Directory entry description consists of 1) file name -- string
with null-terminating; 2) 32-bit number -- inode number.
b) symbolic link description begins from fixed header LNK, after that there are space, value of link -- string with null-terminating.
c) for regular files description begins from fixed header REG, after that there are space, 32-bit number (8 digits) -- number of file fragments (frags), end of line, after that yet frags lines with description of each fragments. A fragment description consist of 2 32-bit numbers divided with spaces: 1) device block number, in which locates the first block of file fragment (besides zero must be interpreted as fragment of sparse-blocks); 2) count of blocks in fragment -- all this blocks locates at device continuously, following one after one.