Skip to content

Layout

The Layout record contains metadata of a file or directory that should be written to the mass memory. When combined with a Content record (and possibly an Index record), it is possible to write the file or directory on disk in a reproducible way.

It is composed of a 32 bytes long header-like section and two fields of variable length.

FieldTypeSize (bytes)Description
uiduint4User ID of the owner of the file.
giduint4Group ID of the owner of the file.
modeuint4File’s mode and permission bits.
tagblob4Unused.
source_lengthuint2Length of the source blob.
target_lengthuint2Length of the target string.
file_typeuint1Type of file to be written.
paddingblob11Unused.
sourceblobSpecified by source_length”source” of the file. Its meaning varies depending on file_type.
targetstrSpecified by target_lengthPath where the file should be written to.

file_type is an enum that specifies the type of file that should be written on disk.

ValueNameDescriptionMeaning of source
1RegularRegular file of data.

XXH3_128bits hash of the file.
The source is a hash because our package manager, Moss, uses a CAS to store files. This hash may be also used to match an Index record, in order to identify a region of a Content record to read. In fact, the Index record also contains a XXH3_128bits-based hash.

2SymlinkSymbolic link to another file.String. Original file path to link somewhere else.
3DirectoryEmpty directory.Unused.
4CharacterDeviceCharacter device.Unused.
5BlockDeviceBlock device.Unused.
6FIFOPOSIX FIFO.Unused.
7SocketPOSIX communication socket.Unused.