@@ -96,16 +96,33 @@ entries/sizes. The default [`Entry`
96
96
implementation] ( https://docs.thi.ng/umbrella/block-fs/classes/Entry.html )
97
97
requires 64 bytes.
98
98
99
- TODO diagram
99
+ ![ Memory layout diagram for a single directory entry ] ( https://raw.githubusercontent.com/thi-ng/umbrella/develop/assets/block-fs/direntry-01.png )
100
100
101
101
#### File blocks
102
102
103
103
Files are stored as linked lists of blocks, with the first few bytes of each
104
- block reserved for linkage and number of data bytes in the block. The number of
105
- bytes effectively available for data depends on the configured block size and
106
- the max. number of blocks in the storage backend.
104
+ block reserved for linkage and number of data bytes in the block.
107
105
108
- TODO diagram
106
+ ![ Memory layout diagram for a single file block] ( https://raw.githubusercontent.com/thi-ng/umbrella/develop/assets/block-fs/block-layout-01.png )
107
+
108
+ The number of bytes effectively available for data depends on the configured
109
+ block size and the max. number of blocks in the storage backend. For example, a
110
+ max. block count of 65536 and a block size of 256 bytes only requires a two
111
+ bytes for linkage and a third byte for storing the number of data bytes used in
112
+ the block. Hence, in this configuration 253 bytes per block are available for
113
+ data.
114
+
115
+ The following diagram shows a block which links to block ID 0x1234 and uses the
116
+ full 253 (0xfd in hex) bytes of data available:
117
+
118
+ ![ Memory layout diagram for a single file block] ( https://raw.githubusercontent.com/thi-ng/umbrella/develop/assets/block-fs/block-layout-02.png )
119
+
120
+ The last block of a file uses a special sentinel marker to indicate that no
121
+ other blocks follow. This sentinel value again depends on the configured max.
122
+ block count, and in this example is 0xffff. This example block only stores 64
123
+ (0x40 in hex) bytes of data, with the remainder zeroed out.
124
+
125
+ ![ Memory layout diagram for a sentinel file block] ( https://raw.githubusercontent.com/thi-ng/umbrella/develop/assets/block-fs/block-layout-03.png )
109
126
110
127
### Command line app
111
128
0 commit comments