SBUF(5) | File Formats Manual | SBUF(5) |
NAME
sbuf
— Star-Buffer
file format
DESCRIPTION
sbuf
is a binary file format for storing
data in a 1-dimensional array.
A sbuf
file begins with a header of four
64-bits integers. The first integer is a power of two (usually 4096) that
defines the size of the memory page in bytes
(pagesize) on wich the array is aligned. By aligning
the array on pagesize, and depending on system
requirements, memory mapping can be used to automatically load/unload the
array items on demand (see
mmap(2)). The second integer is
the size of the array. Finally, the 2 remaining
integers store the memory size and the memory alignment of each array
element.
Fill bytes follow the file header to align the array to pagesize. The array elements are then listed. Fill bytes are finally added to ensure that the overall file size is a multiple of pagesize.
Data are encoded with respect to the little endian bytes ordering, i.e. least significant bytes are stored first.
The file format is as follows:
⟨sbuf⟩ | ::= | ⟨pagesize⟩ ⟨size⟩ ⟨szitem⟩ ⟨alitem⟩ |
⟨padding⟩ | ||
⟨list⟩ | ||
⟨padding⟩ | ||
⟨pagesize⟩ | ::= | uint64_t |
⟨size⟩ | ::= | uint64_t # Number of items stored |
⟨szitem⟩ | ::= | uint64_t # Size of an item in bytes |
⟨alitem⟩ | ::= | uint64_t # Alignement of an item (<= pagesize) |
⟨list⟩ | ::= | ⟨element⟩ ... |
⟨element⟩ | ::= | ⟨item⟩ ⟨padding⟩ |
⟨item⟩ | ::= | char ... |
⟨padding⟩ | ::= | [int8_t ...] # Ensure alignment on pagesize |
SEE ALSO
October 27, 2023 | UNIX |